Performance of Linechart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
lutchanah
Posts: 5
Joined: Thu Jul 31, 2003 7:21 am

Performance of Linechart

Post by lutchanah » Fri Nov 28, 2003 9:06 am

I have three serie of 500 points
So when i make a Linechart it's very slow up to 80 sec

Someboby can tell me if it's ok or if my code is bad ?

My methode to create a Line Chart

Code: Select all

public DefaultCategoryDataset dataset=new DefaultCategoryDataset();
public double i[][]=new double[3][500];

public void CreateLineChart
{
    JFreeChart chart=ChartFactory.createLineChart("","Echantillons","",dataset,PlotOrientation.VERTICAL,false,true,false);

    CategoryPlot plot=chart.getCategoryPlot();

    plot.getRenderer().setSeriesPaint(0,Color.red);
    plot.getRenderer().setSeriesPaint(2,Color.blue);
    plot.getRenderer().setSeriesPaint(1,Color.red);
    
    plot.getDomainAxis().setTickLabelsVisible(false);
    plot.getDomainAxis().setLowerMargin(0.00);
    plot.getDomainAxis().setUpperMargin(0.00);

    ChartPanel chartPanel=new ChartPanel(chart);
}
My chart is in a JTabbedPane when I display the chart I run this methode for each serie

Code: Select all

public void addValue(String series,int j)
{
    for(int k=0;k<i[0].length;k++)
    {
      dataset.setValue(i[j][k],series,""+k);
    }
}
My PC is P4 2.4Ghz with 256 DDR
It's work on win2000

Thank for your reply

Lutchanah

lutchanah
Posts: 5
Joined: Thu Jul 31, 2003 7:21 am

Post by lutchanah » Tue Dec 02, 2003 10:37 am

The problem was in my dataset
So i changed the methode setValue()

Code: Select all

public void setValue(Number value,Comparable rowKey,Comparable columnKey)
  {
    this.data.setValue(value,rowKey,columnKey);
    fireDatasetChanged();
  }
to

Code: Select all

public void setValue(Number value,Comparable rowKey,Comparable columnKey)
  {
    this.data.setValue(value,rowKey,columnKey);
  }
and i crete a methode to update the value

The perfomance are good

Locked