Search code examples
javajsoneclipseteechart

Teechart:Adding a drilldown to a teechart horizontalbar


I am using teecharts. I have successfully populated a chart of type TCHart with horizontal bar series of data. I was wondering if there was a way to add a drill down to the chart. Can I click on an individual bar to create a popup window with more information?

private TChart chart = new TChart();
Series barSeries = new HorizBar();

Solution

  • You can use SeriesMouseListener for this as follows:

    Series barSeries = new HorizBar(tChart1.getChart());
    barSeries.fillSampleValues();
    
    barSeries.addSeriesMouseListener(new SeriesMouseAdapter() {
    
        @Override
        public void seriesClicked(SeriesMouseEvent arg0) {
            // show info here for the arg0.getValueIndex()
        }
    });