List of usage examples for org.jfree.chart.axis NumberAxis createIntegerTickUnits
public static TickUnitSource createIntegerTickUnits()
From source file:j2se.jfreechart.barchart.BarChartDemo7.java
/** * Creates a sample chart.//from w ww .j av a 2s. c om * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 7", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final IntervalMarker target = new IntervalMarker(4.5, 7.5); target.setLabel("Target Range"); target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11)); target.setLabelAnchor(RectangleAnchor.LEFT); target.setLabelTextAnchor(TextAnchor.CENTER_LEFT); target.setPaint(new Color(222, 222, 255, 128)); plot.addRangeMarker(target, Layer.BACKGROUND); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); renderer.setItemMargin(0.10); // set up gradient paints for series... final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); // renderer.setLabelGenerator(new BarChartDemo7.LabelGenerator()); renderer.setItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, -Math.PI / 2.0); renderer.setPositiveItemLabelPosition(p); final ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT, TextAnchor.CENTER_LEFT, -Math.PI / 2.0); renderer.setPositiveItemLabelPositionFallback(p2); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:ReportGen.java
private void yearlyPreview() throws NumberFormatException { exportcounttableexcel.setEnabled(true); exportcounttablepdf.setEnabled(true); tableModel = (DefaultTableModel) dataTable.getModel(); tableModel.getDataVector().removeAllElements(); tableModel.fireTableDataChanged();/*from w w w .j av a 2 s .c o m*/ String str[] = { "Years", "Values" }; tableModel.setColumnIdentifiers(str); ChartPanel chartPanel; displaypane.removeAll(); displaypane.revalidate(); displaypane.repaint(); displaypane.setLayout(new BorderLayout()); //row String series1 = "Results"; //column String year[] = { "2014", "2015", "2016", "2017", "2018", "2019", "2020" }; dataset = new DefaultCategoryDataset(); dataset.addValue(0, series1, year[0]); dataset.addValue(1, series1, year[1]); dataset.addValue(2, series1, year[2]); dataset.addValue(3, series1, year[3]); dataset.addValue(4, series1, year[4]); dataset.addValue(5, series1, year[5]); dataset.addValue(6, series1, year[6]); chart = ChartFactory.createBarChart("181 North Place Residences Graph", // chart title "Years", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); // set up gradient paints for series... final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); final org.jfree.chart.axis.CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); chartPanel = new ChartPanel(chart); displaypane.add(chartPanel, BorderLayout.CENTER); }
From source file:syg_package01.PanelRysunek.java
private void initGUI() { try {//from ww w . j a v a 2 s. com GridLayout thisLayout = new GridLayout(1, 1); thisLayout.setHgap(5); thisLayout.setVgap(5); thisLayout.setColumns(1); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); if (this.wykres) { double punkt = this.sygnalWyswietlany.gett1(); double punktZapisu = this.sygnalWyswietlany.gett1(); XYSeries series = new XYSeries("Wykres"); double krok; int typ = this.sygnalWyswietlany.gettyp(); double f = 1.0 / this.sygnalWyswietlany.getT(); double t = this.sygnalWyswietlany.gett1(); // if (this.sygnalWyswietlany.gettyp()==1){ /* * for (double i = this.sygnalWyswietlany.gett1(); i < * this.sygnalWyswietlany.t1+this.sygnalWyswietlany.getts(); * i++){ punkt= this.sygnalWyswietlany.wykres_punkty(punkt, i); * series.add(i, punkt)} ; */ double ta = this.sygnalWyswietlany.gett1(); if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY || sygnalWyswietlany.getPunktyY().size() <= 0) { while (ta <= this.sygnalWyswietlany.gett1() + this.sygnalWyswietlany.getd()) { // punkt=this.sygnalWyswietlany.sygnalS1(); punkt = this.sygnalWyswietlany.wykres_punkty(punkt, ta); this.sygnalWyswietlany.setPunktyY(punkt); // punkt=this.sygnalWyswietlany.sygnalS3(ta); series.add(ta, punkt); if (this.sygnalWyswietlany.gettyp() < 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } } else if (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.DYSKRETNY && sygnalWyswietlany.getPunktyY().size() > 0) { int iloscProbek = (int) (this.sygnalWyswietlany.getPunktyY().size()); for (int i = 0; i < iloscProbek; i++) { // punkt=this.sygnalWyswietlany.sygnalS1(); punkt = this.sygnalWyswietlany.getPunktzindexu(i); // punkt=this.sygnalWyswietlany.sygnalS3(ta); series.add(ta, punkt); if (this.sygnalWyswietlany.gettyp() < 10) ta = ta + this.sygnalWyswietlany.getkroczek(); else ta = ta + this.sygnalWyswietlany.getkroczek() * 10; } } // this.sygnalWyswietlany.ustawPunkty(); /* * int liczba= this.sygnalWyswietlany.punktyY.size(); int * liczba2= 0; * * while (liczba2<liczba) { ta= ta+ * this.sygnalWyswietlany.getkroczek(); * series.add(ta,this.sygnalWyswietlany * .getPunktzindexu(liczba2)); * * } */ XYSeriesCollection dataset = new XYSeriesCollection(series); // JFreeChart chart = ChartFactory.createHistogram("Histogram", // "x", "y", dataset, PlotOrientation.VERTICAL, false, false, // false); JFreeChart chart; /* * JFreeChart chart = ChartFactory.createScatterPlot("Wykres", * "t[s]", "Warto", dataset, PlotOrientation.VERTICAL, false, * false, false); */ if ((this.sygnalWyswietlany.gettyp() < 10) || (this.sygnalWyswietlany.getrodzaj() == rodzaj_sygnalu.CIAGLY)) { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, false); } else { chart = ChartFactory.createXYLineChart(null, null, null, dataset, PlotOrientation.VERTICAL, true, true, true); final XYPlot plot = chart.getXYPlot(); // plot.setBackgroundPaint(Color.lightGray); // plot.setDomainGridlinePaint(Color.white); // plot.setRangeGridlinePaint(Color.white); // final XYLineAndShapeRenderer renderer = new // XYLineAndShapeRenderer(); final XYDotRenderer renderer = new XYDotRenderer(); renderer.setDotHeight(3); renderer.setDotWidth(3); plot.setRenderer(renderer); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } // ChartPanel chartpanel = new ChartPanel(wykres2); ChartPanel chartpanel = new ChartPanel(chart); chartpanel.setDomainZoomable(true); this.add(chartpanel); } Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this); } catch (Exception e) { e.printStackTrace(); } }
From source file:grafici.MediciBarChart.java
/** * Creates a sample chart./*from w ww. j av a2 s. c o m*/ * * @param dataset * the dataset. * * @return The chart. */ private static JFreeChart createChart(CategoryDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createBarChart(titolo, // chart // title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... CategoryPlot plot = (CategoryPlot) chart.getPlot(); // ****************************************************************** // More than 150 demo applications are included with the JFreeChart // Developer Guide...for more information, see: // // > http://www.object-refinery.com/jfreechart/guide.html // // ****************************************************************** // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); // set up gradient paints for series... GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:de.mpg.mpi_inf.bioinf.netanalyzer.ui.charts.JFreeChartConn.java
/** * Creates a histogram chart that displays the given long histogram data. * //from w w w .ja v a2 s.com * @param aHistogram * Complex parameter that stores the data to be visualized. * @param aSettings * Settings group for long histogram. * @return Newly created chart control. */ public static JFreeChart createHistogram(LongHistogram aHistogram, LongHistogramGroup aSettings) { XYSeriesCollection collection = fromLongHistogram(aHistogram); JFreeChart chart = ChartFactory.createHistogram(null, // title convertLabel(aSettings.axes.getDomainAxisLabel()), // label of X axis convertLabel(aSettings.axes.getRangeAxisLabel()), // label of Y axis collection, // dataset PlotOrientation.VERTICAL, // orientation false, // create legend false, // display tooltips false); // generate urls XYPlot plot = chart.getXYPlot(); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); updateGeneral(plot, aSettings.general); updateAxes(chart, aSettings.axes, aSettings.grid); updateBars(plot, aSettings.bars); chart.setBackgroundPaint(null); return chart; }
From source file:org.mars_sim.msp.ui.swing.demo.BarChartDemo7.java
/** * Creates a sample chart./*from w w w . jav a2 s . c o m*/ * * @param dataset the dataset. * * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart("Bar Chart Demo 7", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation false, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(Color.white); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); final IntervalMarker target = new IntervalMarker(4.5, 7.5); target.setLabel("Target Range"); target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11)); target.setLabelAnchor(RectangleAnchor.LEFT); target.setLabelTextAnchor(TextAnchor.CENTER_LEFT); target.setPaint(new Color(222, 222, 255, 128)); plot.addRangeMarker(target, Layer.BACKGROUND); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); //renderer.setItemMargin(0.10); renderer.setMaximumBarWidth(.5); // set maximum width to 35% of chart // set up gradient paints for series... final GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, Color.lightGray); final GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, Color.lightGray); renderer.setSeriesPaint(0, gp0); renderer.setSeriesPaint(1, gp1); renderer.setSeriesPaint(2, gp2); // renderer.setLabelGenerator(new BarChartDemo7.LabelGenerator()); renderer.setDefaultItemLabelsVisible(true); final ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, TextAnchor.CENTER_RIGHT, TextAnchor.CENTER_RIGHT, -Math.PI / 2.0); renderer.setDefaultPositiveItemLabelPosition(p); final ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.CENTER_LEFT, TextAnchor.CENTER_LEFT, -Math.PI / 2.0); renderer.setPositiveItemLabelPositionFallback(p2); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }
From source file:org.tap4j.plugin.util.GraphHelper.java
/** * Creates the graph displayed on Method results page to compare execution * duration and status of a test method across builds. * /*from w w w . ja v a2 s.c o m*/ * At max, 9 older builds are displayed. * * @param req * request * @param dataset * data set to be displayed on the graph * @param statusMap * a map with build as key and the test methods execution status * (result) as the value * @param methodUrl * URL to get to the method from a build test result page * @return the chart */ public static JFreeChart createMethodChart(StaplerRequest req, final CategoryDataset dataset, final Map<NumberOnlyBuildLabel, String> statusMap, final String methodUrl) { final JFreeChart chart = ChartFactory.createBarChart(null, // chart // title null, // unused " Duration (secs)", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips true // urls ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... chart.setBackgroundPaint(Color.white); chart.removeLegend(); final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.WHITE); plot.setOutlinePaint(null); plot.setForegroundAlpha(0.8f); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.black); CategoryAxis domainAxis = new ShiftedCategoryAxis(null); plot.setDomainAxis(domainAxis); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_90); domainAxis.setLowerMargin(0.0); domainAxis.setUpperMargin(0.0); domainAxis.setCategoryMargin(0.0); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer br = new BarRenderer() { private static final long serialVersionUID = 961671076462240008L; Map<String, Paint> statusPaintMap = new HashMap<String, Paint>(); { statusPaintMap.put("PASS", ColorPalette.BLUE); statusPaintMap.put("SKIP", ColorPalette.YELLOW); statusPaintMap.put("FAIL", ColorPalette.RED); } /** * Returns the paint for an item. Overrides the default behavior * inherited from AbstractSeriesRenderer. * * @param row * the series. * @param column * the category. * * @return The item color. */ public Paint getItemPaint(final int row, final int column) { NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column); Paint paint = statusPaintMap.get(statusMap.get(label)); // when the status of test method is unknown, use gray color return paint == null ? Color.gray : paint; } }; br.setBaseToolTipGenerator(new CategoryToolTipGenerator() { public String generateToolTip(CategoryDataset dataset, int row, int column) { NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(column); if ("UNKNOWN".equals(statusMap.get(label))) { return "unknown"; } // values are in seconds return dataset.getValue(row, column) + " secs"; } }); br.setBaseItemURLGenerator(new CategoryURLGenerator() { public String generateURL(CategoryDataset dataset, int series, int category) { NumberOnlyBuildLabel label = (NumberOnlyBuildLabel) dataset.getColumnKey(category); if ("UNKNOWN".equals(statusMap.get(label))) { // no link when method result doesn't exist return null; } // return label.build.getUpUrl() + label.build.getNumber() + "/" + PluginImpl.URL + "/" + methodUrl; return label.build.getUpUrl() + label.build.getNumber() + "/tap/" + methodUrl; } }); br.setItemMargin(0.0); br.setMinimumBarLength(5); // set the base to be 1/100th of the maximum value displayed in the // graph br.setBase(br.findRangeBounds(dataset).getUpperBound() / 100); plot.setRenderer(br); // crop extra space around the graph plot.setInsets(new RectangleInsets(0, 0, 0, 5.0)); return chart; }
From source file:edu.wpi.cs.wpisuitetng.modules.requirementmanager.view.requirements.NewBarChartPanel.java
/** * @param dataset the data to be shown by the chart * @param title the title of the chart(either status or iteration) @return * the created bar graph//from www . j av a 2 s . c om */ private static JFreeChart createChart(CategoryDataset dataset, String title) { JFreeChart chart = ChartFactory.createBarChart(title, // chart title "Name", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, false); chart.setBackgroundPaint(Color.white); CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return chart; }
From source file:edu.ucla.stat.SOCR.chart.SuperIndexChart.java
/** * Creates a chart./* w w w. j a va 2 s . c om*/ * * @param dataset the dataset. * * @return a chart. */ protected JFreeChart createChart(XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, // chart title domainLabel, // x axis label rangeLabel, // y axis label 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.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:org.jfree.chart.demo.PlotOrientationDemo.java
/** * Creates a sample chart.// w w w.ja v a2s .c o m * * @param index the chart index. * @param dataset the dataset. * * @return A chart. */ private JFreeChart createChart(int index, XYDataset dataset) { // create the chart... JFreeChart chart = ChartFactory.createXYLineChart("Chart " + (index + 1), // chart title "X", // x axis label "Y", // y axis label dataset, // data PlotOrientation.VERTICAL, false, // include legend false, // 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 = 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); StandardXYItemRenderer renderer = (StandardXYItemRenderer) plot.getRenderer(); renderer.setPlotShapes(true); renderer.setShapesFilled(true); // change the auto tick unit selection to integer units only... ValueAxis domainAxis = plot.getDomainAxis(); domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ValueAxis rangeAxis = plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }