From d73c93f348cf3f6afcd4b66a3bb8d1c72dab430a Mon Sep 17 00:00:00 2001 From: Atanas Yonkov Date: Tue, 28 Mar 2023 10:50:35 +0300 Subject: [PATCH] Hide unnecessary configurations for pie and dougnut charts --- .../compose/src/components/Chart/Report/GenericChart.vue | 1 + .../web/compose/src/components/Chart/Report/ReportEdit.vue | 1 + lib/js/src/compose/types/chart/base.ts | 4 ++-- lib/js/src/compose/types/chart/chart.ts | 6 +++++- lib/js/src/compose/types/chart/util.ts | 4 ++-- locale/en/corteza-webapp-compose/chart.yaml | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/client/web/compose/src/components/Chart/Report/GenericChart.vue b/client/web/compose/src/components/Chart/Report/GenericChart.vue index d786f89eb..d662e589f 100644 --- a/client/web/compose/src/components/Chart/Report/GenericChart.vue +++ b/client/web/compose/src/components/Chart/Report/GenericChart.vue @@ -115,6 +115,7 @@ diff --git a/lib/js/src/compose/types/chart/base.ts b/lib/js/src/compose/types/chart/base.ts index 19e388197..600370eee 100644 --- a/lib/js/src/compose/types/chart/base.ts +++ b/lib/js/src/compose/types/chart/base.ts @@ -313,7 +313,7 @@ export class BaseChart { return Object.assign({}, { conditions: {}, meta: {}, - rotateLabel: '0', + rotateLabel: 0, }) } @@ -331,7 +331,7 @@ export class BaseChart { axisType: 'linear', axisPosition: 'left', labelPosition: 'end', - rotateLabel: '0', + rotateLabel: 0, }, tooltip: {}, legend: { diff --git a/lib/js/src/compose/types/chart/chart.ts b/lib/js/src/compose/types/chart/chart.ts index 56cad8acc..e1473b958 100644 --- a/lib/js/src/compose/types/chart/chart.ts +++ b/lib/js/src/compose/types/chart/chart.ts @@ -121,15 +121,19 @@ export default class Chart extends BaseChart { options.tooltip.trigger = 'item' - let lbl = {} + let lbl:any = { + rotate: dimension.rotateLabel ? +dimension.rotateLabel: 0 + } if (t?.labelsNextToPartition) { lbl = { + ...lbl, show: true, overflow: 'truncate', } } else { lbl = { + ...lbl, show: fixed, position: 'inside', align: 'center', diff --git a/lib/js/src/compose/types/chart/util.ts b/lib/js/src/compose/types/chart/util.ts index 488a963c8..d60b23784 100644 --- a/lib/js/src/compose/types/chart/util.ts +++ b/lib/js/src/compose/types/chart/util.ts @@ -30,7 +30,7 @@ export interface Dimension { default?: string; skipMissing?: boolean; autoSkip?: boolean; - rotateLabel?: string; + rotateLabel?: number; } export interface Metric { @@ -56,7 +56,7 @@ export interface YAxis { labelPosition?: string; min?: string; max?: string; - rotateLabel?: string; + rotateLabel?: number; } export interface ChartOffset { diff --git a/locale/en/corteza-webapp-compose/chart.yaml b/locale/en/corteza-webapp-compose/chart.yaml index 0bd64fa74..d52684810 100644 --- a/locale/en/corteza-webapp-compose/chart.yaml +++ b/locale/en/corteza-webapp-compose/chart.yaml @@ -42,7 +42,7 @@ edit: noItemsFound: No options found rotate: label: Rotate label - description: Labels can be rotated from -90 to 90 degrees. Applied to bar and line charts + description: Labels can be rotated from -90 to 90 degrees. filter: customize: Customize filter label: Filters