Example usage for org.jfree.chart.axis CategoryAxis setLowerMargin

List of usage examples for org.jfree.chart.axis CategoryAxis setLowerMargin

Introduction

In this page you can find the example usage for org.jfree.chart.axis CategoryAxis setLowerMargin.

Prototype

public void setLowerMargin(double margin) 

Source Link

Document

Sets the lower margin for the axis and sends an AxisChangeEvent to all registered listeners.

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
    );//from   www  .  j a  v a2s.c om

    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.objectweb.proactive.extensions.timitspmd.util.charts.HierarchicalBarChart.java

private void buildFinalChart(String title, String subTitle, String xAxisLabel, String yAxisLabel, int height,
        int width, String filename, Chart.Scale scaleMode, Chart.LegendFormat legendFormatMode, int alpha) {
    @SuppressWarnings("unchecked")
    Vector<Counter>[] vec = new Vector[this.timers.length];
    boolean exist;

    // create the dataset...
    for (int i = 0; i < this.timers.length; i++) {
        vec[i] = new Vector<Counter>();
        @SuppressWarnings("unchecked")
        Iterator<Element> it = this.timers[i].getDescendants();
        while (it.hasNext()) {
            try {
                Element elt = (Element) it.next();
                String name = elt.getAttributeValue("name");
                double value = Double.valueOf(elt.getAttributeValue("avg"));
                exist = false;//from w  w  w.j av  a 2 s.c om
                for (int j = 0; j < vec[i].size(); j++) {
                    if (((Counter) vec[i].get(j)).getName().equals(name)) {
                        ((Counter) vec[i].get(j)).addValue(value);
                        exist = true;
                        break;
                    }
                }
                if (!exist) {
                    vec[i].add(new Counter(name, value));
                }
            } catch (ClassCastException e) {
                continue;
            }
        }
    }

    CategoryDataset dataset = null;
    try {
        dataset = DatasetUtilities.createCategoryDataset(toSeries(vec[0]), this.categories, toDataset(vec));
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
        throw new IllegalArgumentException(
                "Benchmark names must have different names. Be sure that your filter contains correct timers names");
    }

    // create the chart...
    final CategoryAxis categoryAxis = new CategoryAxis(xAxisLabel);
    final ValueAxis valueAxis = new NumberAxis(yAxisLabel);

    final CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, valueAxis, new HierarchicalBarRenderer());

    plot.setOrientation(PlotOrientation.VERTICAL);
    final JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true);
    chart.addSubtitle(new TextTitle(subTitle));

    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);

    final HierarchicalBarRenderer renderer = (HierarchicalBarRenderer) plot.getRenderer();

    renderer.setItemMargin(0.01);
    renderer.setDatasetTree(this.timers);
    renderer.setSeries(toSeries(vec[0]));
    renderer.setAlpha(alpha);

    final CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryMargin(HierarchicalBarChart.CATEGORY_MARGIN);
    domainAxis.setUpperMargin(0.05);
    domainAxis.setLowerMargin(0.05);

    try {
        if ((filename == null) || "".equals(filename)) {
            throw new RuntimeException(
                    "The output filename for the HierarchicalBarChart cannot be null or empty !");
        }

        ChartUtilities.saveChartAsPNG(XMLHelper.createFileWithDirs(filename + ".png"), chart, width, height);

        Utilities.saveChartAsSVG(chart, new Rectangle(width, height),
                XMLHelper.createFileWithDirs(filename + ".svg"));
    } catch (java.io.IOException e) {
        System.err.println("Error writing chart image to file");
        e.printStackTrace();
    }
}

From source file:org.pentaho.chart.plugin.jfreechart.chart.bar.JFreeBarChartGenerator.java

/**
 * This method allows to manipulate bar width indirectly by sepecifying percentages for lower margin,
 * upper margin, category margin and item margin. Definitions of these margins and how they effect bar width
 * are available in the JFreeChart documentation.
 *
 * @param chartDocument Current chart defintion
 * @param categoryPlot  The plot object for the current chart
 *//*from  w  ww  .j a  v a2 s .c  o  m*/
