Search in sources :

Example 1 with ItemLabelPosition

use of org.jfree.chart.labels.ItemLabelPosition in project tdq-studio-se by Talend.

the class TopChartFactory method createBlockingBarChart.

public static JFreeChart createBlockingBarChart(String title, HistogramDataset dataset) {
    ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme());
    JFreeChart chart = // $NON-NLS-1$
    ChartFactory.createHistogram(// $NON-NLS-1$
    null, // $NON-NLS-1$
    title, // $NON-NLS-1$
    "Key frequency", // $NON-NLS-1$
    dataset, // $NON-NLS-1$
    PlotOrientation.VERTICAL, // $NON-NLS-1$
    false, true, false);
    XYPlot plot = chart.getXYPlot();
    plot.getRangeAxis().setUpperMargin(0.08);
    // plot.getRangeAxis().setLowerBound(-0.08);
    decorateCategoryPlot(chart);
    plot.setRangeGridlinesVisible(true);
    XYBarRenderer renderer = new XYBarRenderer() {

        private static final long serialVersionUID = 4168794048090452033L;

        @Override
        public Paint getItemPaint(int row, int column) {
            return ChartDecorator.COLOR_LIST.get(0);
        }
    };
    renderer.setBaseItemLabelsVisible(true);
    renderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
    renderer.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BASELINE_LEFT));
    renderer.setShadowVisible(Boolean.FALSE);
    plot.setRenderer(renderer);
    return chart;
}
Also used : XYPlot(org.jfree.chart.plot.XYPlot) StandardXYItemLabelGenerator(org.jfree.chart.labels.StandardXYItemLabelGenerator) ItemLabelPosition(org.jfree.chart.labels.ItemLabelPosition) JFreeChart(org.jfree.chart.JFreeChart) XYBarRenderer(org.jfree.chart.renderer.xy.XYBarRenderer)

Example 2 with ItemLabelPosition

use of org.jfree.chart.labels.ItemLabelPosition in project SIMVA-SoS by SESoS.

the class ChartFactory method createWaterfallChart.

/**
 * Creates a waterfall chart.  The chart object returned by this method
 * uses a {@link CategoryPlot} instance as the plot, with a
 * {@link CategoryAxis} for the domain axis, a {@link NumberAxis} as the
 * range axis, and a {@link WaterfallBarRenderer} as the renderer.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param categoryAxisLabel  the label for the category axis
 *                           (<code>null</code> permitted).
 * @param valueAxisLabel  the label for the value axis (<code>null</code>
 *                        permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param orientation  the plot orientation (horizontal or vertical)
 *                     (<code>null</code> NOT permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A waterfall chart.
 */
public static JFreeChart createWaterfallChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {
    ParamChecks.nullNotPermitted(orientation, "orientation");
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    categoryAxis.setCategoryMargin(0.0);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    WaterfallBarRenderer renderer = new WaterfallBarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL) {
        ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, Math.PI / 2.0);
        renderer.setBasePositiveItemLabelPosition(position);
        renderer.setBaseNegativeItemLabelPosition(position);
    } else if (orientation == PlotOrientation.VERTICAL) {
        ItemLabelPosition position = new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER, TextAnchor.CENTER, 0.0);
        renderer.setBasePositiveItemLabelPosition(position);
        renderer.setBaseNegativeItemLabelPosition(position);
    }
    if (tooltips) {
        StandardCategoryToolTipGenerator generator = new StandardCategoryToolTipGenerator();
        renderer.setBaseToolTipGenerator(generator);
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.clearRangeMarkers();
    Marker baseline = new ValueMarker(0.0);
    baseline.setPaint(Color.black);
    plot.addRangeMarker(baseline, Layer.FOREGROUND);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) WaterfallBarRenderer(org.jfree.chart.renderer.category.WaterfallBarRenderer) CategoryAxis(org.jfree.chart.axis.CategoryAxis) StandardCategoryToolTipGenerator(org.jfree.chart.labels.StandardCategoryToolTipGenerator) ValueAxis(org.jfree.chart.axis.ValueAxis) ItemLabelPosition(org.jfree.chart.labels.ItemLabelPosition) StandardCategoryURLGenerator(org.jfree.chart.urls.StandardCategoryURLGenerator) ValueMarker(org.jfree.chart.plot.ValueMarker) Marker(org.jfree.chart.plot.Marker) ValueMarker(org.jfree.chart.plot.ValueMarker) CategoryPlot(org.jfree.chart.plot.CategoryPlot)

