/** * Creates a stacked XY area plot. The chart object returned by this * method uses an {@link XYPlot} instance as the plot, with a * {@link NumberAxis} for the domain axis, a {@link NumberAxis} as the * range axis, and a {@link StackedXYAreaRenderer2} as the renderer. * * @param title the chart title ({@code null} permitted). * @param xAxisLabel a label for the X-axis ({@code null} permitted). * @param yAxisLabel a label for the Y-axis ({@code null} permitted). * @param dataset the dataset for the chart ({@code null} permitted). * * @return A stacked XY area chart. * * @since 1.0.16 */ public static JFreeChart createStackedXYAreaChart(String title, String xAxisLabel, String yAxisLabel, TableXYDataset dataset) { return createStackedXYAreaChart(title, xAxisLabel, yAxisLabel, dataset, PlotOrientation.VERTICAL, true, true, false); }
chart = ChartFactory.createStackedXYAreaChart("", labelX, labelY, ds, PlotOrientation.VERTICAL, showLegend, false, false);
public static JFreeChart createStackedXYAreaChart(String title, String xAxisLabel, String yAxisLabel, TableXYDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) { JFreeChart chart = ChartFactory.createStackedXYAreaChart(title, xAxisLabel, yAxisLabel, dataset, orientation, legend, tooltips, urls); setXYAreaChartDefaults(chart); return chart; }
public static JFreeChart chartProfile(DefaultTableXYDataset dataset, ChartType type) { JFreeChart chart; 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; }
protected JFreeChart createChart(final TableXYDataset dataset) { JFreeChart chart = ChartFactory.createStackedXYAreaChart( null, "days", "ratio", dataset, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(Color.WHITE);
public JFreeChart createChart(Chart chart) { ChartModel model = (ChartModel) chart.getModel(); if (model instanceof CategoryModel) { return ChartFactory.createStackedAreaChart( chart.getTitle(), chart.getXAxis(), chart.getYAxis(), CategoryModelToCategoryDataset((CategoryModel)model), getOrientation(chart.getOrient()), chart.isShowLegend(), chart.isShowTooltiptext(), true); } else if (model instanceof XYModel) { return ChartFactory.createStackedXYAreaChart( chart.getTitle(), chart.getXAxis(), chart.getYAxis(), XYModelToTableXYDataset((XYModel) model), getOrientation(chart.getOrient()), chart.isShowLegend(), chart.isShowTooltiptext(), true); } else { throw new UiException("model must be a org.zkoss.zul.CategoryModel or a org.zkoss.zul.XYModel"); } } }