英文:
How to customize Y axis cursor formatting in LightningChart ChartXY?
问题
当你将鼠标移到这个折线图上时,你可以看到Y轴上的标记显示当前的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.
答案1
得分: 1
在这个情况下,光标在特定轴(本例中是Y轴)上的格式由_tick策略_的属性控制。
以下是自定义光标格式的代码片段。
chart.getDefaultAxisY().setTickStrategy(AxisTickStrategies.Numeric, ticks => ticks
.setCursorFormatter((value, range) => `${value.toFixed(1)} W`)
)
如图所示,光标格式化器也被默认格式化在光标结果表中引用。
英文:
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`)
)
As seen in the picture, the cursor formatter is also referenced by the default formatting in cursor result table.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论