Example usage for org.jfree.chart.axis ValueAxis setFixedDimension

List of usage examples for org.jfree.chart.axis ValueAxis setFixedDimension

Introduction

In this page you can find the example usage for org.jfree.chart.axis ValueAxis setFixedDimension.

Prototype

public void setFixedDimension(double dimension) 

Source Link

Document

Sets the fixed dimension for the axis.

Usage

From source file:sim.app.sugarscape.Charts.java

JFreeChart createChart2() {
    JFreeChart chart2 = ChartFactory.createXYLineChart("Wealth Distribution", // the title of the chart
            "Time step",
            //"% Population",                                          // the label for the X axis
            "Gini Coefficient",
            // % Wealththe label for the Y axis
            new XYSeriesCollection(model.gini_coeff), // the dataset for the chart
            PlotOrientation.VERTICAL, // the orientation of the chart
            true, // a flag specifying whether or not a legend is required
            true, // a flag specifying whether or not tooltips should be generated
            false); // a flag specifying whether or not the chart should generate URLs

    XYPlot plot = chart2.getXYPlot();//from  w  w w .  j a va  2  s  .com

    ValueAxis xAxis = plot.getDomainAxis();
    xAxis.setFixedDimension(100);
    //xAxis.setRange(0,100);
    //yAxis.setRange(0,1);
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.black);
    //System.out.println("done creating chart");
    return chart2;
}

From source file:sim.app.sugarscape.Charts.java

JFreeChart createGiniChart() {
    JFreeChart chart3 = ChartFactory.createXYLineChart("Lorenz Curve", "Population Percentage",
            "Percentage of Total Wealth", new XYSeriesCollection(model.lorenz_curve), PlotOrientation.VERTICAL,
            true, true, false);/*ww w  .j  a  v a2s  .  c o m*/
    XYPlot plot = chart3.getXYPlot();
    ValueAxis yAxis = plot.getRangeAxis();
    //xAxis.setFixedDimension(100);
    yAxis.setFixedDimension(1.0);
    //yAxis.setRange(0,1);
    ValueAxis xAxis = plot.getDomainAxis();
    xAxis.setFixedDimension(50);

    //StandardXYItemRenderer 
    XYItemRenderer renderer = plot.getRenderer();
    renderer.setSeriesPaint(0, Color.black);
    NumberAxis axis2 = new NumberAxis("Average Agent Vision");

    //axis2.setAutoRangeIncludesZero(false);
    axis2.setRange(0, 12);
    plot.setRangeAxis(1, axis2);
    plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT);
    //XYSeriesCollection vision = new XYSeriesCollection(lorenz_agent_vision);
    //plot.setDataset(1, vision);
    return chart3;
}