Diff. StackedXYAreaRenderer and StackedXYAreaRenderer2 ??

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
silent
Posts: 50
Joined: Wed Mar 16, 2005 2:55 pm
Location: Korea
Contact:

Diff. StackedXYAreaRenderer and StackedXYAreaRenderer2 ??

Post by silent » Fri Jul 29, 2005 4:10 am

Hi, there~

I wonder about a difference between StackedXYAreaRenderer and StackedXYAreaRenderer2 .

please, notice to me..
Tokdo belongs to Korea.

Not a 'sea of japan', But a 'East Sea(Dong hae)'

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Jul 29, 2005 9:34 am

StackedXYAreaRenderer was contributed by another developer who based it on the StandardXYItemRenderer class. It carries over a few things that it probably shouldn't (like the shapes), and sometime I'll try to clean it up.

StackedXYAreaRenderer2 uses a different drawing approach, calculating a polygon for each data point and filling that. As a result, it has more intuitive "hotspots" for tooltips (and URLs when used in an HTML image map), but sometimes it does show some drawing artefacts.

Try them both out and tell me which works better. It would make sense to try to combine the best of each into a single class.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

silent
Posts: 50
Joined: Wed Mar 16, 2005 2:55 pm
Location: Korea
Contact:

Post by silent » Fri Jul 29, 2005 11:37 am

First of all, thanks for your answer.

but, I don't understand StackedXYAreaRenderer is based on the StandardXYItemRenderer.

AbstractRender
....|
....+- AbstractXYItemRenderer
..........|
..........+- XYAreaRenderer
..........|..........|
..........|..........+- StackedXYAreaRenderer
..........|
..........+- XYAreaRenderer2
....................|
....................+- StackedXYAreanRenderer2

I found a hierarchy like above.
and StandardXYItemRenderer is super for CyclicXYItemRenderer.

anyway, I try them for my program.
Tokdo belongs to Korea.

Not a 'sea of japan', But a 'East Sea(Dong hae)'

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Jul 29, 2005 12:18 pm

It's based on StandardXYItemRenderer in the sense that it was a copy-paste-modify process that created it. You'll see some common fields and methods between the two classes.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

silent
Posts: 50
Joined: Wed Mar 16, 2005 2:55 pm
Location: Korea
Contact:

Post by silent » Tue Aug 02, 2005 2:22 pm

Help me. :oops:

I trying to use StackedXYAreaRenderer2 with TimeSeriesChart.

in my code.

Code: Select all

TimeTableXYDataset timeTableXYDataset = new TimeTableXYDataset();
JFreeChart jfreeChart = ChartFactory.createTimeSeriesChart(null, null, null, timeTableXYDataset, false, true, false);
XYPlot xyPlot = jfreeChart.getXYPlot();
StackedXYAreaRenderer2 renderer = new StackedXYAreaRenderer2();
xyPlot.setRenderer(renderer);

It's simple.

But, it can't draw a chart.
in StackedXYAreaRenderer2 class.

Code: Select all

public Range findRangeBounds(XYDataset dataset) {
        double min = Double.POSITIVE_INFINITY;
        double max = Double.NEGATIVE_INFINITY;
        TableXYDataset d = (TableXYDataset) dataset;
        int itemCount = d.getItemCount();
        for (int i = 0; i < itemCount; i++) {
            double[] stackValues = getStackValues(dataset, d.getSeriesCount(), i);
            min = Math.min(min, stackValues[0]);
            max = Math.max(max, stackValues[1]);
        }
        return new Range(min, max);
    }
this method called.
because TableXYDataset d has no data, min( is Double.POSITIVE_INFINITY) is greater than max( is Double.NEGATIVE_INFINITY).
so, new Range(min, max) throws IllegalArgumentException.


I want to make chart first. and then, add data periodical-ly.

Is there any solution without dataset have some data before creating a chart ??
Tokdo belongs to Korea.

Not a 'sea of japan', But a 'East Sea(Dong hae)'

Locked