设置MS Chart Control for .net饼图图例的文本

来源:互联网 发布:淘宝信息管理系统要求 编辑:程序博客网 时间:2024/06/06 09:45

KeywordReplaced BySupports Multiple Y Values Supports Formatting String#VALXX value of the data point.NoYes#VALYY value of the data pointYesYes#SERIESNAMESeries nameNoNo#LABELData point labelNoNo#AXISLABELData point axis labelNoNo#INDEXData point index in the seriesNoYes#PERCENTPercent of the data point Y valueYesYes#LEGENDTEXTSeries or data point legend textNoNo#CUSTOMPROPERTY(XXX)Series or data point XXX custom property value, where XXX is the name of the custom property.NoNo#TOTALTotal of all Y values in the seriesYesYes#AVGAverage of all Y values in the seriesYesYes#MINMinimum of all Y values in the seriesYesYes#MAXMaximum of all Y values in the seriesYesYes#FIRSTY value of the first point in the seriesYesYes#LASTY value of the last point in the seriesYesYes

 

利用keyword设置饼图上标签显示的格式,如:

chart1.Series[0].Label = "#VALY[#PERCENT]";

这时,标签显示为Y轴值的大小,并且在后面的中括号中会显示其占百分比。

在实际应用中我发现,在不做这个格式化的情况下,图例中默认显示的是X轴的相应名称,然而,一旦做了这个设置,图例显示的竟然和刚才这个标签的值一样了,这显然不是我想要的结果。但是,在legend的属性里却找不到有text,只有Title和name,title是用来设置图例的标题的,name则是用来指定其名称。

后来,在Series下找到一个LegendText属性,可以满足要求,设置如下:

chart1.Series[0].LegendText = "#VALX";

也利用了一个keyword,即设置其为x轴的对应值。


                                                       出处:http://blog.csdn.net/gaofeng2000/archive/2009/03/10/3975097.aspx

原创粉丝点击