May 7, 2022
0
Level 1
implementation of vue apexchart with laravel
hi all i am trying to implement vue apex chart in my laravel application , but i am unable to plot any data in graph which i am getting for my api
<template>
<div>
<apexchart width="500" type="bar" :options="options" :series="series"
></apexchart>
</div>
</template>
<script>
import VueApexCharts from 'vue-apexcharts'
export default{
data()
{
return {
options: {
chart: {
id: 'vuechart-example'
},
xaxis: {
categories: []
}
},
series: [{
name: '',
data: []
}]
}
},
mounted(){
axios.get('/api/showresult').then(response=>{
let year=[];
let qty=[];
response.data.forEach(val=>{
year.push(val.year);
qty.push(val.quantity);
})
this.options.xaxis.categories=year;
this.series[1]=qty;
})
}
}
</script>
can anyone tell me how i can implement this i am using vue 2
Please or to participate in this conversation.