首页 > 解决方案 > 创建chartXY对象后如何设置主题?

问题描述

我像这样创建了chartXY:

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

有谁知道如何在不使用 LightningChart().ChartXY() 的情况下将主题更改为 Themes.light?

标签: lightningchart

解决方案


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

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

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})

推荐阅读