Sha*_*oon 0 highcharts typescript reactjs react-highcharts
我正在使用 React 和 typescript,我需要在图表打开后立即打开Highchart 工具提示。我需要在特定点打开它。
我知道我需要一个加载函数,但在打字稿中使用此关键字时出现错误。
我找到了解决方案。在 Highcharts.Options 对象中,图表对象内部使用以下代码:
events: {
load: function (this: Highcharts.Chart) {
if (this) {
const data = this.series.map(s => s.points[s.points.length - 1]);
this.tooltip.refresh(data);
}
}
},
Run Code Online (Sandbox Code Playgroud)
图表加载后,工具提示就会出现。
| 归档时间: |
|
| 查看次数: |
359 次 |
| 最近记录: |