Answer the question
In order to leave comments, you need to log in
How to fix "updateSeries is not a function" error in vue-apexcharts?
Ported API for apexchart chart through axios and throws an error
Uncaught (in promise) TypeError: chart.updateSeries is not a function
at eval (webpack-internal:///./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader-v16/dist/index.js?!./src/components/TheChart.vue?vue&type=script&lang=js:42:13)
import VueApexCharts from "vue3-apexcharts";
import axios from 'axios';
export default {
components: {
apexchart: VueApexCharts,
},
data: function() {
return {
chartOptions: {
chartapex: {
id: "vuechart-example",
},
chart: {
height: 350,
type: 'bar',
},
title: {
text: 'Ajax Example',
},
noData: {
text: 'Loading...'
},
dataLabels: {
enabled: false
},
},
series: [],
};
},
mounted() {
var url = 'http://my-json-server.typicode.com/apexcharts/apexcharts.js/yearly';
var chart = document.querySelector('.chart')
axios({
method: 'GET',
url: url,
}).then(function(response) {
chart.updateSeries([{
name: 'Sales',
data: response.data
}])
})
}
};
Answer the question
In order to leave comments, you need to log in
I did everything as instructed.
var chart = document.querySelector('.chart')
.then(function(response) {
chart.updateSeries([{
name: 'Sales',
data: response.data
}])
})
.then(response => {
this.series = [
{
name: 'Sales',
data: response.data,
},
];
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question