use of org.jfree.chart.labels.StandardXYItemLabelGenerator 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;
}
use of org.jfree.chart.labels.StandardXYItemLabelGenerator in project SIMVA-SoS by SESoS.
the class YIntervalRendererTest method testCloning.
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
YIntervalRenderer r1 = new YIntervalRenderer();
YIntervalRenderer r2 = (YIntervalRenderer) r1.clone();
assertTrue(r1 != r2);
assertTrue(r1.getClass() == r2.getClass());
assertTrue(r1.equals(r2));
// check independence
r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
assertFalse(r1.equals(r2));
r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
assertTrue(r1.equals(r2));
r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
assertFalse(r1.equals(r2));
r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
assertTrue(r1.equals(r2));
r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0), Layer.FOREGROUND);
assertFalse(r1.equals(r2));
r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0), Layer.FOREGROUND);
assertTrue(r1.equals(r2));
r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0), Layer.BACKGROUND);
assertFalse(r1.equals(r2));
r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0), Layer.BACKGROUND);
assertTrue(r1.equals(r2));
}
use of org.jfree.chart.labels.StandardXYItemLabelGenerator in project SIMVA-SoS by SESoS.
the class AbstractXYItemRendererTest method testEquals_ObjectList.
@Test
public void testEquals_ObjectList() {
XYBarRenderer r1 = new XYBarRenderer();
r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
XYBarRenderer r2 = new XYBarRenderer();
r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
assertEquals(r1, r2);
r2.setSeriesItemLabelGenerator(1, new StandardXYItemLabelGenerator("X"));
assertNotEquals(r1, r2);
}
use of org.jfree.chart.labels.StandardXYItemLabelGenerator in project SIMVA-SoS by SESoS.
the class YIntervalRendererTest method testEquals.
/**
* Check that the equals() method distinguishes all fields.
*/
@Test
public void testEquals() {
YIntervalRenderer r1 = new YIntervalRenderer();
YIntervalRenderer r2 = new YIntervalRenderer();
assertEquals(r1, r2);
// the following fields are inherited from the AbstractXYItemRenderer
r1.setItemLabelGenerator(new StandardXYItemLabelGenerator());
assertFalse(r1.equals(r2));
r2.setItemLabelGenerator(new StandardXYItemLabelGenerator());
assertTrue(r1.equals(r2));
r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
assertFalse(r1.equals(r2));
r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
assertTrue(r1.equals(r2));
r1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
assertFalse(r1.equals(r2));
r2.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
assertTrue(r1.equals(r2));
r1.setToolTipGenerator(new StandardXYToolTipGenerator());
assertFalse(r1.equals(r2));
r2.setToolTipGenerator(new StandardXYToolTipGenerator());
assertTrue(r1.equals(r2));
r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
assertFalse(r1.equals(r2));
r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
assertTrue(r1.equals(r2));
r1.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
assertFalse(r1.equals(r2));
r2.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
assertTrue(r1.equals(r2));
r1.setURLGenerator(new StandardXYURLGenerator());
assertFalse(r1.equals(r2));
r2.setURLGenerator(new StandardXYURLGenerator());
assertTrue(r1.equals(r2));
r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
assertFalse(r1.equals(r2));
r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
assertTrue(r1.equals(r2));
r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
assertFalse(r1.equals(r2));
r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
assertTrue(r1.equals(r2));
r1.setDefaultEntityRadius(99);
assertFalse(r1.equals(r2));
r2.setDefaultEntityRadius(99);
assertTrue(r1.equals(r2));
r1.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator("{0} {1}"));
assertFalse(r1.equals(r2));
r2.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator("{0} {1}"));
assertTrue(r1.equals(r2));
r1.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
assertFalse(r1.equals(r2));
r2.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
assertTrue(r1.equals(r2));
r1.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
assertFalse(r1.equals(r2));
r2.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
assertTrue(r1.equals(r2));
r1.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
assertFalse(r1.equals(r2));
r2.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
assertTrue(r1.equals(r2));
}
Aggregations