mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-28 12:11:08 -04:00
add format money in line chart
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
<script>
|
||||
import Chart from 'chart.js'
|
||||
import Utils from '../../helpers/utilities'
|
||||
import { mapGetters } from 'vuex'
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -46,9 +47,20 @@ export default {
|
||||
type: Function,
|
||||
require: false,
|
||||
default: Function
|
||||
},
|
||||
FormatGraphMoney: {
|
||||
type: Function,
|
||||
require: false,
|
||||
default: Function
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters('currency', [
|
||||
'defaultCurrency'
|
||||
])
|
||||
},
|
||||
|
||||
watch: {
|
||||
labels (val) {
|
||||
this.update()
|
||||
@ -56,6 +68,7 @@ export default {
|
||||
},
|
||||
|
||||
mounted () {
|
||||
let self = this
|
||||
let context = this.$refs.graph.getContext('2d')
|
||||
let options = {
|
||||
responsive: true,
|
||||
@ -64,7 +77,7 @@ export default {
|
||||
enabled: true,
|
||||
callbacks: {
|
||||
label: function (tooltipItem, data) {
|
||||
return Utils.formatGraphMoney(tooltipItem.value)
|
||||
return self.FormatGraphMoney(tooltipItem.value, self.defaultCurrency)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user