|
From: Zelgadis <zel...@ya...> - 2004-12-03 09:57:34
|
I'm using jChart 0.7.5 and I've a problem with combo
charts. If use a point chart with a legend I receive
an index out of bounds exception.
This is my code:
public void service(HttpServletRequest request,
HttpServletResponse response)
throws
ServletException, IOException {
try {
String[] xAxisLabels= { "1998", "1999", "2000",
"2001", "2002", "2003", "2004" };
String xAxisTitle= null;
String yAxisTitle= null;
String title= null;
DataSeries dataSeries = new DataSeries(
xAxisLabels, xAxisTitle, yAxisTitle, title );
double[][] data1 = {{1,2,3,4,5,6,7}};
String[] legendLabels= {"test_area"};
Paint[] paints= { Color.blue};
AreaChartProperties areaChartProperties= new
AreaChartProperties();
AxisChartDataSet axisChartDataSet= new
AxisChartDataSet( data1, legendLabels, paints,
ChartType.AREA, areaChartProperties );
dataSeries.addIAxisPlotDataSet(
axisChartDataSet );
double[][] data2 = {{1,2,3,4,5,6,7}};
legendLabels = new String[]{"test_point"};
paints = new Paint[]{ Color.red };
Shape[] shapes= {
PointChartProperties.SHAPE_CIRCLE };
boolean[] fillPointFlags = {true};
PointChartProperties pointChartProperties= new
PointChartProperties(shapes, fillPointFlags, paints);
axisChartDataSet = new AxisChartDataSet( data2,
legendLabels, paints, ChartType.POINT,
pointChartProperties );
dataSeries.addIAxisPlotDataSet(
axisChartDataSet );
ChartProperties chartProperties = new
ChartProperties();
AxisProperties axisProperties = new
AxisProperties();
LegendProperties legendProperties = new
LegendProperties();
AxisChart axisChart= new AxisChart( dataSeries,
chartProperties, axisProperties, legendProperties,
500, 360 );
ServletEncoderHelper.encodeJPEG13(axisChart,
1.0f, response);
}
catch (Throwable throwable) {
throwable.getMessage();
throwable.printStackTrace();
}
}
When I encode I receive:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
I have this problem only when I use a point chart.
If I use a LineChart instead of point chart the code
works well
I think there is a problem with the legend, in fact if
I use:
LegendProperties legendProperties = null;
instead of
LegendProperties legendProperties = new
LegendProperties();
the code works well
Is it a bug or am I wrong?
Can someone help me?
Thank you.
___________________________________
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica
Scaricalo ora!
http://it.messenger.yahoo.it
|