Example usage for org.jfree.chart.plot FastXYPlot setAxisOffset

List of usage examples for org.jfree.chart.plot FastXYPlot setAxisOffset

Introduction

In this page you can find the example usage for org.jfree.chart.plot FastXYPlot setAxisOffset.

Prototype

public void setAxisOffset(RectangleInsets offset) 

Source Link

Document

Sets the axis offsets (gap between the data area and the axes) and sends a PlotChangeEvent to all registered listeners.

Usage

From source file:de.uniol.ui.tsv.ui.LineChartDialog.java

/**
 * @return the resulting chart object/*from  www . j  ava2  s  .  c om*/
 */
protected JFreeChart createChart() {
    JFreeChart chart = ChartFactory.createTimeSeriesChartFast(title, xTitle, yTitle, xy, true, false, false);

    chart.setBackgroundPaint(Color.white);
    chart.getLegend().setBackgroundPaint(new Color(224, 224, 224));

    FastXYPlot plot = (FastXYPlot) chart.getPlot();
    //      plot.setBackgroundPaint(new Color(224, 224, 224));
    plot.setBackgroundPaint(new Color(77, 77, 77));
    plot.setDomainGridlinePaint(Color.lightGray);
    plot.setRangeGridlinePaint(Color.lightGray);
    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    StandardXYItemRendererFast r = new StandardXYItemRendererFast(StandardXYItemRendererFast.LINES, null, null);
    plot.setRenderer(r);

    for (int i : seriesStrokes.keySet()) {
        r.setSeriesStroke(i, seriesStrokes.get(i));
    }
    for (int i : seriesColors.keySet()) {
        r.setSeriesPaint(i, seriesColors.get(i));
    }

    DateAxis da = new DateAxis(xTitle);
    if (useRelativeHourFormat) {
        da.setDateFormatOverride(new RelativeHourFormat());
    }
    da.setLowerMargin(0.03);
    plot.setDomainAxis(da);

    if (minRange != 0.0 && maxRange != 0.0) {
        ValueAxis yaxis = plot.getRangeAxis();
        yaxis.setRange(new Range(minRange, maxRange));
    }

    return chart;
}