org.jfree.chart.renderer.category.BarRenderer Java Examples
The following examples show how to use
org.jfree.chart.renderer.category.BarRenderer.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BeltNominalColumnStatisticsModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Creates the histogram chart. */ private JFreeChart createBarChart() { JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL, false, false, false); setDefaultChartFonts(chart); chart.setBackgroundPaint(null); chart.setBackgroundImageAlpha(0.0f); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setOutlineVisible(false); plot.setRangeZeroBaselineVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(COLOR_INVISIBLE); plot.setBackgroundImageAlpha(0.0f); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); return chart; }
Example #2
Source File: AbstractRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the paint lookup mechanism. */ public void testPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.blue, r.getBasePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesPaint(false); assertEquals(Color.blue, r.lookupSeriesPaint(0)); assertNull(r.getSeriesPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[0], r.lookupSeriesPaint(0)); assertNotNull(r.getSeriesPaint(0)); }
Example #3
Source File: NominalAttributeStatisticsModel.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
/** * Creates the histogram chart. * * @return */ private JFreeChart createBarChart() { JFreeChart chart = ChartFactory.createBarChart(null, null, null, createBarDataset(), PlotOrientation.VERTICAL, false, false, false); AbstractAttributeStatisticsModel.setDefaultChartFonts(chart); chart.setBackgroundPaint(null); chart.setBackgroundImageAlpha(0.0f); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setOutlineVisible(false); plot.setRangeZeroBaselineVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(COLOR_INVISIBLE); plot.setBackgroundImageAlpha(0.0f); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setSeriesPaint(0, AttributeGuiTools.getColorForValueType(Ontology.NOMINAL)); renderer.setBarPainter(new StandardBarPainter()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); return chart; }
Example #4
Source File: EyeCandySixtiesChartTheme.java From jasperreports with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected JFreeChart createStackedBarChart() throws JRException { JFreeChart jfreeChart = super.createStackedBarChart(); CategoryPlot categoryPlot = (CategoryPlot)jfreeChart.getPlot(); //categoryPlot.setOrientation(PlotOrientation.HORIZONTAL); BarRenderer barRenderer = (BarRenderer)categoryPlot.getRenderer(); barRenderer.setItemMargin(0); barRenderer.setGradientPaintTransformer( new StandardGradientPaintTransformer(GradientPaintTransformType.HORIZONTAL) ); CategoryDataset categoryDataset = categoryPlot.getDataset(); if (categoryDataset != null) { for (int i = 0; i < categoryDataset.getRowCount(); i++) { barRenderer.setSeriesPaint(i, ChartThemesConstants.EYE_CANDY_SIXTIES_GRADIENT_PAINTS.get(i)); } } return jfreeChart; }
Example #5
Source File: BarChartDemo1.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #6
Source File: BarChartFXDemo1.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #7
Source File: GraphData.java From iBioSim with Apache License 2.0 | 6 votes |
public GraphData(String printer_id, String outDir, boolean warn, String label,String yLabel, ArrayList<String> learnSpecs) { this.outDir = outDir; this.printer_id = printer_id; this.warn = warn; this.learnSpecs = learnSpecs; graphProbs = new ArrayList<String>(); probGraphed = new LinkedList<GraphProbs>(); chart = ChartFactory.createBarChart(label, "", yLabel, new DefaultCategoryDataset(), PlotOrientation.VERTICAL, true, true, false); applyChartTheme(); ((BarRenderer) chart.getCategoryPlot().getRenderer()).setBarPainter(new StandardBarPainter()); chart.setBackgroundPaint(new java.awt.Color(238, 238, 238)); chart.getPlot().setBackgroundPaint(java.awt.Color.WHITE); chart.getCategoryPlot().setRangeGridlinePaint(java.awt.Color.LIGHT_GRAY); legend = chart.getLegend(); timeSeriesPlot = false; averageOrder = null; }
Example #8
Source File: AbstractRendererTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. In addition, * test for a bug that was reported where the listener list is 'null' after * deserialization. */ @Test public void testSerialization() { BarRenderer r1 = new BarRenderer(); r1.setBaseLegendTextFont(new Font("Dialog", Font.PLAIN, 4)); r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.green)); r1.setBaseLegendShape(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); BarRenderer r2 = (BarRenderer) TestUtilities.serialised(r1); assertEquals(r1, r2); try { r2.notifyListeners(new RendererChangeEvent(r2)); } catch (NullPointerException e) { fail("No exception should be thrown."); // failed } }
Example #9
Source File: AbstractRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the fill paint lookup mechanism. */ public void testFillPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.white, r.getBaseFillPaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesFillPaint(false); assertEquals(Color.white, r.lookupSeriesFillPaint(0)); assertNull(r.getSeriesFillPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesFillPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_FILL_PAINT_SEQUENCE[0], r.lookupSeriesFillPaint(0)); assertNotNull(r.getSeriesFillPaint(0)); }
Example #10
Source File: CategoryPlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
@Test public void testAxisIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); assertEquals(xAxis, plot.getDomainAxis(0)); assertEquals(yAxis, plot.getRangeAxis(0)); CategoryAxis xAxis2 = new CategoryAxis("X2"); plot.setDomainAxis(99, xAxis2); assertEquals(xAxis2, plot.getDomainAxis(99)); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setRangeAxis(99, yAxis2); assertEquals(yAxis2, plot.getRangeAxis(99)); }
Example #11
Source File: CategoryPlotTest.java From ccu-historian with GNU General Public License v3.0 | 6 votes |
@Test public void testMapDatasetToRangeAxis() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setRangeAxis(22, yAxis2); // add a second dataset DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset); assertEquals(yAxis, plot.getRangeAxisForDataset(99)); // now map the dataset to the second xAxis plot.mapDatasetToRangeAxis(99, 22); assertEquals(yAxis2, plot.getRangeAxisForDataset(99)); }
Example #12
Source File: ChartFactory.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Sets the current chart theme. This will be applied to all new charts * created via methods in this class. * * @param theme the theme (<code>null</code> not permitted). * * @see #getChartTheme() * @see ChartUtilities#applyCurrentTheme(JFreeChart) * * @since 1.0.11 */ public static void setChartTheme(ChartTheme theme) { ParamChecks.nullNotPermitted(theme, "theme"); currentTheme = theme; // here we do a check to see if the user is installing the "Legacy" // theme, and reset the bar painters in that case... if (theme instanceof StandardChartTheme) { StandardChartTheme sct = (StandardChartTheme) theme; if (sct.getName().equals("Legacy")) { BarRenderer.setDefaultBarPainter(new StandardBarPainter()); XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter()); } else { BarRenderer.setDefaultBarPainter(new GradientBarPainter()); XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter()); } } }
Example #13
Source File: AbstractRendererTests.java From astor with GNU General Public License v2.0 | 6 votes |
/** * Some checks for the paint lookup mechanism. */ public void testPaintLookup() { BarRenderer r = new BarRenderer(); assertEquals(Color.blue, r.getBasePaint()); // first check that autoPopulate==false works as expected r.setAutoPopulateSeriesPaint(false); assertEquals(Color.blue, r.lookupSeriesPaint(0)); assertNull(r.getSeriesPaint(0)); // now check autoPopulate==true r.setAutoPopulateSeriesPaint(true); /*CategoryPlot plot =*/ new CategoryPlot(null, new CategoryAxis( "Category"), new NumberAxis("Value"), r); assertEquals(DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE[0], r.lookupSeriesPaint(0)); assertNotNull(r.getSeriesPaint(0)); }
Example #14
Source File: CategoryPlotTest.java From ECG-Viewer with GNU General Public License v2.0 | 6 votes |
@Test public void testMapDatasetToRangeAxis() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setRangeAxis(22, yAxis2); // add a second dataset DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset); assertEquals(yAxis, plot.getRangeAxisForDataset(99)); // now map the dataset to the second xAxis plot.mapDatasetToRangeAxis(99, 22); assertEquals(yAxis2, plot.getRangeAxisForDataset(99)); }
Example #15
Source File: CategoryPlotTest.java From openstock with GNU General Public License v3.0 | 6 votes |
@Test public void testAxisIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); assertEquals(xAxis, plot.getDomainAxis(0)); assertEquals(yAxis, plot.getRangeAxis(0)); CategoryAxis xAxis2 = new CategoryAxis("X2"); plot.setDomainAxis(99, xAxis2); assertEquals(xAxis2, plot.getDomainAxis(99)); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setRangeAxis(99, yAxis2); assertEquals(yAxis2, plot.getRangeAxis(99)); }
Example #16
Source File: CategoryPlotTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
@Test public void testAxisLocationIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); CategoryAxis xAxis2 = new CategoryAxis("X2"); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setDomainAxis(99, xAxis2); plot.setRangeAxis(99, yAxis2); plot.setDomainAxisLocation(99, AxisLocation.BOTTOM_OR_RIGHT); assertEquals(AxisLocation.BOTTOM_OR_RIGHT, plot.getDomainAxisLocation(99)); plot.setRangeAxisLocation(99, AxisLocation.BOTTOM_OR_LEFT); assertEquals(AxisLocation.BOTTOM_OR_LEFT, plot.getRangeAxisLocation(99)); }
Example #17
Source File: CategoryPlotTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Datasets are now stored in a Map, and it should be possible to assign * them an arbitrary key (index). */ @Test public void testDatasetIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); assertEquals(dataset, plot.getDataset(0)); DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); // we should be able to give a dataset an arbitrary index plot.setDataset(99, dataset2); assertEquals(2, plot.getDatasetCount()); assertEquals(dataset2, plot.getDataset(99)); assertEquals(0, plot.indexOf(dataset)); assertEquals(99, plot.indexOf(dataset2)); }
Example #18
Source File: ChartJFreeChartOutputHistogram.java From gama with GNU General Public License v3.0 | 6 votes |
public static void enableFlatLook(final boolean flat) { if (flat) { BarRenderer.setDefaultBarPainter(new StandardBarPainter()); BarRenderer.setDefaultShadowsVisible(false); XYBarRenderer.setDefaultBarPainter(new StandardXYBarPainter()); XYBarRenderer.setDefaultShadowsVisible(false); StackedBarRenderer.setDefaultBarPainter(new StandardBarPainter()); StackedBarRenderer.setDefaultShadowsVisible(false); } else { BarRenderer.setDefaultBarPainter(new GradientBarPainter()); BarRenderer.setDefaultShadowsVisible(true); XYBarRenderer.setDefaultBarPainter(new GradientXYBarPainter()); XYBarRenderer.setDefaultShadowsVisible(true); StackedBarRenderer.setDefaultBarPainter(new GradientBarPainter()); StackedBarRenderer.setDefaultShadowsVisible(true); } }
Example #19
Source File: AbstractRendererTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Serialize an instance, restore it, and check for equality. In addition, * test for a bug that was reported where the listener list is 'null' after * deserialization. */ @Test public void testSerialization() { BarRenderer r1 = new BarRenderer(); r1.setBaseLegendTextFont(new Font("Dialog", Font.PLAIN, 4)); r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.green)); r1.setBaseLegendShape(new Line2D.Double(1.0, 2.0, 3.0, 4.0)); BarRenderer r2 = (BarRenderer) TestUtilities.serialised(r1); assertEquals(r1, r2); try { r2.notifyListeners(new RendererChangeEvent(r2)); } catch (NullPointerException e) { fail("No exception should be thrown."); // failed } }
Example #20
Source File: CategoryPlotTest.java From openstock with GNU General Public License v3.0 | 6 votes |
@Test public void testDomainMarkerIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); // add a second dataset, plotted against a second x axis DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset); CategoryAxis xAxis2 = new CategoryAxis("X2"); plot.setDomainAxis(1, xAxis2); LineAndShapeRenderer renderer2 = new LineAndShapeRenderer(); plot.setRenderer(99, renderer2); plot.mapDatasetToDomainAxis(99, 1); CategoryMarker xMarker1 = new CategoryMarker(123); plot.addDomainMarker(99, xMarker1, Layer.FOREGROUND); assertTrue(plot.getDomainMarkers(99, Layer.FOREGROUND).contains( xMarker1)); }
Example #21
Source File: CategoryPlotTest.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
@Test public void testMapDatasetToDomainAxis() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); CategoryAxis xAxis2 = new CategoryAxis("X2"); plot.setDomainAxis(11, xAxis2); // add a second dataset DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(1, "R1", "C1"); plot.setDataset(99, dataset); assertEquals(xAxis, plot.getDomainAxisForDataset(99)); // now map the dataset to the second xAxis plot.mapDatasetToDomainAxis(99, 11); assertEquals(xAxis2, plot.getDomainAxisForDataset(99)); }
Example #22
Source File: CategoryPlotTest.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
@Test public void testAxisLocationIndices() { CategoryDataset dataset = new DefaultCategoryDataset(); CategoryAxis xAxis = new CategoryAxis("X"); NumberAxis yAxis = new NumberAxis("Y"); CategoryItemRenderer renderer = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); CategoryAxis xAxis2 = new CategoryAxis("X2"); NumberAxis yAxis2 = new NumberAxis("Y2"); plot.setDomainAxis(99, xAxis2); plot.setRangeAxis(99, yAxis2); plot.setDomainAxisLocation(99, AxisLocation.BOTTOM_OR_RIGHT); assertEquals(AxisLocation.BOTTOM_OR_RIGHT, plot.getDomainAxisLocation(99)); plot.setRangeAxisLocation(99, AxisLocation.BOTTOM_OR_LEFT); assertEquals(AxisLocation.BOTTOM_OR_LEFT, plot.getRangeAxisLocation(99)); }
Example #23
Source File: BarChartDemo1.java From buffer_bci with GNU General Public License v3.0 | 6 votes |
/** * Creates a sample chart. * * @param dataset the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { JFreeChart chart = ChartFactory.createBarChart( "Performance: JFreeSVG vs Batik", null /* x-axis label*/, "Milliseconds" /* y-axis label */, dataset); chart.addSubtitle(new TextTitle("Time to generate 1000 charts in SVG " + "format (lower bars = better performance)")); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); chart.getLegend().setFrame(BlockBorder.NONE); return chart; }
Example #24
Source File: BarChartCustomizer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void customize(JFreeChart chart, JRChart jasperChart) { BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer(); renderer.setSeriesPaint(0, Color.green); renderer.setSeriesPaint(1, Color.orange); }
Example #25
Source File: AbstractRendererTest.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
@Test public void testEquals_ObjectList3() { BarRenderer r1 = new BarRenderer(); r1.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); BarRenderer r2 = new BarRenderer(); r2.setSeriesPositiveItemLabelPosition(0, new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); assertEquals(r1, r2); r2.setSeriesPositiveItemLabelPosition(1, new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.CENTER)); assertNotEquals(r1, r2); }
Example #26
Source File: AbstractRendererTest.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
@Test public void testEquals_ObjectList() { BarRenderer r1 = new BarRenderer(); r1.setSeriesItemLabelFont(0, new Font(Font.DIALOG, Font.BOLD, 10)); BarRenderer r2 = new BarRenderer(); r2.setSeriesItemLabelFont(0, new Font(Font.DIALOG, Font.BOLD, 10)); assertEquals(r1, r2); r2.setSeriesItemLabelFont(1, new Font(Font.DIALOG, Font.PLAIN, 5)); assertNotEquals(r1, r2); }
Example #27
Source File: AbstractRendererTest.java From SIMVA-SoS with Apache License 2.0 | 5 votes |
@Test public void testEquals_ObjectList2() { BarRenderer r1 = new BarRenderer(); r1.setLegendTextFont(0, new Font(Font.DIALOG, Font.BOLD, 10)); BarRenderer r2 = new BarRenderer(); r2.setLegendTextFont(0, new Font(Font.DIALOG, Font.BOLD, 10)); assertEquals(r1, r2); r2.setLegendTextFont(1, new Font(Font.DIALOG, Font.PLAIN, 5)); assertNotEquals(r1, r2); }
Example #28
Source File: CombinedRangeCategoryPlotTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Creates a sample plot. * * @return A plot. */ private CombinedRangeCategoryPlot createPlot() { CategoryDataset dataset1 = createDataset1(); CategoryAxis catAxis1 = new CategoryAxis("Category"); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, catAxis1, null, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(); CategoryAxis catAxis2 = new CategoryAxis("Category"); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator( new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, catAxis2, null, renderer2); subplot2.setDomainGridlinesVisible(true); NumberAxis rangeAxis = new NumberAxis("Value"); CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot( rangeAxis); plot.add(subplot1, 2); plot.add(subplot2, 1); return plot; }
Example #29
Source File: CategoryPlotTest.java From ccu-historian with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization2() { DefaultCategoryDataset data = new DefaultCategoryDataset(); CategoryAxis domainAxis = new CategoryAxis("Domain"); NumberAxis rangeAxis = new NumberAxis("Range"); BarRenderer renderer = new BarRenderer(); CategoryPlot p1 = new CategoryPlot(data, domainAxis, rangeAxis, renderer); p1.setOrientation(PlotOrientation.VERTICAL); CategoryPlot p2 = (CategoryPlot) TestUtilities.serialised(p1); assertEquals(p1, p2); }
Example #30
Source File: CategoryPlotTest.java From buffer_bci with GNU General Public License v3.0 | 5 votes |
/** * Serialize an instance, restore it, and check for equality. */ @Test public void testSerialization2() { DefaultCategoryDataset data = new DefaultCategoryDataset(); CategoryAxis domainAxis = new CategoryAxis("Domain"); NumberAxis rangeAxis = new NumberAxis("Range"); BarRenderer renderer = new BarRenderer(); CategoryPlot p1 = new CategoryPlot(data, domainAxis, rangeAxis, renderer); p1.setOrientation(PlotOrientation.VERTICAL); CategoryPlot p2 = (CategoryPlot) TestUtilities.serialised(p1); assertEquals(p1, p2); }