XY Plot

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Ben Sky

XY Plot

Post by Ben Sky » Tue Aug 13, 2002 9:24 am

Hi,

first let me say, I'm a stupid beginner, but never the less I give my very best! ;-)

I generated a XY PLot, now i want all the points i added to XY Series, displayed in the graph with a little point or something like that.
Just like in a Line Chart!
Is this possible??

THX Ben Sky

Stellios

Re: XY Plot

Post by Stellios » Tue Aug 13, 2002 9:56 am

Hi,
that is almost what I am currently trying to do, I am working right now on using a CombinedXYPlot with a signalPlot although a line graph with the boxes is what I really need. If I get far I'll let you know but it seems from what I've read that Combined or Overlaid plot is the way to go.

Ben Sky

Re: XY Plot

Post by Ben Sky » Tue Aug 13, 2002 3:43 pm

Hi,

now I did it with a OverlaidXYPlot,
but my problem is now the Color, I can't set the line on the same color as the
boxes.

Is there anything to change this??

I allready tried something like that, but it did not work:

JFreeChart chart = ChartFactory.createScatterPlot("",X,Y,data,true);
chart.getPlot().setSeriesPaint(new Paint[]{Color.red});


JFreeChart chart2 = ChartFactory.createScatterPlot("",X,Y,data,true);
chart2.getPlot().setSeriesPaint(new Paint[]{Color.red});

OverlaidXYPlot plot = new OverlaidXYPlot(X,Y);
plot.add(chart);
plot.add(chart2);


JFreeChart mainchart = new JFreeChart("",JFreeChart.DEFAULT_TITLE_FONT,plot,true);

mainchart.getPlot().setSeriesPaint(new Paint[]{Color.red});


THX for all help!

Ben Sky

Ben Sky

Re: XY Plot

Post by Ben Sky » Tue Aug 13, 2002 3:49 pm

Hi,

Sorry there is a mistake in the code above:

it has to be :

plot.add((XYPlot)chart.getPlot());
plot.add((XYPlot)chart2.getPlot());

but, also with this it does not print the right Colors

THX Ben Sky

Anita

Re: XY Plot

Post by Anita » Wed Sep 04, 2002 10:20 pm

Ben,
I'm just encountering this. Did you make any progress on figuring out how to set the line colors?
Anita

David Gilbert

Re: XY Plot

Post by David Gilbert » Wed Sep 04, 2002 11:13 pm

You can create a renderer that draws both shapes and lines:

XYPlot plot = myChart.getXYPlot();
XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES);
plot.setRenderer(renderer);

Regards,

DG.

Locked