Search in sources :

Example 31 with RectangleInsets

use of org.jfree.chart.util.RectangleInsets in project graphcode2vec by graphcode2vec.

the class ChartFactory method createPieChart3D.

/**
 * Creates a 3D pie chart using the specified dataset.  The chart object
 * returned by this method uses a {@link PiePlot3D} instance as the
 * plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 *
 * @return A pie chart.
 */
public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend) {
    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    plot.setToolTipGenerator(new StandardPieToolTipGenerator());
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : PiePlot3D(org.jfree.chart.plot.PiePlot3D) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) RectangleInsets(org.jfree.chart.util.RectangleInsets)

Example 32 with RectangleInsets

use of org.jfree.chart.util.RectangleInsets in project graphcode2vec by graphcode2vec.

the class ChartFactory method createRingChart.

/**
 * Creates a ring chart with default settings.
 * <P>
 * The chart object returned by this method uses a {@link RingPlot}
 * instance as the plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param locale  the locale (<code>null</code> not permitted).
 *
 * @return A ring chart.
 *
 * @since 1.0.7
 */
public static JFreeChart createRingChart(String title, PieDataset dataset, boolean legend, Locale locale) {
    RingPlot plot = new RingPlot(dataset);
    plot.setLabelGenerator(new StandardPieSectionLabelGenerator(locale));
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : RingPlot(org.jfree.chart.plot.RingPlot) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) RectangleInsets(org.jfree.chart.util.RectangleInsets) StandardPieSectionLabelGenerator(org.jfree.chart.labels.StandardPieSectionLabelGenerator)

Example 33 with RectangleInsets

use of org.jfree.chart.util.RectangleInsets in project graphcode2vec by graphcode2vec.

the class ChartFactory method createPieChart3D.

/**
 * Creates a 3D pie chart using the specified dataset.  The chart object
 * returned by this method uses a {@link PiePlot3D} instance as the
 * plot.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param locale  the locale (<code>null</code> not permitted).
 *
 * @return A pie chart.
 *
 * @since 1.0.7
 */
public static JFreeChart createPieChart3D(String title, PieDataset dataset, boolean legend, Locale locale) {
    PiePlot3D plot = new PiePlot3D(dataset);
    plot.setInsets(new RectangleInsets(0.0, 5.0, 5.0, 5.0));
    plot.setToolTipGenerator(new StandardPieToolTipGenerator(locale));
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : PiePlot3D(org.jfree.chart.plot.PiePlot3D) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) RectangleInsets(org.jfree.chart.util.RectangleInsets)

Example 34 with RectangleInsets

use of org.jfree.chart.util.RectangleInsets in project graphcode2vec by graphcode2vec.

the class CombinedDomainCategoryPlot method add.

/**
 * 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();
}
Also used : CategoryAxis(org.jfree.chart.axis.CategoryAxis) RectangleInsets(org.jfree.chart.util.RectangleInsets)

Example 35 with RectangleInsets

use of org.jfree.chart.util.RectangleInsets in project graphcode2vec by graphcode2vec.

the class CombinedDomainXYPlot method add.

/**
 * Adds a subplot with the specified weight and sends a
 * {@link PlotChangeEvent} to all registered listeners.  The weight
 * determines how much space is allocated to the subplot relative to all
 * the other subplots.
 * <P>
 * 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(XYPlot subplot, int weight) {
    if (subplot == null) {
        throw new IllegalArgumentException("Null 'subplot' argument.");
    }
    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), false);
    subplot.setDomainAxis(null);
    subplot.addChangeListener(this);
    this.subplots.add(subplot);
    ValueAxis axis = getDomainAxis();
    if (axis != null) {
        axis.configure();
    }
    fireChangeEvent();
}
Also used : ValueAxis(org.jfree.chart.axis.ValueAxis) RectangleInsets(org.jfree.chart.util.RectangleInsets)

Aggregations

RectangleInsets (org.jfree.chart.util.RectangleInsets)44 Rectangle2D (java.awt.geom.Rectangle2D)21 Shape (java.awt.Shape)13 Font (java.awt.Font)11 FontMetrics (java.awt.FontMetrics)10 AlphaComposite (java.awt.AlphaComposite)8 Composite (java.awt.Composite)8 Paint (java.awt.Paint)8 AxisState (org.jfree.chart.axis.AxisState)8 AxisSpace (org.jfree.chart.axis.AxisSpace)7 ValueAxis (org.jfree.chart.axis.ValueAxis)7 FontRenderContext (java.awt.font.FontRenderContext)6 LineMetrics (java.awt.font.LineMetrics)6 Iterator (java.util.Iterator)6 StandardPieToolTipGenerator (org.jfree.chart.labels.StandardPieToolTipGenerator)6 RectangleEdge (org.jfree.chart.util.RectangleEdge)6 BasicStroke (java.awt.BasicStroke)4 Rectangle (java.awt.Rectangle)4 Stroke (java.awt.Stroke)4 Point2D (java.awt.geom.Point2D)4