Example usage for org.jfree.chart.plot XYPlot getRangeAxis

List of usage examples for org.jfree.chart.plot XYPlot getRangeAxis

Introduction

In this page you can find the example usage for org.jfree.chart.plot XYPlot getRangeAxis.

Prototype

public ValueAxis getRangeAxis() 

Source Link

Document

Returns the range axis for the plot.

Usage

From source file:de.hs.mannheim.modUro.diagram.JCellcycletimeDiagram.java

protected JFreeChart createChart(XYDataset dataset, List<String> celltypes) {
    String title = "Cell cycle times";

    JFreeChart xyLineChart = ChartFactory.createXYLineChart(title, // title
            "t", // x-axis label
            "T", // y-axis label
            dataset);//from ww w . jav a  2  s  . com

    String fontName = "Palatino";
    xyLineChart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));

    XYPlot plot = (XYPlot) xyLineChart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    plot.getRangeAxis().setLowerMargin(0.0);
    // plot.getRangeAxis().setRange(0.0, 1.01);
    plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    xyLineChart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
    xyLineChart.getLegend().setFrame(BlockBorder.NONE);
    xyLineChart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
    XYItemRenderer r = plot.getRenderer();

    // set the default stroke for all series
    int i = 0;
    for (String celltype : celltypes) {
        r.setSeriesPaint(i, CellTypeColor.getColor(celltype));
        i++;
    }
    return xyLineChart;
}

From source file:net.sf.maltcms.chromaui.foldChangeViewer.tasks.FoldChangeViewLoaderWorker.java

@Override
public void run() {
    ProgressHandle handle = ProgressHandleFactory.createHandle("Creating fold change plot");
    try {// w ww  . j  a v  a 2s .c  om
        handle.setDisplayName("Loading fold change elements");//+new File(this.files.getResourceLocation()).getName());
        handle.start(5);
        handle.progress("Reading settings", 1);
        RTUnit rtAxisUnit = RTUnit.valueOf(sp.getProperty("rtAxisUnit", "SECONDS"));
        handle.progress("Retrieving data", 2);
        XYShapeRenderer renderer = new XYShapeRenderer() {

            @Override
            protected Paint getPaint(XYDataset dataset, int series, int item) {
                double x = dataset.getXValue(series, item);
                double y = dataset.getYValue(series, item);
                if (Math.abs(x) < 1.0) {
                    Paint p = super.getPaint(dataset, series, item);
                    if (p instanceof Color) {
                        Color color = (Color) p;
                        float[] values = Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(),
                                new float[3]);
                        Color hsb = new Color(
                                Color.HSBtoRGB(values[0], (float) Math.max(0.1, values[1] - 0.9), values[2]));
                        return new Color(hsb.getRed(), hsb.getGreen(), hsb.getBlue(), 64);
                    }
                }
                return super.getPaint(dataset, series, item);
            }

        };
        renderer.setAutoPopulateSeriesFillPaint(true);
        renderer.setAutoPopulateSeriesOutlinePaint(true);
        renderer.setBaseCreateEntities(true);
        handle.progress("Building plot", 3);
        XYPlot plot = new XYPlot(dataset, new NumberAxis("log2 fold change"), new NumberAxis("-log10 p-value"),
                renderer);
        BasicStroke dashed = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 5.0f,
                new float[] { 5.0f }, 0.0f);
        ValueMarker marker = new ValueMarker(-Math.log10(0.05), Color.RED, dashed);
        marker.setLabel("p-value=0.05");
        marker.setLabelAnchor(RectangleAnchor.BOTTOM_LEFT);
        marker.setLabelOffset(new RectangleInsets(UnitType.ABSOLUTE, 0, 50, 10, 0));
        marker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
        marker.setLabelPaint(Color.LIGHT_GRAY);
        plot.addRangeMarker(marker);

        Font font1 = new Font("SansSerif", Font.PLAIN, 12);
        SelectionAwareXYTooltipGenerator tooltipGenerator = cvtc.getLookup()
                .lookup(SelectionAwareXYTooltipGenerator.class);
        if (tooltipGenerator == null) {
            tooltipGenerator = new SelectionAwareXYTooltipGenerator(tooltipGenerator) {
                @Override
                public String createSelectionAwareTooltip(XYDataset xyd, int i, int i1) {
                    FoldChangeDataset dataset = (FoldChangeDataset) xyd;
                    FoldChangeElement fce = dataset.getNamedElementProvider().get(i).get(i1);
                    StringBuilder sb = new StringBuilder();
                    sb.append("<html>");
                    sb.append(fce.getPeakGroup().getMajorityDisplayName());
                    sb.append("<br>");
                    sb.append("log2 fold change=");
                    sb.append(fce.getFoldChange());
                    sb.append("<br>");
                    sb.append("p-value=");
                    sb.append(Math.pow(10, -fce.getPvalue()));
                    sb.append("</html>");
                    return sb.toString();
                }
            };
        }
        tooltipGenerator.setXYToolTipGenerator(new XYToolTipGenerator() {
            @Override
            public String generateToolTip(XYDataset xyd, int i, int i1) {
                Comparable comp = xyd.getSeriesKey(i);
                double x = xyd.getXValue(i, i1);
                double y = xyd.getYValue(i, i1);
                StringBuilder sb = new StringBuilder();
                sb.append("<html>");
                sb.append(comp);
                sb.append("<br>");
                sb.append("log2 fold change=");
                sb.append(x);
                sb.append("<br>");
                sb.append("p-value=");
                sb.append(sb.append(Math.pow(10, -y)));
                sb.append("</html>");
                return sb.toString();
            }
        });
        plot.getRenderer().setBaseToolTipGenerator(tooltipGenerator);
        handle.progress("Configuring plot", 4);
        configurePlot(plot, rtAxisUnit);
        final FoldChangeViewPanel cmhp = cvtc.getLookup().lookup(FoldChangeViewPanel.class);
        Range domainRange = null;
        Range valueRange = null;
        if (cmhp != null) {
            XYPlot xyplot = cmhp.getPlot();
            if (xyplot != null) {
                ValueAxis domain = xyplot.getDomainAxis();
                domainRange = domain.getRange();
                ValueAxis range = xyplot.getRangeAxis();
                valueRange = range.getRange();
            }
        }

        if (domainRange != null) {
            plot.getDomainAxis().setRange(domainRange);
        }
        if (valueRange != null) {
            Logger.getLogger(getClass().getName()).info("Setting previous value range!");
        }
        handle.progress("Adding plot to panel", 5);
        final XYPlot targetPlot = plot;
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                final FoldChangeViewPanel cmhp = cvtc.getLookup().lookup(FoldChangeViewPanel.class);
                cmhp.setPlot(targetPlot);
                cvtc.requestActive();
            }
        });
    } finally {
        handle.finish();
    }
}

From source file:de.hs.mannheim.modUro.reader.JCellCountDiagram.java

