List of usage examples for org.jfree.chart.plot PlotOrientation VERTICAL
PlotOrientation VERTICAL
To view the source code for org.jfree.chart.plot PlotOrientation VERTICAL.
Click Source Link
From source file:org.jfree.chart.demo.XYLine3DRendererDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYLineChart("XYLine3DRenderer Demo 1", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYLine3DRenderer xyline3drenderer = new XYLine3DRenderer(); xyline3drenderer.setWallPaint(Color.gray); xyline3drenderer.setXOffset(2D);/*from w w w . j av a2 s.com*/ xyline3drenderer.setYOffset(3D); xyline3drenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); xyline3drenderer.setDefaultEntityRadius(6); xyplot.setRenderer(xyline3drenderer); return jfreechart; }
From source file:org.jfree.chart.demo.ClusteredXYBarRendererDemo1.java
private static JFreeChart createChart(String s, IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart(s, null, true, "Y", intervalxydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); ClusteredXYBarRenderer clusteredxybarrenderer = new ClusteredXYBarRenderer(0.20000000000000001D, false); xyplot.setRenderer(clusteredxybarrenderer); return jfreechart; }
From source file:org.jfree.chart.demo.XYLineAndShapeRendererDemo2.java
private static JFreeChart createChart() { XYDataset xydataset = createDataset(1, 1.0D); JFreeChart jfreechart = ChartFactory.createXYLineChart("XYLineAndShapeRenderer Demo 2", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); TextTitle texttitle = new TextTitle( "This chart shows various combinations of the useFillPaint and useOutlinePaint flags."); texttitle.setFont(new Font("Dialog", 0, 10)); jfreechart.addSubtitle(texttitle);/* w w w. j a v a2s. c o m*/ XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setAutoRangeIncludesZero(false); java.awt.geom.Ellipse2D.Double double1 = new java.awt.geom.Ellipse2D.Double(-4D, -4D, 8D, 8D); XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setSeriesShape(0, double1); xylineandshaperenderer.setSeriesPaint(0, Color.red); xylineandshaperenderer.setSeriesFillPaint(0, Color.yellow); xylineandshaperenderer.setSeriesOutlinePaint(0, Color.gray); XYDataset xydataset1 = createDataset(2, 2D); XYLineAndShapeRenderer xylineandshaperenderer1 = new XYLineAndShapeRenderer(); xyplot.setDataset(1, xydataset1); xyplot.setRenderer(1, xylineandshaperenderer1); xylineandshaperenderer1.setSeriesShape(0, double1); xylineandshaperenderer1.setSeriesPaint(0, Color.red); xylineandshaperenderer1.setSeriesFillPaint(0, Color.yellow); xylineandshaperenderer1.setSeriesOutlinePaint(0, Color.gray); xylineandshaperenderer1.setUseFillPaint(true); XYDataset xydataset2 = createDataset(3, 3D); XYLineAndShapeRenderer xylineandshaperenderer2 = new XYLineAndShapeRenderer(); xyplot.setDataset(2, xydataset2); xyplot.setRenderer(2, xylineandshaperenderer2); xylineandshaperenderer2.setSeriesShape(0, double1); xylineandshaperenderer2.setSeriesPaint(0, Color.red); xylineandshaperenderer2.setSeriesFillPaint(0, Color.yellow); xylineandshaperenderer2.setSeriesOutlinePaint(0, Color.gray); xylineandshaperenderer2.setUseOutlinePaint(true); XYDataset xydataset3 = createDataset(4, 4D); XYLineAndShapeRenderer xylineandshaperenderer3 = new XYLineAndShapeRenderer(); xyplot.setDataset(3, xydataset3); xyplot.setRenderer(3, xylineandshaperenderer3); xylineandshaperenderer3.setSeriesShape(0, double1); xylineandshaperenderer3.setSeriesPaint(0, Color.red); xylineandshaperenderer3.setSeriesFillPaint(0, Color.yellow); xylineandshaperenderer3.setSeriesOutlinePaint(0, Color.gray); xylineandshaperenderer3.setUseOutlinePaint(true); xylineandshaperenderer3.setUseFillPaint(true); XYDataset xydataset4 = createDataset(5, 5D); XYLineAndShapeRenderer xylineandshaperenderer4 = new XYLineAndShapeRenderer(); xyplot.setDataset(4, xydataset4); xyplot.setRenderer(4, xylineandshaperenderer4); xylineandshaperenderer4.setSeriesShape(0, double1); xylineandshaperenderer4.setSeriesPaint(0, Color.red); xylineandshaperenderer4.setSeriesFillPaint(0, Color.yellow); xylineandshaperenderer4.setSeriesOutlinePaint(0, Color.gray); xylineandshaperenderer4.setUseOutlinePaint(true); xylineandshaperenderer4.setUseFillPaint(true); xylineandshaperenderer4.setDrawOutlines(false); return jfreechart; }
From source file:org.jfree.chart.demo.PeriodAxisDemo3.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart("Maximum Temperature", "Day", true, "Temperature", intervalxydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); PeriodAxis periodaxis = new PeriodAxis("Day"); periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class); PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[3]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d")); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("E"), new RectangleInsets(2D, 2D, 2D, 2D), new Font("SansSerif", 1, 10), Color.blue, false, new BasicStroke(0.0F), Color.lightGray); aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM")); periodaxis.setLabelInfo(aperiodaxislabelinfo); xyplot.setDomainAxis(periodaxis);// w ww . j av a 2 s . c om return jfreechart; }
From source file:org.jfree.chart.demo.RelativeDateFormatDemo2.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart("RelativeDateFormat Demo 2", "Date ", true, "Time To Complete", intervalxydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); XYBarRenderer xybarrenderer = (XYBarRenderer) xyplot.getRenderer(); xybarrenderer.setDrawBarOutline(false); DateAxis dateaxis = new DateAxis(); RelativeDateFormat relativedateformat = new RelativeDateFormat(); relativedateformat.setShowZeroDays(false); relativedateformat.setSecondFormatter(new DecimalFormat("00")); dateaxis.setDateFormatOverride(relativedateformat); xyplot.setRangeAxis(dateaxis);//from w w w.j a v a2 s .c om return jfreechart; }
From source file:org.jfree.chart.demo.BubbleChartDemo2.java
private static JFreeChart createChart(XYZDataset xyzdataset) { JFreeChart jfreechart = ChartFactory.createBubbleChart("Bubble Chart Demo 2", "X", "Y", xyzdataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setRenderer(new XYBubbleRenderer(0)); xyplot.setForegroundAlpha(0.65F);//from ww w .ja va 2s.co m XYItemRenderer xyitemrenderer = xyplot.getRenderer(); xyitemrenderer.setSeriesPaint(0, Color.blue); xyitemrenderer.setBaseItemLabelGenerator(new BubbleXYItemLabelGenerator()); xyitemrenderer.setBaseToolTipGenerator(new StandardXYZToolTipGenerator()); xyitemrenderer.setBaseItemLabelsVisible(true); xyitemrenderer .setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.CENTER, TextAnchor.CENTER)); NumberAxis numberaxis = (NumberAxis) xyplot.getDomainAxis(); numberaxis.setRange(0.0D, 10D); NumberAxis numberaxis1 = (NumberAxis) xyplot.getRangeAxis(); numberaxis1.setRange(0.0D, 10D); return jfreechart; }
From source file:com.imaging100x.tracker.TrackerUtils.java
/** * Create a frame with a plot of the data given in XYSeries */// www . j ava 2 s . c o m public static void plotData(String title, final XYSeries data, String xTitle, String yTitle, int xLocation, int yLocation) { // JFreeChart code XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(data); JFreeChart chart = ChartFactory.createScatterPlot(title, // Title xTitle, // x-axis Label yTitle, // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation false, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); final XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setSeriesPaint(0, Color.black); renderer.setSeriesFillPaint(0, Color.white); renderer.setSeriesLinesVisible(0, true); Shape circle = new Ellipse2D.Float(-2.0f, -2.0f, 4.0f, 4.0f); renderer.setSeriesShape(0, circle, false); renderer.setUseFillPaint(true); ChartFrame graphFrame = new ChartFrame(title, chart); graphFrame.getChartPanel().setMouseWheelEnabled(true); graphFrame.setPreferredSize(new Dimension(SIZE, SIZE)); graphFrame.setResizable(true); graphFrame.pack(); graphFrame.setLocation(xLocation, yLocation); graphFrame.setVisible(true); dataset.addChangeListener(new DatasetChangeListener() { public void datasetChanged(DatasetChangeEvent dce) { double xRange = data.getMaxX() - data.getMinX(); double yRange = data.getMaxY() - data.getMinY(); double xAvg = (data.getMaxX() + data.getMinX()) / 2; double yAvg = (data.getMaxY() + data.getMinY()) / 2; double range = xRange; if (yRange > range) { range = yRange; } double offset = 0.55 * range; plot.getDomainAxis().setRange(xAvg - offset, xAvg + offset); plot.getRangeAxis().setRange(yAvg - offset, yAvg + offset); } }); }
From source file:org.jfree.chart.demo.NormalDistributionDemo1.java
public static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYLineChart("Normal Distribution", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); return jfreechart; }
From source file:org.jfree.chart.demo.XYBarChartDemo1.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart("State Executions - USA", "Year", true, "Number of People", intervalxydataset, PlotOrientation.VERTICAL, true, false, false); jfreechart.addSubtitle(new TextTitle("Source: http://www.amnestyusa.org/abolish/listbyyear.do", new Font("Dialog", 2, 10))); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYItemRenderer xyitemrenderer = xyplot.getRenderer(); StandardXYToolTipGenerator standardxytooltipgenerator = new StandardXYToolTipGenerator("{1} = {2}", new SimpleDateFormat("yyyy"), new DecimalFormat("0")); xyitemrenderer.setBaseToolTipGenerator(standardxytooltipgenerator); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setRangeGridlinePaint(Color.white); DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); dateaxis.setTickMarkPosition(DateTickMarkPosition.MIDDLE); dateaxis.setLowerMargin(0.01D);//from w w w. ja v a 2 s . co m dateaxis.setUpperMargin(0.01D); return jfreechart; }
From source file:eu.cassandra.csn.gui.Charts.java
/** * // w w w . j a v a2 s .c om * @param title * @param x * @param y * @param data * @return */ public static ChartPanel createGraph(String title, String x, String y, Double[] data) { XYSeries series1 = new XYSeries("First"); for (int i = 0; i < data.length; i++) { series1.add(i, data[i]); } final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series1); PlotOrientation orientation = PlotOrientation.VERTICAL; boolean show = false; boolean toolTips = false; boolean urls = false; JFreeChart chart = ChartFactory.createXYLineChart(title, x, y, dataset, orientation, show, toolTips, urls); //XYPlot plot = (XYPlot) chart.getPlot(); ChartPanel cp = new ChartPanel(chart); return cp; }