VbScript Enclosure of Ms OWC (ii) _vbs

Source: Internet
Author: User
Copy Code code as follows:

"OWC1." VBS
Class OWC
Private O
' Spread the 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-000000000046"
O.setattribute codebase= "Owc11.dll"
O.style.width=width_
O.style.height=height_
document.getElementById (Location_). appendchild (o)
End Sub
' Draw a rectangular chart
' Chart_bgcolor_ the background color of the chart
' The title of the Chartcaption_ chart
' Chartcaption_fontcolor_ Chart title color
' Interior_color_ the fill color inside the rectangle
' Caption_ name
' Categories_ name Number group
' Values_ value series
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 the background color or fill
O.charts (0). PlotArea.Interior.SetSolid Chart_bgcolor_

' Plus the title of the chart
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_
' The background color of the straight line is set
Set Sc=o.charts (0). SeriesCollection (0)
Sc. Interior.color=interior_color_

' The display on the straight
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 = "0%"
' Percentage of the left
Set CTA = Cht. Axes (C.chaxispositionleft)
Cta. Font.Size = 9
Cta. NumberFormat = "0%"
Cta. MajorUnit = 0.1
End Sub
' Multi-Series Rectangular chart
' Chart_bgcolor_ the background color of the chart
' The title of the Chartcaption_ chart
' Chartcaption_fontcolor_ Chart title color
' Color_ Color Group
' Caption_ name Number group
' Categories_ name Number group
' Values_ value Group
Public Sub Serbar (Chart_bgcolor_,chartcaption_,chartcaption_fontcolor_,color_,caption_,categories_,values_)
O.clear
O.charts.add
Set C = o.constants
' Types of graphs
O.charts (0). type=c.chcharttypecolumnclustered
' Add a background color to the drawing area
O.charts (0). PlotArea.Interior.SetSolid Chart_bgcolor_
"Plus the title of the chart
O.haschartspacetitle = True
O.chartspacetitle.caption = Chartcaption_
' The attributes 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
' Use the loop to add seriescollection and inner content
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 = "0%"
Next
' The setting of the sample
O.charts (0). HasLegend = True
O.charts (0). Legend.Font.Size = 9
O.charts (0). Legend.position = C.chlegendpositionbottom
'% of the left
Set CTA = o.charts (0). Axes (C.chaxispositionleft)
Cta. Font.Size = 9
Cta. NumberFormat = "0%"
Cta. MajorUnit = 0.1
End Sub
' Draw a cookie.
' Chart_bgcolor_ drawing area plus background color
' The title of the Chartcaption_ chart
' Chartcaption_fontcolor_ Chart title color
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 a background color to the drawing 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 = "0%"
End Sub
' Split chart
' Chart_bgcolor_ drawing area plus background color
' The title of the Chartcaption_ chart
' Chartcaption_fontcolor_ Chart title color
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 a background color to the drawing 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 disassembly diagram
' Chart_bgcolor_ the background color of the chart
' The title of the Chartcaption_ chart
' Chartcaption_fontcolor_ Chart title color
' Color_ Color Group
' Caption_ name Number group
' Categories_ name Number group
' Values_ value Group
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 chart type
Cht. Type = C.chcharttypelinemarkers
' Add a background color to the drawing 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 (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
' Clear pattern
Public Sub Clear ()
O.clear
End Sub
End Class

Copy Code code as follows:

<title>vbscript OWC class Test</title>
<script language= "VBScript" src= "Owc1.vbs" ></script>
<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", "Report title", "BLUE", "#CCCC00", "group", Categories,values

Color=array ("#CCFFFF", "#99CCFF", "#00CCFF", "#FF0000", "#660066", "#FF8080")
Caption=array ("1th Week", "2nd Week", "3rd Week", "4th Week")
Categories=array ("A building", "B building")
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", "October 2008 pit three factory every week to achieve the ratio map", "Red", color,caption,categories,values

Categories=array ("Taiwan North", "Shanghai")
Values = Array (238760,912560.62)
T.create "CS3", "100%", "400px", "C3"
T.pie "#FFFFFF", "the proportion of sales (urban division)", "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", "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", "Sales", "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,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", "to the rate of monthly Report", "Red", color,seriesnames,categories,values

Set t=nothing
End Sub
</script>
<body>
<div id= "C1" ></div>
<div id= "C2" ></div>
<div Id= "C3" ></div>
<div id= "C4" ></div>
<div id= "C5" ></div>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.