I have implemented a Box and Whisker Chart with data from a csv file.
It has many categories and was displayed very squeezed on the screen.
So I decided to use a SlidingCategoryDataset with a JSlider as mentioned here.
I think my new class with code from SlidingCategoryDataset that extends DefaultBoxAndWhiskerDataset works fine because the category labels on the x-axis are updated correctly. BUT the bars in the chart stay the same and do not update anytime no matter what I do. Even more confusing is that the tool tips of the bars do update correctly.
When I reach the end of the dataset with the slider and display e.g. 10 categories at once and there are e.g. only 9 left, the chart displays 9 bars correctly but instead of hiding the first bar it hides the last bar (axis and tool tip are updated correctly).
I looked for a solutuion with google but did not find an answer for my problem. So I tried it by myself by using all avaible update and repaint methods because I think it must be a GUI problem but with no success. You can see my update method here:
private void sliderChanged(){
int val = slider.getValue();
sData.setFirstCategoryIndex(val);// my sliding dataset
chart = ChartDrawer.draw(sData); // to draw chart again should be unnecessary
chart.fireChartChanged();
chartPanel.setChart(chart);
chartPanel.revalidate();
chartPanel.repaint();
chartPanel.updateUI();
repaint();
}
I am a bit desperate now. Can somebody help me please? Or does somebody know another way to display many categories, that is working?
Thanks a lot.