Skip to content
Snippets Groups Projects
Unverified Commit feb61d94 authored by Howon Lee's avatar Howon Lee Committed by GitHub
Browse files

Make the number formatting, global or otherwise, apply to percentages in pie charts (#14995)

* obey those number separator settings

* make it lint
parent 73e93fa0
No related branches found
No related tags found
No related merge requests found
......@@ -288,6 +288,7 @@ export default class PieChart extends Component {
const formatPercent = percent =>
formatValue(percent, {
column: cols[metricIndex],
number_separators: settings.column(cols[metricIndex]).number_separators,
jsx: true,
majorWidth: 0,
number_style: "percent",
......
......@@ -54,6 +54,22 @@ describe("pie chart", () => {
getAllByText("123"); // should multiply the count in the center by `scale`
});
it("should obey number separator settings", () => {
const cols = [
StringColumn({ name: "name" }),
NumberColumn({ name: "count" }),
];
const column_settings = { '["name","count"]': { number_separators: ", " } };
const series = [
{
card: { display: "pie", visualization_settings: { column_settings } },
data: { rows: [["foo", 0.501], ["bar", 0.499]], cols },
},
];
const { getAllByText } = render(<Visualization rawSeries={series} />);
getAllByText("50,1%");
});
it("should show a condensed tooltip for squashed slices", () => {
const rows = [["foo", 0.5], ["bar", 0.49], ["baz", 0.002], ["qux", 0.008]];
const { container, getAllByText, queryAllByText } = render(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment