Package com.positive.charts.data

Examples of com.positive.charts.data.Range


   *
   * @return The number of visible ticks on the axis.
   */
  protected int calculateVisibleTickCount() {
    final double unit = this.getTickUnit().getSize();
    final Range range = this.getRange();
    return (int) (Math.floor(range.getUpperBound() / unit)
        - Math.ceil(range.getLowerBound() / unit) + 1);
  }
View Full Code Here


      // all tick labels have the same width (equal to the height of the
      // font)...
      result += gc.getFontMetrics().getHeight();
    } else {
      // look at lower and upper bounds...
      final Range range = this.getRange();
      final double lower = range.getLowerBound();
      final double upper = range.getUpperBound();
      final String lowerStr = unit.valueToString(lower);
      final String upperStr = unit.valueToString(upper);
      final double w1 = gc.textExtent(lowerStr).x;
      final double w2 = gc.textExtent(upperStr).x;
      result += Math.max(w1, w2);
View Full Code Here

   * @return The data value.
   */
  public double java2DToValue(final double java2DValue, final Rectangle area,
      final RectangleEdge edge) {

    final Range range = this.getRange();
    final double axisMin = range.getLowerBound();
    final double axisMax = range.getUpperBound();

    double min = 0.0;
    double max = 0.0;
    if (edge.isTopOrBottom()) {
      min = area.x;
View Full Code Here

   *
   * @return The Java2D coordinate.
   */
  public double valueToJava2D(final double value, final Rectangle area,
      final RectangleEdge edge) {
    final Range range = this.getRange();
    final double axisMin = range.getLowerBound();
    final double axisMax = range.getUpperBound();

    double min = 0.0;
    double max = 0.0;
    if (edge.isTopOrBottom()) {
      min = RectangleUtil.getMinX(area);
View Full Code Here

   *            the new central value after the resize.
   */
  public void resizeRange(final double percent, final double anchorValue) {
    if (percent > 0.0) {
      final double halfLength = this.range.getLength() * percent / 2;
      final Range adjusted = new Range(anchorValue - halfLength,
          anchorValue + halfLength);
      this.setRange(adjusted);
    } else {
      this.setAutoRange(true);
    }
View Full Code Here

   *
   * @see #getLowerBound()
   */
  public void setLowerBound(final double min) {
    if (this.range.getUpperBound() > min) {
      this.setRange(new Range(min, this.range.getUpperBound()));
    } else {
      this.setRange(new Range(min, min + 1.0));
    }
  }
View Full Code Here

   *            the upper axis limit.
   *
   * @see #getRange()
   */
  public void setRange(final double lower, final double upper) {
    this.setRange(new Range(lower, upper));
  }
View Full Code Here

   *            the central value.
   * @param length
   *            the range length.
   */
  public void setRangeAboutValue(final double value, final double length) {
    this.setRange(new Range(value - length / 2, value + length / 2));
  }
View Full Code Here

   *            the lower axis limit.
   * @param upper
   *            the upper axis limit.
   */
  public void setRangeWithMargins(final double lower, final double upper) {
    this.setRangeWithMargins(new Range(lower, upper));
  }
View Full Code Here

   * @see #getUpperBound()
   */
  public void setUpperBound(final double max) {

    if (this.range.getLowerBound() < max) {
      this.setRange(new Range(this.range.getLowerBound(), max));
    } else {
      this.setRange(max - 1.0, max);
    }

  }
View Full Code Here

TOP

Related Classes of com.positive.charts.data.Range

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.