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

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

Introduction

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

Prototype

public void zoom(double percent) 

Source Link

Document

Performs a zoom on the plot.

Usage

From source file:audio.cords.SimplestChart.java

private static JFreeChart createChart(XYSeriesCollection data) {
    JFreeChart chart = ChartFactory.createScatterPlot(null, "X", "Y", data, PlotOrientation.VERTICAL, true,
            false, false);// www  . j av a2s .c  o  m
    XYPlot plot = (XYPlot) chart.getPlot();
    XYItemRenderer scatterRenderer = plot.getRenderer();

    //        plot.getDomainAxis().resizeRange(2);
    //        plot.getRangeAxis().resizeRange(2);
    plot.zoom(2);

    //StandardXYItemRenderer regressionRenderer = new StandardXYItemRenderer();
    //regressionRenderer.setBaseSeriesVisibleInLegend(false);
    //plot.setDataset(1, regress(data));
    //plot.setRenderer(1, regressionRenderer);
    DrawingSupplier ds = plot.getDrawingSupplier();
    for (int i = 0; i < data.getSeriesCount(); i++) {
        Paint paint = ds.getNextPaint();
        scatterRenderer.setSeriesPaint(i, paint);
        //regressionRenderer.setSeriesPaint(i, paint);
    }
    return chart;
}