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 '
})
});
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 '
})
});
Share
Improve this question
edited Jan 2, 2020 at 7:07
asked Dec 31, 2019 at 7:54
user12510360user12510360
2
-
1
Ok I used:
$(".apexcharts-title-text").text("lel")
– user12510360 Commented Dec 31, 2019 at 8:14 - The above method is not remended as it will be wiped off on the next render. Try resizing your browser and you'll see it goes back to original. Please refer to my answer below. – junedchhipa Commented Dec 31, 2019 at 20:24
2 Answers
Reset to default 3You 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./docs/methods/#updateOptions
this code can update the title in the chart.
*ApexCharts.exec('id', "updateOptions", {*
title:{
text:title1
}
});
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744302565a4567570.html
评论列表(0条)