List of usage examples for org.jfree.chart.plot PlotOrientation VERTICAL
PlotOrientation VERTICAL
To view the source code for org.jfree.chart.plot PlotOrientation VERTICAL.
Click Source Link
From source file:userInterface.StateAdminRole.DecisionChart4JPanel.java
private static JFreeChart createChart1(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createBarChart("Total Vaccinations", "Hospital", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setDomainGridlinesVisible(true); categoryplot.setRangeCrosshairVisible(true); categoryplot.setRangeCrosshairPaint(Color.blue); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer(); barrenderer.setDrawBarOutline(false); GradientPaint gradientpaint = new GradientPaint(0.0F, 0.0F, Color.blue, 0.0F, 0.0F, new Color(0, 0, 64)); GradientPaint gradientpaint1 = new GradientPaint(0.0F, 0.0F, Color.green, 0.0F, 0.0F, new Color(0, 64, 0)); GradientPaint gradientpaint2 = new GradientPaint(0.0F, 0.0F, Color.red, 0.0F, 0.0F, new Color(64, 0, 0)); barrenderer.setSeriesPaint(0, gradientpaint); barrenderer.setSeriesPaint(1, gradientpaint1); barrenderer.setSeriesPaint(2, gradientpaint2); barrenderer.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("Tooltip: {0}")); CategoryAxis categoryaxis = categoryplot.getDomainAxis(); categoryaxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(0.52359877559829882D)); return jfreechart; }
From source file:jfreechart.ViewGirlsBoysAvgChart.java
public static void viweGirlsAvgChart(List<String> testId, ArrayList<Double> totAvg, ArrayList<Double> girlsAvg, ArrayList<Double> boysAvg) throws SQLException, ClassNotFoundException { try {/*from w w w. j a v a 2s .c o m*/ UIManager.setLookAndFeel(new McWinLookAndFeel()); } catch (UnsupportedLookAndFeelException ex) { Logger.getLogger(ViewEachStudentChart.class.getName()).log(Level.SEVERE, null, ex); } DefaultCategoryDataset objDataset = new DefaultCategoryDataset(); for (Double marks : totAvg) { //Double mark = tstId; //String tetId = tstId.split(",")[3]; objDataset.addValue(marks, "Line1", marks); } for (Double marks : girlsAvg) { //Double mark = tstId; //String tetId = tstId.split(",")[3]; objDataset.addValue(marks, "Line2", marks); } // for (Double testMark : bAvgList) { // Double mark = testMark; // //String tstId = testId.split(",")[3]; // objDataset.setValue(mark, "", mark); // // // } JFreeChart objChart = ChartFactory.createLineChart("Marks Chart", //Chart title "Test", //Domain axis label "Marks", //Range axis label objDataset, //Chart Data PlotOrientation.VERTICAL, // orientation true, // include legend? true, // include tooltips? false // include URLs? ); ChartFrame frame = new ChartFrame("Dakma Higher Education Center", objChart); frame.setLocationRelativeTo(frame); frame.pack(); frame.setVisible(true); }
From source file:business.management.system.Chart.java
/** * Creates new form Chart/*from ww w. j a va 2 s . co m*/ */ public Chart(CategoryDataset dataset) throws SQLException { initComponents(); JFreeChart barChart = ChartFactory.createBarChart("Stock quote", "Category", "Score", dataset, PlotOrientation.VERTICAL, true, true, false); JPanel panel = new JPanel(); ChartPanel chartPanel = new ChartPanel(barChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); panel.add(chartPanel); setContentPane(panel); /*JFreeChart pieChart = ChartFactory.createPieChart( "Completed projects", createPieDataset() ); ChartPanel chartPanel1 = new ChartPanel( pieChart ); chartPanel.setPreferredSize(new java.awt.Dimension( 560 , 367 ) ); panel.add(chartPanel1); setContentPane(panel); */ }
From source file:presentationLayer.PredictionGraph.java
public PredictionGraph(String applicationTitle, String chartTitle, double y, int i) { super(applicationTitle); y1 = y;//from w w w . jav a 2 s. c om id = i; JFreeChart lineChart = ChartFactory.createLineChart(chartTitle, "Order", "Rs.", createDataset(), PlotOrientation.VERTICAL, true, true, false); ChartPanel chartPanel = new ChartPanel(lineChart); chartPanel.setPreferredSize(new java.awt.Dimension(560, 367)); setContentPane(chartPanel); }
From source file:org.jfree.chart.demo.StackedBarDemo3.java
public StackedBarDemo3(String s) { super(s);//from www .j av a2 s.com DefaultCategoryDataset defaultcategorydataset = new DefaultCategoryDataset(); defaultcategorydataset.addValue(1.0D, "Row 1", "Column 1"); defaultcategorydataset.addValue(5D, "Row 1", "Column 2"); defaultcategorydataset.addValue(3D, "Row 1", "Column 3"); defaultcategorydataset.addValue(2D, "Row 2", "Column 1"); defaultcategorydataset.addValue(3D, "Row 2", "Column 2"); defaultcategorydataset.addValue(2D, "Row 2", "Column 3"); JFreeChart jfreechart = ChartFactory.createStackedBarChart("StackedBarDemo3", "Category", "Value", defaultcategorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); StackedBarRenderer stackedbarrenderer = (StackedBarRenderer) categoryplot.getRenderer(); stackedbarrenderer.setRenderAsPercentages(true); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setLabel("Percentage"); numberaxis.setNumberFormatOverride(new DecimalFormat("0.0%")); ChartPanel chartpanel = new ChartPanel(jfreechart, false); chartpanel.setPreferredSize(new Dimension(500, 270)); setContentPane(chartpanel); }
From source file:org.matsim.contrib.util.timeprofile.TimeProfileCharts.java
public static JFreeChart chartProfile(DefaultTableXYDataset dataset, ChartType type) { JFreeChart chart;/* www .j a v a 2s .co m*/ switch (type) { case Line: chart = ChartFactory.createXYLineChart("TimeProfile", "Time [h]", "Values", dataset, PlotOrientation.VERTICAL, true, false, false); break; case StackedArea: chart = ChartFactory.createStackedXYAreaChart("TimeProfile", "Time [h]", "Values", dataset, PlotOrientation.VERTICAL, true, false, false); break; default: throw new IllegalArgumentException(); } XYPlot plot = chart.getXYPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(Color.white); NumberAxis xAxis = (NumberAxis) plot.getDomainAxis(); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setAutoRange(true); XYItemRenderer renderer = plot.getRenderer(); for (int s = 0; s < dataset.getSeriesCount(); s++) { renderer.setSeriesStroke(s, new BasicStroke(2)); } return chart; }
From source file:no.imr.sea2data.guibase.chart.XYBarChart.java
public XYBarChart() { dataset = new XYSeriesCollection(new XYSeries("Series 1")); JFreeChart chart = ChartFactory.createXYBarChart("", "X axis", false, "Y axis", dataset, PlotOrientation.VERTICAL, false, true, false); chart.setBackgroundPaint(Color.white); chart.getTitle().setPaint(Color.black); chart.getTitle().setFont(new Font("SansSerif", Font.PLAIN, 12)); chart.addSubtitle(trendLegend);/*ww w . j av a2s . c om*/ chart.addSubtitle(trendLegend2); trendLegend.setPosition(RectangleEdge.TOP); trendLegend2.setPosition(RectangleEdge.TOP); plot = (XYPlot) chart.getPlot(); XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer(); renderer.setShadowVisible(false); chartPanel = new ChartPanel(chart); plot.getRangeAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); }
From source file:br.unicamp.cst.behavior.bn.support.Grafico.java
public Grafico(String frametitle, String charttitle, String xlabel, String ylabel, XYSeriesCollection dataset) { JFreeChart chart = ChartFactory.createXYLineChart(charttitle, xlabel, ylabel, dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true);/*from www . j a v a2 s. c o m*/ renderer.setShapesFilled(true); setXyplot(plot); setChart(chart); ChartFrame frame = new ChartFrame(frametitle, chart); frame.pack(); frame.setVisible(true); }
From source file:org.jfree.chart.demo.StatisticalBarChartDemo1.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createLineChart("Statistical Bar Chart Demo 1", "Type", "Value", categorydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); categoryplot.setBackgroundPaint(Color.lightGray); categoryplot.setRangeGridlinePaint(Color.white); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis.setAutoRangeIncludesZero(false); StatisticalBarRenderer statisticalbarrenderer = new StatisticalBarRenderer(); statisticalbarrenderer.setErrorIndicatorPaint(Color.black); statisticalbarrenderer.setIncludeBaseInRange(false); categoryplot.setRenderer(statisticalbarrenderer); statisticalbarrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); statisticalbarrenderer.setBaseItemLabelsVisible(true); statisticalbarrenderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.INSIDE6, TextAnchor.BOTTOM_CENTER)); return jfreechart; }
From source file:com.ouc.cpss.view.ProfitChartBuilder.java
public static JFreeChart createJFreeChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createLineChart("?", "", "?", dataset, PlotOrientation.VERTICAL, true, true, false); // ?/*from w w w .java 2s. c om*/ LegendTitle legendTitle = chart.getLegend(0); // legendTitle.setItemFont(new Font("", Font.BOLD, 18)); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ? org.jfree.chart.axis.CategoryAxis categoryAxis = plot.getDomainAxis(); // categoryAxis.setLabelFont(new Font("", Font.BOLD, 18)); // categoryAxis.setTickLabelFont(new Font("", Font.BOLD, 12)); // ? NumberAxis numberAxis = (NumberAxis) plot.getRangeAxis(); // numberAxis.setLabelFont(new Font("", Font.BOLD, 14)); numberAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());// CategoryItemRenderer xylineandshaperenderer = plot.getRenderer(); xylineandshaperenderer.setBaseItemLabelsVisible(true); xylineandshaperenderer.setBasePositiveItemLabelPosition( new ItemLabelPosition(ItemLabelAnchor.OUTSIDE2, TextAnchor.BASELINE_RIGHT)); xylineandshaperenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); return chart; }