mschart控件怎么用呢?
注:转载文章需注明来源:VCer.net 文章地址:http://vcer.net/4838.html
如果你觉得VCer.net不错,而且你愿意为VCer.net捐赠一元钱,那么点击后面的捐赠按钮吧:)
MSChart 控件
一个以图形方式显示数据的图表。
语法 MSChart
备注 MSChart 控件支持下列功能:
MSChart 控件与数据网格(DataGrid 对象)关联。该数据网格是保存要绘制的数据的表。数据网格还可以包括用于标识图表上的系列和类别的标签。图表应用程序的设计者通过插入数据或通过从电子表格或数组导入数据,用信息填充数据网格。
示例 'In this example, the sales for two companies are shown for four months. 'Create the data array and bind it to the ChartData property. Dim Sales(,) As Object = New Object(, ) _ {{"Company", "Company A", "Company B"}, _ {"June", 20, 10}, _ {"July", 10, 5}, _ {"August", 30, 15}, _ {"September", 14, 7}} chtSales.ChartData = Sales 'Add a title and legend. With Me.chtSales .Title.Text = "Sales" .Legend.Location.LocationType = _ MSChart20Lib.VtChLocationType.VtChLocationTypeBottom .Legend.Location.Visible = True End With 'Add titles to the axes. With Me.chtSales.Plot .Axis(MSChart20Lib.VtChAxisId.VtChAxisIdX).AxisTitle.Text = "Year" .Axis(MSChart20Lib.VtChAxisId.VtChAxisIdY).AxisTitle.Text = "Millions of $" End With 'Set custom colors for the bars. With Me.chtSales.Plot 'Yellow for Company A ' -1 selects all the datapoints. .SeriesCollection(1).DataPoints(-1).Brush.FillColor.Set(250, 250, 0) 'Purple for Company B .SeriesCollection(2).DataPoints(-1).Brush.FillColor.Set(200, 50, 200) End With
bluejoe 于 2006-05-19 22:00:37.0 编辑 [回复该贴]