miunsi63 / gflot

Automatically exported from code.google.com/p/gflot
0 stars 0 forks source link

PlotWithOverview top graph always fills to zero #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create a PlotWithOverview
2. Add some DataPoints with 3 values:

        for (int i = 0; i < modsize; i++) {
            JSONArray arr = new JSONArray();
            arr.set(0, new JSONNumber(i));
            arr.set(1, new JSONNumber(1.5 + Random.nextDouble()));
            arr.set(2, new JSONNumber(1.5 - Random.nextDouble()));
            DataPoint dp = new DataPoint(arr);
            series.add(dp);
        }

3. Make sure that the LineSeriesOptions have setFill(true)

What is the expected output? What do you see instead?

Expect to see a region filled between the yValueMin and yValueMax in both the 
overview and the window plot.  Instead, this only happens on the overview plot

What version of the product are you using? On what operating system?

2.3.2, Ubuntu 11.10 64 bit

Please provide any additional information below.
This problem is due to the way slicing is implemented in SeriesData.  When 
slicing is performed, a new DataPoint is created and added (SeriesData.java, 
line 99):

newData.add( new DataPoint( getX( j ), getY( j ) ) );

but this always creates a DataPoint with 2 values, when actually a DataPoint 
can have more.  If you replace line 99 with:

newData.add( new DataPoint(((JSONArray) super.get(j))));

the correct behaviour is seen.  If you could fix this for the next release, I'd 
be very grateful.

Original issue reported on code.google.com by griffith...@gmail.com on 21 Mar 2012 at 1:52

GoogleCodeExporter commented 9 years ago
Thanks for this! I didn't even know this feature. I added your fix and a new 
constructor in DataPoint to pass a 3rd coordinate so you don't have to create 
an array.

Original comment by nmr.morel on 21 Mar 2012 at 9:08

GoogleCodeExporter commented 9 years ago

Original comment by nmr.morel on 25 Mar 2012 at 6:06