创建chartXY对象后如何设置主题?

问题描述

我这样创建了chartXY:

this.chart = lightningChart().ChartXY({container: `${this.chartId}`,theme:Themes.dark})

有人知道如何在不再次使用lightningChart()。ChartXY()的情况下将主题更改为Themes.light吗?

解决方法

创建图表后,无法更改图表的主题。

唯一的选择是使用不同的主题重新创建图表。

const lc = lightningChart()

let chart = lc.ChartXY({theme:Themes.dark})

...

// delete the old chart,also ensure that no references to the old chart is left in application code
chart.dispose()
chart = undefined

// recreate the chart
chart = lc.ChartXY({theme:Themes.light})