Is there some way of converting the pointerlocation on the chart to corresponding values in a category-plot? I'm using Year as the category value. I would like to know the year I'm clicking on in the chart.
I have done this on XY-Plots, but Im not sure if this is possible in a category-plot?
One more thing, would there be much work creating a CategoryAnnotationEntity so that one could record clicks on this item?
Converting pointerlocation to values in a categoryplot
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Hi,
the approach to get informations on the point where the mouse was clicked should be similar for both CategoryPlot and XYPlot. If you register a ChartMouseListener to the JFreeChart, you should be able to get the ChartMouseEvent and the corresponding ChartEntity. For a CategoryPlot that should be a CategoryItemEntity (provided that all hot spots are correctly created when the chart is drawn). From the CategoryItemEntity (http://www.jfree.org/jfreechart/api/jav ... ntity.html) you should get all the infos that you want.
Regards, paradoxoff
the approach to get informations on the point where the mouse was clicked should be similar for both CategoryPlot and XYPlot. If you register a ChartMouseListener to the JFreeChart, you should be able to get the ChartMouseEvent and the corresponding ChartEntity. For a CategoryPlot that should be a CategoryItemEntity (provided that all hot spots are correctly created when the chart is drawn). From the CategoryItemEntity (http://www.jfree.org/jfreechart/api/jav ... ntity.html) you should get all the infos that you want.
Regards, paradoxoff
Thank's for your reply.
I might have been a little unclear. If I'm not clicking an entity at all but just clicking the chart. Could I get the value where I'm clicking? In an XY-plot I would use : java2DToValue()
I would also like to capture a click event on a CategoryAnnotation, but there is no CategoryAnnotationEntity that extends ChartEntity, would it be much work to create something like this?
-Thomas
I might have been a little unclear. If I'm not clicking an entity at all but just clicking the chart. Could I get the value where I'm clicking? In an XY-plot I would use : java2DToValue()
I would also like to capture a click event on a CategoryAnnotation, but there is no CategoryAnnotationEntity that extends ChartEntity, would it be much work to create something like this?
-Thomas