org.jfree.chart.renderer.xy.XYSplineRenderer Java Examples
The following examples show how to use
org.jfree.chart.renderer.xy.XYSplineRenderer.
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: ChartWriter.java From kurento-java with Apache License 2.0 | 6 votes |
public void drawChart(String filename, int width, int height) throws IOException { // Create plot NumberAxis xAxis = new NumberAxis(xAxisLabel); NumberAxis yAxis = new NumberAxis(yAxisLabel); XYSplineRenderer renderer = new XYSplineRenderer(); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(4, 4, 4, 4)); // Create chart JFreeChart chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true); ChartUtilities.applyCurrentTheme(chart); ChartPanel chartPanel = new ChartPanel(chart, false); // Draw png BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); Graphics graphics = bi.getGraphics(); chartPanel.setBounds(0, 0, width, height); chartPanel.paint(graphics); ImageIO.write(bi, "png", new File(filename)); }
Example #2
Source File: SplineCustomizer.java From jasperreports with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void customize(JFreeChart jfc, JRChart jrc) { Plot plot = jfc.getPlot(); if (plot instanceof XYPlot) { ((XYPlot)plot).setRenderer( new XYSplineRenderer()); } }
Example #3
Source File: XYSplineRendererTests.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Test that the equals() method distinguishes all fields. */ public void testEquals() { XYSplineRenderer r1 = new XYSplineRenderer(); XYSplineRenderer r2 = new XYSplineRenderer(); assertEquals(r1, r2); assertEquals(r2, r1); r1.setPrecision(9); assertFalse(r1.equals(r2)); r2.setPrecision(9); assertTrue(r1.equals(r2)); }
Example #4
Source File: XYSplineRendererTests.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() { XYSplineRenderer r1 = new XYSplineRenderer(); XYSplineRenderer r2 = new XYSplineRenderer(); assertTrue(r1.equals(r2)); int h1 = r1.hashCode(); int h2 = r2.hashCode(); assertEquals(h1, h2); }
Example #5
Source File: XYSplineRendererTests.java From astor with GNU General Public License v2.0 | 4 votes |
/** * Verify that this class implements {@link PublicCloneable}. */ public void testPublicCloneable() { XYSplineRenderer r1 = new XYSplineRenderer(); assertTrue(r1 instanceof PublicCloneable); }