List of usage examples for org.jfree.chart ChartFactory createWaterfallChart
public static JFreeChart createWaterfallChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls)
From source file:org.adempiere.apps.graph.ChartBuilder.java
private JFreeChart createWaterfallChart() { JFreeChart chart = ChartFactory.createWaterfallChart(chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title chartModel.get_Translation(MChart.COLUMNNAME_DomainLabel), // domain axis label chartModel.get_Translation(MChart.COLUMNNAME_RangeLabel), // range axis label getCategoryDataset(), // data X_AD_Chart.CHARTORIENTATION_Horizontal.equals(chartModel.getChartOrientation()) ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL, // orientation chartModel.isDisplayLegend(), // include legend true, // tooltips? true // URLs? );/* ww w . ja v a 2 s .c o m*/ setupCategoryChart(chart); return chart; }
From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo.java
private static JFreeChart createWaterfallChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createWaterfallChart("Waterfall Chart Demo 1", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? );// ww w .java 2 s .c om chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); WaterfallBarRenderer renderer = (WaterfallBarRenderer) plot.getRenderer(); // set up gradient paints for series... GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); // GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); // renderer.setSeriesPaint(0, gp0); // renderer.setSeriesPaint(1, gp1); // renderer.setSeriesPaint(2, gp2); //?? renderer.setFirstBarPaint(gp0); renderer.setLastBarPaint(gp2); renderer.setPositiveBarPaint(Color.orange); renderer.setNegativeBarPaint(Color.cyan); return chart; }
From source file:hudson.plugins.plot.PlotData.java
/** * Creates a Chart of the style indicated by getEffStyle() using the given dataset. * Defaults to using createLineChart.// www. j a v a2s. co m */ private JFreeChart createChart(PlotCategoryDataset dataset) { String s = getUrlStyle(); if (s.equalsIgnoreCase("area")) { return ChartFactory.createAreaChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } if (s.equalsIgnoreCase("bar")) { return ChartFactory.createBarChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } if (s.equalsIgnoreCase("bar3d")) { return ChartFactory.createBarChart3D(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } if (s.equalsIgnoreCase("line3d")) { return ChartFactory.createLineChart3D(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } if (s.equalsIgnoreCase("stackedarea")) { return ChartFactory.createStackedAreaChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } if (s.equalsIgnoreCase("stackedbar")) { return ChartFactory.createStackedBarChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } if (s.equalsIgnoreCase("stackedbar3d")) { return ChartFactory.createStackedBarChart3D(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } if (s.equalsIgnoreCase("waterfall")) { return ChartFactory.createWaterfallChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } return ChartFactory.createLineChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); }
From source file:hudson.plugins.plot.Plot.java
/** * Creates a Chart of the style indicated by getEffStyle() using the given * dataset. Defaults to using createLineChart. *//* ww w . j av a 2s . com*/ private JFreeChart createChart(PlotCategoryDataset dataset) { String s = getUrlStyle(); if ("area".equalsIgnoreCase(s)) { return ChartFactory.createAreaChart(getURLTitle(), /* * categoryAxisLabel= */null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* * tooltips * = */ true, /* url= */false); } if ("bar".equalsIgnoreCase(s)) { return ChartFactory.createBarChart(getURLTitle(), /* * categoryAxisLabel= */null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* * tooltips * = */ true, /* url= */false); } if ("bar3d".equalsIgnoreCase(s)) { return ChartFactory.createBarChart3D(getURLTitle(), /* * categoryAxisLabel * = */null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* * tooltips * = */ true, /* url= */false); } if ("line3d".equalsIgnoreCase(s)) { return ChartFactory.createLineChart3D(getURLTitle(), /* * categoryAxisLabel * = */null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* * tooltips * = */ true, /* url= */false); } if ("lineSimple".equalsIgnoreCase(s)) { return ChartFactory.createLineChart(getURLTitle(), /*categoryAxisLabel=*/null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /*tooltips=*/true, /*url=*/false); } if ("stackedarea".equalsIgnoreCase(s)) { return ChartFactory.createStackedAreaChart(getURLTitle(), /* * categoryAxisLabel * = */null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* * tooltips * = */ true, /* url= */false); } if ("stackedbar".equalsIgnoreCase(s)) { return ChartFactory.createStackedBarChart(getURLTitle(), /* * categoryAxisLabel * = */null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* * tooltips * = */ true, /* url= */false); } if ("stackedbar3d".equalsIgnoreCase(s)) { return ChartFactory.createStackedBarChart3D(getURLTitle(), /* * categoryAxisLabel * = */null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* * tooltips * = */ true, /* url= */false); } if ("waterfall".equalsIgnoreCase(s)) { return ChartFactory.createWaterfallChart(getURLTitle(), /* * categoryAxisLabel * = */null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* * tooltips * = */ true, /* url= */false); } return ChartFactory.createLineChart(getURLTitle(), /* categoryAxisLabel= */ null, getYaxis(), dataset, PlotOrientation.VERTICAL, hasLegend(), /* tooltips= */true, /* url= */false); }
From source file:edu.ucla.stat.SOCR.chart.ChartGenerator_JTable.java
private JFreeChart createCategoryBarChart(String title, String xLabel, String yLabel, CategoryDataset dataset) { // System.out.println("layout = "+layout); JFreeChart chart;//from www . j av a2 s .com if (dimension.equalsIgnoreCase("3d")) { chart = ChartFactory.createBarChart3D(title, // chart title xLabel, // domain axis label yLabel, // range axis label dataset, // data orientation, // orientation true, // include legend true, // tooltips false // urls ); CategoryPlot plot = chart.getCategoryPlot(); plot.setDomainGridlinesVisible(true); CategoryAxis axis = plot.getDomainAxis(); axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0)); BarRenderer3D renderer = (BarRenderer3D) plot.getRenderer(); //renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator()); renderer.setDrawBarOutline(false); return chart; } if (layout.equalsIgnoreCase("stacked")) { chart = ChartFactory.createStackedBarChart(title, // chart title xLabel, // domain axis label yLabel, // range axis label dataset, // data orientation, // the plot orientation true, // legend true, // tooltips false // urls ); } else if (layout.equalsIgnoreCase("waterfall")) { chart = ChartFactory.createWaterfallChart(title, xLabel, yLabel, dataset, orientation, true, true, false); CategoryPlot plot = chart.getCategoryPlot(); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); DecimalFormat labelFormatter = new DecimalFormat("$##,###.00"); labelFormatter.setNegativePrefix("("); labelFormatter.setNegativeSuffix(")"); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", labelFormatter)); renderer.setBaseItemLabelsVisible(true); } else { chart = ChartFactory.createBarChart(title, // chart title xLabel, // domain axis label yLabel, // range axis label dataset, // data orientation, // orientation true, // include legend true, // tooltips? false // URLs? ); } // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... if (layout.equalsIgnoreCase("stacked")) { StackedBarRenderer renderer = (StackedBarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setBaseItemLabelsVisible(true); renderer.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator()); } else if (layout.equalsIgnoreCase("layered")) { LayeredBarRenderer renderer = new LayeredBarRenderer(); renderer.setDrawBarOutline(false); plot.setRenderer(renderer); plot.setRowRenderingOrder(SortOrder.DESCENDING); } else { BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); } /* CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions( CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0) );*/ // OPTIONAL CUSTOMISATION COMPLETED. return chart; }