画饼图所需要的数据都在数组里面:
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
这段代码能画出漂亮的饼图来,但是,显示不出来个部分所占的百分比。
如何显示百分比呢?清高手指点,在线等!!!

解决方案 »

  1.   

    MSChar显示百分比: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 WithEnd Sub