private CategoryPlot createBarChartPlot(DefaultCategoryDataset dataset, String yAxisLabel, NumberFormat yAxisNumberFormat) { CategoryAxis xAxis = new CategoryAxis("Data"); xAxis.setCategoryMargin(0.40); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setNumberFormatOverride(yAxisNumberFormat); BarRenderer renderer = createBarChartRenderer(yAxisNumberFormat); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); return plot; }
private CategoryPlot createBoxAndWhiskerChartPlot(DefaultBoxAndWhiskerCategoryDataset dataset, String yAxisLabel, NumberFormat yAxisNumberFormat) { CategoryAxis xAxis = new CategoryAxis("Data"); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setNumberFormatOverride(yAxisNumberFormat); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setItemMargin(0.10); renderer.setMeanVisible(false); // Improve readability by avoiding low contrast with light colors renderer.setUseOutlinePaintForWhiskers(true); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); return plot; }
CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setOrientation(PlotOrientation.HORIZONTAL);
/** * Sets the orientation for the plot (and all the subplots). * * @param orientation the orientation. */ public void setOrientation(PlotOrientation orientation) { super.setOrientation(orientation); Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setOrientation(orientation); } }
/** * Sets the orientation of the plot (and all subplots). * * @param orientation the orientation ({@code null} not permitted). */ @Override public void setOrientation(PlotOrientation orientation) { super.setOrientation(orientation); Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setOrientation(orientation); } }
/** * Sets the orientation for the plot (and all the subplots). * * @param orientation the orientation. */ @Override public void setOrientation(PlotOrientation orientation) { super.setOrientation(orientation); Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setOrientation(orientation); } }
/** * Sets the orientation of the plot (and all subplots). * * @param orientation the orientation (<code>null</code> not permitted). */ public void setOrientation(PlotOrientation orientation) { super.setOrientation(orientation); Iterator iterator = this.subplots.iterator(); while (iterator.hasNext()) { CategoryPlot plot = (CategoryPlot) iterator.next(); plot.setOrientation(orientation); } }
CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setOrientation(PlotOrientation.HORIZONTAL); MinMaxCategoryRenderer renderer = new MinMaxCategoryRenderer(); plot.setRenderer(renderer); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
plot.setOrientation(PlotOrientation.HORIZONTAL); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
"Box and Whisker Chart", "Planet", "Temperature", data, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setOrientation(PlotOrientation.HORIZONTAL); f.add(new ChartPanel(chart) {
/** * Adds a subplot to the combined chart and sends a {@link PlotChangeEvent} * to all registered listeners. * <br><br> * The domain axis for the subplot will be set to <code>null</code>. You * must ensure that the subplot has a non-null range axis. * * @param subplot the subplot (<code>null</code> not permitted). * @param weight the weight (must be >= 1). */ public void add(CategoryPlot subplot, int weight) { if (subplot == null) { throw new IllegalArgumentException("Null 'subplot' argument."); } if (weight < 1) { throw new IllegalArgumentException("Require weight >= 1."); } subplot.setParent(this); subplot.setWeight(weight); subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); subplot.setDomainAxis(null); subplot.setOrientation(getOrientation()); subplot.addChangeListener(this); this.subplots.add(subplot); CategoryAxis axis = getDomainAxis(); if (axis != null) { axis.configure(); } fireChangeEvent(); }
subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); subplot.setRangeAxis(null); subplot.setOrientation(getOrientation()); subplot.addChangeListener(this); this.subplots.add(subplot);
/** * Returns a CategoryPlot. */ private CategoryPlot getCategoryPlot( CategoryDataset dataSet, CategoryItemRenderer renderer, PlotOrientation orientation, CategoryLabelPositions labelPositions ) { CategoryPlot plot = new CategoryPlot( dataSet, new CategoryAxis(), new NumberAxis(), renderer ); plot.setDatasetRenderingOrder( DatasetRenderingOrder.FORWARD ); plot.setOrientation( orientation ); CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setCategoryLabelPositions( labelPositions ); return plot; }
/** * Adds a subplot to the combined chart and sends a {@link PlotChangeEvent} * to all registered listeners. * <br><br> * The domain axis for the subplot will be set to {@code null}. You * must ensure that the subplot has a non-null range axis. * * @param subplot the subplot ({@code null} not permitted). * @param weight the weight (must be >= 1). */ public void add(CategoryPlot subplot, int weight) { Args.nullNotPermitted(subplot, "subplot"); if (weight < 1) { throw new IllegalArgumentException("Require weight >= 1."); } subplot.setParent(this); subplot.setWeight(weight); subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); subplot.setDomainAxis(null); subplot.setOrientation(getOrientation()); subplot.addChangeListener(this); this.subplots.add(subplot); CategoryAxis axis = getDomainAxis(); if (axis != null) { axis.configure(); } fireChangeEvent(); }
/** * Adds a subplot and sends a {@link PlotChangeEvent} to all registered * listeners. * <br><br> * You must ensure that the subplot has a non-null domain axis. The range * axis for the subplot will be set to {@code null}. * * @param subplot the subplot ({@code null} not permitted). * @param weight the weight (must be >= 1). */ public void add(CategoryPlot subplot, int weight) { Args.nullNotPermitted(subplot, "subplot"); if (weight <= 0) { throw new IllegalArgumentException("Require weight >= 1."); } // store the plot and its weight subplot.setParent(this); subplot.setWeight(weight); subplot.setInsets(new RectangleInsets(0.0, 0.0, 0.0, 0.0)); subplot.setRangeAxis(null); subplot.setOrientation(getOrientation()); subplot.addChangeListener(this); this.subplots.add(subplot); // configure the range axis... ValueAxis axis = getRangeAxis(); if (axis != null) { axis.configure(); } fireChangeEvent(); }
private JFreeChart getStackedBarChart( BaseChart chart, CategoryDataset dataSet, boolean horizontal ) { JFreeChart stackedBarChart = ChartFactory.createStackedBarChart( chart.getName(), chart.getDomainAxisLabel(), chart.getRangeAxisLabel(), dataSet, PlotOrientation.VERTICAL, !chart.isHideLegend(), false, false ); setBasicConfig( stackedBarChart, chart ); CategoryPlot plot = (CategoryPlot) stackedBarChart.getPlot(); plot.setOrientation( horizontal ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL ); plot.setRenderer( getStackedBarRenderer() ); CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 ); return stackedBarChart; }
private JFreeChart getStackedAreaChart( BaseChart chart, CategoryDataset dataSet ) { JFreeChart stackedAreaChart = ChartFactory.createStackedAreaChart( chart.getName(), chart.getDomainAxisLabel(), chart.getRangeAxisLabel(), dataSet, PlotOrientation.VERTICAL, !chart.isHideLegend(), false, false ); setBasicConfig( stackedAreaChart, chart ); CategoryPlot plot = (CategoryPlot) stackedAreaChart.getPlot(); plot.setOrientation( PlotOrientation.VERTICAL ); plot.setRenderer( getStackedAreaRenderer() ); CategoryAxis xAxis = plot.getDomainAxis(); xAxis.setCategoryLabelPositions( CategoryLabelPositions.UP_45 ); xAxis.setLabelFont( LABEL_FONT ); return stackedAreaChart; }
plot.setOrientation(PlotOrientation.VERTICAL);
plot.setOrientation(orientation); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
plot.setOrientation(PlotOrientation.VERTICAL);