Example usage for org.jfree.chart.axis NumberAxis setAutoRange

List of usage examples for org.jfree.chart.axis NumberAxis setAutoRange

Introduction

In this page you can find the example usage for org.jfree.chart.axis NumberAxis setAutoRange.

Prototype

public void setAutoRange(boolean auto) 

Source Link

Document

Sets a flag that determines whether or not the axis range is automatically adjusted to fit the data, and notifies registered listeners that the axis has been modified.

Usage

From source file:com.cwctravel.hudson.plugins.multimoduletests.TrendGraph.java

@Override
protected JFreeChart createGraph() {
    final CategoryDataset dataset = createDataSet().build();

    final JFreeChart chart = ChartFactory.createStackedAreaChart(null, // chart
            // title
            null, // unused
            yLabel, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );/*ww  w .  jav a 2s.  c o  m*/

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    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();
    ChartUtil.adjustChebyshev(dataset, rangeAxis);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRange(true);

    StackedAreaRenderer ar = new StackedAreaRenderer2() {
        private static final long serialVersionUID = 7962375662395944968L;

        @Override
        public Paint getItemPaint(int row, int column) {
            ChartLabel key = (ChartLabel) dataset.getColumnKey(column);
            if (key.getColor() != null)
                return key.getColor();
            return super.getItemPaint(row, column);
        }

        @Override
        public String generateURL(CategoryDataset dataset, int row, int column) {
            ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
            return prefixUrl + label.getURL() + suffixUrl;
        }

        @Override
        public String generateToolTip(CategoryDataset dataset, int row, int column) {
            ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
            return label.getToolTipText();
        }
    };
    plot.setRenderer(ar);

    ar.setSeriesPaint(0, ColorPalette.RED); // Skips.
    ar.setSeriesPaint(1, ColorPalette.YELLOW); // Failures.
    ar.setSeriesPaint(2, ColorPalette.BLUE); // Total.

    // crop extra space around the graph
    plot.setInsets(new RectangleInsets(0, 0, 0, 5.0));

    return chart;
}

From source file:org.usfirst.frc.team2084.neuralnetwork.HeadingNeuralNetworkTrainer.java

public HeadingNeuralNetworkTrainer() {
    outputGraphNetworkSeries = new XYSeries("Network Prediction");
    outputGraphDataSeries = new XYSeries("Error");
    final XYSeriesCollection data = new XYSeriesCollection();
    data.addSeries(outputGraphDataSeries);
    data.addSeries(outputGraphNetworkSeries);
    outputGraph = ChartFactory.createXYLineChart("Error vs. Output", "Time", "Error", data,
            PlotOrientation.VERTICAL, true, true, false);

    NumberAxis xAxis = new NumberAxis();
    xAxis.setRange(new Range(-Math.PI, Math.PI));
    xAxis.setAutoRange(false);
    NumberAxis yAxis = new NumberAxis();
    yAxis.setRange(new Range(-1, 1));

    XYPlot plot = (XYPlot) outputGraph.getPlot();
    plot.setDomainAxis(xAxis);/*  w  w w .j av a  2 s.  co  m*/
    plot.setRangeAxis(yAxis);

    network = new Network(new int[] { 1, 5, 1 }, eta, momentum, new TransferFunction.HyperbolicTangent());

    try {
        SwingUtilities.invokeAndWait(() -> {
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            final Container content = frame.getContentPane();
            content.setLayout(new BorderLayout());

            outputGraphPanel = new ChartPanel(outputGraph);
            outputGraphPanel.setDomainZoomable(false);
            outputGraphPanel.setRangeZoomable(false);
            graphPanel.add(outputGraphPanel);

            graphPanel.setLayout(new GridLayout(1, 1));
            content.add(graphPanel, BorderLayout.CENTER);
            {

                JLabel etaLabel = new JLabel("Eta:");
                etaLabel.setLabelFor(etaField);
                etaField.setText(Double.toString(network.getEta()));
                etaField.setColumns(5);
                etaField.addPropertyChangeListener("value",
                        (evt) -> eta = ((Number) evt.getNewValue()).doubleValue());
                controlPanel.add(etaLabel);
                controlPanel.add(etaField);

                JLabel momentumLabel = new JLabel("Momentum:");
                momentumLabel.setLabelFor(etaField);
                momentumField.setText(Double.toString(network.getMomentum()));
                momentumField.setColumns(5);
                momentumField.addPropertyChangeListener("value",
                        (evt) -> momentum = ((Number) evt.getNewValue()).doubleValue());
                controlPanel.add(momentumLabel);
                controlPanel.add(momentumField);

                JLabel iterationsLabel = new JLabel("Iterations:");
                iterationsLabel.setLabelFor(iterationsField);
                iterationsField.setText(Integer.toString(iterations));
                iterationsField.setColumns(10);
                iterationsField.addPropertyChangeListener("value",
                        (evt) -> iterations = ((Number) evt.getNewValue()).intValue());
                controlPanel.add(iterationsLabel);
                controlPanel.add(iterationsField);
            }

            chooseDataButton.addActionListener((e) -> {
                if (dataDirectoryChooser.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) {
                    dataDirectory = dataDirectoryChooser.getSelectedFile();
                    displayData();
                }
            });
            controlPanel.add(chooseDataButton);

            trainButton.addActionListener((e) -> trainNetwork());
            controlPanel.add(trainButton);

            saveButton.addActionListener((e) -> {
                saveNetwork();
            });
            controlPanel.add(saveButton);

            content.add(controlPanel, BorderLayout.SOUTH);

            dataDirectoryChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        });
    } catch (InvocationTargetException | InterruptedException e) {
        e.printStackTrace();
    }
}