protected JFreeChart createChart(XYDataset dataset, List<String> cellTypes) {
    String title = "Cell count";

    JFreeChart xyLineChart = ChartFactory.createXYLineChart(title, // title
            "t", // x-axis label
            "n", // y-axis label
            dataset);/*w w w.  j  a  va 2  s  . c  o m*/

    String fontName = "Palatino";
    xyLineChart.getTitle().setFont(new Font(fontName, Font.BOLD, 18));

    XYPlot plot = (XYPlot) xyLineChart.getPlot();
    plot.setDomainPannable(true);
    plot.setRangePannable(true);
    plot.setDomainCrosshairVisible(true);
    plot.setRangeCrosshairVisible(true);
    plot.getDomainAxis().setLowerMargin(0.0);
    plot.getDomainAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getDomainAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    plot.getRangeAxis().setLowerMargin(0.0);
    // plot.getRangeAxis().setRange(0.0, 1.01);
    plot.getRangeAxis().setLabelFont(new Font(fontName, Font.BOLD, 14));
    plot.getRangeAxis().setTickLabelFont(new Font(fontName, Font.PLAIN, 12));
    xyLineChart.getLegend().setItemFont(new Font(fontName, Font.PLAIN, 14));
    xyLineChart.getLegend().setFrame(BlockBorder.NONE);
    xyLineChart.getLegend().setHorizontalAlignment(HorizontalAlignment.CENTER);
    XYItemRenderer r = plot.getRenderer();
    // set the default stroke for all series
    int i = 0;
    for (String celltype : cellTypes) {
        r.setSeriesPaint(i, CellTypeColor.getColor(celltype));
        i++;
    }
    r.setSeriesPaint(i, Color.BLACK);
    return xyLineChart;
}

From source file:org.interpss.chart.dstab.SimpleOneStateChart.java

/**
 * create the chart based on the data attributes
 * /*from  w  ww .j av  a 2s.  c o  m*/
 */
public void createChart() {
    final JFreeChart chart = ChartFactory.createXYLineChart(plotTitle, xLabel, yLabel,
            createXYDataSet(xDataAry, yDataAry, yDataLabel), PlotOrientation.VERTICAL, true, false, false);

    final XYPlot plot = (XYPlot) chart.getPlot();
    final StandardXYItemRenderer renderer = new StandardXYItemRenderer();
    renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
    plot.setRenderer(renderer);

    //NumberAxis axis_x = (NumberAxis) plot.getDomainAxis();
    //axis_x.setRangeAboutValue(12.0, 24.0);

    final NumberAxis axisLeft = (NumberAxis) plot.getRangeAxis();
    axisLeft.setAutoRangeIncludesZero(false);
    axisLeft.setAutoRangeMinimumSize(autoRangeMinimumSize);

    final XYItemRenderer v_renderer = plot.getRenderer(0);
    v_renderer.setSeriesPaint(0, yColor);

    final ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new java.awt.Dimension(Chart_Width, Chart_Height));
    setContentPane(chartPanel);
}

From source file:test.integ.be.fedict.performance.util.PerformanceResultDialog.java

private JFreeChart getPerformanceChart(int intervalSize, List<PerformanceData> performance,
        int expectedRevoked) {
    TimeSeries series = new TimeSeries("Success");
    TimeSeries revokedSeries = new TimeSeries("Revoked");
    TimeSeries failureSeries = new TimeSeries("Failures");

    performance.remove(performance.size() - 1);
    if (performance.isEmpty()) {
        JOptionPane.showMessageDialog(null, "test did not run long enough");
        return null;
    }/*  w w w . j  ava2s .  c  o  m*/

    JFreeChart chart;

    int totalCount = 0;
    int totalRevoked = 0;
    int totalFailures = 0;

    for (PerformanceData performanceEntry : performance) {
        series.add(new Second(performanceEntry.getDate()), performanceEntry.getCount());
        totalCount += performanceEntry.getCount();

        revokedSeries.add(new Second(performanceEntry.getDate()), performanceEntry.getRevoked());
        totalRevoked += performanceEntry.getRevoked();

        failureSeries.add(new Second(performanceEntry.getDate()), performanceEntry.getFailures());
        totalFailures += performanceEntry.getFailures();
    }

    TimeSeriesCollection dataset = new TimeSeriesCollection();
    dataset.addSeries(series);
    dataset.addSeries(revokedSeries);
    dataset.addSeries(failureSeries);
    chart = ChartFactory.createTimeSeriesChart("eID Trust Service Performance History",
            "Time (interval size " + intervalSize + " msec)", "Number of XKMS requests", dataset, true, false,
            false);

    chart.addSubtitle(new TextTitle(performance.get(0).getDate().toString() + " - "
            + performance.get(performance.size() - 1).getDate().toString()));

    TextTitle info = new TextTitle("Total number of successful requests: " + totalCount);
    info.setTextAlignment(HorizontalAlignment.LEFT);
    info.setPosition(RectangleEdge.BOTTOM);
    chart.addSubtitle(info);

    TextTitle info2 = new TextTitle(
            "Total number of revoked: " + totalRevoked + " expected=" + expectedRevoked);
    info2.setPosition(RectangleEdge.BOTTOM);
    info2.setTextAlignment(HorizontalAlignment.LEFT);
    chart.addSubtitle(info2);

    TextTitle info3 = new TextTitle("Total number of failures: " + totalFailures);
    info3.setPosition(RectangleEdge.BOTTOM);
    info3.setTextAlignment(HorizontalAlignment.LEFT);
    chart.addSubtitle(info3);

    chart.setBackgroundPaint(Color.WHITE);
    XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    DateAxis axis = (DateAxis) plot.getDomainAxis();
    axis.setDateFormatOverride(new SimpleDateFormat("HH:mm:ss"));
    ValueAxis valueAxis = plot.getRangeAxis();
    valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    plot.setRangeGridlinePaint(Color.black);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRenderer(renderer);

    return chart;
}

From source file:net.sf.maltcms.chromaui.chromatogram1Dviewer.tasks.ChromatogramViewLoaderWorker.java

@Override
public void run() {
    ProgressHandle handle = ProgressHandleFactory.createHandle("Creating 1D Chromatogram plot");
    try {/*www . j a  v a  2  s.co m*/
        handle.setDisplayName("Loading " + files.size() + " chromatograms");//+new File(this.files.getResourceLocation()).getName());
        handle.start(5);
        Logger.getLogger(getClass().getName()).info("Running Chromatogram open action!");

        Logger.getLogger(getClass().getName()).info("Storing current viewport!");

        Logger.getLogger(getClass().getName()).info("Retrieving settings from panel");
        handle.progress("Reading settings", 1);
        double massResolution = Double.parseDouble(sp.getProperty("massResolution", "1.0"));
        double[] masses = null;
        String[] massesStrings = (sp.getProperty("selectedMasses", "73.0 147.0")).trim().split(" ");
        masses = new double[massesStrings.length];
        for (int i = 0; i < massesStrings.length; i++) {
            masses[i] = Double.parseDouble(massesStrings[i]);
        }
        String plotMode = sp.getProperty("plotMode", "TIC");
        String plotType = sp.getProperty("plotType", "SIDE");
        RTUnit rtAxisUnit = RTUnit.valueOf(sp.getProperty("rtAxisUnit", "SECONDS"));

        //        boolean autoRange = Boolean.parseBoolean(sp.getProperty("autoRange","true"));
        //        if(autoRange) {
        //            
        //        }
        //        
        //        double minRT = Double.parseDouble(sp.getProperty("timeRangeMin"));
        //        double maxRT = Double.parseDouble(sp.getProperty("timeRangeMax"));
        //        MinMax mm = MAMath.getMinMax(file.getScanAcquisitionTime());
        //        
        handle.progress("Retrieving peaks", 2);
        Chromatogram1DChartProvider c1p = new Chromatogram1DChartProvider();
        c1p.setRenderer(settingsPanel.getRenderer());

        //            c1p.setPeakData(filePeakMap);
        //        c1p.setScanRange(file.getIndexFor(Math.max(mm.min, minRT)),file.getIndexFor(Math.min(mm.max, maxRT)));
        XYPlot plot = null;
        Logger.getLogger(getClass().getName()).log(Level.INFO, "Plot mode is {0}", plotMode);
        SelectionAwareXYTooltipGenerator tooltipGenerator = cvtc.getLookup()
                .lookup(SelectionAwareXYTooltipGenerator.class);
        if (tooltipGenerator == null) {
            tooltipGenerator = new SelectionAwareXYTooltipGenerator(tooltipGenerator) {
                @Override
                public String createSelectionAwareTooltip(XYDataset xyd, int i, int i1) {
                    return null;
                }
            };
        }
        handle.progress("Building plot", 3);
        switch (plotMode) {
        case "TIC":
            Logger.getLogger(getClass().getName()).info("Loading TIC");
            switch (plotType) {
            case "SIDE":
                plot = c1p.provide1DPlot(dataset, tooltipGenerator);
                break;
            case "TOP":
                plot = c1p.provide1DCoPlot(new TopViewDataset<>(dataset), tooltipGenerator, dataset.getMinY(),
                        dataset.getMaxY(), true);
                break;
            }
            break;
        case "EIC-SUM": {
            Logger.getLogger(getClass().getName()).info("Loading EIC-SUM");
            EIC1DDataset ds = new EIC1DDataset(dataset.getNamedElementProvider(), masses, massResolution,
                    EIC1DDataset.TYPE.SUM, new ProxyLookup(dataset.getLookup()));
            switch (plotType) {
            case "SIDE":
                plot = c1p.provide1DEICSUMPlot(ds, tooltipGenerator, masses, massResolution, true);
                break;
            case "TOP":
                plot = c1p.provide1DCoPlot(new TopViewDataset<>(ds), tooltipGenerator, ds.getMinY(),
                        ds.getMaxY(), true);
                break;
            }
            break;
        }
        case "EIC-COPLOT": {
            Logger.getLogger(getClass().getName()).info("Loading EIC-COPLOT");
            EIC1DDataset ds = new EIC1DDataset(dataset.getNamedElementProvider(), masses, massResolution,
                    EIC1DDataset.TYPE.CO, new ProxyLookup(dataset.getLookup()));
            switch (plotType) {
            case "SIDE":
                plot = c1p.provide1DEICCOPlot(ds, tooltipGenerator, masses, massResolution, true);
                break;
            case "TOP":
                plot = c1p.provide1DCoPlot(new TopViewDataset<>(ds), tooltipGenerator, ds.getMinY(),
                        ds.getMaxY(), true);
                break;
            }
            break;
        }
        }

        handle.progress("Configuring plot", 4);
        configurePlot(plot, rtAxisUnit);

        final Chromatogram1DViewPanel cmhp = cvtc.getLookup().lookup(Chromatogram1DViewPanel.class);
        Range domainRange = null;
        Range valueRange = null;
        if (cmhp != null) {
            XYPlot xyplot = cmhp.getPlot();
            if (xyplot != null) {
                ValueAxis domain = xyplot.getDomainAxis();
                domainRange = domain.getRange();
                ValueAxis range = xyplot.getRangeAxis();
                valueRange = range.getRange();
            }
        }

        if (domainRange != null) {
            Logger.getLogger(getClass().getName()).info("Setting previous domain range!");
            plot.getDomainAxis().setRange(domainRange);
        }
        if (valueRange != null) {
            Logger.getLogger(getClass().getName()).info("Setting previous value range!");
            plot.getRangeAxis().setRange(valueRange);
        }
        handle.progress("Adding plot to panel", 5);
        final XYPlot targetPlot = plot;
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                final Chromatogram1DViewPanel cmhp = cvtc.getLookup().lookup(Chromatogram1DViewPanel.class);
                cmhp.setPlot(targetPlot);
                cvtc.requestActive();
            }
        });
    } finally {
        handle.finish();
    }
}

