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
XYChart data point shapes?
Re: XYChart data point shapes?
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.
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.