1

I am using XYPlot class from jfreechart library. I have got two XYSeries and there are legend of them in the bottom of the ChartPanel. Now I want to process mouse click events on that legend. Is it possible to add listener to the legend? If it is not how can I get the coordinates of legend (with coordinates I can add listener to ChartPanel)?

lnk
  • 593
  • 2
  • 11
  • 27

1 Answers1

1

As shown here, you can create your own component in which to render legend items. The example decorates each JLabel with a ColorIcon, which is also suitable for a JButton.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045