资源预览内容
第1页 / 共3页
第2页 / 共3页
第3页 / 共3页
亲,该文档总共3页全部预览完了,如果喜欢就下载吧!
资源描述
MSChart 饼状图实用画法关注问题:如何显示百分比如何设置 Legend源代码:double yValues = 12, 67, 45, 50, 67, 89, 35, 12, 78, 54 ;string xValues = 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 ;/设置为饼型图Chart1.SeriesSeries1.ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie;/绑定数据Chart1.SeriesSeries1.Points.DataBindXY(xValues, yValues);/将份额较小的图合并为一块Series series1 = Chart1.SeriesSeries1;series1CollectedThreshold = 6;series1CollectedThresholdUsePercent = true;/ Set the label of the collected pie sliceseries1CollectedLabel = Other;/ Set the legend text of the collected pie sliceseries1CollectedLegendText = Other;/设置label显示百分比Chart1.SeriesSeries1.Label = #PERCENTP;/Chart1.SeriesSeries1.ToolTip = #LEGENDTEXT: #VALC million;/显示toolTip #VALX x轴值 #VALY y轴值Chart1.SeriesSeries1.ToolTip = #VALX: 产量#VALY million;解决 Legend 和百分比设置问题http:/bbs.bccn.net/thread-316347-1-1.html解决百分比设定后,legend 的显示也为百分比的问题方法:认真设置一下 legend 的标签即可注意:饼图的 Legend 和折线图等线性图的设置不同。首先确保你已经在设计器里将 Chart 设置为饼图形式在 chart 的属性,打开 legends 集合,如果还没有 legend 成员添加一个,添加 legend 成员后,在其右边 打开 cellColumns 集合 ,添加一个 Column1,将 ColumnType 选为SeriesSymbol,再添加一个 Column2,将 ColumnType 属性选为 Text,并将下面的 Text 属性打开,插入新关键字,选择 x 值,并删去原有的#LegendText,这样 Legend 第二列标签在显示时就会显示对应的 x 轴的值了。最终效果:浏览器中查看
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号