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

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

Introduction

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

Prototype

public void setAutoTickUnitSelection(boolean flag) 

Source Link

Document

Sets a flag indicating whether or not the tick unit is automatically selected from a range of standard tick units.

Usage

From source file:MWC.GUI.JFreeChart.CourseFormatter.java

public final void format(final XYPlot thePlot) {
    final NumberAxis theAxis = (NumberAxis) thePlot.getRangeAxis();
    theAxis.setRange(0, 360);//from  w w w .  ja v a 2s  .com

    // create some tick units suitable for degrees
    theAxis.setStandardTickUnits(getDegreeTickUnits());
    theAxis.setAutoTickUnitSelection(true);

}

From source file:MWC.GUI.JFreeChart.RelBearingFormatter.java

public void format(final XYPlot thePlot) {
    final NumberAxis theAxis = (NumberAxis) thePlot.getRangeAxis();
    theAxis.setRange(-180, +180);/*w ww . java2s. c o  m*/
    theAxis.setLabel("(Red)    " + theAxis.getLabel() + "     (Green)");

    // create some tick units suitable for degrees
    theAxis.setStandardTickUnits(CourseFormatter.getDegreeTickUnits());
    theAxis.setAutoTickUnitSelection(true);
}

From source file:net.sourceforge.entrainer.jfreechart.UnitChart.java

private ValueAxis getRangeAxis() {
    NumberAxis axis = new NumberAxis("Range");

    axis.setAutoTickUnitSelection(false);

    return axis;// w w  w .j  av a 2s. c om
}

From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java

public static void customizeNumberAxis(NumberAxis axis, ChartParams params, String prefix) {
    customizeValueAxis(axis, params, prefix);
    if (axis.isAutoRange()) { // work only with auto range
        if (params.get(prefix + ChartParams.NUMBER_AXIS_AUTO_RANGE_INCLUDES_ZERO_SUFFIX) != null) {
            axis.setAutoRangeIncludesZero(
                    params.getBoolean(prefix + ChartParams.NUMBER_AXIS_AUTO_RANGE_INCLUDES_ZERO_SUFFIX)
                            .booleanValue());
        }//from ww  w.  ja v  a  2 s.  c  om
        if (params.get(prefix + ChartParams.NUMBER_AXIS_AUTO_RANGE_STICKY_ZERO_SUFFIX) != null) {
            axis.setAutoRangeStickyZero(params
                    .getBoolean(prefix + ChartParams.NUMBER_AXIS_AUTO_RANGE_STICKY_ZERO_SUFFIX).booleanValue());
        }
    }
    if (params.get(prefix + ChartParams.NUMBER_AXIS_RANGE_TYPE_SUFFIX) != null) {
        axis.setRangeType(params.getRangeType(prefix + ChartParams.NUMBER_AXIS_RANGE_TYPE_SUFFIX));
    }
    if (params.get(prefix + ChartParams.NUMBER_AXIS_NUMBER_TICK_UNIT_SUFFIX) != null) {
        if (axis.isAutoTickUnitSelection()) {
            axis.setAutoTickUnitSelection(false);
        }
        axis.setTickUnit(params.getNumberTickUnit(prefix + ChartParams.NUMBER_AXIS_NUMBER_TICK_UNIT_SUFFIX));
    }
    if (params.get(prefix + ChartParams.NUMBER_AXIS_NUMBER_FORMAT_OVERRIDE_SUFFIX) != null) {
        axis.setNumberFormatOverride(
                params.getNumberFormat(prefix + ChartParams.NUMBER_AXIS_NUMBER_FORMAT_OVERRIDE_SUFFIX));
    }
}

From source file:org.bhavaya.ui.view.ChartView.java

private JFreeChart createStackedHorizontalBarChart() {
    JFreeChart chart;//from  w w  w  .j  av a 2 s  .  co m
    chart = ChartFactory.createStackedBarChart(getName(), getDomainName(), getRangeName(), tableModelDataSet,
            PlotOrientation.HORIZONTAL, true, true, false);

    NumberAxis rangeAxis = (NumberAxis) chart.getCategoryPlot().getRangeAxis();
    rangeAxis.setAutoTickUnitSelection(true);
    rangeAxis.setVerticalTickLabels(true);
    rangeAxis.setTickMarksVisible(true);

    CategoryAxis domainAxis = (CategoryAxis) chart.getCategoryPlot().getDomainAxis();

    return chart;
}

From source file:org.bhavaya.ui.view.ChartView.java

private JFreeChart createStackedVerticalBarChart() {
    JFreeChart chart;//from  w  ww.j a va 2 s . co  m
    if (isPlot3D()) {
        chart = ChartFactory.createStackedBarChart3D(getName(), getDomainName(), getRangeName(),
                tableModelDataSet, PlotOrientation.VERTICAL, true, true, false);
    } else {
        chart = ChartFactory.createStackedBarChart(getName(), getDomainName(), getRangeName(),
                tableModelDataSet, PlotOrientation.VERTICAL, true, true, false);
    }
    NumberAxis rangeAxis = (NumberAxis) chart.getCategoryPlot().getRangeAxis();
    rangeAxis.setAutoTickUnitSelection(true);

    CategoryAxis domainAxis = (CategoryAxis) chart.getCategoryPlot().getDomainAxis();
    domainAxis.setTickMarksVisible(true);
    return chart;
}

From source file:org.bhavaya.ui.view.ChartView.java

private JFreeChart createVerticalBarChart() {
    JFreeChart chart;/*from   w  ww  .  ja  va 2s .  c o m*/
    if (isPlot3D()) {
        chart = ChartFactory.createBarChart3D(getName(), getDomainName(), getRangeName(), tableModelDataSet,
                PlotOrientation.VERTICAL, true, true, false);
    } else {
        chart = ChartFactory.createBarChart(getName(), getDomainName(), getRangeName(), tableModelDataSet,
                PlotOrientation.VERTICAL, true, true, false);
    }

    NumberAxis rangeAxis = (NumberAxis) chart.getCategoryPlot().getRangeAxis();
    rangeAxis.setAutoTickUnitSelection(true);

    CategoryAxis domainAxis = (CategoryAxis) chart.getCategoryPlot().getDomainAxis();
    domainAxis.setTickMarksVisible(true);
    return chart;
}

From source file:org.bhavaya.ui.view.ChartView.java

private JFreeChart createHorizontalBarChart() {
    JFreeChart chart;/*from   www  .j  av a 2  s  . c o  m*/
    if (isPlot3D()) {
        chart = ChartFactory.createBarChart3D(getName(), getDomainName(), getRangeName(), tableModelDataSet,
                PlotOrientation.HORIZONTAL, true, true, false);
    } else {
        chart = ChartFactory.createBarChart(getName(), getDomainName(), getRangeName(), tableModelDataSet,
                PlotOrientation.HORIZONTAL, true, true, false);
    }
    NumberAxis rangeAxis = (NumberAxis) chart.getCategoryPlot().getRangeAxis();
    rangeAxis.setAutoTickUnitSelection(true);
    rangeAxis.setVerticalTickLabels(true);
    rangeAxis.setTickMarksVisible(true);

    CategoryAxis domainAxis = (CategoryAxis) chart.getCategoryPlot().getDomainAxis();
    return chart;
}