格式化Y轴标签 [英] Formatting Y axis labels

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

问题描述

是否有人使用图表(本例中为饼形)来显示文件大小?

Has anyone used a chart (pie style in this case) for displaying file sizes?

我通过了我希望格式化Y轴标签以反映相关的兆字节,千兆字节等文件列表(大小以字节为单位)。我无法传递Y轴的格式化数据,因为订单不正确(例如5 MB,
5 GB)。

I'm passing a list of files (with size in bytes) to the chart, I would like to format the Y axis labels to reflect the relevant Megabytes, Gigabytes etc. I cannot pass formatted data for the Y axis as the order will be incorrect ( 5 MB, 5 GB for example).

是否可以格式化图表中的数据,如果不是我将如何格式化它?

Is it possible to format the data within the chart, if not how would I format it?

Chart1.Series(0).Label = "#AXISLABEL (#VAL)"




即饼图标签为"File01.zip(22 MB)" ; 

i.e the pie label would be "File01.zip (22 MB)" 

我能做到这一点的唯一方法是:

The only way I can do this is:

  For Each Point In Chart1.Series(0).Points
            Point.AxisLabel = Point.AxisLabel & " (" & SetBytes(Point.YValues(0)) & ")"
        Next

(SetBytes只转换为可读字符串)

(SetBytes just converts to a readable string)




推荐答案

唯一我可以这样做的方式是:
The only way I can do this is:
  For Each Point In Chart1.Series(0).Points
            Point.AxisLabel = Point.AxisLabel & " (" & SetBytes(Point.YValues(0)) & ")"
        Next


这种方法有问题吗?

你不能使用Series.Label,因为标签的格式取决于单个数据点的值。

You can't use Series.Label because the format of the label depends on the value of a single data point.


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

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