2
0
mirror of https://github.com/frappe/books.git synced 2024-12-24 11:55:46 +00:00

fix(ui): prevent truncation, don't show year

This commit is contained in:
18alantom 2021-12-06 18:40:12 +05:30
parent 8e0e648497
commit deeaac0f74

View File

@ -13,7 +13,7 @@
<span class="ml-2">{{ _('Outflow') }}</span> <span class="ml-2">{{ _('Outflow') }}</span>
</div> </div>
</div> </div>
<PeriodSelector :value="period" @change="value => (period = value)" /> <PeriodSelector :value="period" @change="(value) => (period = value)" />
</div> </div>
<div class="chart-wrapper" ref="cashflow"></div> <div class="chart-wrapper" ref="cashflow"></div>
</template> </template>
@ -97,11 +97,11 @@ import { getDatesAndPeriodicity } from './getDatesAndPeriodicity';
export default { export default {
name: 'Cashflow', name: 'Cashflow',
components: { components: {
PeriodSelector PeriodSelector,
}, },
data: () => ({ period: 'This Year', hasData: false }), data: () => ({ period: 'This Year', hasData: false }),
watch: { watch: {
period: 'render' period: 'render',
}, },
activated() { activated() {
this.render(); this.render();
@ -115,7 +115,7 @@ export default {
let { data, periodList } = await new Cashflow().run({ let { data, periodList } = await new Cashflow().run({
fromDate, fromDate,
toDate, toDate,
periodicity periodicity,
}); });
let totalInflow = data.reduce((sum, d) => d.inflow + sum, 0); let totalInflow = data.reduce((sum, d) => d.inflow + sum, 0);
@ -134,33 +134,33 @@ export default {
colors: ['#2490EF', '#B7BFC6'], colors: ['#2490EF', '#B7BFC6'],
axisOptions: { axisOptions: {
xAxisMode: 'tick', xAxisMode: 'tick',
shortenYAxisNumbers: true shortenYAxisNumbers: true,
}, },
lineOptions: { lineOptions: {
regionFill: 1, regionFill: 1,
hideDots: 1, hideDots: 1,
heatLine: 1 heatLine: 1,
}, },
tooltipOptions: { tooltipOptions: {
formatTooltipY: value => frappe.format(value, 'Currency') formatTooltipY: (value) => frappe.format(value, 'Currency'),
}, },
data: { data: {
labels: periodList, labels: periodList.map((p) => p.split(' ')[0]),
datasets: [ datasets: [
{ {
name: 'Inflow', name: 'Inflow',
chartType: 'line', chartType: 'line',
values: data.map(period => period.inflow) values: data.map((period) => period.inflow),
}, },
{ {
name: 'Outflow', name: 'Outflow',
chartType: 'line', chartType: 'line',
values: data.map(period => period.outflow) values: data.map((period) => period.outflow),
} },
] ],
} },
}); });
} },
} },
}; };
</script> </script>