XYChart data point shapes?

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

XYChart data point shapes?

Post by Ted Hill » Fri Aug 16, 2002 1:50 pm

Hello,

I am making an XYChart which uses an XYSeriesCollection as its dataset.

The chart will only have about 10 x,y data points on it.

In addition to the line which connects the data points, I'd like to also draw a small shape at each x,y point, e.g. a diamond, square, etc.

What is the best way to do this?

Also, how do I enable tool tips when hovering over the data points?

Thank you,

Ted Hill

David Gilbert

Re: XYChart data point shapes?

Post by David Gilbert » Mon Aug 19, 2002 9:37 am

Hi Ted,

You can change the renderer assigned to the plot:

XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES, new StandardXYToolTipGenerator()));
XYPlot plot = myChart.getXYPlot();
plot.setXYItemRenderer(renderer);

I've had a few questions about this lately, and making the change (as above) isn't as easy as it should be, so I will modify the code to make it simpler.

Tooltips should be enabled by default when you display the chart in a ChartPanel.

Regards,

DG.

Locked