Right now i a JFreeChart line graph. I want to add marker to mark some events. I have added the markers. The problem is that the marker labels have started to overlap. I want to solve this by only showing the marker label if the user mouse over's the marker line. How can i capture the mouseover event?
Marker tempMarker = new ValueMarker(hour.getFirstMillisecond());
tempMarker.setPaint(Color.BLACK);
tempMarker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
tempMarker.setLabelTextAnchor(TextAnchor.TOP_RIGHT);
//instead of this i want a mouseoverlistner and then show the label
tempMarker.setLabel("Event Name");
code for mouse over
chartPanel.addChartMouseListener(new ChartMouseListener() {
@Override
public void chartMouseClicked(ChartMouseEvent event) {
//do something on mouse click
}
@Override
public void chartMouseMoved(ChartMouseEvent event) {
System.out.println("Entity Type: " + event.getEntity());
}
});
When i mouse over the Marker objects a ChartEntity is sent to the chartMouseMoved. This is the same as when i mouse over other non filled portions of the chart.