• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown

refreshing JFreeCharts

Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
    Bookmark Topic Watch Topic
  • New Topic