From source file:hudson.plugins.measurement_plots.Graph.java

protected org.jfree.chart.JFreeChart createGraph() {
    final org.jfree.data.category.CategoryDataset dataset = getDataSetBuilder().build();

    final org.jfree.chart.JFreeChart chart = org.jfree.chart.ChartFactory.createStackedAreaChart(title, // chart title
            null, // unused
            null, // range axis label
            dataset, // data
            org.jfree.chart.plot.PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );/*from   w  ww.j  a v  a  2 s.c  o  m*/

    chart.setBackgroundPaint(java.awt.Color.white);

    final org.jfree.chart.plot.CategoryPlot plot = chart.getCategoryPlot();

    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(java.awt.Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setForegroundAlpha(0.8f);
    // plot.setDomainGridlinesVisible(true);
    // plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(java.awt.Color.black);

    org.jfree.chart.axis.CategoryAxis domainAxis = new hudson.util.ShiftedCategoryAxis(null);
    plot.setDomainAxis(domainAxis);
    domainAxis.setCategoryLabelPositions(org.jfree.chart.axis.CategoryLabelPositions.UP_90);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    domainAxis.setCategoryMargin(0.0);

    final org.jfree.chart.axis.NumberAxis rangeAxis = (org.jfree.chart.axis.NumberAxis) plot.getRangeAxis();
    hudson.util.ChartUtil.adjustChebyshev(dataset, rangeAxis);
    rangeAxis.setStandardTickUnits(org.jfree.chart.axis.NumberAxis.createIntegerTickUnits());
    rangeAxis.setAutoRange(true);

    org.jfree.chart.renderer.category.StackedAreaRenderer areaRenderer = new hudson.util.StackedAreaRenderer2() {

        @Override
        public java.awt.Paint getItemPaint(int row, int column) {
            GraphLabel key = (GraphLabel) dataset.getColumnKey(column);
            if (key.getColor() != null) {
                return key.getColor();
            }
            return super.getItemPaint(row, column);
        }

        @Override
        public String generateURL(org.jfree.data.category.CategoryDataset dataset, int row, int column) {
            GraphLabel label = (GraphLabel) dataset.getColumnKey(column);
            return label.getUrl();
        }

        @Override
        public String generateToolTip(org.jfree.data.category.CategoryDataset dataset, int row, int column) {
            GraphLabel label = (GraphLabel) dataset.getColumnKey(column);
            return label.getToolTip();
        }
    };
    plot.setRenderer(areaRenderer);
    areaRenderer.setSeriesPaint(2, hudson.util.ColorPalette.BLUE);

    // crop extra space around the graph
    plot.setInsets(new org.jfree.ui.RectangleInsets(0, 0, 0, 5.0));

    return chart;
}

From source file:com.wsntools.iris.tools.Graph.java

private void setupChartType(JFreeChart chart) {

    chart.setBackgroundPaint(Color.white);

    // plot = chart.getCategoryPlot();
    plot = chart.getXYPlot();//from  w  ww . j av a2 s  .c  o m
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinePaint(Color.white);
    // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 4, 4, 4, 4));

    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();

    rangeAxis.setAutoRangeIncludesZero(false);
    rangeAxis.setAutoRange(true);
    domainAxis.setAutoRangeIncludesZero(false);
    rangeAxis.setAutoRange(true);
    domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    chartPanel.setChart(chart);
}

From source file:gov.nih.nci.caintegrator.plots.kaplanmeier.JFreeChartIKMPlottermpl.java

public JFreeChart createKMPlot(Collection<GroupCoordinates> groupsToBePlotted, String title, String xAxisLabel,
        String yAxisLabel) {// w ww . j  av a2 s . c  o m
    List<KMPlotPointSeriesSet> kmPlotSets = new ArrayList<KMPlotPointSeriesSet>(
            convertToKaplanMeierPlotPointSeriesSet(groupsToBePlotted));

    XYSeriesCollection finalDataCollection = new XYSeriesCollection();
    /*  Repackage all the datasets to go into the XYSeriesCollection */
    for (KMPlotPointSeriesSet dataSet : kmPlotSets) {
        finalDataCollection.addSeries(dataSet.getCensorPlotPoints());
        finalDataCollection.addSeries(dataSet.getProbabilityPlotPoints());

    }

    JFreeChart chart = ChartFactory.createXYLineChart("", xAxisLabel, yAxisLabel, finalDataCollection,
            PlotOrientation.VERTICAL, true, //legend
            true, //tooltips
            false//urls
    );
    XYPlot plot = (XYPlot) chart.getPlot();
    /*
     * Ideally the actual Renderer settings should have been created
     * at the survivalLength of iterating KaplanMeierPlotPointSeriesSets, adding them to the actual
     * Data Set that is going to be going into the Chart plotter.  But you have no idea how
     * they are going to be sitting in the Plot dataset so there is no guarantee that setting the
     * renderer based on a supposed index will actually work. In fact
     */

    XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer();
    for (int i = 0; i < finalDataCollection.getSeriesCount(); i++) {
        KMPlotPointSeries kmSeries = (KMPlotPointSeries) finalDataCollection.getSeries(i);

        if (kmSeries.getType() == KMPlotPointSeries.SeriesType.CENSOR) {
            renderer.setSeriesLinesVisible(i, false);
            renderer.setSeriesShapesVisible(i, true);
            renderer.setSeriesShape(i, getCensorShape());
        } else if (kmSeries.getType() == KMPlotPointSeries.SeriesType.PROBABILITY) {
            renderer.setSeriesLinesVisible(i, true);
            renderer.setSeriesShapesVisible(i, false);

        } else {
            //don't show this set as it is not a known type
            renderer.setSeriesLinesVisible(i, false);
            renderer.setSeriesShapesVisible(i, false);
        }
        renderer.setSeriesPaint(i, getKMSetColor(kmPlotSets, kmSeries.getKey(), kmSeries.getType()), true);
    }

    renderer.setToolTipGenerator(new StandardXYToolTipGenerator());
    renderer.setDefaultEntityRadius(6);
    plot.setRenderer(renderer);

    /* change the auto tick unit selection to integer units only... */
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits());

    /* OPTIONAL CUSTOMISATION COMPLETED. */
    rangeAxis.setAutoRange(true);
    rangeAxis.setRange(0.0, 1.0);

    /* set Title and Legend */
    chart.setTitle(title);
    createLegend(chart, kmPlotSets);

    return chart;
}

