/** * Sets the dataset for the plot, replacing the existing dataset, if there * is one. This method also calls the * {@link #datasetChanged(DatasetChangeEvent)} method, which adjusts the * axis ranges if necessary and sends a {@link PlotChangeEvent} to all * registered listeners. * * @param dataset the dataset ({@code null} permitted). * * @see #getDataset() */ public void setDataset(CategoryDataset dataset) { setDataset(0, dataset); }
yAxis.setAutoRangeIncludesZero(false); CategoryPlot plot = new CategoryPlot(boxData, xAxis, yAxis, boxRenderer); plot.setDataset(1, catData); plot.setRenderer(1, lineRenderer); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
/** * Sets the dataset for the plot, replacing the existing dataset, if there * is one. This method also calls the * {@link #datasetChanged(DatasetChangeEvent)} method, which adjusts the * axis ranges if necessary and sends a {@link PlotChangeEvent} to all * registered listeners. * * @param dataset the dataset (<code>null</code> permitted). * * @see #getDataset() */ public void setDataset(CategoryDataset dataset) { setDataset(0, dataset); }
plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, lineDataset); plot.mapDatasetToRangeAxis(1, 1);
/** * {@inheritDoc} */ @Override public void customize(JFreeChart chart, ReportParameters reportParameters) { if (chart.getPlot() instanceof CategoryPlot) { CategoryDataset dataset = new SeriesOrderCategoryDataset(chart.getCategoryPlot().getDataset(), seriesOrderBy, seriesOrderType); chart.getCategoryPlot().setDataset(dataset); } } }
CategoryPlot plot = this.chart_.getCategoryPlot(); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, dataset1); plot.mapDatasetToRangeAxis(1, 1);
//Mock data DefaultCategoryDataset dataset = new DefaultCategoryDataset(); int[] times = new int[]{1,2,3,4,5,6,7,8,9}; for ( int i = 0; i < times.length; i++ ){ dataset.addValue(times[i], "Time", "Hour" + String.valueOf(i+1)); } //create the plot CategoryPlot plot = new CategoryPlot(); //add the first dataset, and render as bar values CategoryItemRenderer renderer = new BarRenderer(); plot.setDataset(0,dataset); plot.setRenderer(0,renderer); //add the second dataset, render as lines CategoryItemRenderer renderer2 = new LineAndShapeRenderer(); plot.setDataset(1, dataset); plot.setRenderer(1, renderer2); //set axis plot.setDomainAxis(new CategoryAxis("Time")); plot.setRangeAxis(new NumberAxis("Value"));
CategoryPlot plot = this.chart_.getCategoryPlot(); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, dataset1); plot.mapDatasetToRangeAxis(1, 1);
plot.setDataset(0, dataset); plot.setRenderer(0, renderer); CategoryAxis domainAxis = new CategoryAxis("Time");
CategoryPlot plot = this.chart_.getCategoryPlot(); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, dataset1); plot.mapDatasetToRangeAxis(1, 1);
plot.setDataset(dataset);
plot.setDataset(1, workspaceDataset); LineAndShapeRenderer renderer = new LineAndShapeRenderer(); renderer.setBaseShapesVisible(false);
protected CategoryPlot drawChart4FOI(String featureID, String timeString, ObservedValueTuple tuple) { BarRenderer3D barRenderer = new BarRenderer3D(); CategoryPlot plot = new CategoryPlot(); plot.setDomainAxis(new CategoryAxis(featureID)); for (int i = 0; i < observedProperties.length; i++) { plot.setDataset(i, createDataset(i, timeString, tuple)); plot.setRangeAxis(i, new NumberAxis(tuple.getPhenomenonNames()[i].split(":")[tuple.getPhenomenonNames()[i].split(":").length - 1])); plot.setRenderer(i, barRenderer); plot.mapDatasetToRangeAxis(i, i); } return plot; }
private CategoryPlot generateJFreeChart(ChartParameters params) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); CategoryPlot plot = new CategoryPlot(); Font font = getFont(params.getValue(PARAM_FONT_SIZE)); configureDomainAxis(plot, font); configureRangeAxis(plot, params.getValue(PARAM_Y_SUFFIX, "", true), font); configureRenderer(plot); configureValues(dataset, params.getValues(PARAM_VALUES, "|", true), params.getValue(PARAM_X_SUFFIX, "", true)); configureColors(dataset, plot, params.getValues(PARAM_COLORS, ",")); plot.setDataset(dataset); return plot; }
private CategoryPlot generateJFreeChart(ChartParameters params) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); CategoryPlot plot = new CategoryPlot(); Font font = getFont(params.getValue(PARAM_FONT_SIZE)); configureDomainAxis(plot, font); configureRangeAxis(plot, params.getValue(PARAM_Y_SUFFIX, "", true), font); configureRenderer(plot); configureValues(dataset, params.getValues(PARAM_VALUES, "|", true), params.getValue(PARAM_X_SUFFIX, "", true)); configureColors(dataset, plot, params.getValues(PARAM_COLORS, ",")); plot.setDataset(dataset); return plot; }
/** * Sets the type of the chart. * * @param chartType The chart type. */ public void setChartType(int chartType) { this.chartType = chartType; // first cleanup for gc if(chart.getPlot() instanceof CategoryPlot) { GroupedCategoryDataset dataset = (GroupedCategoryDataset)chart.getCategoryPlot().getDataset(); dataset.cleanup(); // needed for circle references ((CategoryPlot)chart.getPlot()).setDataset(null); } if(chart.getPlot() instanceof MultiplePiePlot) { ((MultiplePiePlot)chart.getPlot()).setDataset(null); } chart = chartType == CHARTTYPE_PIECHART ? createPieChart() : createBarChart(); chartPanel.setChart(chart); }
/** * {@inheritDoc} */ @Override public void customize(JFreeChart chart, ReportParameters reportParameters) { if (chart.getPlot() instanceof CategoryPlot) { if (chart.getCategoryPlot().getDataset() != null) { CategoryDataset dataset; if (!(chart.getCategoryPlot().getRenderer() instanceof GroupedStackedBarRenderer)) { dataset = new PercentageCategoryDataset(chart.getCategoryPlot().getDataset()); } else { dataset = new PercentageGroupedCategoryDataset(chart.getCategoryPlot().getDataset()); } chart.getCategoryPlot().setDataset(dataset); } if (StringUtils.isBlank(chart.getCategoryPlot().getRangeAxis().getLabel())) { chart.getCategoryPlot().getRangeAxis().setLabel("%"); } } } }
plot.setRangeAxis(i, dimension.getRangeAxis()); plot.setRenderer(i, dimension.getRenderer()); plot.setDataset(i, dimension.getDatasetBuilder().build()); plot.mapDatasetToRangeAxis(i,i);
plot.setDataset(1, buildComplexityDataSet(summaries)); plot.mapDatasetToRangeAxis(1, 1);
combined.addCategoryDataset(dataset_sent, "sent"); combined.addCategoryDataset(dataset_received, "received"); plot.setDataset(combined);