/** * Applies the attributes of this theme to a {@link MultiplePiePlot}. * * @param plot the plot ({@code null} not permitted). */ protected void applyToMultiplePiePlot(MultiplePiePlot plot) { apply(plot.getPieChart()); }
/** * Sets the limit below which pie sections are aggregated. * Set this to 0.0 if you don't want any aggregation to occur. * * @param limit the limit percent. */ public void setLimit(double limit) { this.limit = limit; fireChangeEvent(); }
MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPaint(null); plot.setOutlineStroke(null); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setURLGenerator(urlGenerator);
"JFreeChartEngine.ERROR_0001_NULL_ORDER_ARGUMENT" ) ); //$NON-NLS-1$ MultiplePiePlot plot = new MultiplePiePlot( chartDefinition ); JFreeChartEngine.updatePlot( plot, chartDefinition ); plot.setDataExtractOrder( order ); JFreeChart pieChart = plot.getPieChart(); TextTitle seriesTitle = new TextTitle( "Series Title", new Font( "SansSerif", Font.BOLD, 12 ) ); //$NON-NLS-1$ //$NON-NLS-2$ seriesTitle.setPosition( RectangleEdge.BOTTOM ); pieChart.setTitle( seriesTitle ); pieChart.setBackgroundPaint( chartDefinition.getChartBackgroundPaint() ); plot.setPieChart( pieChart );
RectangleInsets insets = getInsets(); insets.trim(area); drawBackground(g2, area); drawOutline(g2, area); drawNoDataMessage(g2, area); return; prefetchSectionPaints();
PiePlot piePlot = (PiePlot) getPieChart().getPlot(); p = (Paint) this.sectionPaints.get(key); if (p == null) { p = getDrawingSupplier().getNextPaint(); p = (Paint) this.sectionPaints.get(key); if (p == null) { p = getDrawingSupplier().getNextPaint();
/** * Creates a new plot. * * @param dataset the dataset ({@code null} permitted). */ public MultiplePiePlot(CategoryDataset dataset) { super(); setDataset(dataset); PiePlot piePlot = new PiePlot(null); piePlot.setIgnoreNullValues(true); this.pieChart = new JFreeChart(piePlot); this.pieChart.removeLegend(); this.dataExtractOrder = TableOrder.BY_COLUMN; this.pieChart.setBackgroundPaint(null); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); this.pieChart.setTitle(seriesTitle); this.aggregatedItemsKey = "Other"; this.aggregatedItemsPaint = Color.lightGray; this.sectionPaints = new HashMap(); this.legendItemShape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0); }
/** * Sets the dataset used by the plot and sends a {@link PlotChangeEvent} * to all registered listeners. * * @param dataset the dataset ({@code null} permitted). */ public void setDataset(CategoryDataset dataset) { // if there is an existing dataset, remove the plot from the list of // change listeners... if (this.dataset != null) { this.dataset.removeChangeListener(this); } // set the new dataset, and register the chart as a change listener... this.dataset = dataset; if (dataset != null) { setDatasetGroup(dataset.getGroup()); dataset.addChangeListener(this); } // send a dataset change event to self to trigger plot change event datasetChanged(new DatasetChangeEvent(this, dataset)); }
throw new IllegalArgumentException("Null 'order' argument."); MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPaint(null); plot.setOutlineStroke(null); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setURLGenerator(urlGenerator);
RectangleInsets insets = getInsets(); insets.trim(area); drawBackground(g2, area); drawOutline(g2, area); drawNoDataMessage(g2, area); return; prefetchSectionPaints();
PiePlot piePlot = (PiePlot) getPieChart().getPlot(); p = (Paint) this.sectionPaints.get(key); if (p == null) { p = getDrawingSupplier().getNextPaint(); p = (Paint) this.sectionPaints.get(key); if (p == null) { p = getDrawingSupplier().getNextPaint();
/** * Creates a new plot. * * @param dataset the dataset (<code>null</code> permitted). */ public MultiplePiePlot(CategoryDataset dataset) { super(); setDataset(dataset); PiePlot piePlot = new PiePlot(null); piePlot.setIgnoreNullValues(true); this.pieChart = new JFreeChart(piePlot); this.pieChart.removeLegend(); this.dataExtractOrder = TableOrder.BY_COLUMN; this.pieChart.setBackgroundPaint(null); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); this.pieChart.setTitle(seriesTitle); this.aggregatedItemsKey = "Other"; this.aggregatedItemsPaint = Color.lightGray; this.sectionPaints = new HashMap(); this.legendItemShape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0); }
/** * Sets the dataset used by the plot and sends a {@link PlotChangeEvent} * to all registered listeners. * * @param dataset the dataset (<code>null</code> permitted). */ public void setDataset(CategoryDataset dataset) { // if there is an existing dataset, remove the plot from the list of // change listeners... if (this.dataset != null) { this.dataset.removeChangeListener(this); } // set the new dataset, and register the chart as a change listener... this.dataset = dataset; if (dataset != null) { setDatasetGroup(dataset.getGroup()); dataset.addChangeListener(this); } // send a dataset change event to self to trigger plot change event datasetChanged(new DatasetChangeEvent(this, dataset)); }
throw new IllegalArgumentException("Null 'order' argument."); MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPaint(null); plot.setOutlineStroke(null); pieChart.removeLegend(); pieChart.setBackgroundPaint(null); plot.setPieChart(pieChart); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setURLGenerator(urlGenerator);
/** * Applies the attributes of this theme to a {@link MultiplePiePlot}. * * @param plot the plot (<code>null</code> not permitted). */ protected void applyToMultiplePiePlot(MultiplePiePlot plot) { apply(plot.getPieChart()); }
/** * 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); }
/** * Sets the limit below which pie sections are aggregated. * Set this to 0.0 if you don't want any aggregation to occur. * * @param limit the limit percent. */ public void setLimit(double limit) { this.limit = limit; fireChangeEvent(); }
MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(order); plot.setBackgroundPaint(null); plot.setOutlineStroke(null); pieChart.removeLegend(); pieChart.setBackgroundPaint(null); plot.setPieChart(pieChart); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setURLGenerator(urlGenerator);
/** * @param showLabels <code>true</code> if labels are to be shown. */ public void setShowLabels(boolean showLabels) { this.showLabels = showLabels; Plot plot = chart.getPlot(); if(plot instanceof MultiplePiePlot) { PiePlot pieplot = (PiePlot)((MultiplePiePlot)plot).getPieChart().getPlot(); // ???? ChartLabelGenerator generator = new ChartLabelGenerator(ChartLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT); generator.setDefaultRenderer(Component.class, new AgentKeyRenderer()); pieplot.setLabelGenerator(showLabels ? generator : null); } if(plot instanceof CategoryPlot) { ((CategoryPlot)plot).getRenderer().setBaseItemLabelsVisible(showLabels); } }
MultiplePiePlot pies = (MultiplePiePlot) plot; CategoryDatasetChartDefinition categoryDatasetChartDefintion = (CategoryDatasetChartDefinition) chartDefinition; pies.setDataset( categoryDatasetChartDefintion );