Example 3 with ItemLabelPosition

use of org.jfree.chart.labels.ItemLabelPosition in project SIMVA-SoS by SESoS.

the class ChartFactory method createBarChart.

/**
 * Creates a bar chart.  The chart object returned by this method uses a
 * {@link CategoryPlot} instance as the plot, with a {@link CategoryAxis}
 * for the domain axis, a {@link NumberAxis} as the range axis, and a
 * {@link BarRenderer} as the renderer.
 *
 * @param title  the chart title (<code>null</code> permitted).
 * @param categoryAxisLabel  the label for the category axis
 *                           (<code>null</code> permitted).
 * @param valueAxisLabel  the label for the value axis
 *                        (<code>null</code> permitted).
 * @param dataset  the dataset for the chart (<code>null</code> permitted).
 * @param orientation  the plot orientation (horizontal or vertical)
 *                     (<code>null</code> not permitted).
 * @param legend  a flag specifying whether or not a legend is required.
 * @param tooltips  configure chart to generate tool tips?
 * @param urls  configure chart to generate URLs?
 *
 * @return A bar chart.
 */
public static JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel, CategoryDataset dataset, PlotOrientation orientation, boolean legend, boolean tooltips, boolean urls) {
    ParamChecks.nullNotPermitted(orientation, "orientation");
    CategoryAxis categoryAxis = new CategoryAxis(categoryAxisLabel);
    ValueAxis valueAxis = new NumberAxis(valueAxisLabel);
    BarRenderer renderer = new BarRenderer();
    if (orientation == PlotOrientation.HORIZONTAL) {
        ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE3, TextAnchor.CENTER_LEFT);
        renderer.setBasePositiveItemLabelPosition(position1);
        ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE9, TextAnchor.CENTER_RIGHT);
        renderer.setBaseNegativeItemLabelPosition(position2);
    } else if (orientation == PlotOrientation.VERTICAL) {
        ItemLabelPosition position1 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER);
        renderer.setBasePositiveItemLabelPosition(position1);
        ItemLabelPosition position2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER);
        renderer.setBaseNegativeItemLabelPosition(position2);
    }
    if (tooltips) {
        renderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator());
    }
    if (urls) {
        renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator());
    }
    CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, renderer);
    plot.setOrientation(orientation);
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    currentTheme.apply(chart);
    return chart;
}
Also used : NumberAxis(org.jfree.chart.axis.NumberAxis) CategoryAxis(org.jfree.chart.axis.CategoryAxis) StandardCategoryToolTipGenerator(org.jfree.chart.labels.StandardCategoryToolTipGenerator) ValueAxis(org.jfree.chart.axis.ValueAxis) WaterfallBarRenderer(org.jfree.chart.renderer.category.WaterfallBarRenderer) BarRenderer(org.jfree.chart.renderer.category.BarRenderer) StackedBarRenderer(org.jfree.chart.renderer.category.StackedBarRenderer) XYBarRenderer(org.jfree.chart.renderer.xy.XYBarRenderer) ItemLabelPosition(org.jfree.chart.labels.ItemLabelPosition) StandardCategoryURLGenerator(org.jfree.chart.urls.StandardCategoryURLGenerator) CategoryPlot(org.jfree.chart.plot.CategoryPlot)

Example 4 with ItemLabelPosition

use of org.jfree.chart.labels.ItemLabelPosition in project SIMVA-SoS by SESoS.

the class YIntervalRenderer method drawAdditionalItemLabel.

/**
 * Draws an item label.
 *
 * @param g2  the graphics device.
 * @param orientation  the orientation.
 * @param dataset  the dataset.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param x  the x coordinate (in Java2D space).
 * @param y  the y coordinate (in Java2D space).
 */
