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

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

Introduction

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

Prototype

public void setTickUnit(NumberTickUnit unit, boolean notify, boolean turnOffAutoSelect) 

Source Link

Document

Sets the tick unit for the axis and, if requested, sends an AxisChangeEvent to all registered listeners.

Usage

From source file:net.sf.jasperreports.charts.util.ChartUtil.java

public void setAutoTickUnit(NumberAxis numberAxis) {
    if (numberAxis.isAutoTickUnitSelection()) {
        Range range = numberAxis.getRange();
        if (range.getLength() >= AUTO_TICK_UNIT_THRESHOLD) {
            // this is a workaround for a floating point error makes JFreeChart
            // select tick units that are too small when the values are very large
            double autoSize = range.getLength() / AUTO_TICK_UNIT_THRESHOLD;
            TickUnit unit = numberAxis.getStandardTickUnits().getCeilingTickUnit(autoSize);
            numberAxis.setTickUnit((NumberTickUnit) unit, false, false);
        }//from   w ww. j ava 2 s. c  om
    }
}