本文整理汇总了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;
}
示例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};
}
}
});
示例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;
}