Hi all,
I'm using jdk 1.6 update 6 on Linux.
I want to create a simple Bar chart and display it in a separate JFrame.
The paint() method of my frame class looks like:
public void paint(Graphics g) {
DataSeries ds = new DataSeries(goCate, "GO terms", "Number of
hits", "Histogram");
AxisChartDataSet axds = null;
try {
axds = new AxisChartDataSet(counts, new String[]{""}, new
Paint[]{Color.blue.darker()}, ChartType.BAR, new BarChartProperties());
} catch (ChartDataException ex) {
ex.printStackTrace();
}
ds.addIAxisPlotDataSet(axds);
AxisChart ac = new AxisChart(ds, new ChartProperties(), new
AxisProperties(), null, this.panel.getWidth(), this.panel.getHeight());
ac.setGraphics2D((Graphics2D) this.panel.getGraphics());
try {
ac.render();
} catch (ChartDataException ex) {
ex.printStackTrace();
} catch (PropertyException ex) {
ex.printStackTrace();
}
}
Which is essentially a copy of the SwingDemo of jCharts source code.
However, the chart is flickering and mostly showing only a grey pane.
Furthermore, the frame is automatically resizing to a very small size.
The 1.0.0-alpha release also shows the flickering but not the resizing.
Does anybody have an idea what goes wrong?
Thanks,
Andreas
|