I have a LineChart. When I click in a point in chart I'd like to get its category.
I've achieved my aim in a XYPlot with the following code:
Code: Select all
public void chartProgress(ChartProgressEvent event) {
if (event.getType() != ChartProgressEvent.DRAWING_FINISHED) {
return;
}
if (this.panel != null) {
JFreeChart c = this.panel.getChart();
if (c != null) {
XYPlot plot = (XYPlot) c.getPlot();
XYDataset dataset = plot.getDataset();
double xx = plot.getDomainCrosshairValue();
int itemIndex=this.series.indexOf(xx);
this.table.changeSelection(itemIndex,0,false,false);
}
}
}
But I don't know how doig it in a LineChart(CategoryPlot).
I need your help, thank's.