vb.net图表-如何在Y轴标签上显示1K而不是1000 [英] vb.net chart - How to show 1K instead of 1000 on Y axis label
本文介绍了vb.net图表-如何在Y轴标签上显示1K而不是1000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几张图,它们在主要和次要Y轴上显示了数以千亿计的巨大数字.
提供给它的原始数据就是这样.现在由于显示这些巨大的数字,我面临着空间问题.
有没有一种方法可以动态地将Y轴标签更改为千个为``k'',并去除``000''个3个零.
问候
Joe
解决方案
由您的图表库确定.如果它没有格式化y轴标签的功能,则应具有某些功能,以便您可以自己提供这些标签. ,有办法用1K代替1000
解决我的问题的确切方法如下
受保护的 Sub Chart1_FormatNumber(发送方 As 对象,e As System.Web.UI.DataVisualization.Charting.FormatNumberEventArgs) 句柄 Chart1.FormatNumber 如果(例如e.ElementType = DataVisualization.Charting.ChartElementType.AxisLabels)然后 如果 e.Value> 10000 然后 e.LocalizedValue = e.Value/ 1000 & " 结束 如果 结束 如果 结束 子
希望这对其他人也有用.
谢谢
Hi,
I have several graphs which show huge numbers in millions of billions on the primary and secondary Y axis.
The raw data that is provided into it is as such. Now because of displaying these huge numbers, im facing space issues.
is there a way to dynamically change the Y axis labels to have a ''k'' for thousand and strip of the ''000'' 3 zeros.
regards
Joe
解决方案
That''s determined by your charting library. If it doesn''t have any funtion to format the y-axis labels, it should have some function so you can provide those labels yourself.
k guess after some experimenting and some extensive googling, got a way to substitute 1K for 1000
the exact solution to my problem is as below
Protected Sub Chart1_FormatNumber(sender As Object, e As System.Web.UI.DataVisualization.Charting.FormatNumberEventArgs) Handles Chart1.FormatNumber If (e.ElementType = DataVisualization.Charting.ChartElementType.AxisLabels) Then If e.Value > 10000 Then e.LocalizedValue = e.Value / 1000 & "k" End If End If End Sub
hope this would be useful to others as well.
thanks
这篇关于vb.net图表-如何在Y轴标签上显示1K而不是1000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文