For downloads, demos, and more visit the
Client-side GChart Home Page
All contributions, conceptual or practical, psuedo or fully coded, gratefully acknowledged and properly documented.

Client-side GChart 2.41 Release Notes

This v2.4 followup release adds several new features and fixes two bugs.

  1. getMouseCoordinate, clientToModel, modelToClient, pixelToModel, and modelToPixel
  2. The new getMouseCoordinate method returns the "GChart tracked" mouse location, projected onto an axis of the chart, in the units of that axis.

    The new World's Simplest Line Chart Editor example in the Chart Gallery illustrates how to use this new method to add a new point to the chart whereever the user clicks. A slightly different version of the same chart now also appears in the updated live demo.

    The clientToModel, modelToClient, pixelToModel, and modelToPixel methods are provided for advanced applications that may overlay graphics on top of the chart, capture mouse events, etc., and that therefore need to convert back and forth between the pixel coordinates of the client window, or the GChart's own localized pixel units, and the model coordinates associated with the x and y values of points on the chart.

    Saurabh Hirani in this GWT Forum post and in GChart issue #22 most recently suggested the need for client to model coordinate mapping. Client to model conversion was requested earlier in GChart issue #9 from yoxel.com

  3. New setDefaultSymbolBorderColors method
  4. The new setDefaultSymbolBorderColors method allows you to change GChart's default sequence of curve colors.

    If, like me, you find choosing good default curve color sequence a bit challenging, consider re-using the LGPL licensed OpenOffice default color sequence. The OpenOffice developers actually let their users vote to select the best default color sequence. The World's Simplest Line Chart Editor in the Chart Gallery illustrates how you can use setDefaultSymbolBorderColors to switch from GChart's defaults to these more popular OpenOffice colors.

    This feature was added in response to an email I received from Joe Cole, pointing out that GChart could be substantially improved if it paid a bit more attention to basic graphic design principles, including default color choices, and in response to a comment about the desirability of changing GChart's colors in this post by Sanjiv Jivan.

  5. Bugfix #1
  6. Under some usage scenarios, in IE browsers only, if you placed a Client-side GChart onto an animated TabPanel, and reduced the number of points on the chart, and then re-updated it, some of the old points would remain visible (cruft).

    The underlying cause of this bug was documented in GWT issue 3336.

    Is it a bug in IE, or in GWT? This bug seems like it is being caused by an outright IE bug (IE appears to simply ignore setting display: none on an image element in obscure cases) for which a cleanly encapsulated GWT workaround may not even be possible. In cases where no Javascript-based workaround that cleanly solves a documented browser "quirk" is available, it's likely more accurate to call it a bug in the browser, rather than a bug in GWT. On the other hand, if you encounter such insects while using GWT, they certainly appear to be GWT bugs to you.

    The original code that first exposed this bug was written as part of this GChart tutorial at /home/nick by Nick Circelli (thanks, Nick). Stripped-down versions of that code that reproduce that original bug appear as TestGChart41.java and TestGChart41a.java of GChart's paint test.

  7. Bugfix #2
  8. ANCHOR_MOUSE, if used in non-system curves, caused GChart to raise a null pointer exception.

    The new ANCHOR_MOUSE symbol type was introduced for use by internal "system curves" to facilitate positioning popups relative to the position of the mouse cursor. It worked fine when used for that purpose.

    But, if you were imaginative enough to try to use ANCHOR_MOUSE as the symbol type of an ordinary curve, you got a null pointer exception for your pains.

    An ordinary curve with the ANCHOR_MOUSE symbol type now positions an ordinary curve's points at the current "GChart tracked" mouse location. Note that GChart does not treat a change in mouse position as an implicit specification change to such curves, so, after the first update, you may have to make some small specification change to force GChart to update these curves to reflect the latest mouse position.

  9. Known bug not fixed
  10. If a chart is initially updated without a Y or Y2 axis (because no curves were mapped to those axes) and then later curves are added to those axes, and if axis limits are specified explicitly, then the corresponding added axis remains unrendered. Similarly, removal of all curves mapped to an axis may not always remove the axis itself.

    It is expected that changes to be made with version 2.5 will also, as a side effect, fix this bug. You can workaround this bug by invoking a do-nothing axis limit specification to force an axis redraw. For example:

       getY2Axis().setAxisMin(getY2Axis().getAxisMin());