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