Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Admin/Stats.vue
<template> | <template> | ||||
<div id="stats-container" class="container"> | <div id="stats-container" class="container"> | ||||
</div> | </div> | ||||
</template> | </template> | ||||
<script> | <script> | ||||
import { Chart } from 'frappe-charts/dist/frappe-charts.esm.js' | import { Chart } from 'frappe-charts/dist/frappe-charts.esm.js' | ||||
export default { | export default { | ||||
data() { | data() { | ||||
return { | return { | ||||
charts: {} | charts: {}, | ||||
chartTypes: ['users', 'users-all', 'income', 'discounts'] | |||||
} | } | ||||
}, | }, | ||||
mounted() { | mounted() { | ||||
['users', 'users-all', 'income', 'discounts'].forEach(chart => this.loadChart(chart)) | this.chartTypes.forEach(chart => this.loadChart(chart)) | ||||
}, | }, | ||||
methods: { | methods: { | ||||
drawChart(name, data) { | drawChart(name, data) { | ||||
if (!data.title) { | if (!data.title) { | ||||
return | return | ||||
} | } | ||||
const ch = new Chart('#chart-' + name, data) | const ch = new Chart('#chart-' + name, data) | ||||
Show All 22 Lines |