Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Zaeem Syed's avatar

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

0 likes
0 replies

Please or to participate in this conversation.