0

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

重现问题的步骤:

  1. 将路线更改为LC Test. 您会看到线和点系列。
  2. Dashboard再次更改为LC-Test。线系列可见,点系列不可见。

在 Mac 上使用 Chrome 和 Firefox。

LightningChart Js - stackblitz - 点系列在路线更改问题上消失

在使用缩放选项玩了一下之后,点系列似乎存在渲染问题:

正常行为:

在此处输入图像描述

更改路线并放大到顶部后:

在此处输入图像描述

4

1 回答 1

2

这是由 LightningChart JS v2.0.2 中的渲染问题引起的。我们现在已经在 v2.0.3 版本中修复了它。感谢您提请我们注意这个问题。

使用 LightningChart JS v2.0.3,您提供的应用程序按预期工作。

于 2020-10-15T10:59:55.823 回答