List of usage examples for org.jfree.chart.plot XYPlot setRangeGridlinePaint
public void setRangeGridlinePaint(Paint paint)
From source file:greenapi.ui.charts.LineChartPanelSupport.java
@Override public JFreeChart createChart() { this.timeSeries = new TimeSeriesCollection(); this.dataset = new TranslatingXYDataset(this.timeSeries); JFreeChart chart = ChartFactory.createTimeSeriesChart(this.getTitle(), null, this.getAxisLabel(), this.dataset, true, true, false); chart.setBackgroundPaint(getBackground()); XYPlot xyPlot = chart.getXYPlot(); xyPlot.setOrientation(PlotOrientation.VERTICAL); xyPlot.setBackgroundPaint(Color.WHITE); xyPlot.setDomainGridlinePaint(Color.BLACK.darker()); xyPlot.setRangeGridlinePaint(Color.BLACK.darker()); xyPlot.setAxisOffset(new RectangleInsets(5.0D, 5.0D, 5.0D, 5.0D)); xyPlot.setDomainCrosshairLockedOnData(true); xyPlot.setRangeCrosshairVisible(true); chart.setAntiAlias(true);/*w ww. ja v a 2s . c om*/ return chart; }
From source file:org.infoglue.deliver.util.charts.TimeSeriesDiagram.java
/** * Creates a chart.//from w w w.j a v a 2 s . co m * * @param dataset a dataset. * * @return A chart. */ private JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart(header, axisXHeader, axisYHeader, dataset, true, true, false); chart.setBackgroundPaint(Color.white); LegendTitle legend = chart.getLegend(); //legend.set .setDisplaySeriesShapes(true); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(UnitType.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYItemRenderer renderer = plot.getRenderer(); if (renderer instanceof StandardXYItemRenderer) { StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer; //rr.setPlotShapes(true); rr.setShapesFilled(true); } DateAxis axis = (DateAxis) plot.getDomainAxis(); if (this.timeGranulariry.equalsIgnoreCase("Week")) { DateTickUnit unit = new DateTickUnit(DateTickUnit.DAY, 7, new SimpleDateFormat(this.dateFormat)); axis.setTickUnit(unit); axis.setTickMarkPosition(DateTickMarkPosition.START); axis.setDateFormatOverride(new SimpleDateFormat(this.dateFormat)); } else { axis.setDateFormatOverride(new SimpleDateFormat(this.dateFormat)); } /* DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat(this.dateFormat)); */ return chart; }
From source file:Demo.ScatterGraph.java
private JFreeChart CreateChart(int x, int y) { dataSet = new DefaultXYDataset(); AddDataSet(x, y);// w w w. j ava2 s .co m JFreeChart jfreechart = ChartFactory.createScatterPlot("Scatter", paraType_list.get(x), paraType_list.get(y), dataSet, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) jfreechart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setDomainGridlinesVisible(true); plot.setNoDataMessage("no data"); XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) plot.getRenderer(); xylineandshaperenderer.setSeriesOutlinePaint(0, Color.WHITE); xylineandshaperenderer.setUseOutlinePaint(true); xylineandshaperenderer.setSeriesPaint(0, Color.BLUE); return jfreechart; }
From source file:ec.nbdemetra.benchmarking.calendarization.CalendarizationChartView.java
@Override protected void onColorSchemeChange() { XYPlot plot = chartPanel.getChart().getXYPlot(); plot.setBackgroundPaint(themeSupport.getPlotColor()); plot.setDomainGridlinePaint(themeSupport.getGridColor()); plot.setRangeGridlinePaint(themeSupport.getGridColor()); chartPanel.getChart().setBackgroundPaint(themeSupport.getBackColor()); XYLineAndShapeRenderer main = (XYLineAndShapeRenderer) plot.getRenderer(DAILY_INDEX); main.setBasePaint(themeSupport.getLineColor(DAILY_COLOR)); XYDifferenceRenderer difference = ((XYDifferenceRenderer) plot.getRenderer(DIFF_INDEX)); difference.setPositivePaint(themeSupport.getAreaColor(DIFF_COLOR)); difference.setNegativePaint(themeSupport.getAreaColor(DIFF_COLOR)); difference.setBasePaint(themeSupport.getLineColor(DIFF_COLOR)); XYLineAndShapeRenderer smooth = (XYLineAndShapeRenderer) plot.getRenderer(SMOOTH_INDEX); smooth.setBasePaint(themeSupport.getLineColor(SMOOTH_COLOR)); }
From source file:com.cs572.assignments.Project2.view.LineChartPanel.java
/** * Creates a chart.// w w w . j a v a2 s . c o m * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Expression Tree", // chart title "DataPoints", // x axis label "Output", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:org.rioproject.examples.hospital.ui.PatientStatsPanel.java
private JFreeChart createTimeSeriesChart(TimeSeriesCollection dataSet, Color color) { JFreeChart chart = ChartFactory.createTimeSeriesChart("", "", "", dataSet, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.getRenderer().setSeriesPaint(0, color); 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); ValueAxis yAxis = plot.getRangeAxis(); yAxis.setRange(0, 150);/* w ww.j av a 2s .co m*/ ValueAxis xAxis = plot.getDomainAxis(); xAxis.setAutoRange(true); xAxis.setFixedAutoRange(5 * MINUTE); return chart; }
From source file:edu.ucla.stat.SOCR.chart.demo.CrosshairDemo4.java
/** * Creates a chart.// w ww . j a v a 2 s .c o m * * @param dataset the data for the chart. * * @return a chart. */ protected JFreeChart createChart(XYDataset dataset) { JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, // chart title domainLabel, // x axis label rangeLabel, // y axis label dataset, // data PlotOrientation.VERTICAL, !legendPanelOn, // include legend true, // tooltips false // urls ); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); setXSummary(dataset); return chart; }
From source file:presentationGui.GraphFrame.java
/** * Creates a chart./* w w w . ja v a 2 s . c o m*/ * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Comportamento Asintotico del throughput", // chart title "numero job", // x axis label "throughput", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // final StandardLegend legend = (StandardLegend) chart.getLegend(); // legend.setDisplaySeriesShapes(true); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... /*final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());*/ // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:serverrobot.DynamicGraph.java
public JFreeChart createChart(XYDataset dataset, String pos, double minRange, double maxRange) { final JFreeChart chart = ChartFactory.createTimeSeriesChart(pos, "Time (ms)", "Displacement", dataset, true, true, false);/*from w w w . j a va 2 s. c o m*/ final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(new Color(232, 232, 232)); plot.setDomainGridlinePaint(Color.BLACK); plot.setRangeGridlinePaint(Color.BLACK); plot.getRenderer().setSeriesPaint(0, Color.BLUE); plot.getRenderer().setSeriesPaint(1, Color.RED); ValueAxis axis = plot.getDomainAxis(); //axis.setAutoRange(true); axis.setFixedAutoRange(20000.0); // 60 seconds axis = plot.getRangeAxis(); axis.setRange(minRange, maxRange); chart.setBackgroundPaint(Color.white); return chart; }
From source file:Utils.GeneradorDeGraficas.java
public JFreeChart graficarCostos(DeterministaGeneral general, String unidad) { XYDataset dataset;/*ww w. ja v a 2 s . co m*/ dataset = createDatasetCosto(general, unidad); JFreeChart chart = ChartFactory.createXYLineChart("Anlisis de Costo de Inventario por " + unidad, "Cantidad de pedido", "Costo", dataset, PlotOrientation.VERTICAL, true, true, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setSeriesPaint(4, black, true); renderer.setSeriesPaint(3, black, true); /* renderer.setShapesFilled(true); renderer.setShapesVisible(true);*/ XYPlot plot2 = chart.getXYPlot(); NumberAxis rangeAxis = (NumberAxis) plot2.getRangeAxis(); rangeAxis.setAutoRange(false); rangeAxis.setUpperBound(general.calcularCostoGrafica(general.calcularCantidadOptimaOrdenar()) * 2); return chart; }