return false;
}
@SuppressWarnings("unchecked")
public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) {
ChartView chartView = (ChartView)component;
ChartView.Element element = chartView.getElementAt(x, y);
if (element != null) {
int seriesIndex = element.getSeriesIndex();
int elementIndex = element.getElementIndex();
String elementLabel;
ChartView.CategorySequence categories = chartView.getCategories();
if (categories.getLength() > 0) {
elementLabel = "\"" + chartView.getCategories().get(elementIndex).getLabel() + "\"";
} else {
elementLabel = Integer.toString(elementIndex);
}
List<?> chartData = chartView.getChartData();
Object series = chartData.get(seriesIndex);
Dictionary<String, Object> seriesDictionary;
if (series instanceof Dictionary<?, ?>) {
seriesDictionary = (Dictionary<String, Object>)series;
} else {
seriesDictionary = new BeanDictionary(series);
}
String seriesNameKey = chartView.getSeriesNameKey();
Alert.alert("You clicked element " + elementLabel + " in \""
+ seriesDictionary.get(seriesNameKey) + "\".", frame);
}