List of usage examples for org.jfree.chart.axis NumberAxis createIntegerTickUnits
public static TickUnitSource createIntegerTickUnits()
From source file:org.jfree.chart.demo.VectorPlotDemo1.java
private static JFreeChart createChart(VectorXYDataset dataset) { NumberAxis xAxis = new NumberAxis("X"); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); xAxis.setLowerMargin(0.01D);/*from w ww . j a va2s.c o m*/ xAxis.setUpperMargin(0.01D); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis("Y"); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); yAxis.setLowerMargin(0.01D); yAxis.setUpperMargin(0.01D); yAxis.setAutoRangeIncludesZero(false); // VectorRenderer renderer = new VectorRenderer(); renderer.setSeriesPaint(0, Color.blue); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); plot.setOutlinePaint(Color.black); JFreeChart chart = new JFreeChart("Vector Plot Demo 1", plot); chart.setBackgroundPaint(Color.white); return chart; }
From source file:org.jfree.chart.demo.VectorRendererDemo1.java
private static JFreeChart createChart(VectorXYDataset dataset) { NumberAxis xAxis = new NumberAxis("X"); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); xAxis.setLowerMargin(0.01D);//w w w.j a v a2 s . c o m xAxis.setUpperMargin(0.01D); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis("Y"); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); yAxis.setLowerMargin(0.01D); yAxis.setUpperMargin(0.01D); yAxis.setAutoRangeIncludesZero(false); // VectorRenderer renderer = new VectorRenderer(); renderer.setSeriesPaint(0, Color.blue); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); plot.setOutlinePaint(Color.black); JFreeChart chart = new JFreeChart("Vector Renderer Demo 1", plot); chart.setBackgroundPaint(Color.white); return chart; }
From source file:org.jfree.chart.demo.XYBlockChartDemo1.java
private static JFreeChart createChart(XYZDataset xyzdataset) { NumberAxis numberaxis = new NumberAxis("X"); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis.setLowerMargin(0.0D);/*from w w w.j a v a 2 s .co m*/ numberaxis.setUpperMargin(0.0D); numberaxis.setAxisLinePaint(Color.white); numberaxis.setTickMarkPaint(Color.white); NumberAxis numberaxis1 = new NumberAxis("Y"); numberaxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); numberaxis1.setLowerMargin(0.0D); numberaxis1.setUpperMargin(0.0D); numberaxis1.setAxisLinePaint(Color.white); numberaxis1.setTickMarkPaint(Color.white); XYBlockRenderer xyblockrenderer = new XYBlockRenderer(); GrayPaintScale graypaintscale = new GrayPaintScale(-2D, 1.0D); xyblockrenderer.setPaintScale(graypaintscale); XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyblockrenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinesVisible(false); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setOutlinePaint(Color.blue); JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo1", xyplot); jfreechart.removeLegend(); NumberAxis numberaxis2 = new NumberAxis("Scale"); numberaxis2.setAxisLinePaint(Color.white); numberaxis2.setTickMarkPaint(Color.white); numberaxis2.setTickLabelFont(new Font("Dialog", 0, 7)); PaintScaleLegend paintscalelegend = new PaintScaleLegend(new GrayPaintScale(), numberaxis2); paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_LEFT); paintscalelegend.setAxisOffset(5D); paintscalelegend.setMargin(new RectangleInsets(5D, 5D, 5D, 5D)); paintscalelegend.setFrame(new BlockBorder(Color.red)); paintscalelegend.setPadding(new RectangleInsets(10D, 10D, 10D, 10D)); paintscalelegend.setStripWidth(10D); paintscalelegend.setPosition(RectangleEdge.RIGHT); paintscalelegend.setBackgroundPaint(new Color(120, 120, 180)); jfreechart.addSubtitle(paintscalelegend); jfreechart.setBackgroundPaint(new Color(180, 180, 250)); return jfreechart; }
From source file:org.jfree.chart.demo.XYBlockChartDemo3.java
private static JFreeChart createChart(XYZDataset xyzdataset) { NumberAxis numberaxis = new NumberAxis("X"); numberaxis.setLowerMargin(0.0D);//from w w w .ja v a2 s . c o m numberaxis.setUpperMargin(0.0D); NumberAxis numberaxis1 = new NumberAxis("Y"); numberaxis1.setAutoRangeIncludesZero(false); numberaxis1.setInverted(true); numberaxis1.setLowerMargin(0.0D); numberaxis1.setUpperMargin(0.0D); numberaxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYBlockRenderer xyblockrenderer = new XYBlockRenderer(); LookupPaintScale lookuppaintscale = new LookupPaintScale(0.5D, 3.5D, Color.black); lookuppaintscale.add(0.5D, Color.green); lookuppaintscale.add(1.5D, Color.orange); lookuppaintscale.add(2.5D, Color.red); xyblockrenderer.setPaintScale(lookuppaintscale); XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyblockrenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setForegroundAlpha(0.66F); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo3", xyplot); jfreechart.removeLegend(); jfreechart.setBackgroundPaint(Color.white); SymbolAxis symbolaxis = new SymbolAxis(null, new String[] { "", "OK", "Uncertain", "Bad" }); symbolaxis.setRange(0.5D, 3.5D); symbolaxis.setPlot(new PiePlot()); symbolaxis.setGridBandsVisible(false); PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, symbolaxis); paintscalelegend.setAxisOffset(5D); paintscalelegend.setPosition(RectangleEdge.BOTTOM); paintscalelegend.setMargin(new RectangleInsets(5D, 5D, 5D, 5D)); jfreechart.addSubtitle(paintscalelegend); return jfreechart; }
From source file:org.jfree.chart.demo.StackedXYBarChartDemo1.java
private static JFreeChart createChart(TableXYDataset tablexydataset) { NumberAxis numberaxis = new NumberAxis("X"); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis numberaxis1 = new NumberAxis("Y"); StackedXYBarRenderer stackedxybarrenderer = new StackedXYBarRenderer(0.10000000000000001D); stackedxybarrenderer.setDrawBarOutline(false); XYPlot xyplot = new XYPlot(tablexydataset, numberaxis, numberaxis1, stackedxybarrenderer); JFreeChart jfreechart = new JFreeChart("Stacked XY Bar Chart Demo 1", xyplot); return jfreechart; }
From source file:org.jfree.chart.demo.XYBlockChartDemo2.java
private static JFreeChart createChart(XYZDataset xyzdataset) { DateAxis dateaxis = new DateAxis("Date"); dateaxis.setLowerMargin(0.0D);//from w ww. j av a 2s . c o m dateaxis.setUpperMargin(0.0D); dateaxis.setInverted(true); NumberAxis numberaxis = new NumberAxis("Hour"); numberaxis.setUpperMargin(0.0D); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYBlockRenderer xyblockrenderer = new XYBlockRenderer(); xyblockrenderer.setBlockWidth(86400000D); xyblockrenderer.setBlockAnchor(RectangleAnchor.BOTTOM_LEFT); LookupPaintScale lookuppaintscale = new LookupPaintScale(0.5D, 4.5D, Color.white); lookuppaintscale.add(0.5D, Color.red); lookuppaintscale.add(1.5D, Color.green); lookuppaintscale.add(2.5D, Color.blue); lookuppaintscale.add(3.5D, Color.yellow); xyblockrenderer.setPaintScale(lookuppaintscale); XYPlot xyplot = new XYPlot(xyzdataset, dateaxis, numberaxis, xyblockrenderer); xyplot.setOrientation(PlotOrientation.HORIZONTAL); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); JFreeChart jfreechart = new JFreeChart("XYBlockChartDemo2", xyplot); jfreechart.removeLegend(); jfreechart.setBackgroundPaint(Color.white); SymbolAxis symbolaxis = new SymbolAxis(null, new String[] { "", "Unavailable", "Free", "Group 1", "Group 2" }); symbolaxis.setRange(0.5D, 4.5D); symbolaxis.setPlot(new PiePlot()); symbolaxis.setGridBandsVisible(false); PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, symbolaxis); paintscalelegend.setMargin(new RectangleInsets(3D, 10D, 3D, 10D)); paintscalelegend.setPosition(RectangleEdge.BOTTOM); paintscalelegend.setAxisOffset(5D); jfreechart.addSubtitle(paintscalelegend); return jfreechart; }
From source file:org.jfree.chart.demo.LineChart3DDemo1.java
private static JFreeChart createChart(CategoryDataset categorydataset) { JFreeChart jfreechart = ChartFactory.createLineChart3D("Line Chart 3D Demo 1", null, "Class Count", categorydataset, PlotOrientation.VERTICAL, false, true, false); jfreechart.setBackgroundPaint(new Color(187, 187, 221)); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setAutoRangeIncludesZero(false); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return jfreechart; }
From source file:com.etest.view.tq.charts.SubjectTestLineChart.java
public static JFreeChart discriminationIndex(int tqCoverageId) { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (CellItem ci : CellItemDAO.getItemAnalysisResult(tqCoverageId)) { dataset.setValue((int) (ci.getDiscriminationIndex() * 100), "Discrimination Index", String.valueOf(ci.getItemNo())); }//ww w . j av a2s . c o m JFreeChart chart = ChartFactory.createLineChart("Item Analysis Report", "Item No.", "Discrimination Index (%)", dataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setRangeGridlinePaint(Color.white); // customise the range axis... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // customise the renderer... LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer(); renderer.setShapesVisible(true); renderer.setDrawOutlines(true); renderer.setUseFillPaint(true); renderer.setFillPaint(Color.white); return chart; }
From source file:org.jfree.chart.demo.PolarChartDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createPolarChart("Polar Chart Demo 1", xydataset, true, false, false); jfreechart.setBackgroundPaint(Color.white); PolarPlot polarplot = (PolarPlot) jfreechart.getPlot(); polarplot.setBackgroundPaint(Color.lightGray); polarplot.addCornerTextItem("Corner Item 1"); polarplot.addCornerTextItem("Corner Item 2"); polarplot.setAngleGridlinePaint(Color.white); polarplot.setRadiusGridlinePaint(Color.white); NumberAxis numberaxis = (NumberAxis) polarplot.getAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return jfreechart; }
From source file:org.jfree.chart.demo.XYShapeRendererDemo1.java
private static JFreeChart createChart(XYZDataset xyzdataset) { NumberAxis numberaxis = new NumberAxis("X"); numberaxis.setAutoRangeIncludesZero(false); NumberAxis numberaxis1 = new NumberAxis("Y"); numberaxis1.setAutoRangeIncludesZero(false); XYShapeRenderer xyshaperenderer = new XYShapeRenderer(); LookupPaintScale lookuppaintscale = new LookupPaintScale(1.0D, 4D, new Color(0, 0, 255)); lookuppaintscale.add(2D, new Color(100, 100, 255)); lookuppaintscale.add(3D, new Color(200, 200, 255)); xyshaperenderer.setPaintScale(lookuppaintscale); XYPlot xyplot = new XYPlot(xyzdataset, numberaxis, numberaxis1, xyshaperenderer); xyplot.setDomainPannable(true);//from w w w . j a v a 2 s. c o m xyplot.setRangePannable(true); JFreeChart jfreechart = new JFreeChart("XYShapeRendererDemo1", xyplot); jfreechart.removeLegend(); NumberAxis numberaxis2 = new NumberAxis("Score"); numberaxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); PaintScaleLegend paintscalelegend = new PaintScaleLegend(lookuppaintscale, numberaxis2); paintscalelegend.setPosition(RectangleEdge.RIGHT); paintscalelegend.setMargin(4D, 4D, 40D, 4D); paintscalelegend.setAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); jfreechart.addSubtitle(paintscalelegend); ChartUtilities.applyCurrentTheme(jfreechart); return jfreechart; }