Skip to content

Commit 4a726a8

Browse files
committed
[FIX] charts: missing humanizeNumbers checkbox in some panels
The `humanizeNumbers` checkbox was missing in the design panels of sunburst, treemap and bar charts. Task: 5155591 Part-of: #7368 Signed-off-by: Rémi Rahir (rar) <[email protected]> Signed-off-by: Adrien Minne (adrm) <[email protected]>
1 parent 83c3455 commit 4a726a8

File tree

7 files changed

+29
-0
lines changed

7 files changed

+29
-0
lines changed

src/components/side_panel/chart/sunburst_chart/sunburst_chart_design_panel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { SidePanelCollapsible } from "../../components/collapsible/side_panel_co
1313
import { RoundColorPicker } from "../../components/round_color_picker/round_color_picker";
1414
import { Section } from "../../components/section/section";
1515
import { GeneralDesignEditor } from "../building_blocks/general_design/general_design_editor";
16+
import { ChartHumanizeNumbers } from "../building_blocks/humanize_numbers/humanize_numbers";
1617
import { ChartLegend } from "../building_blocks/legend/legend";
1718
import { PieHoleSize } from "../building_blocks/pie_hole_size/pie_hole_size";
1819
import { ChartShowValues } from "../building_blocks/show_values/show_values";
@@ -37,6 +38,7 @@ export class SunburstChartDesignPanel extends Component<Props, SpreadsheetChildE
3738
RoundColorPicker,
3839
ChartLegend,
3940
PieHoleSize,
41+
ChartHumanizeNumbers,
4042
};
4143
static props = {
4244
chartId: String,

src/components/side_panel/chart/sunburst_chart/sunburst_chart_design_panel.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<GeneralDesignEditor t-props="props">
44
<t t-set-slot="general-extension">
55
<ChartLegend t-props="props"/>
6+
<Section class="'pt-0'" title.translate="Number formatting">
7+
<ChartHumanizeNumbers t-props="props"/>
8+
</Section>
69
</t>
710
</GeneralDesignEditor>
811

src/components/side_panel/chart/treemap_chart/treemap_chart_design_panel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { SidePanelCollapsible } from "../../components/collapsible/side_panel_co
1414
import { RoundColorPicker } from "../../components/round_color_picker/round_color_picker";
1515
import { Section } from "../../components/section/section";
1616
import { GeneralDesignEditor } from "../building_blocks/general_design/general_design_editor";
17+
import { ChartHumanizeNumbers } from "../building_blocks/humanize_numbers/humanize_numbers";
1718
import { ChartShowValues } from "../building_blocks/show_values/show_values";
1819
import { TextStyler } from "../building_blocks/text_styler/text_styler";
1920
import { TreeMapCategoryColors } from "./treemap_category_color/treemap_category_color";
@@ -52,6 +53,7 @@ export class TreeMapChartDesignPanel extends Component<Props, SpreadsheetChildEn
5253
BadgeSelection,
5354
TreeMapCategoryColors,
5455
TreeMapColorScale,
56+
ChartHumanizeNumbers,
5557
};
5658
static props = {
5759
chartId: String,

src/components/side_panel/chart/treemap_chart/treemap_chart_design_panel.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
hasVerticalAlign="true"
7070
/>
7171
</Section>
72+
<Section class="'pt-0'" title.translate="Number formatting">
73+
<ChartHumanizeNumbers t-props="props"/>
74+
</Section>
7275
</t>
7376
</SidePanelCollapsible>
7477
</t>

src/components/side_panel/chart/zoomable_chart/design_panel.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ZoomableChartDefinition,
66
} from "../../../../types/index";
77
import { Checkbox } from "../../components/checkbox/checkbox";
8+
import { ChartHumanizeNumbers } from "../building_blocks/humanize_numbers/humanize_numbers";
89
import { ChartWithAxisDesignPanel } from "../chart_with_axis/design_panel";
910

1011
interface Props {
@@ -27,6 +28,7 @@ export class GenericZoomableChartDesignPanel<
2728
static components = {
2829
...ChartWithAxisDesignPanel.components,
2930
Checkbox,
31+
ChartHumanizeNumbers,
3032
};
3133

3234
onToggleZoom(zoomable: boolean) {

src/components/side_panel/chart/zoomable_chart/design_panel.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
className="'mb-2'"
1616
/>
1717
</Section>
18+
<Section class="'pt-0'" title.translate="Number formatting">
19+
<ChartHumanizeNumbers t-props="props"/>
20+
</Section>
1821
</t>
1922
</GeneralDesignEditor>
2023
<SeriesWithAxisDesignEditor t-props="props"/>

tests/figures/chart/charts_component.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,20 @@ describe("charts", () => {
18401840
}
18411841
);
18421842

1843+
test.each<ChartType>(["bar", "line", "waterfall", "treemap", "sunburst"])(
1844+
"humanizeNumbers checkbox updates the chart",
1845+
async (type: ChartType) => {
1846+
createTestChart(type);
1847+
await mountChartSidePanel();
1848+
await openChartDesignSidePanel(model, env, fixture, chartId);
1849+
1850+
expect(model.getters.getChartDefinition(chartId).humanize).toBe(true);
1851+
1852+
await simulateClick("input[name='humanizeNumbers']");
1853+
expect(model.getters.getChartDefinition(chartId).humanize).toBe(false);
1854+
}
1855+
);
1856+
18431857
describe("aggregate", () => {
18441858
test.each(["bar", "pie", "line", "scatter", "combo"] as const)(
18451859
"aggregate checkbox is checked for string-count charts",

0 commit comments

Comments
 (0)