private void setAxisMargins(final ChartDocument chartDocument, final CategoryPlot categoryPlot) {
    final ArrayList<ChartElement> axisElementsList = chartDocument.getAxisSeriesLinkInfo()
            .getDomainAxisElements();
    if (axisElementsList != null) {
        for (final ChartElement axisElement : axisElementsList) {
            if (axisElement != null) {
                final String axisType = (String) axisElement.getAttribute("type");//$NON-NLS-1$
                if (axisType != null && DOMAIN_AXIS.equalsIgnoreCase(axisType)) {
                    final LayoutStyle layoutStyle = axisElement.getLayoutStyle();
                    final CSSValue lowerMarginValue = layoutStyle.getValue(ChartStyleKeys.MARGIN_LOWER);
                    final CSSValue upperMarginValue = layoutStyle.getValue(ChartStyleKeys.MARGIN_UPPER);
                    final CSSValue itemMarginValue = layoutStyle.getValue(ChartStyleKeys.MARGIN_ITEM);
                    final CSSValue categoryMarginValue = layoutStyle.getValue(ChartStyleKeys.MARGIN_CATEGORY);

                    // The lower, upper and category margins can be controlled through category axis
                    final CategoryAxis categoryAxis = categoryPlot.getDomainAxis();
                    if (lowerMarginValue != null) {
                        final double lowerMargin = ((CSSNumericValue) lowerMarginValue).getValue() / 100;
                        categoryAxis.setLowerMargin(lowerMargin);
                    }
                    if (upperMarginValue != null) {
                        final double upperMargin = ((CSSNumericValue) upperMarginValue).getValue() / 100;
                        categoryAxis.setUpperMargin(upperMargin);
                    }
                    if (categoryMarginValue != null) {
                        final double categoryMargin = ((CSSNumericValue) categoryMarginValue).getValue() / 100;
                        categoryAxis.setCategoryMargin(categoryMargin);
                    }
                    if (itemMarginValue != null) {
                        final double itemMargin = ((CSSNumericValue) itemMarginValue).getValue() / 100;
                        final int datasetCount = categoryPlot.getDatasetCount();
                        for (int i = 0; i < datasetCount; i++) {
                            if (categoryPlot.getRenderer() instanceof BarRenderer) {
                                final BarRenderer barRenderer = (BarRenderer) categoryPlot.getRenderer(i);
                                barRenderer.setItemMargin(itemMargin);
                            }
                        }
                    }
                }
            }
        }
    }
}

From source file:hudson.graph.jfreechart.JFreeChartSupport.java

public JFreeChart createChart() {

    if (chartType == Graph.TYPE_STACKED_AREA) {
        jFreeChart = ChartFactory.createStackedAreaChart(null, // chart
                chartTitle, // // title 
                xAxisLabel, // range axis label
                dataset, // data
                PlotOrientation.VERTICAL, // orientation
                false, // include legend
                true, // tooltips
                false // urls
        );//from   ww w.  j  av a 2  s  . c om
    } else if (chartType == Graph.TYPE_LINE) {
        jFreeChart = ChartFactory.createLineChart(null, // chart title
                chartTitle, // // title 
                xAxisLabel, // range axis label
                dataset, // data
                PlotOrientation.VERTICAL, // orientation
                true, // include legend
                true, // tooltips
                false // urls
        );
    }

    jFreeChart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = jFreeChart.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);

    if (chartType == Graph.TYPE_LINE) {
        final LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
        renderer.setBaseStroke(new BasicStroke(3));

        if (multiStageTimeSeries != null) {
            for (int i = 0; i < multiStageTimeSeries.size(); i++) {
                renderer.setSeriesPaint(i, multiStageTimeSeries.get(i).color);
            }
        }
    }

    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();
    Utils.adjustChebyshev(dataset, rangeAxis);
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());

    if (chartType == Graph.TYPE_STACKED_AREA) {
        StackedAreaRenderer ar = new StackedAreaRenderer2() {

            @Override
            public Paint getItemPaint(int row, int column) {
                if (row == 2) {
                    return ColorPalette.BLUE;
                }
                if (row == 1) {
                    return ColorPalette.YELLOW;
                }
                if (row == 0) {
                    return ColorPalette.RED;
                }
                ChartLabel key = (ChartLabel) dataset.getColumnKey(column);
                return key.getColor(row, column);
            }

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

            @Override
            public String generateToolTip(CategoryDataset dataset, int row, int column) {
                ChartLabel label = (ChartLabel) dataset.getColumnKey(column);
                return label.getToolTip(row, column);
            }
        };
        plot.setRenderer(ar);
        ar.setSeriesPaint(0, ColorPalette.RED); // Failures.
        ar.setSeriesPaint(1, ColorPalette.YELLOW); // Skips.
        ar.setSeriesPaint(2, ColorPalette.BLUE); // Total.
    }

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

    return jFreeChart;
}

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

