本文整理汇总了TypeScript中core/visuals.Line.set_value方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Line.set_value方法的具体用法?TypeScript Line.set_value怎么用?TypeScript Line.set_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core/visuals.Line
的用法示例。
在下文中一共展示了Line.set_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _draw_ticks
protected _draw_ticks(ctx: Context2d, coords: Coords, tin: number, tout: number, visuals: Line): void {
if (!visuals.doit)
return
const [x, y] = coords
const [sxs, sys] = this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name)
const [nx, ny] = this.model.normals
const [xoff, yoff] = this.model.offsets
const [nxin, nyin] = [nx * (xoff-tin), ny * (yoff-tin)]
const [nxout, nyout] = [nx * (xoff+tout), ny * (yoff+tout)]
visuals.set_value(ctx)
for (let i = 0; i < sxs.length; i++) {
const sx0 = Math.round(sxs[i] + nxout)
const sy0 = Math.round(sys[i] + nyout)
const sx1 = Math.round(sxs[i] + nxin)
const sy1 = Math.round(sys[i] + nyin)
ctx.beginPath()
ctx.moveTo(sx0, sy0)
ctx.lineTo(sx1, sy1)
ctx.stroke()
}
}
示例2: _draw_grid_helper
protected _draw_grid_helper(ctx: Context2d, visuals: Line, xs: number[][], ys: number[][]): void {
visuals.set_value(ctx)
for (let i = 0; i < xs.length; i++) {
const [sx, sy] = this.plot_view.map_to_screen(xs[i], ys[i], this._x_range_name, this._y_range_name)
ctx.beginPath()
ctx.moveTo(Math.round(sx[0]), Math.round(sy[0]))
for (let i = 1; i < sx.length; i++)
ctx.lineTo(Math.round(sx[i]), Math.round(sy[i]))
ctx.stroke()
}
}