From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java

/**
 * Returns dimensions for limiting factor width or height
 * /*w  w w.j  a v  a2 s  .  com*/
 * @param myChart
 * @return
 */
public static Dimension calcMaxSize(ChartViewer myChart, double chartWidth, double chartHeight) {
    makeChartResizable(myChart);
    // paint on a ghost panel
    myChart.getCanvas().draw();

    XYPlot plot = (XYPlot) myChart.getChart().getPlot();
    ChartRenderingInfo info = myChart.getRenderingInfo();
    Rectangle2D dataArea = info.getPlotInfo().getDataArea();
    Rectangle2D chartArea = info.getChartArea();

    // calc title space: will be added later to the right plot size
    double titleWidth = chartArea.getWidth() - dataArea.getWidth();
    double titleHeight = chartArea.getHeight() - dataArea.getHeight();

    // calculatig width for max height

    // calc right plot size with axis dim.
    // real plot width is given by factor;
    double realPH = chartHeight - titleHeight;

    // ranges
    ValueAxis domainAxis = plot.getDomainAxis();
    org.jfree.data.Range x = domainAxis.getRange();
    ValueAxis rangeAxis = plot.getRangeAxis();
    org.jfree.data.Range y = rangeAxis.getRange();

    // real plot height can be calculated by
    double realPW = realPH / y.getLength() * x.getLength();

    double width = realPW + titleWidth;
    // if width is higher than given chartWidth then calc height for chartWidth
    if (width > chartWidth) {
        // calc right plot size with axis dim.
        // real plot width is given by factor;
        realPW = chartWidth - titleWidth;

        // real plot height can be calculated by
        realPH = realPW / x.getLength() * y.getLength();

        double height = realPH + titleHeight;
        // Return size
        return new Dimension((int) chartWidth, (int) height);
    } else {
        // Return size
        return new Dimension((int) width, (int) chartHeight);
    }
}

