工控图表控件ProEssentials创建3D柱状图示例代码
使用ProEssentials可以创建3D柱状图,柱状图的形式包括线框、实体和阴影。
类似于Graph control,3D柱状图只需要YData。
Subsets定义沿z轴有多少行,Points定义了沿着x轴有多少列。
SubsetLabels和PointLabels用于行和列的标签。 SubsetColors是用来控制子集柱状条的颜色。
一旦用户提供数据,ProEssentials将构造一个3D柱状图。下面的示例代码显示了如何构造一个简单的3D
柱状图。
Dim s As Integer Dim p As Integer Pe3do1.PEactions = 20 Pe3do1.PolyMode = PEPM_3DBAR Pe3do1.PrepareImages = True Pe3do1.Subsets = 10 Pe3do1.Points = 10 For s = 0 To 9 For p = 0 To 9 Pe3do1.YData(s, p) = (5+35*Cos(p*.4))*(5+10*Sin(s*.34)) Next p Pe3do1.SubsetColors(s) = RGB(100+s*18, 100+s*18, 100+s*18) Next s Pe3do1.SubsetLabels(0) = "Hello" Pe3do1.SubsetLabels(1) = "World" Pe3do1.PointLabels(0) = "Texas" Pe3do1.PointLabels(1) = "Washington" Pe3do1.DegreeOfRotation = 309 Pe3do1.ViewingHeight = 4 Pe3do1.FontSize = PEFS_SMALL Pe3do1.PlottingMethod = 1 Pe3do1.MainTitle = "3D Bar Chart" Pe3do1.SubTitle = "" Pe3do1.XAxisLabel = "Points" Pe3do1.ZAxisLabel = "Subsets" Pe3do1.YAxisLabel = "Data value"
生成图片如下所示: