Reputation:
I am using Updateseries to update x and y axis. How can i update title?
$.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 '
})
});
Upvotes: 2
Views: 15343
Reputation: 5627
You should use the updateOptions
method of ApexCharts to update any other configuration.
updateSeries
only deals with data of the chart, while updateOptions
allows changing the configuration of the chart dynamically
var chart = new ApexCharts(el, options);
chart.updateOptions({
title: {
text: 'new title'
}
})
Docs for updateOptions - https://apexcharts.com/docs/methods/#updateOptions
Upvotes: 3
Reputation: 75
this code can update the title in the chart.
*ApexCharts.exec('id', "updateOptions", {*
title:{
text:title1
}
});
Upvotes: 0