This may sound very basic as a question, but i am stuck in JFreechart use.
Let me lay out my problem :
You can get a List
of subplots using getSubplots(). To learn which subplot was clicked, examine the ChartMouseEvent that was sent from the ChartPanel
, as suggested here.
Addendum: Here's a simple implementation of ChartMouseListener
that will show each ChartEntity
as it is clicked.
ChartPanel panel = ...
panel.addChartMouseListener(new ChartMouseListener() {
@Override
public void chartMouseClicked(ChartMouseEvent e) {
System.out.println(e.getEntity().getClass());
}
@Override
public void chartMouseMoved(ChartMouseEvent event) {}
});