List of usage examples for org.jfree.chart.plot XYPlot setDomainGridlinePaint
public void setDomainGridlinePaint(Paint paint)
From source file:edu.fullerton.timeseriesapp.TimeSeriesApp.java
public ArrayList<Integer> makePlot(ArrayList<ChanDataBuffer> dbufs, boolean compact) throws WebUtilException { int imageId;// ww w . java 2 s .com try { PluginSupport psupport = new PluginSupport(); String gtitle = psupport.getTitle(dbufs, compact); String xAxisLabel = ""; XYSeriesCollection xyds = new XYSeriesCollection(); TimeSeriesCollection mtds = new TimeSeriesCollection(); compact = dbufs.size() > 2 ? false : compact; for (ChanDataBuffer dbuf : dbufs) { int npts = dbuf.getDataLength(); int sum = 1; if (npts > 2000) { sum = npts / 2000; } String legend = psupport.getLegend(dbuf, compact); if (timeAxis.equalsIgnoreCase("utc")) { TimeSeries ts = psupport.getTimeSeries(dbuf, legend, sum); xAxisLabel = "Time (UTC)"; mtds.addSeries(ts); } else { boolean isDt = timeAxis.equalsIgnoreCase("dt"); XYSeries xys = psupport.addXySeries(dbuf, legend, isDt, sum); xAxisLabel = psupport.getxAxisLabel(); xyds.addSeries(xys); } } Double minx, miny, maxx, maxy; Double[] rng = new Double[4]; if (timeAxis.equalsIgnoreCase("utc")) { PluginSupport.getRangeLimits(mtds, rng); } else { int skip = 0; PluginSupport.getRangeLimits(xyds, rng, skip); } minx = rng[0]; miny = rng[1]; maxx = rng[2]; maxy = rng[3]; int exp; if (timeAxis.equalsIgnoreCase("utc")) { exp = PluginSupport.scaleRange(mtds, miny, maxy); } else { exp = PluginSupport.scaleRange(xyds, miny, maxy); } ChartPanel cpnl; DefaultXYDataset ds = new DefaultXYDataset(); JFreeChart chart; if (timeAxis.equalsIgnoreCase("utc")) { chart = ChartFactory.createTimeSeriesChart(gtitle, "Time (UTC)", "Counts", ds, true, true, false); } else { chart = ChartFactory.createXYLineChart(gtitle, xAxisLabel, "Counts", ds, PlotOrientation.VERTICAL, true, false, false); } chart.setBackgroundPaint(Color.WHITE); chart.setAntiAlias(true); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); NumberAxis rangeAxis = new NumberAxis("Counts"); ScaledAxisNumberFormat sanf = new ScaledAxisNumberFormat(); sanf.setExp(exp); NumberTickUnit tickUnit; double plotRange; if (maxy != 0 && Math.abs(maxy - miny) < Math.abs(maxy) * 1e-30) { // this garbage is to get jFreeChart to always put labels on the Y axis double dt = Math.abs(miny) / 10; double scaledMin = (miny - dt) * Math.pow(10., exp); double scaledMax = (maxy + dt) * Math.pow(10., exp); rangeAxis.setRange(scaledMin, scaledMax); plotRange = scaledMax - scaledMin; rangeAxis.setAutoRange(false); } else { sanf.setMinMax(miny, maxy); plotRange = maxy - miny; rangeAxis.setAutoRange(true); } tickUnit = rangeAxis.getTickUnit(); double tickSize = tickUnit.getSize(); int nticks = (int) ((plotRange) / tickSize); if (nticks > yTicks) { double newTickSize = plotRange / yTicks; rangeAxis.setTickUnit(new NumberTickUnit(newTickSize)); } rangeAxis.setNumberFormatOverride(sanf); rangeAxis.setAutoRangeIncludesZero(false); plot.setRangeAxis(rangeAxis); if (timeAxis.equalsIgnoreCase("utc")) { plot.setDataset(0, mtds); } else { plot.setDataset(0, xyds); } // Set the line thickness XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) plot.getRenderer(); BasicStroke str = new BasicStroke(lineThickness); int n = plot.getSeriesCount(); for (int i = 0; i < n; i++) { r.setSeriesStroke(i, str); } if (compact) { chart.removeLegend(); } cpnl = new ChartPanel(chart); if (outFilename.isEmpty()) { imageId = psupport.saveImageAsPNG(cpnl); } else { imageId = 0; psupport.saveImageAsPdfFile(chart, outFilename); } } catch (SQLException | NoSuchAlgorithmException | IOException ex) { throw new WebUtilException(ex); } ArrayList<Integer> ret = new ArrayList<>(); ret.add(imageId); return ret; }
From source file:playground.dgrether.events.handlers.DgGeoFilteredLegHistogram.java
private JFreeChart getGraphic(final ModeData modeData, final String modeName) { final XYSeriesCollection xyData = new XYSeriesCollection(); final XYSeries departuresSerie = new XYSeries("departures", false, true); final XYSeries arrivalsSerie = new XYSeries("arrivals", false, true); final XYSeries onRouteSerie = new XYSeries("en route", false, true); int onRoute = 0; for (int i = 0; i < modeData.countsDep.length; i++) { onRoute = onRoute + modeData.countsDep[i] - modeData.countsArr[i] - modeData.countsStuck[i]; double hour = i * this.binSizeSeconds / 60.0 / 60.0; departuresSerie.add(hour, modeData.countsDep[i]); arrivalsSerie.add(hour, modeData.countsArr[i]); onRouteSerie.add(hour, onRoute); }/* w ww. j ava 2s . c o m*/ xyData.addSeries(departuresSerie); xyData.addSeries(arrivalsSerie); xyData.addSeries(onRouteSerie); final JFreeChart chart = ChartFactory.createXYStepChart( "Leg Histogram, " + modeName + ", it." + this.iteration, "time", "# vehicles", xyData, PlotOrientation.VERTICAL, true, // legend false, // tooltips false // urls ); XYPlot plot = chart.getXYPlot(); plot.getRenderer().setSeriesStroke(0, new BasicStroke(2.0f)); plot.getRenderer().setSeriesStroke(1, new BasicStroke(2.0f)); plot.getRenderer().setSeriesStroke(2, new BasicStroke(2.0f)); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.gray); plot.setDomainGridlinePaint(Color.gray); final CategoryAxis axis1 = new CategoryAxis("hour"); axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7)); plot.setDomainAxis(new NumberAxis("time")); return chart; }
From source file:de.citec.csra.allocation.vis.MovingChart.java
/** * Creates a sample chart.//from w w w . ja va 2 s . c o m * * @param dataset the dataset. * * @return A sample chart. */ private JFreeChart createChart(final XYDataset dataset) { final JFreeChart result = ChartFactory.createTimeSeriesChart(null, "Time", "Resource", dataset, false, true, false); final XYPlot plot = result.getXYPlot(); plot.addDomainMarker(this.marker); plot.setBackgroundPaint(new Color(0xf8f8ed)); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.lightGray); ValueAxis xaxis = plot.getDomainAxis(); xaxis.setAutoRange(true); xaxis.setTickLabelsVisible(false); //Domain axis would show data of 60 seconds for a time xaxis.setFixedAutoRange(this.past + this.future); // 60 seconds xaxis.setVerticalTickLabels(true); ValueAxis yaxis = plot.getRangeAxis(); yaxis.setAutoRangeMinimumSize(1.8); yaxis.setAutoRange(true); NumberAxis range = (NumberAxis) plot.getRangeAxis(); range.setTickUnit(new NumberTickUnit(1)); range.setNumberFormatOverride(new NumberFormat() { @Override public StringBuffer format(double number, StringBuffer toAppendTo, FieldPosition pos) { return format((long) number, toAppendTo, pos); } private String getID(long number) { return values.entrySet().stream().filter(e -> e.equals(number)).findFirst().get().getKey(); } @Override public StringBuffer format(long number, StringBuffer ap, FieldPosition pos) { String id = "N/A"; if (number == 0) { id = "(Time)"; } if (values.containsValue(number)) { for (Map.Entry<String, Long> entry : values.entrySet()) { if (entry.getValue() == number) { id = entry.getKey(); break; } } } id = id.replaceFirst("/$", ""); ap.append(id); if (id.length() > 32) { ap.replace(15, ap.length() - 15, ".."); } return ap; } @Override public Number parse(String source, ParsePosition parsePosition) { return null; } }); // this.chart.getXYPlot().getRenderer(1).set // XYLineAndShapeRenderer r = (XYLineAndShapeRenderer) this.chart.getXYPlot().getRendererForDataset(dataset); return result; }
From source file:ec.ui.view.MarginView.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(MAIN_INDEX); main.setBasePaint(themeSupport.getLineColor(MAIN_COLOR)); XYDifferenceRenderer difference = ((XYDifferenceRenderer) plot.getRenderer(DIFFERENCE_INDEX)); Color diffArea = SwingColorSchemeSupport.withAlpha(themeSupport.getAreaColor(DIFFERENCE_COLOR), 150); difference.setPositivePaint(diffArea); difference.setNegativePaint(diffArea); difference.setBasePaint(themeSupport.getLineColor(DIFFERENCE_COLOR)); Collection<Marker> markers = (Collection<Marker>) plot.getDomainMarkers(Layer.FOREGROUND); if (!Jdk6.Collections.isNullOrEmpty(markers)) { Color markerColor = themeSupport.getLineColor(DATE_MARKER_COLOR); for (Marker o : markers) { o.setPaint(markerColor);/* ww w.j a v a 2 s. co m*/ } } Collection<Marker> intervalMarkers = (Collection<Marker>) plot.getDomainMarkers(Layer.BACKGROUND); if (!Jdk6.Collections.isNullOrEmpty(intervalMarkers)) { Color markerColor = themeSupport.getLineColor(KnownColor.ORANGE); for (Marker o : intervalMarkers) { o.setPaint(markerColor); } } }
From source file:org.n52.server.io.render.DiagramRenderer.java
protected JFreeChart renderPreChart(Map<String, OXFFeatureCollection> entireCollMap, String[] observedProperties, ArrayList<TimeSeriesCollection> timeSeries, Calendar begin, Calendar end) { JFreeChart chart = ChartFactory.createTimeSeriesChart(null, // title "Date", // x-axis label observedProperties[0], // y-axis label timeSeries.get(0), // data true, // create legend? true, // generate tooltips? false // generate URLs? );// w w w. ja v a2 s .c om chart.setBackgroundPaint(Color.white); XYPlot plot = (XYPlot) chart.getPlot(); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); plot.setAxisOffset(new RectangleInsets(2.0, 2.0, 2.0, 2.0)); plot.setDomainCrosshairVisible(true); plot.setRangeCrosshairVisible(true); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); // add additional datasets: DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setRange(begin.getTime(), end.getTime()); axis.setDateFormatOverride(new SimpleDateFormat()); axis.setTimeZone(end.getTimeZone()); for (int i = 1; i < observedProperties.length; i++) { XYDataset additionalDataset = timeSeries.get(i); plot.setDataset(i, additionalDataset); plot.setRangeAxis(i, new NumberAxis(observedProperties[i])); // plot.getRangeAxis(i).setRange((Double) // overAllSeriesCollection.getMinimum(i), // (Double) overAllSeriesCollection.getMaximum(i)); plot.mapDatasetToRangeAxis(i, i); // plot.getDataset().getXValue(i, i); } return chart; }
From source file:me.childintime.childintime.ui.window.tool.BmiToolDialog.java
/** * Creates a chart./* ww w. j a v a 2 s. co 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("BMI chart", "Age", "Value", dataset, PlotOrientation.VERTICAL, true, true, false); // Set the background color to the LAF's default chart.setBackgroundPaint(new JPanel().getBackground()); // get a reference to the plot for further customisation... final XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setDomainGridlinePaint(Color.lightGray); plot.setRangeGridlinePaint(Color.lightGray); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); for (int i = 0; i < 3; i++) { renderer.setSeriesLinesVisible(i, true); renderer.setSeriesShapesVisible(i, true); renderer.setSeriesFillPaint(i, Color.RED); } plot.setRenderer(renderer); plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // change the auto tick unit selection to integer units only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:com.rapidminer.gui.plotter.charts.HistogramChart.java
@Override protected void updatePlotter() { prepareData();/*from w w w . j a v a 2 s . com*/ String maxClassesProperty = ParameterService .getParameterValue(MainFrame.PROPERTY_RAPIDMINER_GUI_PLOTTER_COLORS_CLASSLIMIT); int maxClasses = 20; try { if (maxClassesProperty != null) { maxClasses = Integer.parseInt(maxClassesProperty); } } catch (NumberFormatException e) { // LogService.getGlobal().log("Deviation plotter: cannot parse property 'rapidminer.gui.plotter.colors.classlimit', using maximal 20 different classes.", // LogService.WARNING); LogService.getRoot().log(Level.WARNING, "com.rapidminer.gui.plotter.charts.HistogramChart.parsing_property_error"); } int categoryCount = this.histogramDataset.getSeriesCount(); boolean createLegend = categoryCount > 0 && categoryCount < maxClasses && this.drawLegend; JFreeChart chart = ChartFactory.createHistogram(null, // title "Value", "Frequency", histogramDataset, PlotOrientation.VERTICAL, createLegend, true, // tooltips false); // urls XYPlot plot = chart.getXYPlot(); plot.setDomainGridlinePaint(Color.LIGHT_GRAY); plot.setRangeGridlinePaint(Color.LIGHT_GRAY); plot.setBackgroundPaint(Color.WHITE); plot.setForegroundAlpha(this.opaqueness); XYBarRenderer renderer = new XYBarRenderer(); if (histogramDataset.getSeriesCount() == 1) { renderer.setSeriesPaint(0, ColorProvider.reduceColorBrightness(Color.RED)); renderer.setSeriesFillPaint(0, ColorProvider.reduceColorBrightness(Color.RED)); } else { for (int i = 0; i < histogramDataset.getSeriesCount(); i++) { Color color = getColorProvider(true) .getPointColor((double) i / (double) (histogramDataset.getSeriesCount() - 1)); renderer.setSeriesPaint(i, color); renderer.setSeriesFillPaint(i, color); } } renderer.setBarPainter(new RapidXYBarPainter()); // renderer.setBarPainter(new StandardXYBarPainter()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); plot.setRenderer(renderer); plot.getRangeAxis().setLabelFont(LABEL_FONT_BOLD); plot.getRangeAxis().setTickLabelFont(LABEL_FONT); plot.getDomainAxis().setLabelFont(LABEL_FONT_BOLD); plot.getDomainAxis().setTickLabelFont(LABEL_FONT); setRange(plot.getDomainAxis()); // display correct x-Axis labels int count = histogramDataset.getSeriesCount(); if (count > 0) { String key = histogramDataset.getSeriesKey(0).toString(); int index = this.dataTable.getColumnIndex(key); if (index >= 0) { // Correctly displays nominal values on x-axis if (count == 1 && this.dataTable.isNominal(index)) { String[] values = new String[dataTable.getNumberOfValues(index)]; for (int i = 0; i < values.length; i++) { values[i] = dataTable.mapIndex(index, i); } plot.setDomainAxis(new SymbolAxis(key, values)); } // Correctly displays dates on x-axis if (this.dataTable.isDateTime(index)) { boolean applyDateAxis = true; if (count > 1) { for (int i = 1; i < count; i++) { index = this.dataTable.getColumnIndex(histogramDataset.getSeriesKey(i).toString()); if (index < 0 || !this.dataTable.isDateTime(index)) { applyDateAxis = false; break; } } } if (applyDateAxis) { DateAxis dateAxis = new DateAxis(); dateAxis.setDateFormatOverride(Tools.DATE_TIME_FORMAT.get()); plot.setDomainAxis(dateAxis); } } } // rotate labels if (isLabelRotating()) { plot.getDomainAxis().setTickLabelsVisible(true); plot.getDomainAxis().setVerticalTickLabels(true); } } // set the background color for the chart... chart.setBackgroundPaint(Color.white); // legend settings LegendTitle legend = chart.getLegend(); if (legend != null) { legend.setPosition(RectangleEdge.TOP); legend.setFrame(BlockBorder.NONE); legend.setHorizontalAlignment(HorizontalAlignment.LEFT); legend.setItemFont(LABEL_FONT); } AbstractChartPanel panel = getPlotterPanel(); if (panel == null) { panel = createPanel(chart); } else { panel.setChart(chart); } // Disable zooming for Histogram-Charts panel.setRangeZoomable(false); panel.setDomainZoomable(false); // ATTENTION: WITHOUT THIS WE GET SEVERE MEMORY LEAKS!!! panel.getChartRenderingInfo().setEntityCollection(null); }
From source file:edu.ucla.stat.SOCR.chart.SuperXYChart.java
/** * Creates a chart.//from w w w. ja v a 2s . co m * * @param dataset the dataset. * * @return a chart. */ protected JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, !legendPanelOn, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... 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.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); // change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:MSUmpire.DIA.MixtureModelKDESemiParametric.java
public void GeneratePlot(String pngfile) throws IOException { String modelfile = FilenameUtils.getFullPath(pngfile) + "/" + FilenameUtils.getBaseName(pngfile) + "_ModelPoints.txt"; FileWriter writer = new FileWriter(modelfile); double[] IDObs = new double[IDEmpiricalDist.getN()]; double[] DecoyObs = new double[DecoyEmpiricalDist.getN()]; for (int i = 0; i < IDEmpiricalDist.getN(); i++) { IDObs[i] = IDEmpiricalDist.getObs(i); }//from ww w. j a v a 2 s. co m for (int i = 0; i < DecoyEmpiricalDist.getN(); i++) { DecoyObs[i] = DecoyEmpiricalDist.getObs(i); } XYSeries model1 = new XYSeries("Incorrect matches"); XYSeries model2 = new XYSeries("Correct matches"); XYSeries model3 = new XYSeries("All target hits"); writer.write("UScore\tModel\tCorrect\tDecoy\n"); for (int i = 0; i < NoBinPoints; i++) { model1.add(model_kde_x[i], decoy_kde_y[i]); model2.add(model_kde_x[i], correct_kde_y[i]); model3.add(model_kde_x[i], model_kde_y[i]); writer.write(model_kde_x[i] + "\t" + model_kde_y[i] + "\t" + correct_kde_y[i] + "\t" + decoy_kde_y[i] + "\n"); } writer.close(); MixtureModelProb = new float[NoBinPoints + 1][3]; float positiveaccu = 0f; float negativeaccu = 0f; MixtureModelProb[0][0] = (float) model2.getMaxX() + Float.MIN_VALUE; MixtureModelProb[0][1] = 1f; MixtureModelProb[0][2] = 1f; for (int i = 1; i < NoBinPoints + 1; i++) { double positiveNumber = correct_kde_y[NoBinPoints - i]; double negativeNumber = decoy_kde_y[NoBinPoints - i]; MixtureModelProb[i][0] = (float) model_kde_x[NoBinPoints - i]; positiveaccu += positiveNumber; negativeaccu += negativeNumber; MixtureModelProb[i][2] = 0.999999f * (float) (positiveNumber / (negativeNumber + positiveNumber)); MixtureModelProb[i][1] = 0.999999f * (float) (positiveaccu / (negativeaccu + positiveaccu)); } XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(model1); dataset.addSeries(model2); dataset.addSeries(model3); HistogramDataset histogramDataset = new HistogramDataset(); histogramDataset.setType(HistogramType.SCALE_AREA_TO_1); histogramDataset.addSeries("ID hits", IDObs, 100); histogramDataset.addSeries("Decoy hits", DecoyObs, 100); //histogramDataset.addSeries("Model hits", ModelObs, 100); JFreeChart chart = ChartFactory.createHistogram(FilenameUtils.getBaseName(pngfile), "Score", "Hits", histogramDataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = chart.getXYPlot(); NumberAxis domain = (NumberAxis) plot.getDomainAxis(); domain.setRange(min, max); plot.setBackgroundPaint(Color.white); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setForegroundAlpha(0.8f); chart.setBackgroundPaint(Color.white); XYLineAndShapeRenderer render = new XYLineAndShapeRenderer(); plot.setDataset(1, dataset); plot.setRenderer(1, render); plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); try { ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600); } catch (IOException e) { } }
From source file:edu.ucla.stat.SOCR.chart.demo.DotChart.java
/** * Creates a chart./*from w w w .j a v a 2 s.c o m*/ * * @param dataset the data for the chart. * * @return a chart. */ protected JFreeChart createChart1(XYDataset dataset) { //System.out.println("createChart1 called"); // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, // chart title "", // x axis label domain rangeLabel, // y axis label range dataset, // data PlotOrientation.HORIZONTAL, !legendPanelOn, // include legend true, // tooltips false // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... 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.lightGray); plot.setRangeGridlinePaint(Color.lightGray); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); // renderer.setSeriesShape(0, java.awt.Shape.round); renderer.setBaseShapesVisible(true); renderer.setBaseShapesFilled(true); renderer.setBaseLinesVisible(false); renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator()); //change the auto tick unit selection to integer units only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setAutoRangeIncludesZero(true); rangeAxis.setUpperMargin(0.01); rangeAxis.setLowerMargin(0.01); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); //domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); domainAxis.setAutoRangeIncludesZero(true); domainAxis.setTickLabelsVisible(false); domainAxis.setTickMarksVisible(false); domainAxis.setUpperMargin(5); domainAxis.setLowerMargin(0.01); // OPTIONAL CUSTOMISATION COMPLETED. setYSummary(dataset); try { // System.out.println("setting the common RangeAxis to null"); common_rangeAxis = null; common_rangeAxis = (NumberAxis) rangeAxis.clone(); // System.out.println("creating the common RangeAxis"); } catch (CloneNotSupportedException e) { System.out.println("CloneNotSupportedException!, exception caught"); } return chart; }