Update of /cvsroot/jcharts/jCharts/jCharts0.7/src/org/jCharts/test In directory sc8-pr-cvs1:/tmp/cvs-serv32423 Modified Files: BarTestDriver.java ChartTestDriver.java ScatterPlotTestDriver.java StackedBarTestDriver.java Log Message: testing Index: BarTestDriver.java =================================================================== RCS file: /cvsroot/jcharts/jCharts/jCharts0.7/src/org/jCharts/test/BarTestDriver.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** BarTestDriver.java 31 Mar 2003 00:26:42 -0000 1.19 --- BarTestDriver.java 2 Nov 2003 13:22:31 -0000 1.20 *************** *** 59,62 **** --- 59,66 ---- import java.awt.*; + import java.util.Locale; + import java.util.Collection; + import java.util.Iterator; + import java.text.MessageFormat; *************** *** 136,145 **** ! double[][] data = {{280, 16, -150, 160, 90, 60, 150, 11, -23, 50, 89 }}; Paint[] paints = {Color.green}; String[] legendLabels = {"Test Legend Label"}; AxisChartDataSet axisChartDataSet = new AxisChartDataSet( data, legendLabels, paints, ChartType.BAR, barChartProperties ); ! String[] axisLabels = {"1900", "195555510", "1920", "1935555555555550", "1940", "19555555550", "5555551960", "19755555550", "19855550", "19905555", "20005555" }; //String[] axisLabels = {"1900", "1910", "1920", "1930", "1940", "1950", "1960", "1970", "1980", "1990", "2000" }; IAxisDataSeries dataSeries = new DataSeries( axisLabels, "Wonka Bars", "Years", "Oompa Loompa Productivity" ); --- 140,150 ---- ! /* ! double[][] data = {{280, 16, -150, 160, 90, 60, 150, 11, -23, 50, 89}}; Paint[] paints = {Color.green}; String[] legendLabels = {"Test Legend Label"}; AxisChartDataSet axisChartDataSet = new AxisChartDataSet( data, legendLabels, paints, ChartType.BAR, barChartProperties ); ! String[] axisLabels = {"1900", "195555510", "1920", "1935555555555550", "1940", "19555555550", "5555551960", "19755555550", "19855550", "19905555", "20005555"}; //String[] axisLabels = {"1900", "1910", "1920", "1930", "1940", "1950", "1960", "1970", "1980", "1990", "2000" }; IAxisDataSeries dataSeries = new DataSeries( axisLabels, "Wonka Bars", "Years", "Oompa Loompa Productivity" ); *************** *** 150,155 **** AxisProperties axisProperties = new AxisProperties( true ); ! axisProperties.getYAxisProperties().setShowGridLines( AxisTypeProperties.GRID_LINES_NONE ); ! axisProperties.getYAxisProperties().setAxisStroke( new ChartStroke( new BasicStroke( 1.5f ), Color.red ) ); //axisProperties.setXAxisLabelsAreVertical( true ); --- 155,160 ---- AxisProperties axisProperties = new AxisProperties( true ); ! axisProperties.getYAxisProperties().setShowGridLines( AxisTypeProperties.GRID_LINES_ALL ); ! axisProperties.getYAxisProperties().setGridLineChartStroke( new ChartStroke( new BasicStroke( 1.5f ), Color.red ) ); //axisProperties.setXAxisLabelsAreVertical( true ); *************** *** 164,170 **** --- 169,281 ---- ChartTestDriver.exportImage( axisChart, "BarChartTest.png" ); + */ + + bug2(); + } + + + public static void bug() throws ChartDataException, PropertyException + { + String[] xAxisLabels = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII"}; + //out = response.getOutputStream(); + + //java.util.ResourceBundle txts = java.util.ResourceBundle.getBundle( "charts", new Locale( language ) ); + + //String year = getParameter( request, "Year" ); + //if( year == null ) year = "2002"; + + //Collection v = user.getNumbersByYear( kid, new Long( year ) ); + //Iterator it = v.iterator(); + + double[][] data = new double[1][12]; + for( int i = 0; i < 12; i++ ) + { + double d = 51; + data[0][i] = d; + } + String xAxisTitle = "CHART1_XAXIS"; + String yAxisTitle = "CHART1_YAXIS"; + + //Object[] arg = {year}; + String title = "CHART1_TITLE hhhhhhhhhhhhhhhhhhhhh hhhhhhhhh hhhhhhhhhhh hhhhhhhhhhh hhhhhhhh hhhhhhhh hhhh hhhhh hhhh hhhh hhhh hhhhh hhhhhhhh"; + + DataSeries dataSeries = new DataSeries( xAxisLabels, xAxisTitle, yAxisTitle, title ); + String[] legendLabels = {"CHART1_LEGEND"}; + + Paint[] paints = {new GradientPaint( 0, 0, new Color( 255, 213, 83, 150 ), 0, 350, new Color( 243, 116, 0, 200 ) ) + }; + BarChartProperties barChartProperties = new BarChartProperties(); + + ValueLabelRenderer valueLabelRenderer = new ValueLabelRenderer( false, false, false, -1 ); + valueLabelRenderer.setValueLabelPosition( ValueLabelPosition.ON_TOP ); + valueLabelRenderer.useVerticalLabels( false ); + barChartProperties.addPostRenderEventListener( valueLabelRenderer ); + + AxisChartDataSet axisChartDataSet = new AxisChartDataSet( data, legendLabels, paints, ChartType.BAR, barChartProperties ); + dataSeries.addIAxisPlotDataSet( axisChartDataSet ); + ChartProperties chartProperties = new ChartProperties(); + + LabelAxisProperties xAxisProperties = new LabelAxisProperties(); + //xAxisProperties.setAxisTitleChartFont( ft_axis ); + //xAxisProperties.setScaleChartFont( ft_labels ); + + DataAxisProperties yAxisProperties = new DataAxisProperties(); + //yAxisProperties.setAxisTitleChartFont( ft_axis ); + //yAxisProperties.setScaleChartFont( ft_labels ); + yAxisProperties.setRoundToNearest( 0 ); + + AxisProperties axisProperties = new AxisProperties( xAxisProperties, yAxisProperties ); + LegendProperties legendProperties = new LegendProperties(); + + //chartProperties.setTitleFont( ft_title ); + //legendProperties.setFont( ft_base_ ); + + axisProperties.setBackgroundPaint( new GradientPaint( 0, 0, new Color( 255, 255, 255 ), 0, 300, new + Color( 167, 213, 255 ) ) ); + AxisChart axisChart = new AxisChart( + dataSeries, + chartProperties, + axisProperties, + null, //legendProperties, + 548, 350 ); // wymiary wykresu + + ChartTestDriver.exportImage( axisChart, "Bug_BarChartTest.png" ); } + + private static void bug2() + { + BarChartProperties barChartProperties = null; + LegendProperties legendProperties = null; + AxisProperties axisProperties = null; + ChartProperties chartProperties =null;// = new ChartProperties(); + int width = 550; + int height = 360; + + try + { + String[] xAxisLabels = {"1995", "1996", "1997", "1998", "1999", "2000","2001", "2002", "2003", "2004"}; + String xAxisTitle = "Years"; + String yAxisTitle = "Problems"; + String title = "Micro$oft At Work"; + IAxisDataSeries dataSeries = new DataSeries( xAxisLabels, xAxisTitle,yAxisTitle, title ); + + double[][] data = new double[][]{{1500, 6880, 4510, 2600, 1200, 1580,8000, 4555, 4000, 6120}}; + String[] legendLabels = {"Bugs"}; + Paint[] paints = new Paint[]{Color.blue.darker()}; + dataSeries.addIAxisPlotDataSet( new AxisChartDataSet( data,legendLabels, paints, ChartType.BAR, barChartProperties ) ); + AxisChart axisChart = new AxisChart( dataSeries, chartProperties, axisProperties, legendProperties, width, height ); + + ChartTestDriver.exportImage( axisChart, "Bug222_BarChartTest.png" ); + } + catch( ChartDataException chartDataException ) + { + chartDataException.printStackTrace(); + } + catch( PropertyException propertyException ) { + propertyException.printStackTrace(); + } + } } Index: ChartTestDriver.java =================================================================== RCS file: /cvsroot/jcharts/jCharts/jCharts0.7/src/org/jCharts/test/ChartTestDriver.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** ChartTestDriver.java 19 Apr 2003 16:30:55 -0000 1.20 --- ChartTestDriver.java 2 Nov 2003 13:22:31 -0000 1.21 *************** *** 76,79 **** --- 76,80 ---- + /* AxisChartTestBase.axisChartTest( "stockChart", new StockTestDriver() ); *************** *** 93,99 **** AxisChartTestBase.axisChartTest( "lineChart", new LineTestDriver() ); ! AxisChartTestBase.axisChartTest( "scatterChart", new ScatterPlotTestDriver() ); //ChartTestDriver.testAxisScale(); --- 94,101 ---- AxisChartTestBase.axisChartTest( "lineChart", new LineTestDriver() ); + */ ! ScatterChartTestBase.axisChartTest( "scatterChart", new ScatterPlotTestDriver() ); //ChartTestDriver.testAxisScale(); Index: ScatterPlotTestDriver.java =================================================================== RCS file: /cvsroot/jcharts/jCharts/jCharts0.7/src/org/jCharts/test/ScatterPlotTestDriver.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ScatterPlotTestDriver.java 31 Mar 2003 00:26:42 -0000 1.5 --- ScatterPlotTestDriver.java 2 Nov 2003 13:22:31 -0000 1.6 *************** *** 56,60 **** * *******************************************************************************************/ ! class ScatterPlotTestDriver extends AxisChartTestBase { boolean supportsImageMap() --- 56,60 ---- * *******************************************************************************************/ ! public class ScatterPlotTestDriver extends ScatterChartTestBase { boolean supportsImageMap() *************** *** 111,116 **** ! Point2D.Double[] points= new Point2D.Double[ 20 ]; ! for( int x = 0; x < 20; x++ ) { //--- y = x^2 --- 111,116 ---- ! Point2D.Double[] points= new Point2D.Double[ numberOfValuesToCreate ]; ! for( int x = 0; x < numberOfValuesToCreate; x++ ) { //--- y = x^2 *************** *** 119,124 **** } ! String[] legendLabels = TestDataGenerator.getRandomStrings( 1, 12, false ); ! // Paint[] paints = TestDataGenerator.getRandomPaints( numberOfDataSets ); Paint paint = TestDataGenerator.getRandomPaint(); --- 119,124 ---- } ! String[] legendLabels = TestDataGenerator.getRandomStrings( numberOfDataSets, 12, false ); ! Paint[] paints = TestDataGenerator.getRandomPaints( numberOfDataSets ); Paint paint = TestDataGenerator.getRandomPaint(); *************** *** 126,130 **** scatterPlotDataSet.addDataPoints( points, paint, legendLabels[ 0 ] ); - System.out.println( "legendLabels[ 0 ]= " + legendLabels[ 0 ] ); return scatterPlotDataSet; } --- 126,129 ---- *************** *** 135,154 **** * ******************************************************************************************/ ! DataSeries getDataSeries() throws ChartDataException { ! DataSeries dataSeries= null; ! int dataSize = (int) TestDataGenerator.getRandomNumber( 3, 3 ); int numberOfDataSets = (int) TestDataGenerator.getRandomNumber( 1, 1 ); ! //ScatterPlotDataSet scatterPlotDataSet= this.createScatterPlotDataSet( ) ! //String[] xAxisLabels = TestDataGenerator.getRandomStrings( numberOfValuesToCreate, ( int ) TestDataGenerator.getRandomNumber( 10 ), false ); String xAxisTitle = TestDataGenerator.getRandomString( 15, true ); String yAxisTitle = TestDataGenerator.getRandomString( 15, true ); ! //dataSeries = new DataSeries( xAxisLabels, xAxisTitle, yAxisTitle, "This is a test title that is so freaking long is is going to wrap around the image for sure. lfksjg;ljs; dflgkjdfgsdgdg dsgdsgsdfg dsfgsdfgsdfgs dfgdsfgd" ); ! ! //dataSeries.addIAxisPlotDataSet( axisChartDataSet ); return dataSeries; --- 134,152 ---- * ******************************************************************************************/ ! ScatterPlotDataSeries getDataSeries() throws ChartDataException { ! ScatterPlotDataSeries dataSeries= null; ! int dataSize = (int) TestDataGenerator.getRandomNumber( 3, 10 ); int numberOfDataSets = (int) TestDataGenerator.getRandomNumber( 1, 1 ); ! ScatterPlotDataSet scatterPlotDataSet= this.createScatterPlotDataSet( numberOfDataSets, dataSize, 50, 50, 0, 0 ); ! String[] xAxisLabels = TestDataGenerator.getRandomStrings( dataSize, ( int ) TestDataGenerator.getRandomNumber( 10 ), false ); String xAxisTitle = TestDataGenerator.getRandomString( 15, true ); String yAxisTitle = TestDataGenerator.getRandomString( 15, true ); ! dataSeries = new ScatterPlotDataSeries( scatterPlotDataSet, xAxisTitle, yAxisTitle, "This is a test title that is so freaking long is is going to wrap around the image for sure. lfksjg;ljs; dflgkjdfgsdgdg dsgdsgsdfg dsfgsdfgsdfgs dfgdsfgd" ); ! dataSeries.addIAxisPlotDataSet( scatterPlotDataSet ); return dataSeries; *************** *** 218,222 **** 400 ); ! ChartTestDriver.exportImage( scatterPlotAxisChart, "ScatterPlotTest.svg" ); } --- 216,220 ---- 400 ); ! ChartTestDriver.exportImage( scatterPlotAxisChart, "ScatterPlotTest.png" ); } Index: StackedBarTestDriver.java =================================================================== RCS file: /cvsroot/jcharts/jCharts/jCharts0.7/src/org/jCharts/test/StackedBarTestDriver.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** StackedBarTestDriver.java 31 Mar 2003 00:26:42 -0000 1.10 --- StackedBarTestDriver.java 2 Nov 2003 13:22:31 -0000 1.11 *************** *** 58,62 **** * *******************************************************************************************/ ! class StackedBarTestDriver extends AxisChartTestBase { boolean supportsImageMap() --- 58,62 ---- * *******************************************************************************************/ ! public class StackedBarTestDriver extends AxisChartTestBase { boolean supportsImageMap() *************** *** 127,132 **** AxisChartDataSet axisChartDataSet = new AxisChartDataSet( data, legendLabels, paints, ChartType.BAR_STACKED, stackedBarChartProperties ); ! String[] axisLabels = null; //{"1900", "1950", "2000", "2050", "3000", "3050", "4000", "4050" }; ! IAxisDataSeries dataSeries = new DataSeries( axisLabels, "Cookies", "Years", null ); dataSeries.addIAxisPlotDataSet( axisChartDataSet ); --- 127,132 ---- AxisChartDataSet axisChartDataSet = new AxisChartDataSet( data, legendLabels, paints, ChartType.BAR_STACKED, stackedBarChartProperties ); ! String[] axisLabels = {"1900", "1950", "2000", "2050", "3000", "3050", "4000", "4050" }; ! IAxisDataSeries dataSeries = new DataSeries( axisLabels, "Cookies", "Years", "Effort Over Time" ); dataSeries.addIAxisPlotDataSet( axisChartDataSet ); *************** *** 134,142 **** ChartProperties chartProperties = new ChartProperties(); AxisProperties axisProperties = new AxisProperties( false ); ! ! axisProperties.getXAxisProperties().setShowAxisLabels( false ); ! axisProperties.getYAxisProperties().setShowAxisLabels( false ); ! axisProperties.getYAxisProperties().setShowTicks( AxisTypeProperties.TICKS_NONE ); //axisProperties.getYAxisProperties().setShowGridLines( AxisTypeProperties.GRID_LINES_NONE ); --- 134,142 ---- ChartProperties chartProperties = new ChartProperties(); AxisProperties axisProperties = new AxisProperties( false ); + axisProperties.getXAxisProperties().getAxisTitleChartFont(); ! // axisProperties.getXAxisProperties().setShowAxisLabels( false ); ! // axisProperties.getYAxisProperties().setShowAxisLabels( false ); ! // axisProperties.getYAxisProperties().setShowTicks( AxisTypeProperties.TICKS_NONE ); //axisProperties.getYAxisProperties().setShowGridLines( AxisTypeProperties.GRID_LINES_NONE ); *************** *** 150,154 **** */ ! LegendProperties legendProperties = null; //new LegendProperties(); AxisChart axisChart = new AxisChart( dataSeries, chartProperties, axisProperties, legendProperties, 500, 400 ); --- 150,154 ---- */ ! LegendProperties legendProperties = new LegendProperties(); AxisChart axisChart = new AxisChart( dataSeries, chartProperties, axisProperties, legendProperties, 500, 400 ); |