apache / echarts

Apache ECharts is a powerful, interactive charting and data visualization library for browser
https://echarts.apache.org
Apache License 2.0
60.82k stars 19.63k forks source link

[Bug] Change number separator #18486

Open fernandabarrigosse opened 1 year ago

fernandabarrigosse commented 1 year ago

Version

5.4.2

Link to Minimal Reproduction

https://echarts.apache.org/examples/en/editor.html?c=watermark&code=MYewdgzgLgBARgVwJYBsAmBTATgKQuGAXhgG8AoGGAQxRQC4YBGABgA5WB2AGgpmAAsqWKBAblKlALZUADgwDMAJnkcAdAFYeEmCiRgMomIsYA2ACyqAnFolwhDDupONV3XpV36HHDqxuUZJAwHeXVNdxgIYCooKGwGRTNmcO1osDQUAygkYABrBkZWM0V_GCwqNHsjZktmUv4MGOk5Jg4TEoioLAwMZoL1S3lSgHNymX4E5hM6iLgQAA8ZFBAofpVSmSEaTPomWtYNEaoEYeCjFjdtADMEMH1d00sO7QgqMFyMAE9-k1ZeAF8bKBJDJwBgwCIxBFTiAEr4_J0kFBMgxLOpHKVMqd0qikjNtFAQCAUNkWpYzCYTCMsEg0KjFJTStIsLkAAogPSrGDyMyMawRZm5AAyejOiksRVK2UkGE8Yo48n52kqUCoAC0iZI4WYzKUAG5ICAIGgAWVkCQpJlUCIJRJQc3mCmYPNUVIioJQVT5ZnUAJsQVRHDM8jI_wA3GRQJBYGgQAB3MDLCp4AjEcQwADkGAEQhEqkkelUACsIBmCgqTClM9nBMIIKoIEgQZl84WS2WYEkOErqzm66pgZJwK2wMXSwwTE8e1m-3n2wUzKxaqGI1HoDAoA0ZSmwERSLwM5UWWOO4wBrqD3oriBRrJ-DkT_SqxmIPf9I-mNMbZmsCBpB-OGMGwM2kaJf0gD9jG7YCDQhKhTg_PlWEUFdI3Adc4xibAzRZAAVDB5lgYgMwAUQAYQACQAQQAJVwgBlDNV3Q2A0j1KgID3WNgAQGUIQHbosJIzI-KgAAKDM2I4jMAEpmOjPgoHmPcpPrU4oDI8A4kIiTFDQWTVzedj6zjWlNxUoyONUBokGGfgiKYZhmFXJTVG0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qSVRUAYN_XOf9C5iS6UbHJw5ZwQBXt3KgsSIBqI0bsaZMBOTYCRgwRRjsBpYSdPUsZugJmigRuU2ZcYqk1Lqd3Bpi8mndwGUMzAGTGDb12S0uhByjknJiGcmAFzf4FyLrc7JJtgSgn0BCJ529XmGg-V475vysD_Ica_YFcRQVIvBcUqFZS46wvhYsxFjtkUwAaZE5W2AgiGC4afZpr07CBQKaqPI7tayQ23gALwUAQzxXzX6gkbCdWhYNbL2VSTMuZ2jJU-23qc852dLkUpuYbaluTHmV2aPXW4UDdxiVgd8xB_ddxUp6Q83VEAsGfBnhTKmNMMB0xpGARmQSQmc3nlKmSejtmO1xWqoQqToBUG1XQ3V5bUD-S0T4jA28kS9Dpp8fm3zQD3VBgAYh6PFMFidXWkvdeS_-Xrun3NHH6_MshA2N0tbjMNPLe6RsyXck2Q8hrrp9bG3M8bZ55p9gW51Ranp4ozOq8tWr8h0L_HS_yqTolvIxSMpg291kvuGVig1RrV4muhY7c1SJm5WppHZPVr8Klwu8SjQd3dh1krzp66NU6Bz3rBAy_1c7IGLtDV8TuK6kFRu9TG6dGH6UiATTgpFJ7GlnoDnszMV7NWVtvZJCjj6Cl1ohA23x3dn2GlfT-xOn6hPftGYnFtkg20dtfl2jGvb-2MNPQh4lbqf7IfHahmlnGsOzpkPO4NS6CMiu0BG5BOnemoO3VZh5emqOHvqXRlFDGnZMbekEVJ5Q0BIAQEqrqGZ5CiIzHKx29D4iCwzMQ3aGYbb2zC8qdTI7NNXKLqPMuICA24dAyZz4hH4EWd3N8ygYAqAygYAXUBSxK0YAkieWLslt7aDJgwDL49y6YNnrgo9TCXMytRcWjzgR4rbx835gLsXgsJdcYfHGAtot22-hvJbiWJCIdHVp656DgGT2w4ZnLLdl2FdXcgkrMAysVfbl8arno64Zga5mJrr9KCtY3FuXb4BqM9ecysiJK4gA

Steps to Reproduce

Just open the repo and the error is visible on the first bar chart. On the second bar chart, it's possible to see the different number formats on the series label and the tooltip.

Current Behavior

In a bar chart, when I add .toLocaleString("pt-BR") to series.data it changes the number format to the brazilian format (dot as a thousand separator and comma as a decimal separator), but the the value of the decimal numbers disappear, and the color of the bars disappear, because it is treated as a decimal number, for example, 1678 is formatted to 1.678 and is treated as one and six hundred seventy-eight thousandths when it's supposed to be a thousand six hundred and seventy eight. If I don't chage the series.data and add local: "pt-BR" to the grid, it changes just the tooltip number format.

Expected Behavior

I want to change the numbert format that appears on a bar chart(series label), not just the tooltip.

Environment

- OS: Windows
- Browser:Chrome 111.0.5563.147
- Framework: Vue@2

Any additional comments?

No response

helgasoft commented 1 year ago

not-a-bug

I want to change the numbert format that appears on a bar chart(series label)

Then use label { formatter: (p) => { return p.data.toLocaleString("pt-BR"); }, ...}