当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript fielddef.isMeasure函数代码示例

本文整理汇总了TypeScript中vega-lite/src/fielddef.isMeasure函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isMeasure函数的具体用法?TypeScript isMeasure怎么用?TypeScript isMeasure使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了isMeasure函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: color

    export function color(encoding: Encoding, fieldDef: FieldDef, stats, opt: SpecOption) {
      // Don't use color if omitMultipleRetinalEncodings is true and we already have other retinal encoding
      if (!retinalEncRules(encoding, fieldDef, stats, opt)) {
        return false;
      }

      // Color must be either measure or dimension with cardinality lower than the max cardinality
      return isMeasure(fieldDef) ||
        cardinality(fieldDef, stats) <= opt.maxCardinalityForColor;
    }
开发者ID:mchally,项目名称:ExploringDataViz,代码行数:10,代码来源:encodings.ts

示例2:

  ['x', 'y'].forEach(function(channel) {
    var fieldDef = encoding[channel];

    // TODO add a parameter for this case
    if (fieldDef && vlFieldDef.isMeasure(fieldDef) && !vlFieldDef.isCount(fieldDef)) {
      var stat = stats[fieldDef.field];
      if (stat && stat.stdev / stat.mean < 0.01) {
        fieldDef.scale = {zero: false};
      }
    }
  });
开发者ID:mchally,项目名称:ExploringDataViz,代码行数:11,代码来源:specs.ts

示例3: xyPlotRules

  function xyPlotRules(encoding: Encoding, stats, opt: SpecOption) {
    if (encoding.row || encoding.column) { // have facet(s)
      if (opt.omitNonTextAggrWithAllDimsOnFacets) {
        // remove all aggregated charts with all dims on facets (row, column)
        if (isAggrWithAllDimOnFacets(encoding)) { return false; }
      }
    }

    var isDimX = isDimension(encoding.x),
      isDimY = isDimension(encoding.y);

    // If both x and y are dimension, and the plot is not aggregated,
    // there might be occlusion.
    if (opt.omitRawWithXYBothDimension && isDimX && isDimY && !isAggregate(encoding)) {
      // FIXME actually check if there would be occlusion #90
      return false;
    }

    if (opt.omitTranspose) {
      if (isDimX !== isDimY) { // dim x mea
        // create horizontal histogram for ordinal
        if ((encoding.y.type === Type.NOMINAL || encoding.y.type === Type.ORDINAL) && isMeasure(encoding.x)) {
          return true;
        }

        // vertical histogram for binned Q and T
        if (!isDimY && isDimX && !(encoding.x.type === Type.NOMINAL || encoding.x.type === Type.ORDINAL)) {
          return true;
        }

        return false;
      } else if (encoding.y.type=== Type.TEMPORAL || encoding.x.type === Type.TEMPORAL) {
        // FIXME revise this
        if (encoding.y.type=== Type.TEMPORAL && encoding.x.type !== Type.TEMPORAL) {
          return false;
        }
      } else {
        // FIXME: test if we can remove this rule
        // show only one OxO, QxQ
        if (encoding.x.field > encoding.y.field) {
          return false;
        }
      }
    }
    return true;
  }
开发者ID:mchally,项目名称:ExploringDataViz,代码行数:46,代码来源:encodings.ts


注:本文中的vega-lite/src/fielddef.isMeasure函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。