1

I have a chart which has mouse events enabled. When I click on a specific line, only that series should be visible and all others should be disabled. Each time I click on a new line, the previously selected line is still visible. I don't want that happening. How can I get the appropriate line displayed ?

chartPanel.addChartMouseListener(new ChartMouseListener() {
{
    public void chartMouseClicked(ChartMouseEvent event)
    {

        int x = event.getTrigger().getX();
        int y = event.getTrigger().getY();
        ChartEntity entity = event.getEntity();
        if (entity != null)
        {
              PieSectionEntity item = (PieSectionEntity)event.getEntity();
              int index = item.getSectionIndex();
              chart.getXYPlot().getRenderer().setBaseSeriesVisible(false);
              chart.getXYPlot().getRenderer().setSeriesVisible(index, true);
        }
}

 public void chartMouseMoved(ChartMouseEvent e) {}
});
chrisrhyno2003
  • 3,906
  • 8
  • 53
  • 102
  • Invoking `setSeriesVisible()` should orke, for [example](http://stackoverflow.com/a/11895709/230513). Please edit your question to include a [complete example](http://stackoverflow.com/help/mcve) that shows your current approach – trashgod Jun 27 '15 at 01:33

0 Answers0