Package com.positive.charts.data.time

Examples of com.positive.charts.data.time.DateRange


    final double length = (this.timeline.toTimelineValue((long) this
        .getRange().getUpperBound()) - this.timeline
        .toTimelineValue((long) this.getRange().getLowerBound()));
    Range adjusted = null;
    if (this.isInverted()) {
      adjusted = new DateRange(
          this.timeline
              .toMillisecond((long) (start + (length * (1 - upperPercent)))),
          this.timeline
              .toMillisecond((long) (start + (length * (1 - lowerPercent)))));
    } else {
      adjusted = new DateRange(this.timeline
          .toMillisecond((long) (start + length * lowerPercent)),
          this.timeline.toMillisecond((long) (start + length
              * upperPercent)));
    }
    this.setRange(adjusted);
 
View Full Code Here


      Range r = vap.getDataRange(this);
      if (r == null) {
        if (this.timeline instanceof SegmentedTimeline) {
          // Timeline hasn't method getStartTime()
          r = new DateRange(
              ((SegmentedTimeline) this.timeline).getStartTime(),
              ((SegmentedTimeline) this.timeline).getStartTime() + 1);
        } else {
          r = new DateRange();
        }
      }

      long upper = this.timeline
          .toTimelineValue((long) r.getUpperBound());
      long lower;
      final long fixedAutoRange = (long) this.getFixedAutoRange();
      if (fixedAutoRange > 0.0) {
        lower = upper - fixedAutoRange;
      } else {
        lower = this.timeline.toTimelineValue((long) r.getLowerBound());
        final double range = upper - lower;
        final long minRange = (long) this.getAutoRangeMinimumSize();
        if (range < minRange) {
          final long expand = (long) (minRange - range) / 2;
          upper = upper + expand;
          lower = lower - expand;
        }
        upper = upper + (long) (range * this.getUpperMargin());
        lower = lower - (long) (range * this.getLowerMargin());
      }

      upper = this.timeline.toMillisecond(upper);
      lower = this.timeline.toMillisecond(lower);
      final DateRange dr = new DateRange(new Date(lower), new Date(upper));
      this.setRange(dr, false, false);
    }

  }
View Full Code Here

      // all tick labels have the same width (equal to the height of
      // the font)...
      result += lm.getHeight();
    } else {
      // look at lower and upper bounds...
      final DateRange range = (DateRange) this.getRange();
      final Date lower = range.getLowerDate();
      final Date upper = range.getUpperDate();
      String lowerStr = null;
      String upperStr = null;
      final DateFormat formatter = this.getDateFormatOverride();
      if (formatter != null) {
        lowerStr = formatter.format(lower);
View Full Code Here

      // all tick labels have the same width (equal to the height of
      // the font)...
      result += lm.getHeight();
    } else {
      // look at lower and upper bounds...
      final DateRange range = (DateRange) this.getRange();
      final Date lower = range.getLowerDate();
      final Date upper = range.getUpperDate();
      String lowerStr = null;
      String upperStr = null;
      final DateFormat formatter = this.getDateFormatOverride();
      if (formatter != null) {
        lowerStr = formatter.format(lower);
View Full Code Here

  public Date getMaximumDate() {

    Date result = null;
    final Range range = this.getRange();
    if (range instanceof DateRange) {
      final DateRange r = (DateRange) range;
      result = r.getUpperDate();
    } else {
      result = new Date((long) range.getUpperBound());
    }
    return result;
View Full Code Here

    Date result = null;

    final Range range = this.getRange();
    if (range instanceof DateRange) {
      final DateRange r = (DateRange) range;
      result = r.getLowerDate();
    } else {
      result = new Date((long) range.getLowerBound());
    }

    return result;
View Full Code Here

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

    final DateRange range = (DateRange) this.getRange();
    final double axisMin = this.timeline.toTimelineValue(range
        .getLowerDate());
    final double axisMax = this.timeline.toTimelineValue(range
        .getUpperDate());

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

   *
   * @param maximumDate
   *            the date (<code>null</code> not permitted).
   */
  public void setMaximumDate(final Date maximumDate) {
    this.setRange(new DateRange(this.getMinimumDate(), maximumDate), true,
        false);
    this.notifyListeners(new AxisChangeEvent(this));
  }
View Full Code Here

   *
   * @param date
   *            the date (<code>null</code> not permitted).
   */
  public void setMinimumDate(final Date date) {
    this.setRange(new DateRange(date, this.getMaximumDate()), true, false);
    this.notifyListeners(new AxisChangeEvent(this));
  }
View Full Code Here

   */
  public void setRange(final Date lower, final Date upper) {
    if (lower.getTime() >= upper.getTime()) {
      throw new IllegalArgumentException("Requires 'lower' < 'upper'.");
    }
    this.setRange(new DateRange(lower, upper));
  }
View Full Code Here

TOP

Related Classes of com.positive.charts.data.time.DateRange

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.