XYLineChart on RCP composite

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
anuyaa
Posts: 1
Joined: Tue Aug 05, 2014 2:16 pm
antibot: No, of course not.

XYLineChart on RCP composite

Post by anuyaa » Tue Aug 05, 2014 2:36 pm

Hi everyone.
I am trying to draw XYLineChart on Eclispe RCP view .I wanted to show the chart on submit of button. On debugging , I am getting the data for the series.However chart is shown as a small rectangle.
Here is my code, I am passing composite to the function on which chart has to be drawn.

function outputFolder(){

outputComposite = new Composite(parent, SWT.BORDER);
GridData data = new GridData(SWT.FILL,SWT.FILL,true,true);
data.heightHint = 500;
data.widthHint = 500;
data.verticalSpan = 3;


outputComposite.setLayoutData(data);


}

private static void displayChart(Composite folder) {

dataProvider.populateSeries();
JFreeChart chart = dataProvider.getChart();

ChartComposite chartComposite = new ChartComposite(folder, SWT.EMBEDDED);

chartComposite.setSize(500, 500);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
chartComposite.setLayoutData(data);

chartComposite.setHorizontalAxisTrace(true);
chartComposite.setVerticalAxisTrace(true);

chartComposite.setChart(chart);
System.out.println("chart visible");



//chartComposite.setSize(300, 300);
chartComposite.pack(true);
chartComposite.setVisible(true);
chartComposite.forceRedraw();

}



And on submit buttton , I am passing the outputComposite to the displayChart function.

Locked