From: G?nther B. <br...@us...> - 2002-05-20 07:43:51
|
Update of /cvsroot/xpg-xml/edu/iicm/xpg/transitions/latex In directory usw-pr-cvs1:/tmp/cvs-serv19295/transitions/latex Modified Files: WriteChartTransition.java Log Message: chart example is now working :-)) Index: WriteChartTransition.java =================================================================== RCS file: /cvsroot/xpg-xml/edu/iicm/xpg/transitions/latex/WriteChartTransition.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WriteChartTransition.java 19 May 2002 08:36:43 -0000 1.1 --- WriteChartTransition.java 20 May 2002 07:43:48 -0000 1.2 *************** *** 39,42 **** --- 39,43 ---- import net.sourceforge.chart2d.Dataset; import net.sourceforge.chart2d.PieChart2DProperties; + import net.sourceforge.chart2d.Chart2D; import net.sourceforge.chart2d.PieChart2D; import net.sourceforge.chart2d.LBChart2D; *************** *** 86,89 **** --- 87,92 ---- Chart2DProperties chart2DProps = new Chart2DProperties(); chart2DProps.setChartTitleText(list_title); + Chart2D chart2D = new LBChart2D(); + JFrame frame = new JFrame(); if (chart_type.equals("pie")) *************** *** 105,122 **** new PieChart2DProperties (chart2DProps, dataset); pieChart2DProps.setLegendLabelsTexts (legendLabels); ! PieChart2D chart2D = new PieChart2D (pieChart2DProps); //<-- End Chart2D configuration --> - - JFrame frame = new JFrame(); - frame.getContentPane().add (chart2D); //Add Chart2D to GUI - frame.setTitle (list_title); - frame.pack(); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - frame.setLocation ( (screenSize.width - frame.getSize().width) / 2, - (screenSize.height - frame.getSize().height) / 2 ); - - ImageIO.write(chart2D.getImage(), "PNG", new File(chart_filename)); } else if (chart_type.equals("line")) { --- 108,116 ---- new PieChart2DProperties (chart2DProps, dataset); pieChart2DProps.setLegendLabelsTexts (legendLabels); ! chart2D = new PieChart2D (pieChart2DProps); //<-- End Chart2D configuration --> } + // FIXXME: LineChart doesn`t work properly at the moment! else if (chart_type.equals("line")) { *************** *** 145,165 **** new GraphChart2DProperties (chart2DProps, graphProps); graphChart2DProps.setLabelsAxisLabelsTexts (axisLabels); ! graphChart2DProps.setLabelsAxisTicksAlignment (graphChart2DProps.CENTERED); //Configure chart ! LBChart2D chart2D = new LBChart2D (graphChart2DProps); //<-- End Chart2D configuration --> - - JFrame frame = new JFrame(); - frame.getContentPane().add (chart2D); //Add Chart2D to GUI - frame.setTitle (list_title); - frame.pack(); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - frame.setLocation ( (screenSize.width - frame.getSize().width) / 2, - (screenSize.height - frame.getSize().height) / 2 ); - - ImageIO.write(chart2D.getImage(), "PNG", new File(chart_filename)); } result.append("\n\\includegraphics{" + chart_filename + "}\n"); --- 139,159 ---- new GraphChart2DProperties (chart2DProps, graphProps); graphChart2DProps.setLabelsAxisLabelsTexts (axisLabels); ! graphChart2DProps.setLabelsAxisTicksAlignment(graphChart2DProps.CENTERED); //Configure chart ! chart2D = new LBChart2D (graphChart2DProps); //<-- End Chart2D configuration --> } + frame.getContentPane().add (chart2D); //Add Chart2D to GUI + frame.setTitle (list_title); + frame.pack(); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + frame.setLocation ( (screenSize.width - frame.getSize().width) / 2, + (screenSize.height - frame.getSize().height) / 2 ); + + ImageIO.write(chart2D.getImage(), "png", + new File(chart_filename + ".png")); + result.append("\n\\includegraphics{" + chart_filename + "}\n"); |