本文整理汇总了TypeScript中d3-selection.Selection.text方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Selection.text方法的具体用法?TypeScript Selection.text怎么用?TypeScript Selection.text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类d3-selection.Selection
的用法示例。
在下文中一共展示了Selection.text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: drawProc
const schedulePointRefresh = drawProc(() => {
const [greenData, blueData] = this.data[Math.round(this.highlightedDataIdx)]
this.legendTime.text(new Date(this.idxToTime.applyToPoint(this.highlightedDataIdx)).toLocaleString())
const dotScaleMatrixNy = pathTransformNy.dotScaleMatrix(dotRadius)
const dotScaleMatrixSf = pathTransformSf.dotScaleMatrix(dotRadius)
const updateDot = (greenData: number, legend: Selection<BaseType, {}, HTMLElement, any>, node: SVGGraphicsElement, dotScaleMatrix: SVGMatrix) => {
legend.text(fixNaN(greenData, ' '))
updateNode(node, identityMatrix.translate(this.highlightedDataIdx, fixNaN(greenData, 0)).multiply(dotScaleMatrix))
}
updateDot(greenData, this.legendGreen, highlightedGreenDot, dotScaleMatrixNy)
updateDot(blueData, this.legendBlue, highlightedBlueDot, dotScaleMatrixSf)
})
示例2: renderExample
/* Documentation */
function renderExample($target: Selection<any, any, any, any>, specText: string) {
$target.classed('example', true);
$target.text('');
const vis = $target.append('div').attr('class', 'example-vis');
// Decrease visual noise by removing $schema and description from code examples.
const textClean = specText.replace(/(\s)+\"(\$schema|description)\": \".*?\",/g, '');
const code = $target
.append('pre')
.attr('class', 'example-code')
.append('code')
.attr('class', 'json')
.text(textClean);
hljs.highlightBlock(code.node() as any);
const spec = JSON.parse(specText);
embedExample(vis.node(), spec, true, !$target.classed('no-tooltip'));
}
示例3: fixNaN
const updateDot = (greenData: number, legend: Selection<BaseType, {}, HTMLElement, any>, node: SVGGraphicsElement, dotScaleMatrix: SVGMatrix) => {
legend.text(fixNaN(greenData, ' '))
updateNode(node, identityMatrix.translate(this.highlightedDataIdx, fixNaN(greenData, 0)).multiply(dotScaleMatrix))
}