vs2008中mschart控件的应用示例
发一些运用示例 最好能运行
[解决办法]
demo下载
Visual Basic:MSChart 控件
MSChart 控件
一个以图形方式显示数据的图表。
语法
MSChart
备注
MSChart 控件支持下列功能:
真实的三维表示形式。
支持所有主要的图表类型。
通过随机数据和数据数组填充数据网格。
MSChart 控件与数据网格—ataGrid 对象)关联。该数据网格是保存要绘制的数据的表。数据网格还可以包括用于标识图表上的系列和类别的标签。图表应用程序的设计者通过插入数据或通过从电子表格或数组导入数据,用信息填充数据网格。
示例
- VB.NET code
'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
[解决办法]
MSChart