From source file:org.spantus.exp.segment.draw.AbstractGraphGenerator.java

public JFreeChart getChart(ComparisionResult result) {
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Time"));
    plot.setGap(10.0);//from  w  w w.  j  av  a2 s.c o  m
    plot.setOrientation(PlotOrientation.VERTICAL);

    XYSeriesCollection[] seriesArr = createSeries(result);
    for (XYSeriesCollection series : seriesArr) {
        XYSeriesCollection data = series;
        StandardXYItemRenderer renderer = new StandardXYItemRenderer();
        renderer.setAutoPopulateSeriesPaint(false);
        renderer.setBasePaint(Color.BLACK);
        NumberAxis rangeAxis = new NumberAxis();
        rangeAxis.setLabel(((XYSeries) series.getSeries().get(0)).getDescription());
        rangeAxis.setAutoRange(true);
        XYPlot subplot = new XYPlot(data, null, rangeAxis, renderer);
        plot.add(subplot);
    }
    String name = result.getName() == null ? "Segmentation" : "Segmentation: " + result.getName();

    JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, true);

    return chart;

}

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

private void configurePlot(XYPlot plot, RTUnit rtAxisUnit) {
    NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setNumberFormatOverride(new RTNumberFormatter(rtAxisUnit));
    domainAxis.setLabel("RT[" + rtAxisUnit.name().toLowerCase() + "]");
    plot.setRangeZeroBaselineVisible(true);
    plot.setDomainZeroBaselineVisible(false);
    domainAxis.setAutoRange(true);
    domainAxis.setAutoRangeIncludesZero(false);
    ((NumberAxis) plot.getRangeAxis()).setAutoRange(true);
    ((NumberAxis) plot.getRangeAxis()).setAutoRangeIncludesZero(true);
    Logger.getLogger(getClass().getName()).info("Adding chart");
    plot.setBackgroundPaint(Color.WHITE);
}

From source file:maltcms.ui.fileHandles.csv.CSV2JFCLoader.java

@Override
public void run() {
    CSV2TableLoader tl = new CSV2TableLoader(this.ph, this.is);

    DefaultTableModel dtm;//from   ww  w . j  a v a  2s  . com
    try {
        dtm = tl.call();
        if (this.mode == CHART.XY) {
            XYSeriesCollection cd = new XYSeriesCollection();
            for (int j = 0; j < dtm.getColumnCount(); j++) {
                XYSeries xys = new XYSeries(dtm.getColumnName(j));
                for (int i = 0; i < dtm.getRowCount(); i++) {
                    Object o = dtm.getValueAt(i, j);
                    try {
                        double d = Double.parseDouble(o.toString());
                        xys.add(i, d);
                        Logger.getLogger(getClass().getName()).log(Level.INFO, "Adding {0} {1} {2}",
                                new Object[] { i, d, dtm.getColumnName(j) });
                    } catch (Exception e) {
                    }
                }
                cd.addSeries(xys);
            }
            XYLineAndShapeRenderer d = new XYLineAndShapeRenderer(true, false);
            XYPlot xyp = new XYPlot(cd, new NumberAxis("category"), new NumberAxis("value"), d);

            JFreeChart jfc = new JFreeChart(this.title, xyp);
            jtc.setChart(jfc);
            Logger.getLogger(getClass().getName()).info("creating chart done");
        } else if (this.mode == CHART.MATRIX) {
            DefaultXYZDataset cd = new DefaultXYZDataset();
            Logger.getLogger(getClass().getName()).log(Level.INFO, "Name of column 0: {0}",
                    dtm.getColumnName(0));
            if (dtm.getColumnName(0).isEmpty()) {
                Logger.getLogger(getClass().getName()).info("Removing column 0");
                dtm = removeColumn(dtm, 0);
            }
            if (dtm.getColumnName(dtm.getColumnCount() - 1).equalsIgnoreCase("filename")) {
                dtm = removeColumn(dtm, dtm.getColumnCount() - 1);
            }
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < dtm.getRowCount(); i++) {
                for (int j = 0; j < dtm.getColumnCount(); j++) {
                    sb.append(dtm.getValueAt(i, j) + " ");
                }
                sb.append("\n");
            }
            Logger.getLogger(getClass().getName()).log(Level.INFO, "Table before sorting: {0}", sb.toString());
            //                dtm = sort(dtm);
            StringBuilder sb2 = new StringBuilder();
            for (int i = 0; i < dtm.getRowCount(); i++) {
                for (int j = 0; j < dtm.getColumnCount(); j++) {
                    sb2.append(dtm.getValueAt(i, j) + " ");
                }
                sb2.append("\n");
            }
            Logger.getLogger(getClass().getName()).log(Level.INFO, "Table after sorting: {0}", sb2.toString());
            int rows = dtm.getRowCount();
            int columns = dtm.getColumnCount();
            Logger.getLogger(getClass().getName()).log(Level.INFO, "Storing {0} * {1} elements, {2} total!",
                    new Object[] { columns, rows, rows * columns });
            double[][] data = new double[3][(columns * rows)];
            ArrayDouble.D1 dt = new ArrayDouble.D1((columns) * rows);
            double min = Double.POSITIVE_INFINITY;
            double max = Double.NEGATIVE_INFINITY;
            EvalTools.eqI(rows, columns, this);
            int k = 0;
            for (int i = 0; i < dtm.getRowCount(); i++) {
                for (int j = 0; j < dtm.getColumnCount(); j++) {

                    Object o = dtm.getValueAt(i, j);
                    try {
                        double d = Double.parseDouble(o.toString());
                        if (d < min) {
                            min = d;
                        }
                        if (d > max) {
                            max = d;
                        }
                        data[0][k] = (double) i;
                        data[1][k] = (double) j;
                        data[2][k] = d;
                        dt.set(k, d);
                        k++;
                        //System.out.println("Adding "+i+" "+d+" "+dtm.getColumnName(j));
                    } catch (Exception e) {
                    }
                }
                //cd.addSeries(xys);
            }
            cd.addSeries(this.title, data);
            XYBlockRenderer xyb = new XYBlockRenderer();
            GradientPaintScale ps = new GradientPaintScale(ImageTools.createSampleTable(256), min, max,
                    ImageTools
                            .rampToColorArray(new ColorRampReader().readColorRamp("res/colorRamps/bcgyr.csv")));

            xyb.setPaintScale(ps);
            final String[] colnames = new String[dtm.getColumnCount()];
            for (int i = 0; i < colnames.length; i++) {
                colnames[i] = dtm.getColumnName(i);
            }
            NumberAxis na1 = new SymbolAxis("category", colnames);
            na1.setVerticalTickLabels(false);
            NumberAxis na2 = new SymbolAxis("category", colnames);
            na1.setVerticalTickLabels(true);
            XYPlot xyp = new XYPlot(cd, na1, na2, xyb);
            xyb.setSeriesToolTipGenerator(0, new XYToolTipGenerator() {

                @Override
                public String generateToolTip(XYDataset xyd, int i, int i1) {
                    return "[" + colnames[xyd.getX(i, i1).intValue()] + ":"
                            + colnames[xyd.getY(i, i1).intValue()] + "] = "
                            + ((XYZDataset) xyd).getZValue(i, i1) + "";
                }
            });

            JFreeChart jfc = new JFreeChart(this.title, xyp);
            NumberAxis values = new NumberAxis("value");
            values.setAutoRange(false);
            values.setRangeWithMargins(min, max);
            PaintScaleLegend psl = new PaintScaleLegend(ps, values);
            psl.setBackgroundPaint(jfc.getBackgroundPaint());
            jfc.addSubtitle(psl);
            psl.setStripWidth(50);
            psl.setPadding(20, 20, 20, 20);
            psl.setHeight(200);
            psl.setPosition(RectangleEdge.RIGHT);
            jtc.setChart(jfc);
        }
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
    }

    ph.finish();
}

From source file:org.jls.toolbox.math.chart.XYBarChart.java

/**
 * Permet de paramtrer le graphique une fois cr.
 *///from w  w  w  .j a v a 2s .  co m
private void setChartStyle() {
    // Paramtrage des courbes
    this.plot.setBackgroundAlpha((float) 0.0);
    this.plot.setDomainCrosshairVisible(this.isGridXVisible);
    this.plot.setDomainCrosshairLockedOnData(true);
    this.plot.setRangeCrosshairVisible(this.isGridYVisible);
    this.plot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
    this.plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));

    this.chart.setBackgroundPaint(this.CHART_BACKGROUND_COLOR);

    NumberAxis xAxis = (NumberAxis) this.plot.getDomainAxis();
    NumberAxis yAxis = (NumberAxis) this.plot.getRangeAxis();

    xAxis.setAxisLinePaint(this.CHART_FOREGROUND_COLOR);
    xAxis.setLabelPaint(this.CHART_FOREGROUND_COLOR);
    xAxis.setTickLabelPaint(this.CHART_FOREGROUND_COLOR);
    xAxis.setTickMarkPaint(this.CHART_FOREGROUND_COLOR);
    xAxis.setAutoRange(true);
    xAxis.setAutoRangeIncludesZero(false);

    yAxis.setAxisLinePaint(this.CHART_FOREGROUND_COLOR);
    yAxis.setLabelPaint(this.CHART_FOREGROUND_COLOR);
    yAxis.setTickLabelPaint(this.CHART_FOREGROUND_COLOR);
    yAxis.setTickMarkPaint(this.CHART_FOREGROUND_COLOR);
    yAxis.setAutoRange(true);
    yAxis.setAutoRangeIncludesZero(false);

    this.plot.setBackgroundPaint(this.CHART_FOREGROUND_COLOR);
    this.plot.setDomainGridlinePaint(this.CHART_FOREGROUND_COLOR);
    this.plot.setRangeGridlinePaint(this.CHART_FOREGROUND_COLOR);
    this.plot.setDomainCrosshairPaint(this.CROSSHAIR_COLOR);
    this.plot.setRangeCrosshairPaint(this.CROSSHAIR_COLOR);
}

From source file:dk.netarkivet.harvester.harvesting.monitor.StartedJobHistoryChartGen.java

/**
 * Set the axis range./*from  w ww. j  a v a 2  s.  c om*/
 * @param axis a numberAxis
 * @param range a range
 */
private void setAxisRange(NumberAxis axis, double[] range) {
    if (range == null || range.length != 2) {
        axis.setAutoRange(true);
    } else {
        double lower = range[0];
        double upper = range[1];
        ArgumentNotValid.checkTrue(lower < upper, "Incorrect range");
        axis.setAutoRange(false);
        axis.setRange(new Range(lower, upper));
    }
}