List of usage examples for org.jfree.chart.plot XYPlot setRenderer
public void setRenderer(XYItemRenderer renderer)
From source file:jprobix.ui.SPlotFinal.java
public static JPanel creteDemoPanel() { JFreeChart jfreechart = ChartFactory.createScatterPlot("Scatter plot demo", "X", "Y", samplexydataset2(), PlotOrientation.VERTICAL, true, true, false); Shape cross = ShapeUtilities.createDiagonalCross(3, 2); XYPlot xyPlot = (XYPlot) jfreechart.getPlot(); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); XYItemRenderer renderer = xyPlot.getRenderer(); renderer.setSeriesShape(5, cross);//from w w w . j a v a 2 s. co m renderer.setSeriesPaint(0, Color.YELLOW); XYDotRenderer xydotrenderer = new XYDotRenderer(); xyPlot.setRenderer(xydotrenderer); xydotrenderer.setSeriesShape(0, cross); xyPlot.setDomainCrosshairVisible(true); xyPlot.setRangeCrosshairVisible(true); return new ChartPanel(jfreechart); }
From source file:org.jfree.chart.demo.XYStepRendererDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYLineChart("XYStepRenderer Demo 1", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYStepRenderer xysteprenderer = new XYStepRenderer(); xysteprenderer.setBaseShapesVisible(true); xysteprenderer.setSeriesStroke(0, new BasicStroke(2.0F)); xysteprenderer.setSeriesStroke(1, new BasicStroke(2.0F)); xysteprenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); xysteprenderer.setDefaultEntityRadius(6); xyplot.setRenderer(xysteprenderer); return jfreechart; }
From source file:org.jfree.chart.demo.DifferenceChartDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Difference Chart Demo 1", "Time", "Value", xydataset, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYDifferenceRenderer xydifferencerenderer = new XYDifferenceRenderer(Color.green, Color.red, false); xydifferencerenderer.setRoundXCoordinates(true); xyplot.setDomainCrosshairLockedOnData(true); xyplot.setRangeCrosshairLockedOnData(true); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); xyplot.setRenderer(xydifferencerenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); DateAxis dateaxis = new DateAxis("Time"); dateaxis.setLowerMargin(0.0D);/* w ww .ja v a 2 s . c o m*/ dateaxis.setUpperMargin(0.0D); xyplot.setDomainAxis(dateaxis); xyplot.setForegroundAlpha(0.5F); return jfreechart; }
From source file:net.commerce.zocalo.freechart.ChartGenerator.java
private static JFreeChart createCustomXYStepChart(TimePeriodValuesCollection prices) { DateAxis xAxis = new DateAxis(null); NumberAxis yAxis = new NumberAxis("price"); yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); XYPlot plot = new XYPlot(prices, xAxis, yAxis, null); plot.setRenderer(new XYStepRenderer(null, null)); plot.setOrientation(PlotOrientation.VERTICAL); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); return new JFreeChart(null, JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
From source file:org.jfree.chart.demo.DeviationRendererDemo3.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart chart = ChartFactory.createXYLineChart("DeviationRenderer - Demo 3", "X", "Y", xydataset, PlotOrientation.VERTICAL, false, true, false); XYPlot plot = (XYPlot) chart.getPlot(); //// w w w . j a v a 2 s . com DeviationRenderer renderer = new DeviationRenderer(false, false); renderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1)); renderer.setSeriesStroke(0, new BasicStroke(3F, 1, 1)); renderer.setSeriesStroke(1, new BasicStroke(3F, 1, 1)); renderer.setSeriesFillPaint(0, Color.red); renderer.setSeriesFillPaint(1, Color.orange); renderer.setSeriesFillPaint(2, Color.green); plot.setRenderer(renderer); // DateAxis domainAxis = new DateAxis("Date"); domainAxis.setLowerMargin(0.0D); domainAxis.setUpperMargin(0.0D); plot.setDomainAxis(domainAxis); NumberAxis valueAxis = (NumberAxis) plot.getRangeAxis(); valueAxis.setRange(-40D, 40D); valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartUtilities.applyCurrentTheme(chart); return chart; }
From source file:MainWindowLogic.java
static void drawXYChart(JPanel panelWhenInside, JTable pointsCollector) { panelWhenInside.removeAll();//from w w w . j av a 2 s .c om panelWhenInside.setLayout(new java.awt.BorderLayout()); //TODO XYSeries seriersAllPoints = new XYSeries("All points"); addPointsToSeries(seriersAllPoints, pointsCollector); // Add the seriersAllPoints to your data set XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(seriersAllPoints); // Generate the graph JFreeChart chart = ChartFactory.createXYLineChart(null, // Title null, // x-axis Label null, // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation false, // Show Legend false, // Use tooltips false // Configure chart to generate URLs? ); final XYPlot plot = chart.getXYPlot(); ChartPanel chartPanel = new ChartPanel(chart); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesPaint(0, Color.BLACK); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesStroke(0, new BasicStroke(4.0f)); plot.setRenderer(renderer); panelWhenInside.add(chartPanel, BorderLayout.CENTER); panelWhenInside.validate(); }
From source file:es.bsc.autonomic.powermodeller.graphics.TotalPowerAndPredictionDifference.java
private static JFreeChart createChart() { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(NAME, "Power (Watts)", "Power (Watts)", data, true, true, false);//from w w w . j a v a 2s. c o m jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYDifferenceRenderer xydifferencerenderer = new XYDifferenceRenderer(Color.green, Color.yellow, false); xydifferencerenderer.setRoundXCoordinates(true); xyplot.setDomainCrosshairLockedOnData(true); xyplot.setRangeCrosshairLockedOnData(true); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); xyplot.setRenderer(xydifferencerenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); DateAxis dateaxis = new DateAxis("Samples"); dateaxis.setTickLabelsVisible(false); dateaxis.setLowerMargin(0.0D); dateaxis.setUpperMargin(0.0D); xyplot.setDomainAxis(dateaxis); xyplot.setForegroundAlpha(0.5F); return jfreechart; }
From source file:org.jfree.chart.demo.XYLineAndShapeRendererDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYLineChart("XYLineAndShapeRenderer Demo 1", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYLineAndShapeRenderer xylineandshaperenderer = new XYLineAndShapeRenderer(); xylineandshaperenderer.setSeriesLinesVisible(0, true); xylineandshaperenderer.setSeriesShapesVisible(0, false); xylineandshaperenderer.setSeriesLinesVisible(1, false); xylineandshaperenderer.setSeriesShapesVisible(1, true); xylineandshaperenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); xylineandshaperenderer.setDefaultEntityRadius(6); xyplot.setRenderer(xylineandshaperenderer); return jfreechart; }
From source file:org.gephi.statistics.plugin.ChartUtils.java
public static void decorateChart(JFreeChart chart) { XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesShape(0, new java.awt.geom.Ellipse2D.Double(0, 0, 2, 2)); plot.setBackgroundPaint(java.awt.Color.WHITE); plot.setDomainGridlinePaint(java.awt.Color.GRAY); plot.setRangeGridlinePaint(java.awt.Color.GRAY); plot.setRenderer(renderer); }
From source file:org.hxzon.demo.jfreechart.OtherDatasetDemo.java
private static JFreeChart createCandlestickChart(OHLCDataset dataset) { ValueAxis timeAxis = new DateAxis(xAxisLabel); NumberAxis valueAxis = new NumberAxis(yAxisLabel); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null); plot.setRenderer(new CandlestickRenderer()); JFreeChart chart = new JFreeChart("Candlestick Chart Demo", JFreeChart.DEFAULT_TITLE_FONT, plot, legend); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); return chart; }