org.jfree.chart.renderer.xy.XYBlockRenderer Java Examples
The following examples show how to use
org.jfree.chart.renderer.xy.XYBlockRenderer.
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: BlockChartPlotter.java From rapidminer-studio with GNU Affero General Public License v3.0 | 6 votes |
@Override public AbstractXYItemRenderer getItemRenderer(boolean nominal, int size, double minColor, double maxColor) { XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setPaintScale(new BlockPaintScale(minColor, maxColor)); renderer.setBlockAnchor(RectangleAnchor.CENTER); // if Block dimension is increased (e.g 1.2x1.2), the grid effect gets bigger // so it could be that blocks are overlapping a little // but if Block dimension is decreased (e.g. 0.9x0.9), each rectangle seems to have // a less-transparent border (you have to zoom-in to notice), and that could be the cause of // the grid effect. // renderer.setBlockHeight(1.0); // renderer.setBlockWidth(1.0); return renderer; }
Example #2
Source File: ChartJFreeChartOutputHeatmap.java From gama with GNU General Public License v3.0 | 5 votes |
@Override protected void initRenderer(final IScope scope) { // TODO Auto-generated method stub final XYPlot plot = (XYPlot) this.chart.getPlot(); defaultrenderer = new XYBlockRenderer(); plot.setRenderer((XYBlockRenderer) defaultrenderer); }
Example #3
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Test that the equals() method distinguishes all fields. */ public void testEquals() { // default instances XYBlockRenderer r1 = new XYBlockRenderer(); XYBlockRenderer r2 = new XYBlockRenderer(); assertTrue(r1.equals(r2)); assertTrue(r2.equals(r1)); // blockHeight r1.setBlockHeight(2.0); assertFalse(r1.equals(r2)); r2.setBlockHeight(2.0); assertTrue(r1.equals(r2)); // blockWidth r1.setBlockWidth(2.0); assertFalse(r1.equals(r2)); r2.setBlockWidth(2.0); assertTrue(r1.equals(r2)); // paintScale r1.setPaintScale(new GrayPaintScale(0.0, 1.0)); assertFalse(r1.equals(r2)); r2.setPaintScale(new GrayPaintScale(0.0, 1.0)); assertTrue(r1.equals(r2)); }
Example #4
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { XYBlockRenderer r1 = new XYBlockRenderer(); XYBlockRenderer r2 = new XYBlockRenderer(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #5
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A simple test for bug 1766646. */ public void testBug1766646A() { XYBlockRenderer r = new XYBlockRenderer(); Range range = r.findDomainBounds(null); assertTrue(range == null); DefaultXYZDataset emptyDataset = new DefaultXYZDataset(); range = r.findDomainBounds(emptyDataset); assertTrue(range == null); }
Example #6
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A simple test for bug 1766646. */ public void testBug1766646B() { XYBlockRenderer r = new XYBlockRenderer(); Range range = r.findRangeBounds(null); assertTrue(range == null); DefaultXYZDataset emptyDataset = new DefaultXYZDataset(); range = r.findRangeBounds(emptyDataset); assertTrue(range == null); }
Example #7
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Test that the equals() method distinguishes all fields. */ public void testEquals() { // default instances XYBlockRenderer r1 = new XYBlockRenderer(); XYBlockRenderer r2 = new XYBlockRenderer(); assertTrue(r1.equals(r2)); assertTrue(r2.equals(r1)); // blockHeight r1.setBlockHeight(2.0); assertFalse(r1.equals(r2)); r2.setBlockHeight(2.0); assertTrue(r1.equals(r2)); // blockWidth r1.setBlockWidth(2.0); assertFalse(r1.equals(r2)); r2.setBlockWidth(2.0); assertTrue(r1.equals(r2)); // paintScale r1.setPaintScale(new GrayPaintScale(0.0, 1.0)); assertFalse(r1.equals(r2)); r2.setPaintScale(new GrayPaintScale(0.0, 1.0)); assertTrue(r1.equals(r2)); }
Example #8
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Two objects that are equal are required to return the same hashCode. */ public void testHashcode() { XYBlockRenderer r1 = new XYBlockRenderer(); XYBlockRenderer r2 = new XYBlockRenderer(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #9
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A simple test for bug 1766646. */ public void testBug1766646A() { XYBlockRenderer r = new XYBlockRenderer(); Range range = r.findDomainBounds(null); assertTrue(range == null); DefaultXYZDataset emptyDataset = new DefaultXYZDataset(); range = r.findDomainBounds(emptyDataset); assertTrue(range == null); }
Example #10
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * A simple test for bug 1766646. */ public void testBug1766646B() { XYBlockRenderer r = new XYBlockRenderer(); Range range = r.findRangeBounds(null); assertTrue(range == null); DefaultXYZDataset emptyDataset = new DefaultXYZDataset(); range = r.findRangeBounds(emptyDataset); assertTrue(range == null); }
Example #11
Source File: PlotUtil.java From dl4j-tutorials with MIT License | 4 votes |
private static JFreeChart createChart(XYZDataset dataset, double[] mins, double[] maxs, int nPoints, XYDataset xyData) { NumberAxis xAxis = new NumberAxis("X"); xAxis.setRange(mins[0],maxs[0]); NumberAxis yAxis = new NumberAxis("Y"); yAxis.setRange(mins[1], maxs[1]); XYBlockRenderer renderer = new XYBlockRenderer(); renderer.setBlockWidth((maxs[0]-mins[0])/(nPoints-1)); renderer.setBlockHeight((maxs[1] - mins[1]) / (nPoints - 1)); PaintScale scale = new GrayPaintScale(0, 1.0); renderer.setPaintScale(scale); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinesVisible(false); plot.setRangeGridlinesVisible(false); plot.setAxisOffset(new RectangleInsets(5, 5, 5, 5)); JFreeChart chart = new JFreeChart("", plot); chart.getXYPlot().getRenderer().setSeriesVisibleInLegend(0, false); NumberAxis scaleAxis = new NumberAxis("Probability (class 0)"); scaleAxis.setAxisLinePaint(Color.white); scaleAxis.setTickMarkPaint(Color.white); scaleAxis.setTickLabelFont(new Font("Dialog", Font.PLAIN, 7)); PaintScaleLegend legend = new PaintScaleLegend(new GrayPaintScale(), scaleAxis); legend.setStripOutlineVisible(false); legend.setSubdivisionCount(20); legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT); legend.setAxisOffset(5.0); legend.setMargin(new RectangleInsets(5, 5, 5, 5)); legend.setFrame(new BlockBorder(Color.red)); legend.setPadding(new RectangleInsets(10, 10, 10, 10)); legend.setStripWidth(10); legend.setPosition(RectangleEdge.LEFT); chart.addSubtitle(legend); ChartUtilities.applyCurrentTheme(chart); plot.setDataset(1, xyData); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); renderer2.setBaseLinesVisible(false); plot.setRenderer(1, renderer2); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); return chart; }
Example #12
Source File: ChartJFreeChartOutputHeatmap.java From gama with GNU General Public License v3.0 | 4 votes |
protected void resetRenderer(final IScope scope, final String serieid) { final XYBlockRenderer newr = (XYBlockRenderer) this.getOrCreateRenderer(scope, serieid); // newr.setSeriesStroke(0, new BasicStroke(0)); final ChartDataSeries myserie = this.getChartdataset().getDataSeries(scope, serieid); if (myserie.getMycolor() != null) { newr.setSeriesPaint(0, myserie.getMycolor()); } if (myserie.getSValues(scope).size() > 0) { final double maxval = Collections.max(myserie.getSValues(scope)); final double minval = Collections.min(myserie.getSValues(scope)); Color cdeb = new Color(0, 0, 0, 0); if (myserie.getMyMincolor() != null) { cdeb = myserie.getMyMincolor(); } Color cend = new Color(0.9f, 0.9f, 0.9f, 1.0f); if (myserie.getMycolor() != null) { cend = myserie.getMycolor(); } LookupPaintScale paintscale = createLUT(100, (float) minval, (float) maxval, cdeb, cend); if (myserie.getMyMedcolor() != null) { paintscale = createLUT(100, (float) minval, (float) maxval, cdeb, myserie.getMyMedcolor(), cend); } newr.setPaintScale(paintscale); final NumberAxis scaleAxis = new NumberAxis(myserie.getName()); scaleAxis.setAxisLinePaint(this.axesColor); scaleAxis.setTickMarkPaint(this.axesColor); scaleAxis.setTickLabelFont(this.getTickFont()); scaleAxis.setRange(minval, maxval); scaleAxis.setAxisLinePaint(axesColor); scaleAxis.setLabelFont(getLabelFont()); if (textColor != null) { scaleAxis.setLabelPaint(textColor); scaleAxis.setTickLabelPaint(textColor); } if (!this.getXTickValueVisible(scope)) { scaleAxis.setTickMarksVisible(false); scaleAxis.setTickLabelsVisible(false); } final PaintScaleLegend legend = new PaintScaleLegend(paintscale, scaleAxis); legend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT); legend.setAxisOffset(5.0); // legend.setMargin(new RectangleInsets(5, 5, 5, 5)); // legend.setFrame(new BlockBorder(Color.red)); // legend.setPadding(new RectangleInsets(10, 10, 10, 10)); // legend.setStripWidth(10); legend.setPosition(RectangleEdge.RIGHT); legend.setBackgroundPaint(this.backgroundColor); // ArrayList<PaintScaleLegend> caxe=new // ArrayList<PaintScaleLegend>(); // caxe.add(legend); // chart.setSubtitles(caxe); if (!this.series_label_position.equals("none")) { chart.addSubtitle(legend); } } }
Example #13
Source File: XYBlockRendererTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Verify that this class implements {@link PublicCloneable}. */ public void testPublicCloneable() { XYBlockRenderer r1 = new XYBlockRenderer(); assertTrue(r1 instanceof PublicCloneable); }