本文整理匯總了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;
}