百分比 [英] Percents

查看:148
本文介绍了百分比的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改简单图表(例如,条形图)以显示百分比而不是计数。 我用过这个:

How can I change a simple chart (eg, Bar) to show percents rather than counts.  I used this:

MySeries.Label ="#PERCENT";

MySeries.Label = "#PERCENT";

它可以很好地正确显示百分比。  ;有问题:

It shows the percents nicely and correctly.  There are problems:

现在显示计数的轴没有意义。 它不再显示正确的计数。 此外,我希望轴显示0到100. 我尝试设置:

The axis that showed the counts now does not make sense.  It does not show the correct counts anymore.  Furthermore, I want the axis to show 0 to 100.  I tried setting:

area.AxisY.Minimum = 0 ; $
area.AxisY.Maximum = 100;

area.AxisY.Minimum = 0;
area.AxisY.Maximum = 100;

这改变了最小值/最大值,但是没有调整条形。

This changed min/max but the bars were not adjusted.

要点: 如何以简单的方式将计数条形图转换为百分比。

Summary:  How do it in a simple way convert a count bar chart to a percent.

Jay

推荐答案

标签只是一个字符串。您可以将其设置为您想要的任何内容。更改它不会影响轴范围。数据仍然相同。

A label is just a string. You can set it to anything you want. Changing it won't affect the axis range. The data is still the same.

如果您希望轴值代表百分比,您还必须更改数据
(或轴标签。 )

If you want the axis values to represent percentages, you'll have to change the data too (or the axis labels.)

For Each dp As DataPoint In MySeries.Points
	'total is the sum of all y values
	dp.YValues(0) = dp.YValues(0) / total * 100
Next


这篇关于百分比的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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