%PDF- %PDF-
Direktori : /home/ugotscom/bos_naturals/resources/js/components/ |
Current File : /home/ugotscom/bos_naturals/resources/js/components/maintenance_line_sales.vue |
<script> import { Bar } from "vue-chartjs"; export default { extends: Bar, data() { return { url: "/maintenance/monthly", years: [0,0,0,0,0], labels: ["Apartment","House","Gated","Land"], data: [], test:[], }; }, methods: { getProducts() { axios.get(this.url).then(response => { this.data = response.data; this.data.forEach((item, index) => { this.years.push(item.total); }); if (this.data) { this.renderChart( { labels: ['January', 'February','March','April','May','June','July','August','Sept','Oct','Nov','Dec'], datasets: [ { label: "Maintenance leads per month ", backgroundColor: 'rgba(66, 141, 245)', data: this.years } ] }, { responsive: true, maintainAspectRatio: false, scales: { xAxes: [{ ticks: { maxRotation: 90, minRotation: 80 } }], yAxes: [{ ticks: { min: 0, max: 50, stepSize: 5, } }] } } ); } else { console.log("NO DATA"); } }); } }, mounted() { this.getProducts(); } }; </script>