Results 1 to 2 of 2

Thread: LineSeries putting NaN in fill

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Nov 2012
    Vote Rating

    Default LineSeries putting NaN in fill

    I'm using v3.0.1

    I have a situation in my application where the "coordinates" Map does not contain a PrecisePoint at index (i == store.size()-1) -- i.e., the last time through the for loop at Line 154 of LineSeries.

    This is causing "x" to be set to Double.NaN at line 160.

    This then causes a LineTo at line 263 to be built with "x" when "x" is NaN, resulting in "NaN" being inserted into the chart HTML on the page (in my example, the "d" attribute of an SVG path). This is messing up the rendering.

    This could be an issue with my data, but I thought I would post it because the "x" value is never checked before being used for the fill.

    Work Around:
    My work around is to have a fillRenderer (at line 282) that checks for "NaN" and replaces X with the X from the previous command in the fillCommands, because that is what X should be based on what lines 262-265 are trying to do.

    Here's my messy work around hack to clean it up after the fact...:
    lineSeries.setFillRenderer(new SeriesRenderer<SparklineChartGXT.SparklineDatum>() {
                public void spriteRenderer(Sprite sprite, int index, ListStore<SparklineDatum> store) {
                    // fix fill -- FIXME: HACK
                    PathSprite fillSprite = (PathSprite) sprite;
                    if (fillSprite.getCommand(fillSprite.getCommands().size() - 3).toString().contains("NaN")) {
                        double previousX = ((LineTo) fillSprite.getCommand(fillSprite.getCommands().size() - 4)).getX();
                        ((LineTo) fillSprite.getCommand(fillSprite.getCommands().size() - 3)).setX(previousX);
                    // force dirty for redraw

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Vote Rating


    LineSeries supports gaps in the data drawn by each line - the NaN value is used to represent that. Check out to see how this is supposed to work.

    NaN values should only be inserted into the coordinates map by ScatterSeries.calculateBounds if a null value (or NaN) is returned from a field ValueProvider. This is almost certainly an issue with your data - either you have unexpected nulls or NaNs in your data.

    If you can build an example that does not have nulls or NaNs in the data and still gets NaN values in the list, please post it here - that sounds like a bug, and should be fixed. But from your description, I do not believe that is what is happening.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts