本文整理汇总了TypeScript中vega-lite/src/fielddef.isCount函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isCount函数的具体用法?TypeScript isCount怎么用?TypeScript isCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isCount函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: if
fieldDefs.forEach(function(fieldDef, index){
// save indices for stable sort later
indices[fieldDef.field] = index;
if (fieldDef.selected) { // selected fields are included in selected
selected.push(fieldDef);
if (isDimension(fieldDef) ||
(fieldDef.type === TEMPORAL /* TODO: add && current constraint make it a dimension */)) {
// If the field can serve as dimension
// FIXME vega-lite's isDimension is designed to work with FieldDef, not SchemaField
// Therefore, we should augment vega-lite's isDimension
hasSelectedDimension = true;
} else {
hasSelectedMeasure = true;
}
} else if (fieldDef.selected !== false && !vlFieldDef.isCount(fieldDef)) {
if (vlFieldDef.isDimension(fieldDef) &&
!opt.maxCardinalityForAutoAddOrdinal &&
vlFieldDef.cardinality(fieldDef, stats, 15) > opt.maxCardinalityForAutoAddOrdinal
) {
return;
}
fieldsToAdd.push(fieldDef);
}
});
示例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:
return projection.map(function(fieldDef) {
return vlFieldDef.isCount(fieldDef) ? 'count' : fieldDef.field;
}).join(',');