List of usage examples for org.jfree.chart.plot XYPlot setDomainGridlinePaint
public void setDomainGridlinePaint(Paint paint)
From source file:org.n52.io.measurement.img.ChartIoHandler.java
private XYPlot createPlotArea(JFreeChart chart) { XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(WHITE);// www .j a v a 2 s . c o m plot.setDomainGridlinePaint(LIGHT_GRAY); plot.setRangeGridlinePaint(LIGHT_GRAY); plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); showCrosshairsOnAxes(plot); configureDomainAxis(plot); showGridlinesOnChart(plot); configureTimeAxis(plot); configureTitle(chart); addNotice(chart); return plot; }
From source file:pharoslabut.logger.CompassLoggerGUI.java
/** * Creates a chart./*from w ww. j a v a2s.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("Proteus Robot Compass Measurements", // chart title "Time (s)", // x axis label "Angle (radians)", // y axis label dataset, // data PlotOrientation.VERTICAL, false, // 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 customization... 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, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setRange(new Range(0, 140)); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); // change the auto tick unit selection to integer units only... // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setRange(new Range(-Math.PI, Math.PI)); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:msi.gama.hpc.gui.perspective.chart.HeadlessChart.java
private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Line Chart from XML output file", // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls );//from w w w .j a v a 2 s . c om // 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, 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:Main.Chart.java
/** * Creates a chart./* ww w.j a v a 2s. c om*/ * * @param dataset the data for the chart. * * @return a chart. */ private JFreeChart createChart(final XYDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("Weather Forecast", // chart title "Time", // x axis label "Temperature", // 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, 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.ietr.preesm.mapper.ui.stats.PerformancePlotter.java
/** * Creates a chart in order to plot the speed-ups. * //from w w w.j a va 2 s. c o m * @return A chart. */ private JFreeChart createChart(String title) { // Creating display domain NumberAxis horizontalAxis = new NumberAxis("Number of operators"); final CombinedDomainXYPlot plot = new CombinedDomainXYPlot(horizontalAxis); // Creating the best speedups subplot this.speedups = new DefaultXYDataset(); final NumberAxis xAxis = new NumberAxis("speedups"); xAxis.setAutoRangeIncludesZero(false); XYSplineRenderer renderer = new XYSplineRenderer(); final XYPlot subplot = new XYPlot(this.speedups, null, xAxis, renderer); subplot.setBackgroundPaint(Color.white); subplot.setDomainGridlinePaint(Color.lightGray); subplot.setRangeGridlinePaint(Color.lightGray); plot.add(subplot); plot.setForegroundAlpha(0.5f); final JFreeChart chart = new JFreeChart(title, plot); chart.setBorderPaint(Color.white); chart.setBorderVisible(true); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final ValueAxis axis = plot.getDomainAxis(); axis.setAutoRange(true); return chart; }
From source file:edu.utexas.ece.pharos.proteus3.sensors.CompassChartGUI.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("Proteus III Compass Measurements", // chart title "Time (s)", // x axis label "Angle (degrees)", // y axis label dataset, // data PlotOrientation.VERTICAL, false, // 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 customization... 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, false); renderer.setSeriesShapesVisible(1, false); plot.setRenderer(renderer); final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setRange(new Range(0, 140)); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); // change the auto tick unit selection to integer units only... // rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); //rangeAxis.setRange(new Range(-Math.PI, Math.PI)); rangeAxis.setRange(new Range(-180, 180)); return chart; }
From source file:Chart.JFreeChartDemo.java
/** * Create a chart./* w ww. j a va 2s . com*/ * * @param dataset the dataset * @return the chart */ private JFreeChart createChart(XYDataset dataset) { // WHAT IS THIS LINE??? // JFreeChart chart = ChartFactory.createTimeSeriesChart(null, null, null, dataset, rootPaneCheckingEnabled, rootPaneCheckingEnabled, rootPaneCheckingEnabled) // create the chart... JFreeChart chart = ChartFactory.createXYLineChart("", // chart title "Time", // domain axis label "Range", // range axis label dataset, // initial series PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); // set chart background chart.setBackgroundPaint(Color.white); // set a few custom plot features XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(new Color(0xffffe0)); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); // set the plot's axes to display integers TickUnitSource ticks = NumberAxis.createIntegerTickUnits(); NumberAxis domain = (NumberAxis) plot.getDomainAxis(); domain.setStandardTickUnits(ticks); NumberAxis range = (NumberAxis) plot.getRangeAxis(); range.setStandardTickUnits(ticks); // render shapes and lines // XYLineAndShapeRenderer renderer = // new XYLineAndShapeRenderer(true, true); // plot.setRenderer(renderer); // renderer.setBaseShapesVisible(true); // renderer.setBaseShapesFilled(true); // // // set the renderer's stroke // Stroke stroke = new BasicStroke( // 3f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL); // // renderer.setBaseOutlineStroke(stroke); // //Shape theshape = ShapeUtilities.createDiamond(1); //renderer.setSeriesShape(5, theshape); // label the points // NumberFormat format = NumberFormat.getNumberInstance(); // format.setMaximumFractionDigits(2); // XYItemLabelGenerator generator = // new StandardXYItemLabelGenerator( // StandardXYItemLabelGenerator.DEFAULT_ITEM_LABEL_FORMAT, // format, format); // renderer.setBaseItemLabelGenerator(generator); // renderer.setBaseItemLabelsVisible(true); return chart; }
From source file:web.diva.server.unused.PCAGenerator.java
public PCAImageResult generateChart(String path, PCAResults pcaResults, int[] subSelectionData, int[] selection, boolean zoom, boolean selectAll, String imgName, double w, double h, DivaDataset divaDataset) { XYDataset dataset = this.createDataset(pcaResults.getPoints(), subSelectionData, selection, zoom, divaDataset);/*from ww w . j a va2s . com*/ final JFreeChart chart = ChartFactory.createScatterPlot("", // chart title "Principal Component" + (pcaResults.getPcai() + 1), // x axis label "Principal Component " + (pcaResults.getPcaii() + 1), // y axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend true, // tooltips false // urls ); final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.WHITE); plot.setRangeGridlinePaint(Color.WHITE); XYDotRenderer renderer = new XYDotRenderer(); renderer.setDotHeight(5); renderer.setDotWidth(5); if (selectAll) { int i = 0; for (String col : seriesList.keySet()) { if (col.equalsIgnoreCase("unGrouped")) { col = "#000000"; } renderer.setSeriesPaint(i, imgGenerator.hex2Rgb(col)); i++; } } else if (selection == null) { renderer.setPaint(Color.LIGHT_GRAY); int i = 0; for (String col : seriesList.keySet()) { if (col.equalsIgnoreCase("unGrouped")) { col = "#000000"; } renderer.setSeriesPaint(i, imgGenerator.hex2Rgb(col)); i++; } } else { int i = 0; for (String col : seriesList.keySet()) { if (col.equalsIgnoreCase("unGrouped")) { renderer.setSeriesPaint(i, Color.LIGHT_GRAY); } else { renderer.setSeriesPaint(i, imgGenerator.hex2Rgb(col)); } i++; } } plot.setRenderer(renderer); plot.setSeriesRenderingOrder(SeriesRenderingOrder.REVERSE); NumberAxis xAxis = new NumberAxis("Principal Component" + (pcaResults.getPcai() + 1)); xAxis.setVerticalTickLabels(true); boolean auto = xAxis.getAutoRangeIncludesZero(); xAxis.setAutoRangeIncludesZero(true ^ auto); NumberAxis yAxis = new NumberAxis("Principal Component" + (pcaResults.getPcaii() + 1)); yAxis.setAutoRangeIncludesZero(true ^ auto); yAxis.setTickUnit(new NumberTickUnit(1)); plot.setDomainAxis(0, xAxis); plot.setRangeAxis(0, yAxis); double MaxX = xAxis.getRange().getUpperBound(); double MinX = xAxis.getRange().getLowerBound(); double MaxY = yAxis.getRange().getUpperBound(); double MinY = yAxis.getRange().getLowerBound(); chartRenderingInfo.clear(); String imgUrl = imgGenerator.saveToFile(chart, w, h, chartRenderingInfo); PCAImageResult imgUtilRes = new PCAImageResult(); imgUtilRes.setImgString(imgUrl); imgUtilRes.setDataAreaMaxX(chartRenderingInfo.getPlotInfo().getDataArea().getMaxX()); imgUtilRes.setDataAreaMaxY(chartRenderingInfo.getPlotInfo().getDataArea().getMaxY()); imgUtilRes.setDataAreaMinY(chartRenderingInfo.getPlotInfo().getDataArea().getMinY()); imgUtilRes.setDataAreaMinX(chartRenderingInfo.getPlotInfo().getDataArea().getMinX()); imgUtilRes.setMaxX(MaxX); imgUtilRes.setMaxY(MaxY); imgUtilRes.setMinX(MinX); imgUtilRes.setMinY(MinY); return imgUtilRes; }
From source file:flexflux.analyses.result.ParetoAnalysisResult.java
public void plot() { XYSeriesCollection dataset = new XYSeriesCollection(); int i = 1;/* w w w . j a v a 2 s. co m*/ for (Objective obj : oneDResults.keySet()) { XYSeries series = new XYSeries(obj.getName()); for (double val : oneDResults.get(obj)) { series.add(i, val); } dataset.addSeries(series); i++; } // create the chart... final JFreeChart chart = ChartFactory.createXYLineChart("", // chart title "Objectives", // x axis label "Values", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); ChartPanel chartPanel = new ChartPanel(chart); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setRangeGridlinePaint(Color.GRAY); plot.setDomainGridlinePaint(Color.GRAY); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setLinesVisible(false); renderer.setShapesVisible(true); plot.setRenderer(renderer); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getDomainAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); JFrame frame = new JFrame("Pareto analysis one dimension results"); frame.add(chartPanel); frame.pack(); RefineryUtilities.centerFrameOnScreen(frame); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setVisible(true); for (PP2DResult r : twoDResults.keySet()) { r.plot(); } for (PP3DResult r : threeDResults.keySet()) { r.plot(); } }
From source file:com.al.cellplugin.LineChart.java
/** * Creates a chart./*from ww w .j a va2 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("Line Chart of Product SVD [V]", // chart title "X", // x axis label "Y", // 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); plot.setRangeGridlinesVisible(true); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); 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()); //rangeAxis.setTickLabelsVisible(true); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }