问题描述
我在LightningChartJs 2.0.2
应用程序中使用Angular
。
在图表中,我实现了一条直线和一个点系列,其工作原理与预期的一样。
但是,如果我更改路线并返回到图表the point series is not visible anymore
。在不同的环境中尝试无法成功。我也找不到实际问题的原因。
this.chart = lightningChart().ChartXY({container: `${this.chartId}`});
const lineseries = this.chart.addLineseries().setstrokeStyle((style) => style.setThickness(5));
lineseries.add(this.points);
const pointSeries = this.chart.addPointSeries().setName('Points').setPointSize(6);
pointSeries.add(this.points);
在销毁图表时将其丢弃:
ngOnDestroy() {
// "dispose" should be called when the component is unmounted to free all the resources used by the chart
this.chart.dispose();
}
通常情况下,此时图表和所有依赖项将被破坏。 如果我回到图表页面,则应该使用所有系列来重新创建图表,但是点系列不是。
为什么点序列不再可见以及如何解决?
请参阅stackblitz示例!图表处理位于
/src/app/lc-test/lc-test.component.ts
重现问题的步骤:
- 将路线更改为
LC Test
。您会看到线和点系列。 - 改回到
Dashboard
,然后再次改成LC-Test
。线系列可见,点系列不可见。
在Mac上使用Chrome和Firefox。
lightningChart Js - stackblitz - point series disappears on route change issue
在使用缩放选项后,似乎在点系列上存在渲染问题:
正常行为:
更改路线后,放大到顶部:
解决方法
这是由LightningChart JS v2.0.2中的渲染问题引起的。现在,我们在v2.0.3版本中修复了该问题。感谢您将此问题引起我们的注意。
使用LightningChart JS v2.0.3,您提供的应用程序可以按预期运行。