/** * Sets the tick unit for the axis and, if requested, sends an * {@link AxisChangeEvent} to all registered listeners. In addition, an * option is provided to turn off the "auto-select" feature for tick units * (you can restore it using the * {@link ValueAxis#setAutoTickUnitSelection(boolean)} method). * * @param unit the new tick unit (<code>null</code> not permitted). * @param notify notify listeners? * @param turnOffAutoSelect turn off the auto-tick selection? */ public void setTickUnit(NumberTickUnit unit, boolean notify, boolean turnOffAutoSelect) { if (unit == null) { throw new IllegalArgumentException("Null 'unit' argument."); } this.tickUnit = unit; if (turnOffAutoSelect) { setAutoTickUnitSelection(false, false); } if (notify) { notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the tick unit for the axis and, if requested, sends an * {@link AxisChangeEvent} to all registered listeners. In addition, an * option is provided to turn off the "auto-select" feature for tick units * (you can restore it using the * {@link ValueAxis#setAutoTickUnitSelection(boolean)} method). * * @param unit the new tick unit ({@code null} not permitted). * @param notify notify listeners? * @param turnOffAutoSelect turn off the auto-tick selection? */ public void setTickUnit(NumberTickUnit unit, boolean notify, boolean turnOffAutoSelect) { Args.nullNotPermitted(unit, "unit"); this.tickUnit = unit; if (turnOffAutoSelect) { setAutoTickUnitSelection(false, false); } if (notify) { notifyListeners(new AxisChangeEvent(this)); } }
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()); } 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)); } }