3
0

Fix legend default position

This commit is contained in:
Jože Fortun 2022-11-25 12:14:36 +01:00
parent 6a1931cf01
commit 522fe9a8f5
5 changed files with 27 additions and 22 deletions

View File

@ -228,13 +228,6 @@
v-model="report.legend.orientation" v-model="report.legend.orientation"
:options="orientations" :options="orientations"
/> />
<b-form-checkbox
v-model="report.legend.isScrollable"
class="mt-2"
:disabled="report.legend.orientation !== 'horizontal'"
>
{{ $t('edit.additionalConfig.legend.scrollable') }}
</b-form-checkbox>
</b-form-group> </b-form-group>
<b-form-group <b-form-group
horizontal horizontal
@ -245,8 +238,15 @@
<b-form-select <b-form-select
v-model="report.legend.align" v-model="report.legend.align"
:options="alignments" :options="alignments"
:disabled="report.legend.position.isDefault" :disabled="!report.legend.position.isDefault"
/> />
<b-form-checkbox
v-model="report.legend.isScrollable"
class="mt-2"
:disabled="report.legend.orientation !== 'horizontal'"
>
{{ $t('edit.additionalConfig.legend.scrollable') }}
</b-form-checkbox>
<b-form-checkbox <b-form-checkbox
v-model="report.legend.position.isDefault" v-model="report.legend.position.isDefault"
class="mt-2" class="mt-2"
@ -255,7 +255,7 @@
</b-form-checkbox> </b-form-checkbox>
</b-form-group> </b-form-group>
<template <template
v-if="report.legend.position.isDefault" v-if="!report.legend.position.isDefault"
> >
<b-form-group <b-form-group
horizontal horizontal

View File

@ -434,6 +434,7 @@ export default {
deep: true, deep: true,
handler (value, oldValue) { handler (value, oldValue) {
if (value && oldValue) { if (value && oldValue) {
console.log(value, oldValue)
this.onConfigUpdate() this.onConfigUpdate()
} }
}, },
@ -499,7 +500,6 @@ export default {
} else { } else {
this.updateChart(c).then((chart) => { this.updateChart(c).then((chart) => {
this.chart = chartConstructor(chart) this.chart = chartConstructor(chart)
this.update()
this.toastSuccess(this.$t('notification:chart.saved')) this.toastSuccess(this.$t('notification:chart.saved'))
if (closeOnSuccess) { if (closeOnSuccess) {
this.redirect() this.redirect()

View File

@ -252,7 +252,11 @@ export class BaseChart {
} }
defDimension (): Dimension { defDimension (): Dimension {
return Object.assign({}, { conditions: {}, meta: {} }) return Object.assign({}, {
conditions: {},
meta: {},
rotateLabel: '0',
})
} }
defMetrics (): Metric { defMetrics (): Metric {
@ -269,6 +273,7 @@ export class BaseChart {
axisType: 'linear', axisType: 'linear',
axisPosition: 'left', axisPosition: 'left',
labelPosition: 'end', labelPosition: 'end',
rotateLabel: '0',
}, },
tooltip: {}, tooltip: {},
legend: { legend: {
@ -276,10 +281,10 @@ export class BaseChart {
orientation: 'horizontal', orientation: 'horizontal',
align: 'center', align: 'center',
position: { position: {
top: '0', top: undefined,
right: '0', right: undefined,
bottom: '0', bottom: undefined,
left: '0', left: undefined,
isDefault: true, isDefault: true,
}, },
}, },

View File

@ -278,10 +278,10 @@ export default class Chart extends BaseChart {
legend: { legend: {
show: !l?.isHidden, show: !l?.isHidden,
type: l?.isScrollable ? 'scroll' : 'plain', type: l?.isScrollable ? 'scroll' : 'plain',
top: (l?.position?.isDefault ? l?.position?.top : undefined) || undefined, top: (l?.position?.isDefault ? undefined : l?.position?.top) || undefined,
right: (l?.position?.isDefault ? l?.position?.right : undefined) || undefined, right: (l?.position?.isDefault ? undefined : l?.position?.right) || undefined,
bottom: (l?.position?.isDefault ? l?.position?.bottom : undefined) || undefined, bottom: (l?.position?.isDefault ? undefined : l?.position?.bottom) || undefined,
left: (l?.position?.isDefault ? l?.position?.left : l?.align || 'center') || 'auto', left: (l?.position?.isDefault ? l?.align || 'center' : l?.position?.left) || 'auto',
orient: l?.orientation || 'horizontal' orient: l?.orientation || 'horizontal'
}, },
...options, ...options,

View File

@ -136,12 +136,12 @@ edit:
center: Center center: Center
scrollable: Scrollable scrollable: Scrollable
position: position:
customize: Customize position customize: Default position
top: Top top: Top
right: Right right: Right
bottom: Bottom bottom: Bottom
left: Left left: Left
valueRange: Values can be set a pixels 20 or as percentages 20% valueRange: Values can be set as pixels 20 or as percentages 20%
tooltip: tooltip:
label: Tooltip label: Tooltip
labelNextToChartPartition: Show labels next to chart partition labelNextToChartPartition: Show labels next to chart partition
@ -157,7 +157,7 @@ edit:
right: Right right: Right
bottom: Bottom bottom: Bottom
left: Left left: Left
valueRange: Values can be set a pixels 20 or as percentages 20% valueRange: Values can be set as pixels 20 or as percentages 20%
import: 'Import chart(s):' import: 'Import chart(s):'
newLabel: 'Create a new chart:' newLabel: 'Create a new chart:'
name: Chart name * name: Chart name *