2
0
mirror of https://github.com/frappe/books.git synced 2024-11-10 07:40:55 +00:00

fix: tentative fix to single value charts

- i.e. when This Month
This commit is contained in:
18alantom 2022-01-28 01:09:48 +05:30 committed by Alan
parent 55fc6d8b66
commit 281de603e4
3 changed files with 16 additions and 5 deletions

View File

@ -13,7 +13,11 @@
<span class="ml-2 text-gray-900">{{ t('Outflow') }}</span>
</div>
</div>
<PeriodSelector :value="period" @change="(value) => (period = value)" />
<PeriodSelector
:value="period"
@change="(value) => (period = value)"
:options="['This Year', 'This Quarter']"
/>
</div>
<LineChart
v-if="hasData"
@ -136,7 +140,7 @@ export default {
const colors = ['#2490EF', '#B7BFC6'];
const format = (value) => frappe.format(value ?? 0, 'Currency');
const yMax = getYMax(points);
return { points, xLabels, colors, format, yMax, formatX:formatXLabels };
return { points, xLabels, colors, format, yMax, formatX: formatXLabels };
},
},
methods: {

View File

@ -39,14 +39,20 @@
import Dropdown from '@/components/Dropdown';
export default {
name: 'PeriodSelector',
props: ['value'],
props: {
value: String,
options: {
type: Array,
default: () => ['This Year', 'This Quarter', 'This Month'],
},
},
components: {
Dropdown,
},
data() {
let options = ['This Year', 'This Quarter', 'This Month'];
return {
periodOptions: options.map((option) => {
periodOptions: this.options.map((option) => {
return {
label: option,
action: () => this.selectOption(option),

View File

@ -5,6 +5,7 @@
<PeriodSelector
slot="action"
:value="period"
:options="['This Year', 'This Quarter']"
@change="(value) => (period = value)"
/>
</SectionHeader>