File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes refreshing JFreeCharts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "refreshing JFreeCharts" Watch "refreshing JFreeCharts" New topic

refreshing JFreeCharts

anjali ray

Joined: Mar 12, 2005
Posts: 28
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.
I agree. Here's the link:
subject: refreshing JFreeCharts
It's not a secret anymore!