I have a bar chart which I want to update and I tried the revalidate and repaint methods but with no success
问题 class GraphGenerator1 extends JPanel { ChartPanel chartPanel, sbc; void generator(int t, int Value1, int Value2) { if (t == 1) { DefaultCategoryDataset gData = new DefaultCategoryDataset(); gData.setValue(Value1, "What you saved", ""); gData.setValue(Value2, "What you paid", ""); JFreeChart chart = ChartFactory.createBarChart("", "", "", gData, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.WHITE); BarRenderer br = (BarRenderer) chart.getCategoryPlot()