如何在 lcjs 图表中添加自定义标记时获取 Point 的值

huangapple go评论101阅读模式
英文:

How to get the value of Point when Adding custom markers to lcjs chart

问题

以下是代码部分的翻译:

我试图使用一个恒定线来标记数值但我不知道如何获取与它相交的曲线对应的值

与此问题相同https://stackoverflow.com/questions/75111465/adding-custom-markers-to-lcjs-chart

const chart = lightningChart()
    .ChartXY({
        theme: Themes.darkGold,
    })
const series = chart.addLineSeries().setName('Y1')
createProgressiveTraceGenerator()
    .setNumberOfPoints(100)
    .generate()
    .toPromise()
    .then((data) => {
        series.add(data)
    })
const xAxis = chart.getDefaultAxisX()
const xAxisConstantline = xAxis.addConstantLine()
xAxisConstantline.setValue(100)
xAxisConstantline.setName('X Axis Constantline')

如何获取 xAxisConstantline 的值中的 Y1 的值。

英文:

I'm trying to use a constant line to mark values, but I don't know how to get the value corresponding to the curve it intersects.

the same with this question:https://stackoverflow.com/questions/75111465/adding-custom-markers-to-lcjs-chart

const chart = lightningChart()
    .ChartXY({
        theme: Themes.darkGold,
    })
const series = chart.addLineSeries().setName('Y1')
createProgressiveTraceGenerator()
    .setNumberOfPoints(100)
    .generate()
    .toPromise()
    .then((data) => {
        series.add(data)
    })
const xAxis = chart.getDefaultAxisX()
const xAxisConstantline = xAxis.addConstantLine()
xAxisConstantline.setValue(100)
xAxisConstantline.setName('X Axis Constantline')

how to get the value of Y1 in xAxisConstantline value

答案1

得分: 0

你有一系列带有一些数据的线,并且你知道X轴上的一个坐标,想知道该线系列上相应的Y坐标?

可以使用LineSeries.solveNearestFromScreen

请参阅自定义游标图示例以进行快速参考:

https://lightningchart.com/lightningchart-js-interactive-examples/examples/lcjs-example-0702-customCursor.html?isList=false

英文:

So you have a line series with some data, and you know a coordinate on X axis, and want to know the respective Y coordinate on the line series?

This can be done using LineSeries.solveNearestFromScreen

Please see custom cursor chart example for immediate reference:

https://lightningchart.com/lightningchart-js-interactive-examples/examples/lcjs-example-0702-customCursor.html?isList=false

huangapple
  • 本文由 发表于 2023年4月11日 15:07:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/75983257.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定