格式化Y轴标签 - 用逗号分隔的数字 [英] Format Y axis label - numbers separated by comma

查看:98
本文介绍了格式化Y轴标签 - 用逗号分隔的数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试格式化Y轴标签以显示分隔的数字,(逗号) 但它没有正确格式化

I am trying to format the Y axis label to display the numbers separated with , (comma)  but its not getting formatted correctly

我正在使用

ChartAreas [0] .AxisY.LabelStyle.Format =" N0" ;

ChartAreas[0].AxisY.LabelStyle.Format = "N0" ;

我面临的问题是,如果值为1000,则为1.000而不是1,000

The issue that I am facing is that if the value is 1000 it comes as 1.000 instead of 1,000

我检查了当前的文化。它是en-US

I checked the current culture . It is en-US

我还尝试使用不同的格式字符串"#,###" ,"C0",等我每次看到。 (点)代替,(逗号)

Also I tried with different format strings "#,###" , "C0" etc. Everytime I see . (dot) instead of , (comma)

仅在Y轴标签上我看到了问题。在工具提示上,当我使用ToolTip =" Count:#VALY {N0}"

Only on the Y axis label I am seeing the issue. On the Tool tip it works fine when I use ToolTip = "Count : #VALY{N0}"

有关如何解决问题的任何指示时,它工作正常。

Any pointers on how I can resolve the issue.




推荐答案

您应该尝试将以下内容添加到Page_Load

You should try and add the following to your Page_Load

Dim cultureInfo As CultureInfo = New CultureInfo("en-US", False)
Thread.CurrentThread.CurrentCulture = cultureInfo
cultureInfo.NumberFormat.NumberGroupSeparator = ","

结合使用:

Chart1.ChartAreas("ChartArea1").AxisY.LabelStyle.Format = "N0"




它将1.000变成1,000


It turns 1.000 into 1,000


这篇关于格式化Y轴标签 - 用逗号分隔的数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