网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 网络学院 >> 程序设计 >> VB编程 >> 文章正文
  MSChar显示百分比            【字体:
MSChar显示百分比
作者:佚名    文章来源:不详    点击数:    更新时间:2007-8-11    

问:

画饼图所需要的数据都在数组里面:  
  dim   dataArray(0   to   iMax,   0   to   1)  
   
  其中dataArray(i,0)是标题  
          dataArray(i,0)是数字   
    
  代码如下:   

                          MSChart.chartType   =   VtChChartType2dPie   '   画饼图   
                            
                          MSChart.Visible   
=   True   
                          MSChart.AllowSelections   
=   False   
                          MSChart.ShowLegend   
=   True   
                          MSChart.TitleText   
=   "百分比图"   
                            
                          
'   为Chart控件的各行各列赋值   
                          MSChart.RowCount   =   1   
                          MSChart.ColumnCount   
=   iMax   +   1   
                          MSChart.RowLabel   
=   ""   
                          
For   i   =   0   To   iMax   
                                  MSChart.Row   
=   1   
                                  MSChart.Column   
=   i   +   1   
                                  MSChart.Data   
=   dataArray(i,   1)   
                                  MSChart.ColumnLabel   
=   dataArray(i,   0)   
                          
Next



  这段代码能画出漂亮的饼图来,但是,显示不出来个部分所占的百分比。
正在装载数据……
 
  如何显示百分比呢?

答:    

Private   Sub   Form_Load()   
              
With   MSChart1   
                    .ChartType   
=   VtChChartType2dPie   
    
              
For   i   =   1   To   3   
                    .Row   
=   1   
                    .Column   
=   i   
                    .Data   
=   i   *   100   
              
Next   
    
              
With   .DataGrid   
                    .RowLabelCount   
=   1   
                    .ColumnCount   
=   3   
                    .RowCount   
=   1   
                    
For   i   =   1   To   .ColumnCount   
                          .ColumnLabel(i,   
1)   =   "Column   "   &   i   
                    
Next   i   
                    .RowLabel(
1,   1)   =   "Data   as   a   Percentage"   
              
End   With   
    
              
For   i   =   1   To   .Plot.SeriesCollection.Count   
                    
With   .Plot.SeriesCollection(i).DataPoints(-1).DataPointLabel   
                          .LocationType   
=   VtChLabelLocationTypeOutside   
                          .Component   
=   VtChLabelComponentPercent   
                          .PercentFormat   
=   "0%"   
                          .VtFont.Size   
=   10   
                    
End   With   
              
Next   i   
    
              
End   With   
    
End   Sub 



本文来源:http://blog.csdn.net/cncco/archive/2007/08/07/1729589.aspx
站内文章搜索 高级搜索
文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
     如何在ado中使用connect…
     vb 贪吃蛇 单人版游戏 (…
     关于在vb中进行com组件的…
     用vb6.0编写自我升级的程…
     vb自动登陆网络站点详解…
     vb打造超酷个性化菜单(…
  • HashTable和HashMap; Vecto…

  • Hashtable 排序

  • [ZT]关于用jar打包(分享)

  • 一个关于Comparator的使用例…

  • jsf自定义toolbar组件

  • 摘:主题:   using springmo…

  • JSP Tag Library

  • jsp重定向forward和sendRedi…

  • struts异常_does not start …

  • 进程防杀与屏蔽WIN 、alt+ta…

  •   网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    网络学院©2007 www.23book.net
    为您提供web编程,vb编程,vc编程,服务器架设管理,数据库设计等方面的知识 站长:David