當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript plywood.TimeRange類代碼示例

本文整理匯總了TypeScript中plywood.TimeRange的典型用法代碼示例。如果您正苦於以下問題:TypeScript TimeRange類的具體用法?TypeScript TimeRange怎麽用?TypeScript TimeRange使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TimeRange類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: getPseudoHighlight

  getPseudoHighlight(eventX: number): TimeRange {
    var { scaleX } = this.props;
    var { dragStartPx } = this.state;
    var myDOM = React.findDOMNode(this);
    var d1 = scaleX.invert(dragStartPx);
    var d2 = scaleX.invert(eventX - myDOM.getBoundingClientRect().left);

    if (d1 < d2) {
      return TimeRange.fromJS({ start: d1, end: d2 });
    } else {
      return TimeRange.fromJS({ start: d2, end: d1 });
    }
  }
開發者ID:Ghostubborn,項目名稱:pivot,代碼行數:13,代碼來源:highlighter.ts

示例2: formatValue

export function formatValue(value: any, timezone?: Timezone, displayYear?: DisplayYear): string {
  if (NumberRange.isNumberRange(value)) {
    return `${formatValue(value.start)}-${formatValue(value.end)}`;
  } else if (TimeRange.isTimeRange(value)) {
    return formatTimeRange(value, timezone, displayYear);
  } else {
    return '' + value;
  }
}
開發者ID:boneill42,項目名稱:pivot,代碼行數:9,代碼來源:formatter.ts

示例3: globalMouseUpListener

  globalMouseUpListener(e: MouseEvent) {
    var { clicker, essence, highlightId, duration, timezone, onClose } = this.props;
    var { dragStartPx, pseudoHighlight } = this.state;
    if (dragStartPx === null) return;
    if (!pseudoHighlight) { // There was no mouse move so just quietly cancel out
      clicker.dropHighlight();
      onClose();
      return;
    }

    pseudoHighlight = this.getPseudoHighlight(e.clientX);
    this.setState({
      dragStartPx: null,
      pseudoHighlight: null
    });

    var timeRange = TimeRange.fromJS({
      start: duration.floor(pseudoHighlight.start, timezone),
      end: duration.move(duration.floor(pseudoHighlight.end, timezone), timezone, 1)
    });

    var timeDimension = essence.getTimeDimension();
    clicker.changeHighlight(highlightId, Filter.fromClause(timeDimension.expression.in(timeRange)));
  }
開發者ID:Ghostubborn,項目名稱:pivot,代碼行數:24,代碼來源:highlighter.ts

示例4: parseIntervalString

function parseIntervalString(str: string): TimeRange {
  var parts = str.split('/');
  if (parts.length > 2) throw new Error(`Can not parse string ${str}`);
  var p0: string = parts[0];
  var p1: string = parts.length === 2 ? parts[1] : (new Date()).toISOString();

  var start: Date = null;
  var end: Date = null;
  var duration: Duration = null;
  if (p0[0] === 'P') {
    duration = Duration.fromJS(p0);
    end = new Date(p1);
    start = duration.move(end, Timezone.UTC, -1);
  } else if (p1[0] === 'P') {
    start = new Date(p0);
    duration = Duration.fromJS(p1);
    end = duration.move(end, Timezone.UTC, 1);
  } else {
    start = new Date(p0);
    end = new Date(p1);
  }

  return TimeRange.fromJS({ start, end });
}
開發者ID:dkarpman,項目名稱:plyql,代碼行數:24,代碼來源:cli.ts

示例5: fromJS

 static fromJS(parameters: TimePresetJS): TimePreset {
   return new TimePreset({
     name: parameters.name,
     timeRange: TimeRange.fromJS(parameters.timeRange)
   });
 }
開發者ID:Ghostubborn,項目名稱:pivot,代碼行數:6,代碼來源:time-preset.ts

示例6: equals

 public equals(other: TimePreset): boolean {
   return TimePreset.isTimePreset(other) &&
     this.name === other.name &&
     this.timeRange.equals(other.timeRange);
 }
開發者ID:Ghostubborn,項目名稱:pivot,代碼行數:5,代碼來源:time-preset.ts

示例7: toJS

 public toJS(): TimePresetJS {
   return {
     name: this.name,
     timeRange: this.timeRange.toJS()
   };
 }
開發者ID:Ghostubborn,項目名稱:pivot,代碼行數:6,代碼來源:time-preset.ts


注:本文中的plywood.TimeRange類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。