• Post Reply Bookmark Topic Watch Topic
  • New Topic

refreshing JFreeCharts  RSS feed

anjali ray
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the code that I have posted below to add JFreeChart into an eclipse RCP application.
I have the problem that I cannot refresh the chart.
I tried using refresh buffer on the frame but that does not work.
I tried to dispose off the composite also before I run the program again to create the chart.
That refershes the chart the first time I rerun the program only.
Does anybody have any idea about what the problem can be?

/// STEP 1 ////////////////////////////////////////////////
// create a composite suitable for displaying all of our chart data
Composite chartComposite = new Composite(/* options */);
chartComposite.setLayoutData(/* set the layout options */);

/// STEP 2 ////////////////////////////////////////////////
// create the dataset for the pie chart of the distribution
DefaultPieDataset pieData = new DefaultPieDataset();
/* populate the pieData here */

JFreeChart chart = ChartFactory.createPie3DChart(/* some options */);
// OPTIONAL: tinkering with plot options here

/// STEP 3 ////////////////////////////////////////////////
// Grab the background color from the SWT Composite
// so our AWT panel "matches" the SWT Composite
Color backgroundColor = chartComposite.getBackground();

// create the frame
Frame chartFrame = SWT_AWT.new_Frame(chartComposite);

chartPanel.setLayout(/* some AWT/Swing layout manager like BoxLayout */);

/// STEP 4 ////////////////////////////////////////////////
ChartPanel jfreeChartPanel = new ChartPanel(chart);

Thanks for any help.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!