本文整理汇总了TypeScript中d3-shape.symbol函数的典型用法代码示例。如果您正苦于以下问题:TypeScript symbol函数的具体用法?TypeScript symbol怎么用?TypeScript symbol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了symbol函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(size: number, type: 'circle' | 'square') {
this.size = size;
switch (type) {
case 'circle':
this.type = d3Shape.symbolCircle;
break;
case 'square':
this.type = d3Shape.symbolSquare;
break;
default:
this.type = d3Shape.symbolCircle;
break;
}
this.symbol = d3Shape.symbol<Symbolizer, SymbolDatum>()
.size(function(this: Symbolizer, d?: SymbolDatum) {
return d ? d.size : this.size;
})
.type(function(this: Symbolizer, d?: SymbolDatum) {
let type = this.type;
if (d && d.type) {
switch (d.type) {
case 'circle':
type = d3Shape.symbolCircle;
break;
case 'square':
type = d3Shape.symbolSquare;
break;
default:
type = d3Shape.symbolSquare;
}
}
return type;
});
}
开发者ID:Georadix,项目名称:DefinitelyTyped,代码行数:34,代码来源:d3-shape-tests.ts
示例2: draw
let customSymbol: d3Shape.SymbolType;
customSymbol = {
draw(context: CanvasPathMethods, size: number): void {
// draw custom symbol using canvas path methods
}
};
// Symbol() create Symbol Generator ===================================================
let canvasSymbol: d3Shape.Symbol<any, any>;
let svgSymbol: d3Shape.Symbol<SVGPathElement, SymbolDatum>;
canvasSymbol = d3Shape.symbol();
svgSymbol = d3Shape.symbol<SymbolDatum>();
// Configure Symbol Generator =========================================================
// context() --------------------------------------------------------------------------
if (context !== null) {
canvasSymbol = canvasSymbol.context(context); // draw to canvas
}
context = canvasSymbol.context();
svgSymbol = svgSymbol.context(null); // use as path string generator for SVG
// size() ----------------------------------------------------------------------------
开发者ID:Georadix,项目名称:DefinitelyTyped,代码行数:30,代码来源:d3-shape-tests.ts
示例3: symbol
export const dSymbol = (
{ size }: ScatterSeries.PointOptions,
) => symbol().size(size ** 2).type(symbolCircle)()!;
开发者ID:MaximKudriavtsev,项目名称:devextreme-reactive,代码行数:3,代码来源:computeds.ts
注:本文中的d3-shape.symbol函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论