-
Notifications
You must be signed in to change notification settings - Fork 19.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is possible to define separator, in French thousand separator as made by space and not comma ? #4180
Comments
Yes you can format the label by yourself using the |
Not the label @pissang the thousand separator i hack this part of your js file : function addCommas(x) { if (isNaN(x)) { return '-'; } x = (x + '').split('.'); return x[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g, '$1 ') + (x.length > 1 ? '.' + x[1] : ''); } so if you can add in some options the ability to define the thousandSeparator ;) |
Hi all, It is too bad that the default formatter use an hardcoded function like addCommas to format numbers. Of course, we can redefine the formatter for each use case (xAxis.axisLabel, xAxis.axisPointer.label, yAxis.axisLabel, yAxis.axisPointer.label, ...) but this is a lot of work for a default behavior. At least, it should use browser locale to define which ways to format number. Here is an example :
As you can see, i redefined formater for yAxis.axisLabel and yAxis.axisPointer.label. Still, i need to do it also for tooltip content. As i'm working with multi-series, the tooltip is different than the other and is much more complicated. Redefining the formatter should be a workaraound but it shouldn't be enough to close this issue =/ (you can drop the example above into the editor on : https://ecomfe.github.io/echarts-examples/public/editor.html) to see the issue. |
One thing to consider as an easy fix : toLocaleString
It would display number the right way by default depending on environment locale. |
@pissang I think the issue is still there: As @astik mentions, it is a lot of work to redefine all formatters for the proper display of the correct thousand / decimal separator. |
Another issue relative to this one : #8294 (it also have been closed by stale bot ='() |
I'm also interested in a simpler way to display the correct number format. @pissang Is there any advance in this issue? |
There is no possibility to provide own implementation of makeValueReadable. There is the only way — to set |
There are lots of variations for thousand and decimal separators across different languages. For example, seeing |
@Vovan-VE Yes, in my app I use Intl.NumberFormat / Intl.DateTimeFormat. Issue is that 1) you cannot easily set it globally (#8294) 2) for Probably, it is easy to send PR, maybe I will do it when I will finish my app. |
We are experimenting this too. We can see it has been mentioned in other issues like #14516 , #17419 and #18264
Did you were able to make the PR? |
问题简述 (One-line summary)
版本及环境 (Version & Environment)
重现步骤 (Steps to reproduce)
期望结果 (Expected behaviour)
可能哪里有问题 (What went wrong)
ECharts配置项 (ECharts option)
其他信息 (Other comments)
The text was updated successfully, but these errors were encountered: