|
From: <tam...@ub...> - 2004-02-26 10:02:18
|
hi all
we are generating clusteredbarcharts based on the result of some =
database selects, so the data to display is not static.
we have a problem if there is no data. I have tried different ways to =
tweak this issue, but always ran into troubles:
I'm using jcharts 0.7.4 (the posted methods are the same in 0.7.5)=20
- legendlabels and data array (double[][]) are null=20
java.lang.NullPointerException
at =
org.jCharts.chartData.AxisChartDataSet.getNumberOfDataSets(AxisChartDataS=
et.java:136)
at =
org.jCharts.chartData.AxisDataSeries.addIAxisPlotDataSet(AxisDataSeries.j=
ava:166)
code which throws exception [AxisChartDataSet.getNumberOfDataSets]:
public final int getNumberOfDataSets()
{
return this.data.length;
}
- legenlabels is null, data array is new double[0][0];
java.lang.ArrayIndexOutOfBoundsException: 0
at org.jCharts.chartData.DataSet.getNumberOfDataItems(DataSet.java:148)
at =
org.jCharts.chartData.AxisDataSeries.addIAxisPlotDataSet(AxisDataSeries.j=
ava:168)
code which throws exception [DataSet.getNumberOfDataItems]:
public int getNumberOfDataItems()
{
return this.data[ 0 ].length;
}
is there any reason, why null and/or length is not checked in those =
methods ??=20
is there any other way to get a empty chart, I do set=20
setUserDefinedScale(0, 2)
setNumItems(5)
regards
tamer
|