List<XYPlot> subplots = (List<XYPlot>) combinedPlots.getSubplots(); for (XYPlot p:subplots) p.setDomainGridlinesVisible(false);
private void showGridlinesOnChart(XYPlot xyPlot) { boolean grid = getChartStyleDefinitions().isGrid(); xyPlot.setDomainGridlinesVisible(grid); xyPlot.setRangeGridlinesVisible(grid); }
private void showGridlinesOnChart(XYPlot plot) { IoParameters parameters = getParameters(); boolean showGrid = parameters.isGrid(); plot.setDomainGridlinesVisible(showGrid); plot.setRangeGridlinesVisible(showGrid); }
private void setGridVisible(boolean visible) { chart.getXYPlot().setDomainGridlinesVisible(visible); chart.getXYPlot().setRangeGridlinesVisible(visible); }
private void setGridVisible(boolean visible) { chart.getXYPlot().setDomainGridlinesVisible(visible); chart.getXYPlot().setRangeGridlinesVisible(visible); }
private JFreeChart createChart() { final XYDataset dataset = this.createDataset(series); final JFreeChart result = ChartFactory.createTimeSeriesChart("Dynamic Line And TimeSeries Chart", "Time", "Value", dataset, true, true, false); final XYPlot plot = result.getXYPlot(); plot.setBackgroundPaint(new Color(0xffffe0)); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); // first time series this.firstTimeSeries(plot); // second time series this.secondTimeSeries(plot); // third time series this.thirdTimeSeries(plot); return result; }
public static void setupPlot(XYPlot plot) { plot.setBackgroundPaint(ChartDefaults.transparent); plot.setOutlinePaint(ChartDefaults.transparent); plot.setRangeGridlinePaint(ChartDefaults.gridLineColor); plot.setRangeGridlineStroke(new BasicStroke(0.5f)); plot.setRangeGridlinesVisible(true); plot.setRangeAxisLocation(ChartDefaults.rangeAxisLocation); plot.setDomainGridlinesVisible(true); ChartUtil.setupRangeAxis(plot.getRangeAxis()); ChartUtil.setupDomainAxis(plot.getDomainAxis()); }
public static void setupPlot(XYPlot plot) { plot.setBackgroundPaint(ChartDefaults.transparent); plot.setOutlinePaint(ChartDefaults.transparent); plot.setRangeGridlinePaint(ChartDefaults.gridLineColor); plot.setRangeGridlineStroke(new BasicStroke(0.5f)); plot.setRangeGridlinesVisible(true); plot.setRangeAxisLocation(ChartDefaults.rangeAxisLocation); plot.setDomainGridlinesVisible(true); ChartUtil.setupRangeAxis(plot.getRangeAxis()); ChartUtil.setupDomainAxis(plot.getDomainAxis()); }
@Override protected void setSpecialGrid() { XYPlot plot = (XYPlot) chart.getPlot(); Grid grid = ofxChart.getGrid(); if(grid.isSetDomain()){plot.setDomainGridlinesVisible(grid.isDomain());} if(grid.isSetRange()){plot.setRangeGridlinesVisible(grid.isRange());} }
public void enableGrid(boolean enable) { if (enable) { BasicStroke dotted = new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] {1.0f, 6.0f}, 0.0f); graph.getXYPlot().setDomainGridlinesVisible(true); graph.getXYPlot().setRangeGridlinesVisible(true); graph.getXYPlot().setRangeGridlinePaint(Color.black); graph.getXYPlot().setDomainGridlinePaint(Color.black); graph.getXYPlot().setRangeGridlineStroke(dotted); graph.getXYPlot().setDomainGridlineStroke(dotted); } else { graph.getXYPlot().setDomainGridlinesVisible(false); graph.getXYPlot().setRangeGridlinesVisible(false); } }
private XYPlot createPlot(JFreeChart chart) { XYPlot plot = chart.getXYPlot(); plot.setForegroundAlpha(0.65F); plot.setDomainGridlinesVisible(preferences.getBoolean(X_GRID_PREFERENCE, true)); plot.setRangeGridlinesVisible(preferences.getBoolean(Y_GRID_PREFERENCE, true)); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); rangeAxis.setStandardTickUnits(createIntegerTickUnits()); Font font = new JLabel().getFont(); rangeAxis.setLabelFont(font); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setStandardTickUnits(createIntegerTickUnits()); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); domainAxis.setLabelFont(font); plot.getRenderer().setBaseToolTipGenerator(null); return plot; }
/** * Utility method to set the default style of the XY Step Area Charts * * @param chart {@link JFreeChart} to style */ private static void setXYStepAreaChartDefaults(JFreeChart chart) { ChartUtil.setDefaults(chart); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainGridlinesVisible(false); // renderer XYStepAreaRenderer renderer = (XYStepAreaRenderer) plot.getRenderer(); renderer.setBaseItemLabelFont(ChartDefaults.defaultFont); renderer.setBaseItemLabelPaint(ChartDefaults.axisLabelColor); renderer.setShapesVisible(false); renderer.setBaseStroke(ChartDefaults.defaultStroke); for (int j = 0; j < ChartDefaults.darkColors.length; j++) { renderer.setSeriesStroke(j, ChartDefaults.defaultStroke); renderer.setSeriesPaint(j, ChartDefaults.darkColors[j]); } StandardXYToolTipGenerator generator = new StandardXYToolTipGenerator("{1}, {2}", NumberFormat.getInstance(), NumberFormat.getInstance()); renderer.setBaseToolTipGenerator(generator); }
public static JFreeChart chartProfile(DefaultTableXYDataset dataset, ChartType type) { JFreeChart chart; switch (type) { case Line: chart = ChartFactory .createXYLineChart("TimeProfile", "Time [h]", "Values", dataset, PlotOrientation.VERTICAL, true, false, false); break; case StackedArea: chart = ChartFactory.createStackedXYAreaChart("TimeProfile", "Time [h]", "Values", dataset, PlotOrientation.VERTICAL, true, false, false); break; default: throw new IllegalArgumentException(); } XYPlot plot = chart.getXYPlot(); plot.setRangeGridlinesVisible(false); plot.setDomainGridlinesVisible(false); plot.setBackgroundPaint(Color.white); NumberAxis xAxis = (NumberAxis)plot.getDomainAxis(); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis yAxis = (NumberAxis)plot.getRangeAxis(); yAxis.setAutoRange(true); XYItemRenderer renderer = plot.getRenderer(); for (int s = 0; s < dataset.getSeriesCount(); s++) { renderer.setSeriesStroke(s, new BasicStroke(2)); } return chart; }
/** * Utility method to set the default style of the XY Step Charts * * @param chart {@link JFreeChart} to style */ private static void setXYStepChartDefaults(JFreeChart chart) { ChartUtil.setDefaults(chart); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainGridlinesVisible(false); // renderer XYStepRenderer renderer = (XYStepRenderer) plot.getRenderer(); renderer.setBaseItemLabelFont(ChartDefaults.defaultFont); renderer.setBaseStroke(ChartDefaults.defaultStroke); renderer.setShapesVisible(false); for (int j = 0; j < ChartDefaults.darkColors.length; j++) { renderer.setSeriesStroke(j, ChartDefaults.defaultStroke); renderer.setSeriesPaint(j, ChartDefaults.darkColors[j]); } }
/** * Updates the axis-related properties of a plot. * * @param aPlot * Plot to be updated. * @param aAxes * Axis-related visual settings to be applied. * @param aGrid * Grid-related visual settings to be applied. */ private static void updateAxes(XYPlot aPlot, AxesSettings aAxes, GridSettings aGrid, Range aDomainDataRange, Range aRangeDataRange) { aPlot.setDomainAxis(createAxis(aAxes, true, aDomainDataRange)); aPlot.setRangeAxis(createAxis(aAxes, false, aRangeDataRange)); aPlot.setDomainGridlinesVisible(aGrid.getVerticalGridLines()); // set gridlines for X axis aPlot.setDomainGridlinePaint(aGrid.getGridLinesColor()); // set color of domain gridline aPlot.setRangeGridlinesVisible(aGrid.getHorizontalGridLines()); // set gridlines for Y axis aPlot.setRangeGridlinePaint(aGrid.getGridLinesColor()); // set color of range gridline }
public void createXYLineChart(double[] xDATA, double[] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC) { XYDataset dataset = createDataset(xDATA, yDATA); JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis, domainAxis; if (ISXAXISLOGARITHMIC) domainAxis = new LogarithmicAxis(XLABEL); else domainAxis = new NumberAxis(XLABEL); if (ISYAXISLOGARITHMIC) rangeAxis = new LogarithmicAxis(YLABEL); else rangeAxis = new NumberAxis(YLABEL); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); this.setContentPane(chartPanel); }
public void createXYLineChart(double[][] xDATA, double[][] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC) { XYDataset dataset = createDataset(xDATA, yDATA); JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis, domainAxis; if (ISXAXISLOGARITHMIC) domainAxis = new LogarithmicAxis(XLABEL); else domainAxis = new NumberAxis(XLABEL); if (ISYAXISLOGARITHMIC) rangeAxis = new LogarithmicAxis(YLABEL); else rangeAxis = new NumberAxis(YLABEL); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); this.setContentPane(chartPanel); }
public void createXYLineChart(double[][] xDATA, double[][] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC) { XYDataset dataset = createDataset(xDATA, yDATA); JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis, domainAxis; if (ISXAXISLOGARITHMIC) domainAxis = new LogarithmicAxis(XLABEL); else domainAxis = new NumberAxis(XLABEL); if (ISYAXISLOGARITHMIC) rangeAxis = new LogarithmicAxis(YLABEL); else rangeAxis = new NumberAxis(YLABEL); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); this.setContentPane(chartPanel); }
public void createXYLineChart(double[] xDATA, double[] yDATA, String TITLE, String XLABEL, String YLABEL, int WIDTH, int HEIGHT, boolean ISXAXISLOGARITHMIC, boolean ISYAXISLOGARITHMIC) { XYDataset dataset = createDataset(xDATA, yDATA); JFreeChart chart = ChartFactory.createXYLineChart(TITLE, XLABEL, YLABEL, dataset, PlotOrientation.VERTICAL, false, false, false); chart.setBackgroundPaint(Color.lightGray); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis, domainAxis; if (ISXAXISLOGARITHMIC) domainAxis = new LogarithmicAxis(XLABEL); else domainAxis = new NumberAxis(XLABEL); if (ISYAXISLOGARITHMIC) rangeAxis = new LogarithmicAxis(YLABEL); else rangeAxis = new NumberAxis(YLABEL); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.blue); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(WIDTH, HEIGHT)); this.setContentPane(chartPanel); }
public void configureXYPlot(XYPlot plot) { plot.setDomainGridlinesVisible(getDomainGridlinesVisible());