private void drawAdditionalItemLabel(Graphics2D g2, PlotOrientation orientation, XYDataset dataset, int series, int item, double x, double y) {
    if (this.additionalItemLabelGenerator == null) {
        return;
    }
    Font labelFont = getItemLabelFont(series, item);
    Paint paint = getItemLabelPaint(series, item);
    g2.setFont(labelFont);
    g2.setPaint(paint);
    String label = this.additionalItemLabelGenerator.generateLabel(dataset, series, item);
    ItemLabelPosition position = getNegativeItemLabelPosition(series, item);
    Point2D anchorPoint = calculateLabelAnchorPoint(position.getItemLabelAnchor(), x, y, orientation);
    TextUtilities.drawRotatedString(label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(), position.getTextAnchor(), position.getAngle(), position.getRotationAnchor());
}
Also used : Point2D(java.awt.geom.Point2D) ItemLabelPosition(org.jfree.chart.labels.ItemLabelPosition) Paint(java.awt.Paint) Font(java.awt.Font)

Example 5 with ItemLabelPosition

use of org.jfree.chart.labels.ItemLabelPosition in project SIMVA-SoS by SESoS.

the class AbstractRendererTest method testEquals.

/**
 * Test that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    // have to use a concrete subclass...
    BarRenderer r1 = new BarRenderer();
    BarRenderer r2 = new BarRenderer();
    assertTrue(r1.equals(r2));
    assertTrue(r2.equals(r1));
    // seriesVisible
    r1.setSeriesVisible(Boolean.TRUE);
    assertFalse(r1.equals(r2));
    r2.setSeriesVisible(Boolean.TRUE);
    assertTrue(r1.equals(r2));
    // seriesVisibleList
    r1.setSeriesVisible(2, Boolean.TRUE);
    assertFalse(r1.equals(r2));
    r2.setSeriesVisible(2, Boolean.TRUE);
    assertTrue(r1.equals(r2));
    // baseSeriesVisible
    r1.setBaseSeriesVisible(false);
    assertFalse(r1.equals(r2));
    r2.setBaseSeriesVisible(false);
    assertTrue(r1.equals(r2));
    // seriesVisibleInLegend
    r1.setSeriesVisibleInLegend(Boolean.TRUE);
    assertFalse(r1.equals(r2));
    r2.setSeriesVisibleInLegend(Boolean.TRUE);
    assertTrue(r1.equals(r2));
    // seriesVisibleInLegendList
    r1.setSeriesVisibleInLegend(1, Boolean.TRUE);
    assertFalse(r1.equals(r2));
    r2.setSeriesVisibleInLegend(1, Boolean.TRUE);
    assertTrue(r1.equals(r2));
    // baseSeriesVisibleInLegend
    r1.setBaseSeriesVisibleInLegend(false);
    assertFalse(r1.equals(r2));
    r2.setBaseSeriesVisibleInLegend(false);
    assertTrue(r1.equals(r2));
    // paint
    r1.setPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // paintList
    r1.setSeriesPaint(0, new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    assertFalse(r1.equals(r2));
    r2.setSeriesPaint(0, new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    assertTrue(r1.equals(r2));
    // basePaint
    r1.setBasePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setBasePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // fillPaint
    r1.setFillPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setFillPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // fillPaintList
    r1.setSeriesFillPaint(0, new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setSeriesFillPaint(0, new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // baseFillPaint
    r1.setBaseFillPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setBaseFillPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // outlinePaint
    r1.setOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // outlinePaintList
    r1.setSeriesOutlinePaint(0, new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setSeriesOutlinePaint(0, new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // baseOutlinePaint
    r1.setBaseOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setBaseOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // stroke
    Stroke s = new BasicStroke(3.21f);
    r1.setStroke(s);
    assertFalse(r1.equals(r2));
    r2.setStroke(s);
    assertTrue(r1.equals(r2));
    // strokeList
    r1.setSeriesStroke(1, s);
    assertFalse(r1.equals(r2));
    r2.setSeriesStroke(1, s);
    assertTrue(r1.equals(r2));
    // baseStroke
    r1.setBaseStroke(s);
    assertFalse(r1.equals(r2));
    r2.setBaseStroke(s);
    assertTrue(r1.equals(r2));
    // outlineStroke
    r1.setOutlineStroke(s);
    assertFalse(r1.equals(r2));
    r2.setOutlineStroke(s);
    assertTrue(r1.equals(r2));
    // outlineStrokeList
    r1.setSeriesOutlineStroke(0, s);
    assertFalse(r1.equals(r2));
    r2.setSeriesOutlineStroke(0, s);
    assertTrue(r1.equals(r2));
    // baseOutlineStroke
    r1.setBaseOutlineStroke(s);
    assertFalse(r1.equals(r2));
    r2.setBaseOutlineStroke(s);
    assertTrue(r1.equals(r2));
    // shape
    r1.setShape(new Ellipse2D.Double(1, 2, 3, 4));
    assertFalse(r1.equals(r2));
    r2.setShape(new Ellipse2D.Double(1, 2, 3, 4));
    assertTrue(r1.equals(r2));
    // shapeList
    r1.setSeriesShape(1, new Ellipse2D.Double(1, 2, 3, 4));
    assertFalse(r1.equals(r2));
    r2.setSeriesShape(1, new Ellipse2D.Double(1, 2, 3, 4));
    assertTrue(r1.equals(r2));
    // baseShape
    r1.setBaseShape(new Ellipse2D.Double(1, 2, 3, 4));
    assertFalse(r1.equals(r2));
    r2.setBaseShape(new Ellipse2D.Double(1, 2, 3, 4));
    assertTrue(r1.equals(r2));
    // itemLabelsVisible
    r1.setItemLabelsVisible(true);
    assertFalse(r1.equals(r2));
    r2.setItemLabelsVisible(true);
    assertTrue(r1.equals(r2));
    // itemLabelsVisibleList
    r1.setSeriesItemLabelsVisible(1, Boolean.TRUE);
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelsVisible(1, Boolean.TRUE);
    assertTrue(r1.equals(r2));
    // baseItemLabelsVisible
    r1.setBaseItemLabelsVisible(true);
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelsVisible(true);
    assertTrue(r1.equals(r2));
    // itemLabelFont
    r1.setItemLabelFont(new Font("Serif", Font.PLAIN, 10));
    assertFalse(r1.equals(r2));
    r2.setItemLabelFont(new Font("Serif", Font.PLAIN, 10));
    assertTrue(r1.equals(r2));
    // itemLabelFontList
    r1.setSeriesItemLabelFont(1, new Font("Serif", Font.BOLD, 9));
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelFont(1, new Font("Serif", Font.BOLD, 9));
    assertTrue(r1.equals(r2));
    // baseItemLabelFont
    r1.setBaseItemLabelFont(new Font("Serif", Font.PLAIN, 10));
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelFont(new Font("Serif", Font.PLAIN, 10));
    assertTrue(r1.equals(r2));
    // itemLabelPaint
    r1.setItemLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.gray));
    assertFalse(r1.equals(r2));
    r2.setItemLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.gray));
    assertTrue(r1.equals(r2));
    // itemLabelPaintList
    r1.setSeriesItemLabelPaint(0, new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.gray));
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelPaint(0, new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.gray));
    assertTrue(r1.equals(r2));
    // baseItemLabelPaint
    r1.setBaseItemLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.gray));
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.gray));
    assertTrue(r1.equals(r2));
    // positiveItemLabelPosition;
    r1.setPositiveItemLabelPosition(new ItemLabelPosition());
    assertFalse(r1.equals(r2));
    r2.setPositiveItemLabelPosition(new ItemLabelPosition());
    assertTrue(r1.equals(r2));
    // positiveItemLabelPositionList;
    r1.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition());
    assertFalse(r1.equals(r2));
    r2.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition());
    assertTrue(r1.equals(r2));
    // basePositiveItemLabelPosition;
    r1.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_RIGHT));
    assertFalse(r1.equals(r2));
    r2.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_RIGHT));
    assertTrue(r1.equals(r2));
    // negativeItemLabelPosition;
    r1.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_RIGHT));
    assertFalse(r1.equals(r2));
    r2.setNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_RIGHT));
    assertTrue(r1.equals(r2));
    // negativeItemLabelPositionList;
    r1.setSeriesNegativeItemLabelPosition(1, new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_RIGHT));
    assertFalse(r1.equals(r2));
    r2.setSeriesNegativeItemLabelPosition(1, new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_RIGHT));
    assertTrue(r1.equals(r2));
    // baseNegativeItemLabelPosition;
    r1.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_RIGHT));
    assertFalse(r1.equals(r2));
    r2.setBaseNegativeItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.INSIDE10, TextAnchor.BASELINE_RIGHT));
    assertTrue(r1.equals(r2));
    // itemLabelAnchorOffset
    r1.setItemLabelAnchorOffset(3.0);
    assertFalse(r1.equals(r2));
    r2.setItemLabelAnchorOffset(3.0);
    assertTrue(r1.equals(r2));
    // createEntities;
    r1.setCreateEntities(Boolean.TRUE);
    assertFalse(r1.equals(r2));
    r2.setCreateEntities(Boolean.TRUE);
    assertTrue(r1.equals(r2));
    // createEntitiesList;
    r1.setSeriesCreateEntities(0, Boolean.TRUE);
    assertFalse(r1.equals(r2));
    r2.setSeriesCreateEntities(0, Boolean.TRUE);
    assertTrue(r1.equals(r2));
    // baseCreateEntities;
    r1.setBaseCreateEntities(false);
    assertFalse(r1.equals(r2));
    r2.setBaseCreateEntities(false);
    assertTrue(r1.equals(r2));
    // legendShape
    r1.setLegendShape(0, new Ellipse2D.Double(1.0, 2.0, 3.0, 4.0));
    assertFalse(r1.equals(r2));
    r2.setLegendShape(0, new Ellipse2D.Double(1.0, 2.0, 3.0, 4.0));
    assertTrue(r1.equals(r2));
    // baseLegendShape
    r1.setBaseLegendShape(new Ellipse2D.Double(5.0, 6.0, 7.0, 8.0));
    assertFalse(r1.equals(r2));
    r2.setBaseLegendShape(new Ellipse2D.Double(5.0, 6.0, 7.0, 8.0));
    assertTrue(r1.equals(r2));
    // legendTextFont
    r1.setLegendTextFont(0, new Font("Dialog", Font.PLAIN, 7));
    assertFalse(r1.equals(r2));
    r2.setLegendTextFont(0, new Font("Dialog", Font.PLAIN, 7));
    assertTrue(r1.equals(r2));
    // baseLegendTextFont
    r1.setBaseLegendTextFont(new Font("Dialog", Font.PLAIN, 7));
    assertFalse(r1.equals(r2));
    r2.setBaseLegendTextFont(new Font("Dialog", Font.PLAIN, 7));
    assertTrue(r1.equals(r2));
    // legendTextPaint
    r1.setLegendTextPaint(0, new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setLegendTextPaint(0, new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
    // baseOutlinePaint
    r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(r1.equals(r2));
    r2.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(r1.equals(r2));
}
Also used : BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) BarRenderer(org.jfree.chart.renderer.category.BarRenderer) GradientPaint(java.awt.GradientPaint) ItemLabelPosition(org.jfree.chart.labels.ItemLabelPosition) Ellipse2D(java.awt.geom.Ellipse2D) Font(java.awt.Font) Test(org.junit.Test)

Aggregations

ItemLabelPosition (org.jfree.chart.labels.ItemLabelPosition)26 CategoryPlot (org.jfree.chart.plot.CategoryPlot)10 BarRenderer (org.jfree.chart.renderer.category.BarRenderer)10 Test (org.junit.Test)10 Font (java.awt.Font)8 JFreeChart (org.jfree.chart.JFreeChart)8 NumberAxis (org.jfree.chart.axis.NumberAxis)8 Paint (java.awt.Paint)7 CategoryAxis (org.jfree.chart.axis.CategoryAxis)6 Point2D (java.awt.geom.Point2D)5 StandardCategoryToolTipGenerator (org.jfree.chart.labels.StandardCategoryToolTipGenerator)5 BasicStroke (java.awt.BasicStroke)4 GradientPaint (java.awt.GradientPaint)4 Rectangle2D (java.awt.geom.Rectangle2D)4 ValueAxis (org.jfree.chart.axis.ValueAxis)4 StandardCategoryItemLabelGenerator (org.jfree.chart.labels.StandardCategoryItemLabelGenerator)4 BarRenderer3D (org.jfree.chart.renderer.category.BarRenderer3D)4 StackedBarRenderer (org.jfree.chart.renderer.category.StackedBarRenderer)4 StandardCategoryURLGenerator (org.jfree.chart.urls.StandardCategoryURLGenerator)4 Color (java.awt.Color)3