Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How VbScript encapsulates MS OWC

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces VbScript how to package MS OWC, the article is very detailed, has a certain reference value, interested friends must read it!

The code is as follows:

'' OWC1.VBS

Class owc

Private o

'import an object

Public sub create (id_,width_,height_,location_)

Set o = document.createElement ("object")

O.setAttribute "id", id_

O.setAttribute "classid", "CLSID:0002E55D-0000-0000-C000-00000046"

O.setAttribute codebase= "owc11.dll"

O.style.widthparts widthswidth.widthwidth.style

O.style.heightfloor heightHight _

Document.getElementById (location_) .appendChild (o)

End sub

'The rectangle'

The background color of the chart_bgcolor_ table

'The title of the chartCaption_ table

'The color of the chartCaption_fontColor_ table title

The fill color in the rectangle of Interior_Color_

'Caption_ name

'Number of categories_ names

'Strings of values_ 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

'set background color or fill

O.Charts (0). PlotArea.Interior.SetSolid chart_bgcolor_

'add the title of the table.

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

'add data

Cht.SetData c.chDimCategories, c.chDataLiteral, categories_

Cht.SeriesCollection (0). SetData c.chDimValues, c.chDataLiteral, values_

'set the direct background color

Set sc=o.Charts (0) .SeriesCollection (0)

Sc.Interior.Color=Interior_Color_

'display settings on the line

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%"

'The attribute setting of the left percentage

Set cta = cht.Axes (c.chAxisPositionLeft)

Cta.Font.Size = 9

Cta.NumberFormat = "0.0%"

Cta.MajorUnit = 0.1

End sub

'Multi-series rectangles'

The background color of the chart_bgColor_ table

'The title of the chartCaption_ table

'The color of the chartCaption_fontColor_ table title

'The number of color_ colors

'Number of caption_ names

'Number of categories_ names

'group of values_ values

Public sub serBar (chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,caption_,categories_,values_)

O.Clear

O.Charts.Add

Set c = o.Constants

'The type of the table

O.Charts (0). Type=c.chChartTypeColumnClustered

'add background color to the tropical area.

O.Charts (0). PlotArea.Interior.SetSolid chart_bgColor_

'' add the title of the table

O.HasChartSpaceTitle = True

O.ChartSpaceTitle.Caption = chartCaption_

'The nature of the title.

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

'add SeriesCollection and the content in it by following the steps

For iTun0 to ubound (caption_)

Valuetemp= ""

For j = I * (ubound (categories_) + 1) to (iTun1) * (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

'' setting of exception

O.Charts (0) .HasLegend = True

O.Charts (0). Legend.Font.Size = 9

O.Charts (0) .Legend.Position = c.chLegendPositionBottom

'' the attribute setting of the left percentage

Set cta = o.Charts (0) .Axes (c.chAxisPositionLeft)

Cta.Font.Size = 9

Cta.NumberFormat = "0.005%"

Cta.MajorUnit = 0.1

End sub

'' thank you.''

'chart_bgColor_ area plus background color

'The title of the chartCaption_ table

'The color of the chartCaption_fontColor_ table title

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

'add background color to the tropical area.

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

'disconnect'

'chart_bgColor_ area plus background color

'The title of the chartCaption_ table

'The color of the chartCaption_fontColor_ table title

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

'add background color to the tropical area.

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

'Multi-series disconnect'

The background color of the chart_bgColor_ table

'The title of the chartCaption_ table

'The color of the chartCaption_fontColor_ table title

'The number of color_ colors

'Number of caption_ names

'Number of categories_ names

'group of values_ values

Public sub serLine (chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,SeriesNames_,categories_,values_)

O.Clear

Set cht = o.Charts.Add

Set c = o.Constants

'set the table type

Cht.Type = c.chChartTypeLineMarkers

'add background color to the tropical area.

O.Charts (0). PlotArea.Interior.Color=chart_bgColor_

'Plus the title

O.HasChartSpaceTitle = True

O.ChartSpaceTitle.Caption = chartCaption_

O.ChartSpaceTitle.Font.Color = chartCaption_fontColor_

O.ChartSpaceTitle.Font.Name = "Arial"

O.ChartSpaceTitle.Font.Size = 12

'' add data

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 (iTun1) * (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

'Clearing the type.

Public sub clear ()

O.Clear

End sub

End class

The copy code is as follows:

Vbscript owc class test

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", "report title", "BLUE", "# CCCC00", "Group", categories,values

Color=Array ("# CCFFFF", "# 99CCFF", "# 00CCFF", "# FF0000", "# 660066", "# FF8080")

Caption=Array ("week 1", "week 2", "week 3", "week 4")

Categories=Array ("A girls", "B girls")

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", "ratio of annual turnover per week to week in October 2008", "red", color,caption,categories,values

Categories=array ("Heibei", "Shanghai")

Values = array (238760, 912560.62)

T.create "cs3", "100%", "400px", "c3"

T.Pie "# FFFFFF", "proportion of gold sales (city classification)", "BLUE", "city", 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", "2008x11gam8", "2008x11gamet9", "2008gamel11lemagen10", "2008gamel11games11", "2008gamel11Uniexus 12", "2008gamel11lem13", "2008gamel11lem14", "2008gamel11lem15", "2008gamel1116". "2008-11-17", "2008-11-18", "2008-11-19", "2008-11-20", "2008-11-21", "2008-11-21", "2008-11-22", "2008-11-23", "2008gamel11 Master24", "2008gamel11games25", "2008gamel11games26", "2008gamel11games27", "2008gamel11games28", "2008planc11ly29", "2008gamel11plains")

Values = array (67239.89, 60400.26, 7202.89, 18453.12, 28889.29, 102136.25, 78826.39, 146291.6, 93743.29, 44204.4, 45349.28, 50730.6, 37900.21, 84359.87, 169333.62, 114594.96, 75334.7, 51360.32, 55853.05, 37912.6, 45068.22, 639399892993.71.186, 24714.534792.91, 24714,534792.91,

T.create "cs4", "100%", "400px", "c4"

T.line "# FFFFFF", "sales Gold", "BLUE", "date", categories,values

Color=Array ("# CCFFFF", "# 99CCFF", "# 00CCFF", "# FF0000")

SeriesNames = array ("A products", "B products", "C products", "D products")

Categories = array ("2005-3-24", "2005-3-25", "2005-3-26", "2005-3-27", "2005-3-28")

Values = array (50, 100, 20, 80, 80, 80, 40, 60, 90, 70, 70, 50, 55, 25, 60, 80, 50, 50, 55, 25, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, and 50).

T.create "cs5", "100%", "400px", "c5"

T.serline "# FFFFFF", "monthly success rate Table", "red", color,SeriesNames,categories,values

Set t=nothing

End sub

The above is all the content of the article "how VbScript encapsulates MS OWC". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report