/**
 * Creates a Area chart./* w w w  .j ava2s . c  o  m*/
 * 
 * @param dataset  the dataset.
 * 
 * @return The chart.
 */
protected JFreeChart createChart(CategoryDataset dataset) {

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

    // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART...
    chart.setBackgroundPaint(Color.white);
    if (isDemo) {
        TextTitle subtitle = new TextTitle("An area chart demonstration.  We use this subtitle as an "
                + "example of what happens when you get a really long title or " + "subtitle.");
        subtitle.setFont(new Font("SansSerif", Font.PLAIN, 12));
        subtitle.setPosition(RectangleEdge.TOP);
        subtitle.setPadding(new RectangleInsets(UnitType.RELATIVE, 0.05, 0.05, 0.05, 0.05));
        subtitle.setVerticalAlignment(VerticalAlignment.BOTTOM);
        chart.addSubtitle(subtitle);
    }

    CategoryPlot plot = chart.getCategoryPlot();
    plot.setForegroundAlpha(0.5f);

    plot.setAxisOffset(new RectangleInsets(5.0, 5.0, 5.0, 5.0));
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

    AreaRenderer renderer = (AreaRenderer) plot.getRenderer();
    renderer.setLegendItemLabelGenerator(new SOCRCategorySeriesLabelGenerator());

    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    if (isDemo) {
        domainAxis.addCategoryLabelToolTip("Type 1", "The first type.");
        domainAxis.addCategoryLabelToolTip("Type 2", "The second type.");
        domainAxis.addCategoryLabelToolTip("Type 3", "The third type.");
    }
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    rangeAxis.setLabelAngle(0 * Math.PI / 2.0);
    // OPTIONAL CUSTOMISATION COMPLETED.

    setCategorySummary(dataset);
    return chart;

}

From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java

/**
 * Creates an area chart.// ww  w  .j a  va  2 s .  c om
 * 
 * @param title
 * @param categoryAxisLabel
 *            (X-Axis label)
 * @param valueAxisLabel
 *            (Y-Axis label)
 * @param dataset
 * @return JfreeChart instance.
 */
public JFreeChart createAreaChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createAreaChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            this.orientation, this.drawLegend, false, false);
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);
    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0);
    domainAxis.setUpperMargin(0);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
    AreaRenderer renderer = (AreaRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.red);
    renderer.setSeriesPaint(2, Color.green);
    renderer.setSeriesPaint(3, Color.darkGray);
    renderer.setSeriesPaint(4, Color.yellow);
    return chart;
}

From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java

/**
 * Creates a bar chart./*from  www . ja v a 2s  . c  o m*/
 * 
 * @param title
 * @param categoryAxisLabel
 *            (X-Axis label)
 * @param valueAxisLabel
 *            (Y-Axis label)
 * @param dataset
 * @return JfreeChart instance.
 */
public JFreeChart createBarChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset) {
    JFreeChart chart = ChartFactory.createBarChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            this.orientation, this.drawLegend, false, false);
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);
    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.01);
    domainAxis.setUpperMargin(0.01);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
    BarRenderer renderer = (BarRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.red);
    renderer.setSeriesPaint(2, Color.green);
    renderer.setSeriesPaint(3, Color.darkGray);
    renderer.setSeriesPaint(4, Color.yellow);
    return chart;
}

From source file:org.openscience.cdk.applications.taverna.basicutilities.ChartTool.java

/**
 * Creates a line chart./*from   www .j a v  a  2  s . c om*/
 * 
 * @param title
 * @param categoryAxisLabel
 *            (X-Axis label)
 * @param valueAxisLabel
 *            (Y-Axis label)
 * @param dataset
 * @param includeZero
 *            True when zero shall be included to the axis range.
 * @return JfreeChart instance.
 */
public JFreeChart createLineChart(String title, String categoryAxisLabel, String valueAxisLabel,
        CategoryDataset dataset, boolean includeZero, boolean drawShapes) {
    JFreeChart chart = ChartFactory.createLineChart(title, categoryAxisLabel, valueAxisLabel, dataset,
            this.orientation, this.drawLegend, false, false);
    // set the background color for the chart...
    chart.setBackgroundPaint(Color.white);
    chart.setAntiAlias(true);
    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis domainAxis = plot.getDomainAxis();
    domainAxis.setLowerMargin(0.025);
    domainAxis.setUpperMargin(0.025);
    domainAxis.setCategoryLabelPositions(CategoryLabelPositions.DOWN_90);
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
    rangeAxis.setAutoRangeIncludesZero(includeZero);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
    renderer.setSeriesPaint(0, Color.blue);
    renderer.setSeriesPaint(1, Color.red);
    renderer.setSeriesPaint(2, Color.green);
    renderer.setSeriesPaint(3, Color.darkGray);
    renderer.setSeriesPaint(4, Color.yellow);
    renderer.setDrawOutlines(true);
    renderer.setUseFillPaint(true);
    renderer.setBaseShapesVisible(drawShapes);
    renderer.setBaseShapesFilled(true);
    return chart;
}

From source file:com.mentor.questa.vrm.jenkins.QuestaVrmHostAction.java

private JFreeChart createChart(StaplerRequest req, CategoryDataset dataset) {

    final JFreeChart chart = ChartFactory.createStackedAreaChart(null, // chart title
            "Relative time", // unused
            "count", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            false, // include legend
            true, // tooltips
            false // urls
    );/*from w  w w . j a  va2 s .  co  m*/

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    plot.setForegroundAlpha(0.8f);

    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());

    StackedAreaRenderer ar = new StackedAreaRenderer2() {
        private long getTime(CategoryDataset dataset, int column) {
            Long offset = (Long) dataset.getColumnKey(column);
            return getRegressionResult().getRegressionBegin().getTime() + offset * 1000;

        }

        @Override
        public String generateURL(CategoryDataset dataset, int row, int column) {
            return "javascript:getSummary(" + getTime(dataset, column) + ");";
        }

        @Override
        public String generateToolTip(CategoryDataset dataset, int row, int column) {
            String host = (String) dataset.getRowKey(row);
            Date date = new Date(getTime(dataset, column));
            int value = (Integer) dataset.getValue(row, column);
            return value + " on " + host + "@" + date.toString();
        }
    };
    plot.setRenderer(ar);

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

    return chart;
}

From source file:net.praqma.jenkins.memorymap.MemoryMapBuildAction.java

protected JFreeChart createChart(CategoryDataset dataset, String title, String yaxis, int max, int min) {
    final JFreeChart chart = ChartFactory.createStackedAreaChart(title, // chart                                                                                                                                       // title
            null, // unused
            yaxis, // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );/*from www . j ava  2  s . c o  m*/

    final LegendTitle legend = chart.getLegend();

    legend.setPosition(RectangleEdge.BOTTOM);

    chart.setBackgroundPaint(Color.white);

    final CategoryPlot plot = chart.getCategoryPlot();

    plot.setBackgroundPaint(Color.WHITE);
    plot.setOutlinePaint(null);
    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());
    rangeAxis.setUpperBound(max);
    rangeAxis.setLowerBound(min);

    final StackedAreaRenderer renderer = (StackedAreaRenderer) plot.getRenderer();
    renderer.setBaseStroke(new BasicStroke(2.0f));
    plot.setInsets(new RectangleInsets(5.0, 0, 0, 5.0));
    return chart;
}