|
From: <tam...@ub...> - 2004-02-27 07:43:15
|
providing a placeholder image is exactly how we solved this issue.=20
still I was wondering, whether the cart implementation couldn't handle =
that. or let's say I was surprised it didn't catch that scenario and =
throw at least some validation exception instead of running into =
nullpointer.
-----Original Message-----
From: jch...@li...
[mailto:jch...@li...]On Behalf Of Nathaniel
G. Auvil
Sent: Freitag, 27. Februar 2004 01:29
To: jch...@li...
Subject: Re: [jCharts-users] Problems (NullPointer or ArrayIndex) if no
data available for barchart
If there is no data what do you expect to see in a chart? What would be =
on the y-axis if there
are no data elements?
I would think your logic, would see there was no data, and stream a =
placeholder image instead of
the chart or a chart with a few zero values and labels of empty Strings.
--- tam...@ub... wrote:
> hi all
>=20
> 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:
>=20
> I'm using jcharts 0.7.4 (the posted methods are the same in 0.7.5)=20
>=20
> - legendlabels and data array (double[][]) are null=20
>=20
> java.lang.NullPointerException
> at =
org.jCharts.chartData.AxisChartDataSet.getNumberOfDataSets(AxisChartDataS=
et.java:136)
> at =
org.jCharts.chartData.AxisDataSeries.addIAxisPlotDataSet(AxisDataSeries.j=
ava:166)
>=20
> code which throws exception [AxisChartDataSet.getNumberOfDataSets]:
> public final int getNumberOfDataSets()
> {
> return this.data.length;
> }
>=20
> - legenlabels is null, data array is new double[0][0];
>=20
> java.lang.ArrayIndexOutOfBoundsException: 0
> at =
org.jCharts.chartData.DataSet.getNumberOfDataItems(DataSet.java:148)
> at =
org.jCharts.chartData.AxisDataSeries.addIAxisPlotDataSet(AxisDataSeries.j=
ava:168)
>=20
> code which throws exception [DataSet.getNumberOfDataItems]:
> public int getNumberOfDataItems()
> {
> return this.data[ 0 ].length;
> }
>=20
> is there any reason, why null and/or length is not checked in those =
methods ??=20
>=20
> is there any other way to get a empty chart, I do set=20
> setUserDefinedScale(0, 2)
> setNumItems(5)
>=20
>=20
> regards
>=20
> tamer
>=20
>=20
> -------------------------------------------------------
> SF.Net is sponsored by: Speed Start Your Linux Apps Now.
> Build and deploy apps & Web services for Linux with
> a free DVD software kit from IBM. Click Now!
> http://ads.osdn.com/?ad_id=1356&alloc_id438&op=3Dclick
> _______________________________________________
> jCharts-users mailing list
> jCh...@li...
> https://lists.sourceforge.net/lists/listinfo/jcharts-users
__________________________________
Do you Yahoo!?
Get better spam protection with Yahoo! Mail.
http://antispam.yahoo.com/tools
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick
_______________________________________________
jCharts-users mailing list
jCh...@li...
https://lists.sourceforge.net/lists/listinfo/jcharts-users
|