• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript scale.hasDiscreteDomain函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: smallRangeStepForHighCardinalityOrFacet

export function smallRangeStepForHighCardinalityOrFacet(specM: SpecQueryModel, schema: Schema, encQIndex: Dict<EncodingQuery>, opt: QueryConfig): SpecQueryModel {
  [Channel.ROW, Channel.Y, Channel.COLUMN, Channel.X].forEach((channel) => {
    encQIndex[channel] = specM.getEncodingQueryByChannel(channel);
  });

  const yEncQ = encQIndex[Channel.Y];
  if (yEncQ !== undefined && isFieldQuery(yEncQ)) {
    if (encQIndex[Channel.ROW] ||
        schema.cardinality(yEncQ) > opt.smallRangeStepForHighCardinalityOrFacet.maxCardinality) {

      // We check for undefined rather than
      // yEncQ.scale = yEncQ.scale || {} to cover the case where
      // yEncQ.scale has been set to false/null.
      // This prevents us from incorrectly overriding scale and
      // assigning a rangeStep when scale is set to false.
      if (yEncQ.scale === undefined) {
        yEncQ.scale = {};
      }

      // We do not want to assign a rangeStep if scale is set to false
      // and we only apply this if the scale is (or can be) an ordinal scale.
      const yScaleType = scaleType(yEncQ);
      if (yEncQ.scale && (yScaleType === undefined || hasDiscreteDomain(yScaleType))) {
        if (!(yEncQ.scale as ScaleQuery).rangeStep) {
          (yEncQ.scale as ScaleQuery).rangeStep = 12;
        }
      }
    }
  }

  const xEncQ = encQIndex[Channel.X];
  if (isFieldQuery(xEncQ)) {
    if (encQIndex[Channel.COLUMN] ||
        schema.cardinality(xEncQ) > opt.smallRangeStepForHighCardinalityOrFacet.maxCardinality) {

      // Just like y, we don't want to do this if scale is null/false
      if (xEncQ.scale === undefined) {
        xEncQ.scale = {};
      }

      // We do not want to assign a rangeStep if scale is set to false
      // and we only apply this if the scale is (or can be) an ordinal scale.
      const xScaleType = scaleType(xEncQ);
      if (xEncQ.scale && (xScaleType === undefined || hasDiscreteDomain(xScaleType))) {
        if (!(xEncQ.scale as ScaleQuery).rangeStep) {
          (xEncQ.scale as ScaleQuery).rangeStep = 12;
        }
      }
    }
  }

  return specM;
}
开发者ID:herrstucki,项目名称:compassql,代码行数:53,代码来源:stylize.ts


示例2: getExtendedType

export function getExtendedType(fieldQ: FieldQuery): ExtendedType {
  if (fieldQ.bin) {
    return ExtendedType.BIN_Q;
  } else if (fieldQ.timeUnit) {
    const sType = scaleType(fieldQ);
    return hasDiscreteDomain(sType) ? ExtendedType.TIMEUNIT_O : ExtendedType.TIMEUNIT_T;
  }
  return fieldQ.type as ExtendedType;
}
开发者ID:uwdata,项目名称:compassql,代码行数:9,代码来源:type.ts


示例3: scaleType

    satisfy: (fieldQ: FieldQuery, _: Schema, __: PropIndex<Wildcard<any>>, ___: QueryConfig) => {
      if (fieldQ.scale) {
        const type = fieldQ.type;
        const sType = scaleType(fieldQ);

        if (isDiscrete(type)) {
            return sType === undefined || hasDiscreteDomain(sType);
        } else if (type === Type.TEMPORAL) {
          if(!fieldQ.timeUnit) {
            return contains([ScaleType.TIME, ScaleType.UTC, undefined], sType);
          } else {
            return contains([ScaleType.TIME, ScaleType.UTC, undefined], sType) || hasDiscreteDomain(sType);
          }
        } else if (type === Type.QUANTITATIVE) {
          if (fieldQ.bin) {
            return contains([ScaleType.LINEAR, undefined], sType);
          } else {
            return contains([ScaleType.LOG, ScaleType.POW, ScaleType.SQRT, ScaleType.QUANTILE, ScaleType.QUANTIZE, ScaleType.LINEAR, undefined], sType);
          }
        }
      }
      return true;
    }
开发者ID:uwdata,项目名称:compassql,代码行数:23,代码来源:field.ts


示例4: xAxisOnTopForHighYCardinalityWithoutColumn

export function xAxisOnTopForHighYCardinalityWithoutColumn(specM: SpecQueryModel, schema: Schema, encQIndex: Dict<EncodingQuery>, opt: QueryConfig): SpecQueryModel {
  [Channel.COLUMN, Channel.X, Channel.Y].forEach((channel) => {
    encQIndex[channel] = specM.getEncodingQueryByChannel(channel);
  });

  if (encQIndex[Channel.COLUMN] === undefined) {
    const xEncQ = encQIndex[Channel.X];
    const yEncQ = encQIndex[Channel.Y];
    if (isFieldQuery(xEncQ) && isFieldQuery(yEncQ) && yEncQ !== undefined && yEncQ.field && hasDiscreteDomain(scaleType(yEncQ))) {
      if (xEncQ !== undefined) {
        if (schema.cardinality(yEncQ) > opt.xAxisOnTopForHighYCardinalityWithoutColumn.maxCardinality) {

          if (xEncQ.axis === undefined) {
            xEncQ.axis = {};
          }

          if (xEncQ.axis && !(xEncQ.axis as AxisQuery).orient) {
            (xEncQ.axis as AxisQuery).orient = 'top';
          }
        }
      }
    }
  }

  return specM;
}
开发者ID:herrstucki,项目名称:compassql,代码行数:26,代码来源:stylize.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript fielddef.cardinality函数代码示例发布时间:2022-05-25
下一篇:
TypeScript mark.PRIMITIVE_MARKS类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap