List of usage examples for org.jfree.chart.plot XYPlot setRangeGridlinePaint
public void setRangeGridlinePaint(Paint paint)
From source file:grafix.graficos.eixos.Eixo.java
protected void configurarPlot(final XYPlot plot) { NumberAxis nAxis = definirEixoVertical(); plot.setRangeAxis(nAxis);/* w w w. j av a 2s. co m*/ plot.setBackgroundPaint(Color.white); plot.setRangeGridlinesVisible(this.isGradeHorizontal()); plot.setRangeGridlinePaint(this.getCorGradeHorizontal()); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); incluirLegenda(plot); incluirEixoX(plot); configurarEscalaVertical(plot); }
From source file:se.six.jmeter.visualizer.statagg.StatAggVisualizer.java
private JFreeChart createChart() { setupDatasets();// w ww. ja v a2 s. c o m final JFreeChart chart = ChartFactory.createTimeSeriesChart(null, "Time", "ThroughPut", _dataSet1, true, true, false); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); //axis.setFixedAutoRange(12 * 3600 * 1000); // 12 Hours XYItemRenderer renderer1 = plot.getRenderer(); renderer1.setSeriesPaint(0, Color.BLACK); final NumberAxis axis2 = new NumberAxis("Response Time"); axis2.setAutoRangeIncludesZero(false); plot.setRangeAxis(1, axis2); plot.setDataset(1, _dataSet2); plot.mapDatasetToRangeAxis(1, 1); StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setSeriesPaint(0, new Color(0, 153, 255)); plot.setRenderer(1, renderer2); chart.setBackgroundPaint(Color.white); return chart; }
From source file:de.fischer.thotti.reportgen.diagram.ChartGenerator.java
private JFreeChart createChart(final String chartTitle, final XYDataset xyDataset) { JFreeChart chart = ChartFactory.createTimeSeriesChart(chartTitle, // title "Date", // x-axis label "Seconds", // y-axis label xyDataset, // data true, // create legend? false, // generate tooltips? false // generate URLs? );//from w ww .j a va2 s. c o m // 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.gray); plot.setRangeGridlinePaint(Color.lightGray); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); //renderer.setSeriesLinesVisible(1, false); //renderer.setSeriesLinesVisible(0, 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. DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("dd-MM-yyyy")); return chart; }
From source file:net.vanosten.dings.swing.SummaryView.java
public void displayTimeSeriesChart(final TimeSeriesCollection averageScore, final int maxScoreRange, final TimeSeriesCollection numberOfEntries, final int maxTotalRange) { final JFreeChart chart = ChartFactory.createTimeSeriesChart("Time Series", "Date", "Average Score", averageScore, true, true, false); chart.setBackgroundPaint(Color.white); final XYPlot plot = chart.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final XYItemRenderer renderer1 = plot.getRenderer(); renderer1.setPaint(Color.blue); //axis 1// w ww .ja va2 s .com final NumberAxis axis1 = new NumberAxis("Average Score"); axis1.setLabelPaint(Color.blue); axis1.setTickLabelPaint(Color.blue); axis1.setRange(0.0d, maxScoreRange + 1); plot.setRangeAxis(0, axis1); //axis 2 final NumberAxis axis2 = new NumberAxis("Number of Entries"); axis2.setLabelPaint(Color.red); axis2.setTickLabelPaint(Color.red); axis2.setRange(0.0d, 10 * (((int) (maxTotalRange / 10)) + 1)); plot.setRangeAxis(1, axis2); plot.setDataset(1, numberOfEntries); plot.mapDatasetToRangeAxis(1, 1); final StandardXYItemRenderer renderer2 = new StandardXYItemRenderer(); renderer2.setPaint(Color.red); plot.setRenderer(1, renderer2); placeChart(chart); }
From source file:networkmonitor.MainIBMApplicationForm.java
/** * Creates a chart.// w w w. j av 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( // put a big space or it'll overlap with the statistics of data... :) "B/W Usage in KBps: ", // chart title "Seconds ", // x axis label " Usage", // y axis label dataset, // data PlotOrientation.VERTICAL, // Plot Orientation.. it means grap will show you statistics vertically true, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // Background color of chart/outside plot........ chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); //plot background color inside the graph.... plot.setBackgroundPaint(Color.orange); //org.jfree.chart.plot.XYPlot; //Plot vertical inner graph line..... plot.setDomainGridlinePaint(Color.red); //plot horizontal inner graph line..... plot.setRangeGridlinePaint(Color.blue); //Sets the renderer for the PGraphics object that is used for drawing to... final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); // it used to show the up and down connecting line will show or not(RED LINE of graph) renderer.setSeriesLinesVisible(1, true); //renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer);//it used to show the up and down block of data(RED Block Of GRAPH) //......................................... //..... change the auto tick unit selection to integer units only //LIMIT OF X and Y axis GRAPH SIDE DATA (usages/second) //.....if I unhide these then only integer number show in X axis,it avoid floating point /*final NumberAxis domainAxis = new NumberAxis("X-Axis"); domainAxis.setRange(0.00,1.00); domainAxis.setTickUnit(new NumberTickUnit(0.1)); final NumberAxis rangeAxis = new NumberAxis("Y-Axis"); rangeAxis.setRange(0.0,1.0); rangeAxis.setTickUnit(new NumberTickUnit(0.0));*/ //usases(X axis) integer data counting //final NumberAxis rangeAxis = (NumberAxis) //plot.getRangeAxis(); // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. //.............................................. return chart; }
From source file:com.rapidminer.gui.viewer.ROCChartPlotter.java
private JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(null, // chart title null, // x axis label null, // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );//from w ww.jav a2s.c o m chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0)); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); ValueAxis valueAxis = plot.getRangeAxis(); valueAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD); valueAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT); ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setLabelFont(PlotterAdapter.LABEL_FONT_BOLD); domainAxis.setTickLabelFont(PlotterAdapter.LABEL_FONT); DeviationRenderer renderer = new DeviationRenderer(true, false); Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); if (dataset.getSeriesCount() == 1) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); } else if (dataset.getSeriesCount() == 2) { renderer.setSeriesStroke(0, stroke); renderer.setSeriesPaint(0, Color.RED); renderer.setSeriesFillPaint(0, Color.RED); renderer.setSeriesStroke(1, stroke); renderer.setSeriesPaint(1, Color.BLUE); renderer.setSeriesFillPaint(1, Color.BLUE); } else { for (int i = 0; i < dataset.getSeriesCount(); i++) { renderer.setSeriesStroke(i, stroke); Color color = colorProvider.getPointColor((double) i / (double) (dataset.getSeriesCount() - 1)); renderer.setSeriesPaint(i, color); renderer.setSeriesFillPaint(i, color); } } renderer.setAlpha(0.12f); plot.setRenderer(renderer); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(PlotterAdapter.LABEL_FONT); } return chart; }
From source file:ec.nbdemetra.chainlinking.outlineview.ChainLinkingChart.java
@Override protected void onColorSchemeChange() { XYPlot plot = chartPanel.getChart().getXYPlot(); if (plot.getDataset() != null) { for (int i = 0; i < plot.getDataset().getSeriesCount(); i++) { plot.getRenderer().setSeriesPaint(i, themeSupport.getLineColor(i)); }// w w w. ja va 2 s .co m } plot.setBackgroundPaint(themeSupport.getPlotColor()); plot.setDomainGridlinePaint(themeSupport.getGridColor()); plot.setRangeGridlinePaint(themeSupport.getGridColor()); chartPanel.getChart().setBackgroundPaint(themeSupport.getBackColor()); }
From source file:visualizer.datamining.dataanalysis.NeighborhoodHit.java
private JFreeChart createChart(XYDataset xydataset) { JFreeChart chart = ChartFactory.createXYLineChart("Neighborhood Hit", "Number Neighbors", "Precision", xydataset, PlotOrientation.VERTICAL, true, true, false); chart.setBackgroundPaint(Color.WHITE); XYPlot xyplot = (XYPlot) chart.getPlot(); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setAutoRangeIncludesZero(false); xyplot.setDomainGridlinePaint(Color.BLACK); xyplot.setRangeGridlinePaint(Color.BLACK); xyplot.setOutlinePaint(Color.BLACK); xyplot.setOutlineStroke(new BasicStroke(1.0f)); xyplot.setBackgroundPaint(Color.white); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); xyplot.setDrawingSupplier(new DefaultDrawingSupplier( new Paint[] { Color.RED, Color.BLUE, Color.GREEN, Color.MAGENTA, Color.CYAN, Color.ORANGE, Color.BLACK, Color.DARK_GRAY, Color.GRAY, Color.LIGHT_GRAY, Color.YELLOW }, DefaultDrawingSupplier.DEFAULT_OUTLINE_PAINT_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_OUTLINE_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE)); XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); xylineandshaperenderer.setDrawOutlines(true); return chart; }
From source file:org.agmip.ui.afsirs.frames.GraphOutput.java
public void addRain() { XYSeries rainSeries = new XYSeries("RAIN"); double[][] RAIN = utils.getRain(); for (int i = 0; i < 10/*RAIN.length*/; i++) { for (int j = 0; j < 10/*RAIN[0].length*/; j++) { rainSeries.add(i * RAIN[0].length + j, RAIN[i][j]); }/*from w w w . j a v a 2s . co m*/ } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(rainSeries); JFreeChart chart = ChartFactory.createXYLineChart("Rain", "Days", "Inches", dataset/*, PlotOrientation.VERTICAL, true, true, false*/); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.GRAY); plot.setDomainGridlinePaint(Color.WHITE); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartPanel panel = new ChartPanel(chart); jTabbedPane1.addTab("Rain", panel); }
From source file:org.agmip.ui.afsirs.frames.GraphOutput.java
public void addEvaporationAndTranspiration() { XYSeries etSeries = new XYSeries("ET"); double[][] ET = utils.getET(); for (int i = 0; i < 10/*ET.length*/; i++) { for (int j = 0; j < 10/*ET[0].length*/; j++) { etSeries.add(i * ET[0].length + j, ET[i][j]); }// ww w .j a v a 2 s .co m } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(etSeries); JFreeChart chart = ChartFactory.createXYLineChart("Evaporation Transpiration", "Days", "Inches", dataset/*, PlotOrientation.VERTICAL, true, true, false*/); chart.setBackgroundPaint(Color.white); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.GRAY); plot.setDomainGridlinePaint(Color.WHITE); plot.setRangeGridlinePaint(Color.white); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartPanel panel = new ChartPanel(chart); jTabbedPane1.addTab("Evaporation Transpiration", panel); }