/** * Sets the label for the axis and sends an {@link AxisChangeEvent} to all registered * listeners. * * @param label the new label (<code>null</code> permitted). */ public void setLabel(String label) { String existing = this.label; if (existing != null) { if (!existing.equals(label)) { this.label = label; notifyListeners(new AxisChangeEvent(this)); } } else { if (label != null) { this.label = label; 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</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 display range. The values will be mapped to the fixed range if * necessary. * * @param start the start value. * @param end the end value. */ public void setDisplayRange(double start, double end) { this.displayStart = mapValueToFixedRange(start); this.displayEnd = mapValueToFixedRange(end); if (this.displayStart < this.displayEnd) { setRange(this.displayStart, this.displayEnd); } else { setRange( this.displayStart, this.fixedRange.getUpperBound() + (this.displayEnd - this.fixedRange.getLowerBound()) ); } 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</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 label for the axis and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param label the new label (<code>null</code> permitted). * * @see #getLabel() * @see #setLabelFont(Font) * @see #setLabelPaint(Paint) */ public void setLabel(String label) { String existing = this.label; if (existing != null) { if (!existing.equals(label)) { this.label = label; notifyListeners(new AxisChangeEvent(this)); } } else { if (label != null) { this.label = label; notifyListeners(new AxisChangeEvent(this)); } } }
/** * Sets the auto range attribute. If the <code>notify</code> flag is set, * an {@link AxisChangeEvent} is sent to registered listeners. * * @param auto the flag. * @param notify notify listeners? * * @see #isAutoRange() */ protected void setAutoRange(boolean auto, boolean notify) { if (this.autoRange != auto) { this.autoRange = auto; if (this.autoRange) { autoAdjustRange(); } if (notify) { notifyListeners(new AxisChangeEvent(this)); } } }
/** * Sets a flag that affects the auto-range when zero falls outside the data * range but inside the margins defined for the axis. * * @param flag the new flag. * * @see #getAutoRangeStickyZero() */ public void setAutoRangeStickyZero(boolean flag) { if (this.autoRangeStickyZero != flag) { this.autoRangeStickyZero = flag; if (isAutoRange()) { autoAdjustRange(); } notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the tick unit attribute without any other side effects. * * @param unit the new tick unit. * @param notify notify registered listeners? * @param turnOffAutoSelection turn off auto selection? */ public void setTickUnit(DateTickUnit unit, boolean notify, boolean turnOffAutoSelection) { this.tickUnit = unit; if (turnOffAutoSelection) { setAutoTickUnitSelection(false, false); } if (notify) { notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the tick mark position (start, middle or end of the time period) and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param position the position (<code>null</code> not permitted). */ public void setTickMarkPosition(DateTickMarkPosition position) { if (position == null) { throw new IllegalArgumentException("Null 'position' argument."); } this.tickMarkPosition = position; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets a flag that controls whether or not the axis is visible and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param flag the flag. */ public void setVisible(boolean flag) { if (flag != this.visible) { this.visible = flag; notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the paint used to draw the axis label and sends an {@link AxisChangeEvent} * to all registered listeners. * * @param paint the paint (<code>null</code> not permitted). */ public void setLabelPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Axis.setLabelPaint(...): null not permitted."); } this.labelPaint = paint; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the class used to create the first and last time periods for the * axis range when the auto-range flag is set to <code>true</code> and * sends an {@link AxisChangeEvent} to all registered listeners. * * @param c the class (<code>null</code> not permitted). */ public void setAutoRangeTimePeriodClass(Class c) { if (c == null) { throw new IllegalArgumentException("Null 'c' argument."); } this.autoRangeTimePeriodClass = c; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the font for the tick label for the specified category and sends * an {@link AxisChangeEvent} to all registered listeners. * * @param category the category (<code>null</code> not permitted). * @param font the font (<code>null</code> permitted). * * @see #getTickLabelFont(Comparable) */ public void setTickLabelFont(Comparable category, Font font) { if (category == null) { throw new IllegalArgumentException("Null 'category' argument."); } if (font == null) { this.tickLabelFontMap.remove(category); } else { this.tickLabelFontMap.put(category, font); } notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the stroke used to draw the axis line and sends an {@link AxisChangeEvent} * to all registered listeners. * * @param stroke the stroke (<code>null</code> not permitted). */ public void setAxisLineStroke(Stroke stroke) { if (stroke == null) { throw new IllegalArgumentException("Null 'stroke' argument."); } this.axisLineStroke = stroke; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the flag that determines whether or not the tick labels are visible and sends * an {@link AxisChangeEvent} to all registered listeners. * * @param flag the flag. */ public void setTickLabelsVisible(boolean flag) { if (flag != this.tickLabelsVisible) { this.tickLabelsVisible = flag; notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the paint for the tick label for the specified category and sends * an {@link AxisChangeEvent} to all registered listeners. * * @param category the category (<code>null</code> not permitted). * @param paint the paint (<code>null</code> permitted). * * @see #getTickLabelPaint(Comparable) */ public void setTickLabelPaint(Comparable category, Paint paint) { if (category == null) { throw new IllegalArgumentException("Null 'category' argument."); } if (paint == null) { this.tickLabelPaintMap.remove(category); } else { this.tickLabelPaintMap.put(category, paint); } notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the paint used to draw tick labels (if they are showing) and sends an * {@link AxisChangeEvent} to all registered listeners. * * @param paint the paint (<code>null</code> not permitted). */ public void setTickLabelPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.tickLabelPaint = paint; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the flag that indicates whether or not the tick marks are showing and sends * an {@link AxisChangeEvent} to all registered listeners. * * @param flag the flag. */ public void setTickMarksVisible(boolean flag) { if (flag != this.tickMarksVisible) { this.tickMarksVisible = flag; notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the stroke used to draw tick marks and sends * an {@link AxisChangeEvent} to all registered listeners. * * @param stroke the stroke (<code>null</code> not permitted). */ public void setTickMarkStroke(Stroke stroke) { if (stroke == null) { throw new IllegalArgumentException("Null 'stroke' argument."); } if (!this.tickMarkStroke.equals(stroke)) { this.tickMarkStroke = stroke; notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the paint used to draw tick marks and sends an {@link AxisChangeEvent} to all * registered listeners. * * @param paint the paint (<code>null</code> not permitted). */ public void setTickMarkPaint(Paint paint) { if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } this.tickMarkPaint = paint; notifyListeners(new AxisChangeEvent(this)); }
/** * Notifies all registered listeners that the axis has changed. * The AxisChangeEvent provides information about the change. * * @param event information about the change to the axis. */ protected void notifyListeners(AxisChangeEvent event) { Object[] listeners = this.listenerList.getListenerList(); for (int i = listeners.length - 2; i >= 0; i -= 2) { if (listeners[i] == AxisChangeListener.class) { ((AxisChangeListener) listeners[i + 1]).axisChanged(event); } } }
/** * Sets the flag that indicates whether or not the axis range, if automatically calculated, is * forced to include zero. * <p> * If the flag is changed to <code>true</code>, the axis range is recalculated. * <p> * Any change to the flag will trigger an {@link AxisChangeEvent}. * * @param flag the new value of the flag. */ public void setAutoRangeIncludesZero(boolean flag) { if (this.autoRangeIncludesZero != flag) { this.autoRangeIncludesZero = flag; if (isAutoRange()) { autoAdjustRange(); } notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets a flag that affects the auto-range when zero falls outside the data * range but inside the margins defined for the axis. * * @param flag the new flag. */ public void setAutoRangeStickyZero(boolean flag) { if (this.autoRangeStickyZero != flag) { this.autoRangeStickyZero = flag; if (isAutoRange()) { autoAdjustRange(); } notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the class that controls the spacing of the major tick marks, and * sends an {@link AxisChangeEvent} to all registered listeners. * * @param c the class (a subclass of {@link RegularTimePeriod} is * expected). */ public void setMajorTickTimePeriodClass(Class c) { if (c == null) { throw new IllegalArgumentException("Null 'c' argument."); } this.majorTickTimePeriodClass = c; notifyListeners(new AxisChangeEvent(this)); }
/** * Adds a tooltip to the specified category and sends an {@link AxisChangeEvent} to * all registered listeners. * * @param category the category (<code>null<code> not permitted). * @param tooltip the tooltip text (<code>null</code> permitted). */ public void addCategoryLabelToolTip(Comparable category, String tooltip) { if (category == null) { throw new IllegalArgumentException("Null 'category' argument."); } this.categoryLabelToolTips.put(category, tooltip); notifyListeners(new AxisChangeEvent(this)); }
/** * Removes the tooltip for the specified category and sends an {@link AxisChangeEvent} to * all registered listeners. * * @param category the category (<code>null<code> not permitted). */ public void removeCategoryLabelToolTip(Comparable category) { if (category == null) { throw new IllegalArgumentException("Null 'category' argument."); } this.categoryLabelToolTips.remove(category); notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the flag that determines whether the category labels are rotated to vertical. * * @param flag the flag. * * @deprecated Use the get/setXXXCategoryLabelPosition methods. */ public void setVerticalCategoryLabels(boolean flag) { if (flag) { this.categoryLabelPositions = CategoryLabelPositions.UP_90; } else { this.categoryLabelPositions = CategoryLabelPositions.STANDARD; } notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the visibility of the symbolic grid lines and notifies registered * listeners that the axis has been modified. * * @param flag the new setting. */ public void setSymbolicGridLinesVisible(boolean flag) { if (this.symbolicGridLinesVisible != flag) { this.symbolicGridLinesVisible = flag; notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the first time period in the axis range and sends an {@link AxisChangeEvent} to * all registered listeners. * * @param first the time period (<code>null</code> not permitted). */ public void setFirst(RegularTimePeriod first) { if (first == null) { throw new IllegalArgumentException("Null 'first' argument."); } this.first = first; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the last time period in the axis range and sends an {@link AxisChangeEvent} to * all registered listeners. * * @param last the time period (<code>null</code> not permitted). */ public void setLast(RegularTimePeriod last) { if (last == null) { throw new IllegalArgumentException("Null 'last' argument."); } this.last = last; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the time zone that is used to convert the time periods into absolute milliseconds. * * @param zone the time zone (<code>null</code> not permitted). */ public void setTimeZone(TimeZone zone) { if (zone == null) { throw new IllegalArgumentException("Null 'zone' argument."); } this.timeZone = zone; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the class used to create the first and last time periods for the axis range * when the auto-range flag is set to <code>true</code> and sends an {@link AxisChangeEvent} * to all registered listeners. * * @param c the class (<code>null</code> not permitted). */ public void setAutoRangeTimePeriodClass(Class c) { if (c == null) { throw new IllegalArgumentException("Null 'c' argument."); } this.autoRangeTimePeriodClass = c; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the shape that can be displayed as an arrow pointing upwards at the end of an * axis line and sends an {@link AxisChangeEvent} to all registered listeners. * * @param arrow the arrow shape (<code>null</code> not permitted). */ public void setUpArrow(Shape arrow) { if (arrow == null) { throw new IllegalArgumentException("Null 'arrow' argument."); } this.upArrow = arrow; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the shape that can be displayed as an arrow pointing left at the end of an * axis line and sends an {@link AxisChangeEvent} to all registered listeners. * * @param arrow the arrow shape (<code>null</code> not permitted). */ public void setLeftArrow(Shape arrow) { if (arrow == null) { throw new IllegalArgumentException("Null 'arrow' argument."); } this.leftArrow = arrow; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the shape that can be displayed as an arrow pointing rightwards at the end of an * axis line and sends an {@link AxisChangeEvent} to all registered listeners. * * @param arrow the arrow shape (<code>null</code> not permitted). */ public void setRightArrow(Shape arrow) { if (arrow == null) { throw new IllegalArgumentException("Null 'arrow' argument."); } this.rightArrow = arrow; notifyListeners(new AxisChangeEvent(this)); }
/** * Sets a flag that controls the direction of values on the axis, and * notifies registered listeners that the axis has changed. * * @param flag the flag. */ public void setInverted(boolean flag) { if (this.inverted != flag) { this.inverted = flag; notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets the lower margin for the axis (as a percentage of the axis range) and sends an * {@link AxisChangeEvent} to all registered listeners. This margin is added only when the * axis range is auto-calculated - if you set the axis range manually, the margin is ignored. * * @param margin the margin percentage (for example, 0.05 is five percent). */ public void setLowerMargin(double margin) { this.lowerMargin = margin; if (isAutoRange()) { autoAdjustRange(); } notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the upper margin for the axis (as a percentage of the axis range) and sends an * {@link AxisChangeEvent} to all registered listeners. This margin is added only when the * axis range is auto-calculated - if you set the axis range manually, the margin is ignored. * * @param margin the margin percentage (for example, 0.05 is five percent). */ public void setUpperMargin(double margin) { this.upperMargin = margin; if (isAutoRange()) { autoAdjustRange(); } notifyListeners(new AxisChangeEvent(this)); }
/** * Sets the range for the axis, if requested, sends an {@link AxisChangeEvent} to all * registered listeners. As a side-effect, the auto-range flag is set to <code>false</code> * (optional). * * @param range the range (<code>null</code> not permitted). * @param turnOffAutoRange a flag that controls whether or not the auto range is turned off. * @param notify a flag that controls whether or not listeners are notified. */ public void setRange(Range range, boolean turnOffAutoRange, boolean notify) { if (range == null) { throw new IllegalArgumentException("Null 'range' argument."); } if (turnOffAutoRange) { this.autoRange = false; } this.range = range; if (notify) { notifyListeners(new AxisChangeEvent(this)); } }
/** * Sets a flag indicating whether or not the tick unit is automatically * selected from a range of standard tick units. * * @param flag the new value of the flag. * @param notify notify listeners? */ public void setAutoTickUnitSelection(boolean flag, boolean notify) { if (this.autoTickUnitSelection != flag) { this.autoTickUnitSelection = flag; if (notify) { notifyListeners(new AxisChangeEvent(this)); } } }