• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: 小 中 大 | 推荐给好友 上一篇 | 下一篇

Html中使用M$控件系列之OWC-图表篇

发布: 2007-6-30 18:56 | 作者: admin | 来源: | 查看: 20次 | 进入软件测试论坛讨论

领测软件测试网 <object id=ChartSpace1 classid=CLSID:0002E500-0000-0000-C000-000000000046 style="width:100%;height:350"></object>
<SCRIPT LANGUAGE="VBSCRIPT">
SUB Window_OnLoad()
Dim categories(3), values(3)

‘’取得已命名的常量对象,在以后的脚本中使用
Set c = ChartSpace1.Constants

‘’设置图表工作区标题
ChartSpace1.HasChartSpaceTitle = True
ChartSpace1.ChartSpaceTitle.Caption = "Chart Space Title"

‘’设置图表工作区的图例
ChartSpace1.HasChartSpaceLegend = True

‘’图例位置,其中c.*为位置枚举值,值列表如下
‘’chLegendPositionTop :顶端
‘’chLegendPositionLeft :左边
‘’chLegendPositionRight :右边
‘’chLegendPositionBottom :底部
‘’chLegendPositionAutomatic :自动
ChartSpace1.ChartSpaceLegend.Position = c.chLegendPositionRight

categories(0) = "White"
categories(1) = "Black"
categories(2) = "Asian"
categories(3) = "Latino"

‘’将图表添加到图表工作区
ChartSpace1.Charts.Add

‘’将新系列添加到图表工作区的指定图表中,下同
Set a = ChartSpace1.Charts(0).SeriesCollection.Add
‘’指定新系列的类型,C.*为类型枚举值,列表如下:
‘’chChartTypeCombo
‘’chChartTypeColumnClustered
‘’chChartTypeColumnStacked
‘’chChartTypeColumnStacked100
‘’chChartTypeBarClustered
‘’chChartTypeBarStacked
‘’chChartTypeBarStacked100
‘’chChartTypeLine
‘’chChartTypeLineMarkers
‘’chChartTypeLineStacked
‘’chChartTypeLineStackedMarkers
‘’chChartTypeLineStacked100
‘’chChartTypeLineStacked100Markers
‘’chChartTypeSmoothLine
‘’chChartTypeSmoothLineMarkers
‘’chChartTypeSmoothLineStacked
‘’chChartTypeSmoothLineStackedMarkers
‘’chChartTypeSmoothLineStacked100
‘’chChartTypeSmoothLineStacked100Markers
‘’chChartTypePie
‘’chChartTypePieExploded
‘’chChartTypePieStacked
‘’chChartTypeScatterMarkers
‘’chChartTypeScatterSmoothLineMarkers
‘’chChartTypeScatterSmoothLine
‘’chChartTypeScatterLineMarkers
‘’chChartTypeScatterLine
‘’chChartTypeScatterLineFilled
‘’chChartTypeBubble
‘’chChartTypeBubbleLine
‘’chChartTypeArea
‘’chChartTypeAreaStacked
‘’chChartTypeAreaStacked100
‘’chChartTypeDoughnut
‘’chChartTypeDoughnutExploded
‘’chChartTypeRadarLine
‘’chChartTypeRadarLineMarkers
‘’chChartTypeRadarLineFilled
‘’chChartTypeRadarSmoothLine
‘’chChartTypeRadarSmoothLineMarkers
‘’chChartTypeStockHLC
‘’chChartTypeStockOHLC
‘’chChartTypePolarMarkers
‘’chChartTypePolarLine
‘’chChartTypePolarLineMarkers
‘’chChartTypePolarSmoothLine
‘’chChartTypePolarSmoothLineMarkers
‘’共47个,谁有兴趣谁一一的试吧,我懒。
‘’类型不同,支持的方法也有所不同,本文针对chChartTypeColumnClustered。
a.Type = c.chChartTypeColumnClustered

ChartSpace1.Charts(0).SeriesCollection.Add
ChartSpace1.Charts(0).SeriesCollection.Add

values(0) = 0.2
values(1) = 0.06
values(2) = 0.17
values(3) = 0.13

‘’设置系列的名字,将显示于图例当中,下同
ChartSpace1.Charts(0).SeriesCollection(0).Caption = "Perot"
‘’设定种类名称,下同
ChartSpace1.Charts(0).SeriesCollection(0).SetData c.chDimCategories, c.chDataLiteral, categories
‘’设置系列的值,下同
ChartSpace1.Charts(0).SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values

values(0) = 0.38
values(1) = 0.82
values(2) = 0.28
values(3) = 0.62

ChartSpace1.Charts(0).SeriesCollection(1).Caption = "Clinton"
ChartSpace1.Charts(0).SeriesCollection(1).SetData c.chDimCategories, c.chDataLiteral, categories
ChartSpace1.Charts(0).SeriesCollection(1).SetData c.chDimValues, c.chDataLiteral, values

values(0) = 0.42
values(1) = 0.12
values(2) = 0.55
values(3) = 0.25

ChartSpace1.Charts(0).SeriesCollection(2).Caption = "Bush"
ChartSpace1.Charts(0).SeriesCollection(2).SetData c.chDimCategories, c.chDataLiteral, categories
ChartSpace1.Charts(0).SeriesCollection(2).SetData c.chDimValues, c.chDataLiteral, values

‘’设定指定轴的起点及格式,String类型
‘’其中,c.*为轴类型的枚举值,值列表如下:
‘’chAxisPositionLeft
‘’chAxisPositionCircular
‘’chAxisPositionRadial
‘’chAxisPositionRight
‘’chAxisPositionLeft
‘’chAxisPositionBottom
‘’chAxisPositionTop
ChartSpace1.Charts(0).Axes(c.chAxisPositionLeft).NumberFormat = "0%"

‘’设置指定坐标轴的主单位,Double类型
ChartSpace1.Charts(0).Axes(c.chAxisPositionLeft).MajorUnit = 0.1
END SUB
</SCRIPT>

延伸阅读

文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:[email protected] 电话:010-51297073

软件测试 | 领测国际 | ISTQB | ISTQB官网 | TMMi | TMMi认证 | 国际软件测试工程师认证 | 领测软件测试网