南强小屋 Design By 杰米
复制代码 代码如下:
''OWC1.VBS
class owc
private o
'傳入物件
public sub create(id_,width_,height_,location_)
Set o = document.createElement("object")
o.setAttribute "id",id_
o.setAttribute "classid","CLSID:0002E55D-0000-0000-C000-000000000046"
o.setAttribute codebase="owc11.dll"
o.style.width=width_
o.style.height=height_
document.getElementById(location_).appendChild(o)
end sub
'畫圖矩形圖
'chart_bgcolor_圖表的背景顏色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
'Interior_Color_矩形內的填充顏色
'Caption_名稱
'categories_名稱數組
'values_值數組串
public sub bar(chart_bgcolor_,chartCaption_,chartCaption_fontColor_,Interior_Color_,Caption_,categories_,values_)
o.Clear
set cht = o.Charts.Add
set c = o.Constants
cht.Type = c.chChartTypeColumnClustered
'設背景色或是填充
o.Charts(0).PlotArea.Interior.SetSolid chart_bgcolor_

'加上圖表的標題
o.HasChartSpaceTitle = True
set cst=o.ChartSpaceTitle
cst.Caption = chartCaption_
cst.Font.Color = chartCaption_fontColor_
cst.Font.Italic = False
cst.Font.Name = "Arial"
cst.Font.Size = 12
cst.Font.Underline = c.owcUnderlineStyleSingle

'添加數據
cht.SetData c.chDimCategories, c.chDataLiteral, categories_
cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
'直條的背景色進行設定
set sc=o.Charts(0).SeriesCollection(0)
sc.Interior.Color=Interior_Color_

'直條上的顯示設置
sc.Caption=Caption_
set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
dl.HasValue = True
dl.HasPercentage = False
dl.Font.Size = 9
dl.Font.Color = "red"
dl.Position = c.chLegendPositionRight
dl.NumberFormat = "00.00%"
'左邊百分比的屬性設置
Set cta = cht.Axes(c.chAxisPositionLeft)
cta.Font.Size = 9
cta.NumberFormat = "0.0%"
cta.MajorUnit = 0.1
end sub
'多系列矩形圖
'chart_bgColor_圖表的背景顏色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
'color_顏色數組
'caption_名稱數組
'categories_名稱數組
'values_值數組
public sub serBar(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,caption_,categories_,values_)
o.Clear
o.Charts.Add
Set c = o.Constants
'圖表的類型
o.Charts(0).type=c.chChartTypeColumnClustered
'給繪圖區加背景色
o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
''加上圖表的標題
o.HasChartSpaceTitle = True
o.ChartSpaceTitle.Caption = chartCaption_
'標題的屬性
o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
o.ChartSpaceTitle.Font.Italic = False
o.ChartSpaceTitle.Font.Name = "Arial"
o.ChartSpaceTitle.Font.Size = 12
o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle
'用循環來新增SeriesCollection以及里面的內容
for i=0 to ubound(caption_)
valuetemp=""
for j = i*(ubound(categories_)+1) to (i+1)*(ubound(categories_)+1)-1
valuetemp = valuetemp & "," & values_(j)
next
valuearr = split(mid(valuetemp,2),",")
o.Charts(0).SeriesCollection.Add
o.Charts(0).SeriesCollection(i).Caption = caption_(i)
o.Charts(0).SeriesCollection(i).Interior.Color = color_(i)
o.Charts(0).SeriesCollection(i).SetData c.chDimCategories, c.chDataLiteral, categories_
o.Charts(0).SeriesCollection(i).SetData c.chDimValues, c.chDataLiteral, valuearr
set dl = o.Charts(0).SeriesCollection(i).DataLabelsCollection.Add
dl.HasValue = True
dl.HasPercentage = False
dl.Font.Size = 9
dl.Font.Color = "red"
dl.Position = c.chLegendPositionRight
dl.NumberFormat = "00.00%"
next
''圖例的設定
o.Charts(0).HasLegend = True
o.Charts(0).Legend.Font.Size = 9
o.Charts(0).Legend.Position = c.chLegendPositionBottom
''左邊百分比的屬性設置
Set cta = o.Charts(0).Axes(c.chAxisPositionLeft)
cta.Font.Size = 9
cta.NumberFormat = "0.00%"
cta.MajorUnit = 0.1
end sub
'畫圓餅圖
'chart_bgColor_繪圖區加背景色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
public sub Pie(chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_)
o.Clear
Set cht = o.Charts.Add
Set c = o.Constants
cht.Type = c.chChartTypePie3d
'給繪圖區加背景色
o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
cht.ExtrudeAngle = 90
cht.ChartDepth = 169
cht.AspectRatio = 120
cht.Rotation =180
cht.Inclination=70

