Skip to content

Commit d1b802b

Browse files
committed
[FIX] charts: wrong padding for humanize number section
closes #7368 Task: 5155591 Signed-off-by: Rémi Rahir (rar) <[email protected]> Signed-off-by: Adrien Minne (adrm) <[email protected]>
1 parent 4a726a8 commit d1b802b

File tree

12 files changed

+20
-12
lines changed

12 files changed

+20
-12
lines changed

src/components/side_panel/chart/building_blocks/humanize_numbers/humanize_numbers.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { _t } from "@odoo/o-spreadsheet-engine";
2+
import { formatLargeNumber, formatValue } from "@odoo/o-spreadsheet-engine/helpers/format/format";
13
import { SpreadsheetChildEnv } from "@odoo/o-spreadsheet-engine/types/spreadsheet_env";
24
import { Component } from "@odoo/owl";
35
import { ChartWithDataSetDefinition, DispatchResult, UID } from "../../../../../types";
@@ -21,4 +23,11 @@ export class ChartHumanizeNumbers extends Component<Props, SpreadsheetChildEnv>
2123
updateChart: Function,
2224
canUpdateChart: Function,
2325
};
26+
27+
get title() {
28+
const locale = this.env.model.getters.getLocale();
29+
const format = formatLargeNumber({ value: 1234567 }, undefined, locale);
30+
const value = formatValue(1234567, { format, locale });
31+
return _t("E.g. 1234567 -> %(value)s", { value });
32+
}
2433
}

src/components/side_panel/chart/building_blocks/humanize_numbers/humanize_numbers.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<t t-name="o-spreadsheet-ChartHumanizeNumbers">
33
<Checkbox
44
name="'humanizeNumbers'"
5-
label.translate="Make numbers human-readable"
5+
label.translate="Use compact format"
6+
title="title"
67
value="props.definition.humanize ?? true"
78
onChange="(humanize) => props.updateChart(this.props.chartId, { humanize })"
89
/>

src/components/side_panel/chart/combo_chart/combo_chart_design_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
className="'mb-2'"
1717
/>
1818
</Section>
19-
<Section class="'pt-1'" title.translate="Number formatting">
19+
<Section class="'pt-0'" title.translate="Number formatting">
2020
<ChartHumanizeNumbers t-props="props"/>
2121
</Section>
2222
</t>

src/components/side_panel/chart/funnel_chart_panel/funnel_chart_design_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<Section class="'pt-0'" title.translate="Values">
66
<ChartShowValues t-props="props"/>
77
</Section>
8-
<Section class="'pt-1'" title.translate="Number formatting">
8+
<Section class="'pt-0'" title.translate="Number formatting">
99
<ChartHumanizeNumbers t-props="props"/>
1010
</Section>
1111
</t>

src/components/side_panel/chart/gauge_chart_panel/gauge_chart_design_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<t t-name="o-spreadsheet-GaugeChartDesignPanel">
33
<GeneralDesignEditor t-props="props">
44
<t t-set-slot="general-extension">
5-
<Section class="'pt-1'" title.translate="Number formatting">
5+
<Section class="'pt-0'" title.translate="Number formatting">
66
<ChartHumanizeNumbers t-props="props"/>
77
</Section>
88
</t>

src/components/side_panel/chart/geo_chart_panel/geo_chart_design_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<option value="left">Bottom left</option>
1515
</select>
1616
</Section>
17-
<Section class="'pt-1'" title.translate="Number formatting">
17+
<Section class="'pt-0'" title.translate="Number formatting">
1818
<ChartHumanizeNumbers t-props="props"/>
1919
</Section>
2020
</t>

src/components/side_panel/chart/line_chart/line_chart_design_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
className="'mb-2'"
1717
/>
1818
</Section>
19-
<Section class="'pt-1'" title.translate="Number formatting">
19+
<Section class="'pt-0'" title.translate="Number formatting">
2020
<ChartHumanizeNumbers t-props="props"/>
2121
</Section>
2222
</t>

src/components/side_panel/chart/pie_chart/pie_chart_design_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<Section class="'pt-0'" title.translate="Values">
77
<ChartShowValues t-props="props"/>
88
</Section>
9-
<Section class="'pt-1'" title.translate="Number formatting">
9+
<Section class="'pt-0'" title.translate="Number formatting">
1010
<ChartHumanizeNumbers t-props="props"/>
1111
</Section>
1212
<PieHoleSize

src/components/side_panel/chart/radar_chart/radar_chart_design_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ChartShowValues t-props="props"/>
88
<ChartShowDataMarkers t-props="props"/>
99
</Section>
10-
<Section class="'pt-1'" title.translate="Number formatting">
10+
<Section class="'pt-0'" title.translate="Number formatting">
1111
<ChartHumanizeNumbers t-props="props"/>
1212
</Section>
1313
</t>

src/components/side_panel/chart/scorecard_chart_panel/scorecard_chart_design_panel.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<t t-set="color_down">Color Down</t>
55
<GeneralDesignEditor t-props="props" defaultChartTitleFontSize="defaultScorecardTitleFontSize">
66
<t t-set-slot="general-extension">
7-
<Section class="'pt-1'" title.translate="Number formatting">
7+
<Section class="'pt-0'" title.translate="Number formatting">
88
<ChartHumanizeNumbers t-props="props"/>
99
</Section>
1010
</t>

0 commit comments

Comments
 (0)