I have a ChartMouseListener attached to a ChartPanel.
The mouse listener is used to detect clicks on the x-axis labels.
I developed the code using freechart-1.0.10
In that environment the following code would assign the x-axis label that the user clicked on to 'selectedKey' in the snippet below.
Code: Select all
public void chartMouseClicked(ChartMouseEvent event)
{
ChartEntity entity = event.getEntity();
// if user has clicked on an x-axis label
if (entity instanceof CategoryLabelEntity)
{
selectedKey = ((CategoryLabelEntity)entity).getKey();
}
event.getEntity() now returns an AxisEntity instead of a CategoryLabelEntity
Does anyone know how to get the label that the user clicked on from the AxisEntity?
For example, if the lables along the x-axis are " 1 2 3 4 5 6 "
and the user clicks on 3, how can I get that?
There is no getKey() method on AxisEntity.
Thanks.