我正在使用 Updateseries 来更新 x 和 y 轴。如何更新标题?
$.getJSON('chartData.php', {
devicename: feature.get('id')
}, (response) => {
chart.updateSeries([{
data: response
}])
let chart = new ApexCharts(document.getElementById("chart"), options)
chart.updateOptions({
title: 'Water Consumption per day on December 2019 for '
})
});
最佳答案
您应该使用 ApexCharts 的 updateOptions
方法来更新任何其他配置。
updateSeries
仅处理图表的数据,而 updateOptions
允许动态更改图表的配置
var chart = new ApexCharts(el, options);
chart.updateOptions({
title: {
text: 'new title'
}
})
updateOptions 文档 - https://apexcharts.com/docs/methods/#updateOptions
关于javascript - 在 Apexcharts 上动态更新标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59541214/