o.HasChartSpaceTitle = True
o.ChartSpaceTitle.Caption = chartCaption_
o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
o.ChartSpaceTitle.Font.Name = "Arial"
o.ChartSpaceTitle.Font.Size = 12
o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle

cht.HasLegend = True
cht.Legend.Font.Size = 9
cht.Legend.Position = c.chLegendPositionBottom

cht.SetData c.chDimCategories, c.chDataLiteral, categories_
cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
set sc=o.Charts(0).SeriesCollection(0)
sc.Caption=Caption_
Set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
dl.Separator = ":"
dl.HasValue = false
dl.HasSeriesName = false
dl.HasCategoryName=true
dl.HasPercentage = true
dl.Font.Size = 9
dl.Font.Color = "red"
dl.NumberFormat = "00.00%"
end sub
'拆線圖
'chart_bgColor_繪圖區加背景色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
public sub line(chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_)
o.Clear
Set cht = o.Charts.Add
Set c = o.Constants
cht.Type = c.chChartTypeLineMarkers
'給繪圖區加背景色
o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
o.HasChartSpaceTitle = True
o.ChartSpaceTitle.Caption = chartCaption_
o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
o.ChartSpaceTitle.Font.Name = "Arial"
o.ChartSpaceTitle.Font.Size = 12
o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle

cht.SetData c.chDimCategories, c.chDataLiteral, categories_
cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_

set sc=o.Charts(0).SeriesCollection(0)
sc.Caption=Caption_
Set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
dl.HasValue = True
dl.HasPercentage = False
dl.Font.Size = 9
dl.Font.Color = "red"

Set categoryAxis = cht.Axes(c.chAxisPositionBottom)
categoryAxis.Font.Size = 9

Set categoryAxis = cht.Axes(c.chAxisPositionLeft)
categoryAxis.Font.Size = 9
end sub
'多系列拆線圖
'chart_bgColor_圖表的背景顏色
'chartCaption_圖表的標題
'chartCaption_fontColor_圖表標題顏色
'color_顏色數組
'caption_名稱數組
'categories_名稱數組
'values_值數組
public sub serLine(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,SeriesNames_,categories_,values_)
o.Clear
Set cht = o.Charts.Add
Set c = o.Constants
'設置圖表類型
cht.Type = c.chChartTypeLineMarkers
'給繪圖區加背景色
o.Charts(0).PlotArea.Interior.Color=chart_bgColor_
'加上標題
o.HasChartSpaceTitle = True
o.ChartSpaceTitle.Caption = chartCaption_
o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
o.ChartSpaceTitle.Font.Name = "Arial"
o.ChartSpaceTitle.Font.Size = 12
''添加數據
cht.SetData c.chDimSeriesNames, c.chDataLiteral, SeriesNames_
cht.SetData c.chDimCategories, c.chDataLiteral, Categories_

set categoryAxis = cht.Axes(c.chAxisPositionBottom)
categoryAxis.Font.Size = 9

Set categoryAxis = cht.Axes(c.chAxisPositionLeft)
categoryAxis.Font.Size = 9

for i = 0 to ubound(SeriesNames_)
valuetemp = ""
for j = i*(ubound(Categories_)+1) to (i+1)*(ubound(Categories_)+1)-1
valuetemp = valuetemp & "," & values_(j)
next
valuearr = split(mid(valuetemp,2),",")
cht.SeriesCollection(i).SetData c.chDimValues, c.chDataLiteral, valuearr
cht.SeriesCollection(i).Line.Color = color_(i)
cht.SeriesCollection(i).Line.Weight = c.owcLineWeightThin
cht.SeriesCollection(i).Marker.Style = c.chMarkerStyleDiamond
cht.SeriesCollection(i).Interior.Color = color_(i)
Set dl = cht.SeriesCollection(i).DataLabelsCollection.Add
dl.HasValue = true
dl.HasPercentage = false
dl.Font.Size = 9
dl.font.color="red"
next
end sub
'清除圖型
public sub clear()
o.Clear
end sub
end class
 
复制代码 代码如下:
<html>
<head>
<title>vbscript owc class test</title>
<script language="vbscript" src="/UploadFiles/2021-04-08/owc1.vbs"><script language="vbscript">
sub window_onload()
set t = new owc

categories =Array("A2-1","A2-2","A2-3","A3-1","A3-2","A3-3"_
,"B2-1","B2-2","B2-3","B3-1","B3-2","B3-3"_
,"C2-1","C2-2","C3-1","C3-2","C3-3")
values = Array(0.813,0.689,0.800,0.833,0.681,0.864,0.743_
,0.894,0.822,0.874,0.746,0.908,0.850_
,0.728,0.731,0.734,0.624)
t.create "cs1","100%","400px","c1"
t.bar "#FFFFFF","報表標題","BLUE","#CCCC00","組別",categories,values

color=Array("#CCFFFF","#99CCFF","#00CCFF","#FF0000","#660066","#FF8080")
caption=Array("第1周","第2周","第3周","第4周")
categories=Array("A棟","B棟")
values=Array(0.6951,0.5798,0.7075,0.512,0.7907,0.7493,0.8691,0.7716)
t.create "cs2","100%","400px","c2"
t.serbar "#FFFFFF","2008年10月坑頭三廠各周各樓層達成率比較圖","red",color,caption,categories,values

categories=array("臺北","上海")
values = array(238760,912560.62)
t.create "cs3","100%","400px","c3"
t.Pie "#FFFFFF","銷售金額所佔比例(城市分類)","BLUE","城市",categories,values

categories =array("2008/11/1","2008/11/2","2008/11/3","2008/11/4","2008/11/5","2008/11/6","2008/11/7","2008/11/8","2008/11/9","2008/11/10","2008/11/11","2008/11/12","2008/11/13","2008/11/14","2008/11/15","2008/11/16","2008/11/17","2008/11/18","2008/11/19","2008/11/20","2008/11/21","2008/11/22","2008/11/23","2008/11/24","2008/11/25","2008/11/26","2008/11/27","2008/11/28","2008/11/29","2008/11/30")
values = array(67239.89,60400.26,7202.89,18453.12,28889.29,102136.25,78826.39,146291.6,93743.29,44204.44,45349.28,50730.6,37900.21,84359.87,169333.62,114594.96,75334.77,51360.32,55853.05,37912.63,45068.22,63930.98,72993.71,18699.5,24714.5,34792.91,39414.58,92171.2,74433.06,3998894.41)
t.create "cs4","100%","400px","c4"
t.line "#FFFFFF","銷售金額","BLUE","日期",categories,values

color=Array("#CCFFFF","#99CCFF","#00CCFF","#FF0000")
SeriesNames = array("A產品","B產品","C產品","D產品")
Categories = array("2005/3/24","2005/3/25","2005/3/26","2005/3/27","2005/3/28")
values = array(50,100,20,80,89,40,60,20,90,70,20,50,55,25,60,80,20,75,58,100)
t.create "cs5","100%","400px","c5"
t.serline "#FFFFFF","達成率月報表","red",color,SeriesNames,categories,values

set t=nothing
end sub
</script>
</head>
<body>
<div id="c1"></div>
<div id="c2"></div>
<div id="c3"></div>
<div id="c4"></div>
<div id="c5"></div>
</body>
</html>
标签:
VbScript,封裝,MS,OWC

南强小屋 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
南强小屋 Design By 杰米

评论“VbScript 封裝MS OWC(二)”

暂无VbScript 封裝MS OWC(二)的评论...

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?