如何自定义 LightningChart ChartXY 中的 Y 轴光标格式?

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

How to customize Y axis cursor formatting in LightningChart ChartXY?

问题

当你将鼠标移到这个折线图上时,你可以看到Y轴上的标记显示当前的Y值。我想要改变显示的数值,但不知道文档中如何称呼这个元素,如果有的话。

如何自定义 LightningChart ChartXY 中的 Y 轴光标格式?

英文:

When you move the mouse over this line chart, you can see the marker on the Y axis showing the current Y value. I want to change the displayed value but have no idea how this element is called in the documentation, if it is described at all.

如何自定义 LightningChart ChartXY 中的 Y 轴光标格式?

答案1

得分: 1

在这个情况下,光标在特定轴(本例中是Y轴)上的格式由_tick策略_的属性控制。

以下是自定义光标格式的代码片段。

chart.getDefaultAxisY().setTickStrategy(AxisTickStrategies.Numeric, ticks => ticks
    .setCursorFormatter((value, range) => `${value.toFixed(1)} W`)
)

如图所示,光标格式化器也被默认格式化在光标结果表中引用。

如何自定义 LightningChart ChartXY 中的 Y 轴光标格式?

英文:

Cursor formatting over a particular axis (Y axis in this case) is controlled over properties of tick strategy.

Here's a code snippet how to customize the cursor formatting.

chart.getDefaultAxisY().setTickStrategy(AxisTickStrategies.Numeric, ticks => ticks
    .setCursorFormatter((value, range) => `${value.toFixed(1)} W`)
)

如何自定义 LightningChart ChartXY 中的 Y 轴光标格式?

As seen in the picture, the cursor formatter is also referenced by the default formatting in cursor result table.

huangapple
  • 本文由 发表于 2023年3月8日 19:32:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75672472.html
匿名

发表评论

匿名网友

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

确定