From source file:speedbagalg.OscopeView.java

private void vMaxSpinnerStateChanged(javax.swing.event.ChangeEvent evt)//GEN-FIRST:event_vMaxSpinnerStateChanged
{//GEN-HEADEREND:event_vMaxSpinnerStateChanged
    final XYPlot plot = chart.getXYPlot();
    ValueAxis axis = plot.getRangeAxis();
    axis.setAutoRange(false);/*from  w  ww  . ja  v  a 2s. c  o m*/
    vMax = (int) vMaxSpinner.getValue();
    axis.setRange(vMin, vMax);
}

From source file:EHRAppointment.ChartPanelDraw.java

private ChartPanel createChart(XYDataset dataset, String type) {
    final JFreeChart chart = ChartFactory.createTimeSeriesChart(type, "Date", getValueAxis(), dataset);

    chart.setBackgroundPaint(Color.white);

    final XYPlot plot = chart.getXYPlot();
    plot.setBackgroundPaint(Color.WHITE);
    plot.setDomainGridlinePaint(Color.black);
    plot.setRangeGridlinePaint(Color.black);

    final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    renderer.setSeriesLinesVisible(0, true);
    plot.setRenderer(renderer);/* w  w  w  .j  ava2s . c o  m*/

    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    return new ChartPanel(chart);
}

From source file:edu.ucla.stat.SOCR.chart.demo.LineChartDemo3.java

/**
 * Creates a chart.//from w w w.  java  2 s. c o  m
 * 
 * @param dataset  a dataset.
 * 
 * @return A chart based on the supplied dataset.
 */
protected JFreeChart createChart(XYDataset dataset) {

    JFreeChart chart = ChartFactory.createXYLineChart(chartTitle, // chart title
            domainLabel, // x axis label
            rangeLabel, // y axis label
            dataset, // data
            PlotOrientation.VERTICAL, !legendPanelOn, // include legend
            true, // tooltips
            false // urls
    );

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...

    // get a reference to the plot for further customisation...
    XYPlot plot = (XYPlot) chart.getPlot();
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer();
    renderer.setBaseShapesVisible(true);
    renderer.setBaseShapesFilled(true);
    renderer.setDrawOutlines(true);
    renderer.setLegendItemLabelGenerator(new SOCRXYSeriesLabelGenerator());

    // change the auto tick unit selection to integer units only...
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    setXSummary(dataset);
    return chart;
}