From: Nathaniel G. A. <nat...@ya...> - 2003-05-06 03:46:15
|
that works for me. I just made a chart from: BarChartProperties barChartProperties = new BarChartProperties(); Double[][] m_tmpdata= new Double[][]{ { new Double(10), new Double(15) } }; double[][] m_data = new double[m_tmpdata.length][m_tmpdata[0].length]; for(int i=0; i<m_tmpdata.length; i++) { for(int j=0; j<m_tmpdata[0].length; j++) { m_data[i][j]=m_tmpdata[i][j].doubleValue(); } } Paint[] paints = {Color.green}; String[] legendLabels = {"Test Legend Label"}; AxisChartDataSet axisChartDataSet = new AxisChartDataSet( m_data, legendLabels, paints, ChartType.BAR, barChartProperties ); String[] axisLabels = {"1900", "2000" }; IAxisDataSeries dataSeries = new DataSeries( axisLabels, "Wonka Bars", "Years", "Oompa Loompa Productivity" ); dataSeries.addIAxisPlotDataSet( axisChartDataSet ); ChartProperties chartProperties = new ChartProperties(); AxisProperties axisProperties = new AxisProperties( true ); axisProperties.getYAxisProperties().setShowGridLines( AxisTypeProperties.GRID_LINES_NONE ); axisProperties.getYAxisProperties().setAxisStroke( new ChartStroke( new BasicStroke( 1.5f ), Color.red ) ); DataAxisProperties yAxis = (DataAxisProperties) axisProperties.getXAxisProperties(); LegendProperties legendProperties = null; AxisChart axisChart = new AxisChart( dataSeries, chartProperties, axisProperties, legendProperties, 500, 400 ); --- Sreemannarayana <sp...@os...> wrote: > I am working with simple Bar charts, JSP, Tomcat. > I am passing the data of type "Double[][]" from Jsp-page-1 jsp-page-2 > through "Session". > In jsp-page-2, I have written code for bar graph. > So in jsp-page-2 I am taking the data (of type Double[][]) from session > and putting in to an array of type "double[][]". > > // Double[][] m_tmpdata , this passed through session. > double[][] m_data = new double[m_tmpdata.length][m_tmpdata[0].length]; > for(int i=0; i<m_tmpdata.length; i++) > { > for(int j=0; j<m_tmpdata[0].length; j++) > { > m_data[i][j]=m_tmpdata[i][j].doubleValue(); > } > } > > Paint[] m_paints = TestDataGenerator.getRandomPaints(1) // since its > simple bar charts. > > The above code is not working. > Its giving exception like: > "There is not an one to one mapping of "Paint" implementation to > "data sets". > > Why am I getting this problem.????? > > If I write the code like as follows its working fine: > > Double [][] m_data = {{m_tmpdata[0][0].doubleValue(), > m_tmpdata[1][0].doubleValue()}}; > > > Please Help me. > > Thanks and regards. > ===== http://nathaniel-auvil.blog-city.com/ __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com |