本文整理汇总了TypeScript中vega-util.toSet函数的典型用法代码示例。如果您正苦于以下问题:TypeScript toSet函数的具体用法?TypeScript toSet怎么用?TypeScript toSet使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toSet函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: producedFields
public producedFields(): StringSet {
return toSet(this.transform.from.fields || ((this.transform.as instanceof Array) ? this.transform.as : [this.transform.as]));
}
示例2: scaleTypePrecedence
ordinal: 0,
'bin-ordinal': 0,
quantile: 0,
quantize: 0,
threshold: 0
};
/**
* Return scale categories -- only scale of the same categories can be merged together.
*/
export function scaleTypePrecedence(scaleType: ScaleType): number {
return SCALE_PRECEDENCE_INDEX[scaleType];
}
export const CONTINUOUS_TO_CONTINUOUS_SCALES: ScaleType[] = ['linear', 'log', 'pow', 'sqrt', 'symlog', 'time', 'utc'];
const CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES);
export const CONTINUOUS_TO_DISCRETE_SCALES: ScaleType[] = ['quantile', 'quantize', 'threshold'];
const CONTINUOUS_TO_DISCRETE_INDEX = toSet(CONTINUOUS_TO_DISCRETE_SCALES);
export const CONTINUOUS_DOMAIN_SCALES: ScaleType[] = CONTINUOUS_TO_CONTINUOUS_SCALES.concat([
'quantile',
'quantize',
'threshold'
]);
const CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES);
export const DISCRETE_DOMAIN_SCALES: ScaleType[] = ['ordinal', 'bin-ordinal', 'point', 'band'];
const DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES);
export const TIME_SCALE_TYPES: ScaleType[] = ['time', 'utc'];
示例3: isMarkDef
* Offset between bars for binned field. Ideal value for this is either 0 (Preferred by statisticians) or 1 (Vega-Lite Default, D3 example style).
*
* __Default value:__ `1`
*
* @minimum 0
*/
binSpacing?: number;
}
export type AnyMark = CompositeMark | CompositeMarkDef | Mark | MarkDef;
export function isMarkDef(mark: string | GenericMarkDef<any>): mark is GenericMarkDef<any> {
return mark['type'];
}
const PRIMITIVE_MARK_INDEX = toSet(PRIMITIVE_MARKS);
export function isPrimitiveMark(mark: AnyMark): mark is Mark {
const markType = isMarkDef(mark) ? mark.type : mark;
return markType in PRIMITIVE_MARK_INDEX;
}
export const STROKE_CONFIG = [
'stroke',
'strokeWidth',
'strokeDash',
'strokeDashOffset',
'strokeOpacity',
'strokeJoin',
'strokeMiterLimit'
];
示例4: toSet
DATASET_URL_REQUEST,
// Shelf Actions,
SHELF_CLEAR,
SHELF_MARK_CHANGE_TYPE,
SHELF_FIELD_ADD,
SHELF_FIELD_AUTO_ADD,
SHELF_FIELD_REMOVE,
SHELF_FIELD_MOVE,
SHELF_FUNCTION_CHANGE,
SHELF_SPEC_LOAD,
SHELF_SPEC_PREVIEW,
SHELF_SPEC_PREVIEW_DISABLE,
];
export const USER_ACTION_INDEX: Object = toSet(USER_ACTIONS);
/**
* Actions that are to be grouped with actions that precede them.
*
* This list is here for documentation purposes
*
* DATASET_INLINE_RECEIVE,
* DATASET_URL_RECEIVE,
*/
export const GROUPED_ACTIONS: ActionType[] = [
DATASET_INLINE_RECEIVE,
DATASET_URL_RECEIVE,
];
示例5: isCountingAggregateOp
export const COUNTING_OPS: AggregateOp[] = ['count', 'valid', 'missing', 'distinct'];
export function isCountingAggregateOp(aggregate: string): boolean {
return aggregate && contains(COUNTING_OPS, aggregate);
}
/** Additive-based aggregation operations. These can be applied to stack. */
export const SUM_OPS: AggregateOp[] = [
'count',
'sum',
'distinct',
'valid',
'missing'
];
/**
* Aggregation operators that always produce values within the range [domainMin, domainMax].
*/
export const SHARED_DOMAIN_OPS: AggregateOp[] = [
'mean',
'average',
'median',
'q1',
'q3',
'min',
'max',
];
export const SHARED_DOMAIN_OP_INDEX = toSet(SHARED_DOMAIN_OPS);
示例6: scaleTypePrecedence
// non grouped types
'bin-linear': 0,
sequential: 0,
ordinal: 0,
'bin-ordinal': 0,
};
/**
* Return scale categories -- only scale of the same categories can be merged together.
*/
export function scaleTypePrecedence(scaleType: ScaleType): number {
return SCALE_PRECEDENCE_INDEX[scaleType];
}
export const CONTINUOUS_TO_CONTINUOUS_SCALES: ScaleType[] = ['linear', 'bin-linear', 'log', 'pow', 'sqrt', 'time', 'utc'];
const CONTINUOUS_TO_CONTINUOUS_INDEX = toSet(CONTINUOUS_TO_CONTINUOUS_SCALES);
export const CONTINUOUS_DOMAIN_SCALES: ScaleType[] = CONTINUOUS_TO_CONTINUOUS_SCALES.concat(['sequential' /* TODO add 'quantile', 'quantize', 'threshold'*/]);
const CONTINUOUS_DOMAIN_INDEX = toSet(CONTINUOUS_DOMAIN_SCALES);
export const DISCRETE_DOMAIN_SCALES: ScaleType[] = ['ordinal', 'bin-ordinal', 'point', 'band'];
const DISCRETE_DOMAIN_INDEX = toSet(DISCRETE_DOMAIN_SCALES);
const BIN_SCALES_INDEX = toSet(['bin-linear', 'bin-ordinal']);
export const TIME_SCALE_TYPES: ScaleType[] = ['time', 'utc'];
export function hasDiscreteDomain(type: ScaleType): type is 'ordinal' | 'bin-ordinal' | 'point' | 'band' {
return type in DISCRETE_DOMAIN_INDEX;
}
示例7: toSet
line: ['x', 'y'],
trail: ['x', 'y'],
area: ['x', 'y']
};
export interface SupportedChannelMap {
[mark: string]: {
[channel: string]: boolean
};
}
/**
* Supported Encoding Channel for each mark type
*/
export const DEFAULT_SUPPORTED_CHANNEL_TYPE: SupportedChannelMap = {
bar: toSet(['row', 'column', 'x', 'y', 'size', 'color', 'fill', 'stroke', 'detail']),
line: toSet(['row', 'column', 'x', 'y', 'color', 'fill', 'stroke', 'color', 'detail']),
trail: toSet(['row', 'column', 'x', 'y', 'color', 'fill', 'stroke', 'color', 'detail', 'size']),
area: toSet(['row', 'column', 'x', 'y', 'color', 'fill', 'stroke', 'detail']),
tick: toSet(['row', 'column', 'x', 'y', 'color', 'fill', 'stroke', 'detail']),
circle: toSet(['row', 'column', 'x', 'y', 'color', 'fill', 'stroke', 'size', 'detail']),
square: toSet(['row', 'column', 'x', 'y', 'color', 'fill', 'stroke', 'size', 'detail']),
point: toSet(['row', 'column', 'x', 'y', 'color', 'fill', 'stroke', 'size', 'detail', 'shape']),
geoshape: toSet(['row', 'column', 'color', 'fill', 'stroke', 'detail', 'shape']),
text: toSet(['row', 'column', 'size', 'color', 'fill', 'stroke', 'text']) // TODO(#724) revise
};
// TODO: consider if we should add validate method and
// requires ZSchema in the main vega-lite repo
/**
示例8: it
it('NON_TYPE_RANGE_SCALE_PROPERTIES should be SCALE_PROPERTIES wihtout type, domain, and range properties', () => {
expect(toSet(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES)).toEqual(
toSet(without(SCALE_PROPERTIES, ['type', 'domain', 'range', 'rangeStep', 'scheme']))
);
});
示例9: dependentFields
public dependentFields(): StringSet {
return toSet(keys(this._parse));
}
示例10: producedFields
// format parse depends and produces all fields in its parse
public producedFields(): StringSet {
return toSet(keys(this._parse));
}