ASP封裝OWC CLASS
1 <%
2 '生成各种圖型的png圖片
3 class owc
4 private o
5 private PicType
6
7 '創建時自動create owc
8 Private Sub Class_Initialize()
9 set o=Server.CreateObject("OWC11.ChartSpace")
10 PicType = "PNG"'生成的圖片格式
11 End Sub
12 '實例終止時自動設為nothing
13 Private Sub Class_Terminate
14 set o=nothing
15 End Sub
16 '畫圖矩形圖
17 'chart_bgcolor_圖表的背景顏色
18 'chartCaption_圖表的標題
19 'chartCaption_fontColor_圖表標題顏色
20 'Interior_Color_矩形內的填充顏色
21 'Caption_名稱
22 'categories_名稱數組
23 'values_值數組串
24 public sub bar(chart_bgcolor_,chartCaption_,chartCaption_fontColor_,Interior_Color_,Caption_,categories_,values_,width_,height_)
25 On Error Resume Next
26 Response.Expires = 0
27 Response.Buffer = True
28 Response.Clear
29 o.Clear
30 set cht = o.Charts.Add
31 set c = o.Constants
32 cht.Type = c.chChartTypeColumnClustered
33 '設背景色或是填充
34 o.Charts(0).PlotArea.Interior.SetSolid chart_bgcolor_
35
36 '加上圖表的標題
37 o.HasChartSpaceTitle = True
38 set cst=o.ChartSpaceTitle
39 cst.Caption = chartCaption_
40 cst.Font.Color = chartCaption_fontColor_
41 cst.Font.Italic = False
42 cst.Font.Name = "Arial"
43 cst.Font.Size = 12
44 cst.Font.Underline = c.owcUnderlineStyleSingle
45
46 '添加數據
47 cht.SetData c.chDimCategories, c.chDataLiteral, categories_
48 cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
49 '直條的背景色進行設定
50 set sc=o.Charts(0).SeriesCollection(0)
51 sc.Interior.Color=Interior_Color_
52
53 '直條上的顯示設置
54 sc.Caption=Caption_
55 set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
56 dl.HasValue = True
57 dl.HasPercentage = False
58 dl.Font.Size = 9
59 dl.Font.Color = "red"
60 dl.Position = c.chLegendPositionRight
61 dl.NumberFormat = "00.00%"
62 '左邊百分比的屬性設置
63 Set cta = cht.Axes(c.chAxisPositionLeft)
64 cta.Font.Size = 9
65 cta.NumberFormat = "0.0%"
66 cta.MajorUnit = 0.1
67
68 Response.ContentType = "image/" & PicType
69 Response.BinaryWrite o.GetPicture(PicType,width_,height_)
70 end sub
71 '多系列矩形圖
72 'chart_bgColor_圖表的背景顏色
73 'chartCaption_圖表的標題
74 'chartCaption_fontColor_圖表標題顏色
75 'color_顏色數組
76 'caption_名稱數組
77 'categories_名稱數組
78 'values_值數組
79 public sub serBar(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,caption_,categories_,values_,width_,height_)
80 On Error Resume Next
81 Response.Expires = 0
82 Response.Buffer = True
83 Response.Clear
84 o.Clear
85 o.Charts.Add
86 Set c = o.Constants
87 '圖表的類型
88 o.Charts(0).type=c.chChartTypeColumnClustered
89 '給繪圖區加背景色
90 o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
91 ''加上圖表的標題
92 o.HasChartSpaceTitle = True
93 o.ChartSpaceTitle.Caption = chartCaption_
94 '標題的屬性
95 o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
96 o.ChartSpaceTitle.Font.Italic = False
97 o.ChartSpaceTitle.Font.Name = "Arial"
98 o.ChartSpaceTitle.Font.Size = 12
99 o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle
100 '用循環來新增SeriesCollection以及里面的內容
101 for i=0 to ubound(caption_)
102 valuetemp=""
103 for j = i*(ubound(categories_)+1) to (i+1)*(ubound(categories_)+1)-1
104 valuetemp = valuetemp & "," & values_(j)
105 next
106 valuearr = split(mid(valuetemp,2),",")
107 o.Charts(0).SeriesCollection.Add
108 o.Charts(0).SeriesCollection(i).Caption = caption_(i)
109 o.Charts(0).SeriesCollection(i).Interior.Color = color_(i)
110 o.Charts(0).SeriesCollection(i).SetData c.chDimCategories, c.chDataLiteral, categories_
111 o.Charts(0).SeriesCollection(i).SetData c.chDimValues, c.chDataLiteral, valuearr
112 set dl = o.Charts(0).SeriesCollection(i).DataLabelsCollection.Add
113 dl.HasValue = True
114 dl.HasPercentage = False
115 dl.Font.Size = 9
116 dl.Font.Color = "red"
117 dl.Position = c.chLegendPositionRight
118 dl.NumberFormat = "00.00%"
119 next
120 ''圖例的設定
121 o.Charts(0).HasLegend = True
122 o.Charts(0).Legend.Font.Size = 9
123 o.Charts(0).Legend.Position = c.chLegendPositionBottom
124 ''左邊百分比的屬性設置
125 Set cta = o.Charts(0).Axes(c.chAxisPositionLeft)
126 cta.Font.Size = 9
127 cta.NumberFormat = "0.00%"
128 cta.MajorUnit = 0.1
129 Response.ContentType = "image/" & PicType
130 response.BinaryWrite o.GetPicture(PicType,width_,height_)
131 end sub
132 '畫圓餅圖
133 'chart_bgColor_繪圖區加背景色
134 'chartCaption_圖表的標題
135 'chartCaption_fontColor_圖表標題顏色
136 public sub Pie(chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_,width_,height_)
137 On Error Resume Next
138 Response.Expires = 0
139 Response.Buffer = True
140 Response.Clear
141 o.Clear
142 Set cht = o.Charts.Add
143 Set c = o.Constants
144 cht.Type = c.chChartTypePie3d
145 '給繪圖區加背景色
146 o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
147 cht.ExtrudeAngle = 90
148 cht.ChartDepth = 169
149 cht.AspectRatio = 120
150 cht.Rotation =180
151 cht.Inclination=70
152
153 o.HasChartSpaceTitle = True
154 o.ChartSpaceTitle.Caption = chartCaption_
155 o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
156 o.ChartSpaceTitle.Font.Name = "Arial"
157 o.ChartSpaceTitle.Font.Size = 12
158 o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle
159
160 cht.HasLegend = True
161 cht.Legend.Font.Size = 9
162 cht.Legend.Position = c.chLegendPositionBottom
163
164 cht.SetData c.chDimCategories, c.chDataLiteral, categories_
165 cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
166 set sc=o.Charts(0).SeriesCollection(0)
167 sc.Caption=Caption_
168 Set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
169 dl.Separator = ":"
170 dl.HasValue = false
171 dl.HasSeriesName = false
172 dl.HasCategoryName=true
173 dl.HasPercentage = true
174 dl.Font.Size = 9
175 dl.Font.Color = "red"
176 dl.NumberFormat = "00.00%"
177 Response.ContentType = "image/" & PicType
178 response.BinaryWrite o.GetPicture(PicType,width_,height_)
179 end sub
180 '拆線圖
181 'chart_bgColor_繪圖區加背景色
182 'chartCaption_圖表的標題
183 'chartCaption_fontColor_圖表標題顏色
184 public sub line(chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_,width_,height_)
185 On Error Resume Next
186 Response.Expires = 0
187 Response.Buffer = True
188 Response.Clear
189 o.Clear
190 Set cht = o.Charts.Add
191 Set c = o.Constants
192 cht.Type = c.chChartTypeLineMarkers
193 '給繪圖區加背景色
194 o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
195 o.HasChartSpaceTitle = True
196 o.ChartSpaceTitle.Caption = chartCaption_
197 o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
198 o.ChartSpaceTitle.Font.Name = "Arial"
199 o.ChartSpaceTitle.Font.Size = 12
200 o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle
201
202 cht.SetData c.chDimCategories, c.chDataLiteral, categories_
203 cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
204
205 set sc=o.Charts(0).SeriesCollection(0)
206 sc.Caption=Caption_
207 Set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
208 dl.HasValue = True
209 dl.HasPercentage = False
210 dl.Font.Size = 9
211 dl.Font.Color = "red"
212
213 Set categoryAxis = cht.Axes(c.chAxisPositionBottom)
214 categoryAxis.Font.Size = 9
215
216 Set categoryAxis = cht.Axes(c.chAxisPositionLeft)
217 categoryAxis.Font.Size = 9
218 Response.ContentType = "image/" & PicType
219 response.BinaryWrite o.GetPicture(PicType,width_,height_)
220 end sub
221 '多系列拆線圖
222 'chart_bgColor_圖表的背景顏色
223 'chartCaption_圖表的標題
224 'chartCaption_fontColor_圖表標題顏色
225 'color_顏色數組
226 'caption_名稱數組
227 'categories_名稱數組
228 'values_值數組
229 public sub serLine(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,SeriesNames_,categories_,values_,width_,height_)
230 On Error Resume Next
231 Response.Expires = 0
232 Response.Buffer = True
233 Response.Clear
234 o.Clear
235 Set cht = o.Charts.Add
236 Set c = o.Constants
237 '設置圖表類型
238 cht.Type = c.chChartTypeLineMarkers
239 '給繪圖區加背景色
240 o.Charts(0).PlotArea.Interior.Color=chart_bgColor_
241 '加上標題
242 o.HasChartSpaceTitle = True
243 o.ChartSpaceTitle.Caption = chartCaption_
244 o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
245 o.ChartSpaceTitle.Font.Name = "Arial"
246 o.ChartSpaceTitle.Font.Size = 12
247 ''添加數據
248 cht.SetData c.chDimSeriesNames, c.chDataLiteral, SeriesNames_
249 cht.SetData c.chDimCategories, c.chDataLiteral, Categories_
250
251 set categoryAxis = cht.Axes(c.chAxisPositionBottom)
252 categoryAxis.Font.Size = 9
253
254 Set categoryAxis = cht.Axes(c.chAxisPositionLeft)
255 categoryAxis.Font.Size = 9
256
257 for i = 0 to ubound(SeriesNames_)
258 valuetemp = ""
259 for j = i*(ubound(Categories_)+1) to (i+1)*(ubound(Categories_)+1)-1
260 valuetemp = valuetemp & "," & values_(j)
261 next
262 valuearr = split(mid(valuetemp,2),",")
263 cht.SeriesCollection(i).SetData c.chDimValues, c.chDataLiteral, valuearr
264 cht.SeriesCollection(i).Line.Color = color_(i)
265 cht.SeriesCollection(i).Line.Weight = c.owcLineWeightThin
266 cht.SeriesCollection(i).Marker.Style = c.chMarkerStyleDiamond
267 cht.SeriesCollection(i).Interior.Color = color_(i)
268 Set dl = cht.SeriesCollection(i).DataLabelsCollection.Add
269 dl.HasValue = true
270 dl.HasPercentage = false
271 dl.Font.Size = 9
272 dl.font.color="red"
273 next
274 Response.ContentType = "image/" & PicType
275 response.BinaryWrite o.GetPicture(PicType,width_,height_)
276 end sub
277 end class
278 %>
279
2 '生成各种圖型的png圖片
3 class owc
4 private o
5 private PicType
6
7 '創建時自動create owc
8 Private Sub Class_Initialize()
9 set o=Server.CreateObject("OWC11.ChartSpace")
10 PicType = "PNG"'生成的圖片格式
11 End Sub
12 '實例終止時自動設為nothing
13 Private Sub Class_Terminate
14 set o=nothing
15 End Sub
16 '畫圖矩形圖
17 'chart_bgcolor_圖表的背景顏色
18 'chartCaption_圖表的標題
19 'chartCaption_fontColor_圖表標題顏色
20 'Interior_Color_矩形內的填充顏色
21 'Caption_名稱
22 'categories_名稱數組
23 'values_值數組串
24 public sub bar(chart_bgcolor_,chartCaption_,chartCaption_fontColor_,Interior_Color_,Caption_,categories_,values_,width_,height_)
25 On Error Resume Next
26 Response.Expires = 0
27 Response.Buffer = True
28 Response.Clear
29 o.Clear
30 set cht = o.Charts.Add
31 set c = o.Constants
32 cht.Type = c.chChartTypeColumnClustered
33 '設背景色或是填充
34 o.Charts(0).PlotArea.Interior.SetSolid chart_bgcolor_
35
36 '加上圖表的標題
37 o.HasChartSpaceTitle = True
38 set cst=o.ChartSpaceTitle
39 cst.Caption = chartCaption_
40 cst.Font.Color = chartCaption_fontColor_
41 cst.Font.Italic = False
42 cst.Font.Name = "Arial"
43 cst.Font.Size = 12
44 cst.Font.Underline = c.owcUnderlineStyleSingle
45
46 '添加數據
47 cht.SetData c.chDimCategories, c.chDataLiteral, categories_
48 cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
49 '直條的背景色進行設定
50 set sc=o.Charts(0).SeriesCollection(0)
51 sc.Interior.Color=Interior_Color_
52
53 '直條上的顯示設置
54 sc.Caption=Caption_
55 set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
56 dl.HasValue = True
57 dl.HasPercentage = False
58 dl.Font.Size = 9
59 dl.Font.Color = "red"
60 dl.Position = c.chLegendPositionRight
61 dl.NumberFormat = "00.00%"
62 '左邊百分比的屬性設置
63 Set cta = cht.Axes(c.chAxisPositionLeft)
64 cta.Font.Size = 9
65 cta.NumberFormat = "0.0%"
66 cta.MajorUnit = 0.1
67
68 Response.ContentType = "image/" & PicType
69 Response.BinaryWrite o.GetPicture(PicType,width_,height_)
70 end sub
71 '多系列矩形圖
72 'chart_bgColor_圖表的背景顏色
73 'chartCaption_圖表的標題
74 'chartCaption_fontColor_圖表標題顏色
75 'color_顏色數組
76 'caption_名稱數組
77 'categories_名稱數組
78 'values_值數組
79 public sub serBar(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,caption_,categories_,values_,width_,height_)
80 On Error Resume Next
81 Response.Expires = 0
82 Response.Buffer = True
83 Response.Clear
84 o.Clear
85 o.Charts.Add
86 Set c = o.Constants
87 '圖表的類型
88 o.Charts(0).type=c.chChartTypeColumnClustered
89 '給繪圖區加背景色
90 o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
91 ''加上圖表的標題
92 o.HasChartSpaceTitle = True
93 o.ChartSpaceTitle.Caption = chartCaption_
94 '標題的屬性
95 o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
96 o.ChartSpaceTitle.Font.Italic = False
97 o.ChartSpaceTitle.Font.Name = "Arial"
98 o.ChartSpaceTitle.Font.Size = 12
99 o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle
100 '用循環來新增SeriesCollection以及里面的內容
101 for i=0 to ubound(caption_)
102 valuetemp=""
103 for j = i*(ubound(categories_)+1) to (i+1)*(ubound(categories_)+1)-1
104 valuetemp = valuetemp & "," & values_(j)
105 next
106 valuearr = split(mid(valuetemp,2),",")
107 o.Charts(0).SeriesCollection.Add
108 o.Charts(0).SeriesCollection(i).Caption = caption_(i)
109 o.Charts(0).SeriesCollection(i).Interior.Color = color_(i)
110 o.Charts(0).SeriesCollection(i).SetData c.chDimCategories, c.chDataLiteral, categories_
111 o.Charts(0).SeriesCollection(i).SetData c.chDimValues, c.chDataLiteral, valuearr
112 set dl = o.Charts(0).SeriesCollection(i).DataLabelsCollection.Add
113 dl.HasValue = True
114 dl.HasPercentage = False
115 dl.Font.Size = 9
116 dl.Font.Color = "red"
117 dl.Position = c.chLegendPositionRight
118 dl.NumberFormat = "00.00%"
119 next
120 ''圖例的設定
121 o.Charts(0).HasLegend = True
122 o.Charts(0).Legend.Font.Size = 9
123 o.Charts(0).Legend.Position = c.chLegendPositionBottom
124 ''左邊百分比的屬性設置
125 Set cta = o.Charts(0).Axes(c.chAxisPositionLeft)
126 cta.Font.Size = 9
127 cta.NumberFormat = "0.00%"
128 cta.MajorUnit = 0.1
129 Response.ContentType = "image/" & PicType
130 response.BinaryWrite o.GetPicture(PicType,width_,height_)
131 end sub
132 '畫圓餅圖
133 'chart_bgColor_繪圖區加背景色
134 'chartCaption_圖表的標題
135 'chartCaption_fontColor_圖表標題顏色
136 public sub Pie(chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_,width_,height_)
137 On Error Resume Next
138 Response.Expires = 0
139 Response.Buffer = True
140 Response.Clear
141 o.Clear
142 Set cht = o.Charts.Add
143 Set c = o.Constants
144 cht.Type = c.chChartTypePie3d
145 '給繪圖區加背景色
146 o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
147 cht.ExtrudeAngle = 90
148 cht.ChartDepth = 169
149 cht.AspectRatio = 120
150 cht.Rotation =180
151 cht.Inclination=70
152
153 o.HasChartSpaceTitle = True
154 o.ChartSpaceTitle.Caption = chartCaption_
155 o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
156 o.ChartSpaceTitle.Font.Name = "Arial"
157 o.ChartSpaceTitle.Font.Size = 12
158 o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle
159
160 cht.HasLegend = True
161 cht.Legend.Font.Size = 9
162 cht.Legend.Position = c.chLegendPositionBottom
163
164 cht.SetData c.chDimCategories, c.chDataLiteral, categories_
165 cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
166 set sc=o.Charts(0).SeriesCollection(0)
167 sc.Caption=Caption_
168 Set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
169 dl.Separator = ":"
170 dl.HasValue = false
171 dl.HasSeriesName = false
172 dl.HasCategoryName=true
173 dl.HasPercentage = true
174 dl.Font.Size = 9
175 dl.Font.Color = "red"
176 dl.NumberFormat = "00.00%"
177 Response.ContentType = "image/" & PicType
178 response.BinaryWrite o.GetPicture(PicType,width_,height_)
179 end sub
180 '拆線圖
181 'chart_bgColor_繪圖區加背景色
182 'chartCaption_圖表的標題
183 'chartCaption_fontColor_圖表標題顏色
184 public sub line(chart_bgColor_,chartCaption_,chartCaption_fontColor_,Caption_,categories_,values_,width_,height_)
185 On Error Resume Next
186 Response.Expires = 0
187 Response.Buffer = True
188 Response.Clear
189 o.Clear
190 Set cht = o.Charts.Add
191 Set c = o.Constants
192 cht.Type = c.chChartTypeLineMarkers
193 '給繪圖區加背景色
194 o.Charts(0).PlotArea.Interior.SetSolid chart_bgColor_
195 o.HasChartSpaceTitle = True
196 o.ChartSpaceTitle.Caption = chartCaption_
197 o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
198 o.ChartSpaceTitle.Font.Name = "Arial"
199 o.ChartSpaceTitle.Font.Size = 12
200 o.ChartSpaceTitle.Font.Underline = c.owcUnderlineStyleSingle
201
202 cht.SetData c.chDimCategories, c.chDataLiteral, categories_
203 cht.SeriesCollection(0).SetData c.chDimValues, c.chDataLiteral, values_
204
205 set sc=o.Charts(0).SeriesCollection(0)
206 sc.Caption=Caption_
207 Set dl = cht.SeriesCollection(0).DataLabelsCollection.Add
208 dl.HasValue = True
209 dl.HasPercentage = False
210 dl.Font.Size = 9
211 dl.Font.Color = "red"
212
213 Set categoryAxis = cht.Axes(c.chAxisPositionBottom)
214 categoryAxis.Font.Size = 9
215
216 Set categoryAxis = cht.Axes(c.chAxisPositionLeft)
217 categoryAxis.Font.Size = 9
218 Response.ContentType = "image/" & PicType
219 response.BinaryWrite o.GetPicture(PicType,width_,height_)
220 end sub
221 '多系列拆線圖
222 'chart_bgColor_圖表的背景顏色
223 'chartCaption_圖表的標題
224 'chartCaption_fontColor_圖表標題顏色
225 'color_顏色數組
226 'caption_名稱數組
227 'categories_名稱數組
228 'values_值數組
229 public sub serLine(chart_bgColor_,chartCaption_,chartCaption_fontColor_,color_,SeriesNames_,categories_,values_,width_,height_)
230 On Error Resume Next
231 Response.Expires = 0
232 Response.Buffer = True
233 Response.Clear
234 o.Clear
235 Set cht = o.Charts.Add
236 Set c = o.Constants
237 '設置圖表類型
238 cht.Type = c.chChartTypeLineMarkers
239 '給繪圖區加背景色
240 o.Charts(0).PlotArea.Interior.Color=chart_bgColor_
241 '加上標題
242 o.HasChartSpaceTitle = True
243 o.ChartSpaceTitle.Caption = chartCaption_
244 o.ChartSpaceTitle.Font.Color = chartCaption_fontColor_
245 o.ChartSpaceTitle.Font.Name = "Arial"
246 o.ChartSpaceTitle.Font.Size = 12
247 ''添加數據
248 cht.SetData c.chDimSeriesNames, c.chDataLiteral, SeriesNames_
249 cht.SetData c.chDimCategories, c.chDataLiteral, Categories_
250
251 set categoryAxis = cht.Axes(c.chAxisPositionBottom)
252 categoryAxis.Font.Size = 9
253
254 Set categoryAxis = cht.Axes(c.chAxisPositionLeft)
255 categoryAxis.Font.Size = 9
256
257 for i = 0 to ubound(SeriesNames_)
258 valuetemp = ""
259 for j = i*(ubound(Categories_)+1) to (i+1)*(ubound(Categories_)+1)-1
260 valuetemp = valuetemp & "," & values_(j)
261 next
262 valuearr = split(mid(valuetemp,2),",")
263 cht.SeriesCollection(i).SetData c.chDimValues, c.chDataLiteral, valuearr
264 cht.SeriesCollection(i).Line.Color = color_(i)
265 cht.SeriesCollection(i).Line.Weight = c.owcLineWeightThin
266 cht.SeriesCollection(i).Marker.Style = c.chMarkerStyleDiamond
267 cht.SeriesCollection(i).Interior.Color = color_(i)
268 Set dl = cht.SeriesCollection(i).DataLabelsCollection.Add
269 dl.HasValue = true
270 dl.HasPercentage = false
271 dl.Font.Size = 9
272 dl.font.color="red"
273 next
274 Response.ContentType = "image/" & PicType
275 response.BinaryWrite o.GetPicture(PicType,width_,height_)
276 end sub
277 end class
278 %>
279
<!--#include file="owc.asp" -->
<%
'Option Explicit
Response.buffer=true
Response.Expires = -1
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
chartType=request.QueryString("chartType")
select case chartType
case "bar"
call bar()
case "serbar"
call serbar()
case "pie"
call pie()
case "line"
call line()
case "serline"
call serline()
end select
sub bar()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,Interior_Color,Caption,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
Interior_Color=request.QueryString("Interior_Color")
Caption=request.QueryString("Caption")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim catarr,valarr
catarr=split(categories,",")
valarr=split(values,",")
o.bar chart_bgcolor,chartCaption,chartCaption_fontColor,Interior_Color,Caption,catarr,valarr,width,height
set o=nothing
end sub
sub serbar()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,color,Caption,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
color=request.QueryString("color")
Caption=request.QueryString("Caption")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim colarr,catarr,valarr
colarr=split(color,",")
catarr=split(categories,",")
valarr=split(values,",")
o.serbar chart_bgColor,chartCaption,chartCaption_fontColor,colarr,catarr,valarr,values,width,height
set o=nothing
end sub
sub pie()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,Caption,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
Caption=request.QueryString("Caption")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim catarr,valarr
catarr=split(categories,",")
valarr=split(values,",")
o.pie chart_bgColor,chartCaption,chartCaption_fontColor,Caption,catarr,valarr,width,height
set o=nothing
end sub
sub line()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,Caption,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
Caption=request.QueryString("Caption")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim catarr,valarr
catarr=split(categories,",")
valarr=split(values,",")
o.line chart_bgColor,chartCaption,chartCaption_fontColor,Caption,catarr,valarr,width,height
set o=nothing
end sub
sub serline()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,color,SeriesNames,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
color=request.QueryString("color")
SeriesNames=request.QueryString("SeriesNames")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim colarr,serarr,catarr,valarr
colarr=split(color,",")
serarr=split(SeriesNames,",")
catarr=split(categories,",")
valarr=split(values,",")
o.serline chart_bgColor,chartCaption,chartCaption_fontColor,colarr,serarr,catarr,valarr,width,height
set o=nothing
end sub
%>
<%
'Option Explicit
Response.buffer=true
Response.Expires = -1
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "cache-ctrol","no-cache"
chartType=request.QueryString("chartType")
select case chartType
case "bar"
call bar()
case "serbar"
call serbar()
case "pie"
call pie()
case "line"
call line()
case "serline"
call serline()
end select
sub bar()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,Interior_Color,Caption,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
Interior_Color=request.QueryString("Interior_Color")
Caption=request.QueryString("Caption")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim catarr,valarr
catarr=split(categories,",")
valarr=split(values,",")
o.bar chart_bgcolor,chartCaption,chartCaption_fontColor,Interior_Color,Caption,catarr,valarr,width,height
set o=nothing
end sub
sub serbar()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,color,Caption,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
color=request.QueryString("color")
Caption=request.QueryString("Caption")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim colarr,catarr,valarr
colarr=split(color,",")
catarr=split(categories,",")
valarr=split(values,",")
o.serbar chart_bgColor,chartCaption,chartCaption_fontColor,colarr,catarr,valarr,values,width,height
set o=nothing
end sub
sub pie()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,Caption,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
Caption=request.QueryString("Caption")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim catarr,valarr
catarr=split(categories,",")
valarr=split(values,",")
o.pie chart_bgColor,chartCaption,chartCaption_fontColor,Caption,catarr,valarr,width,height
set o=nothing
end sub
sub line()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,Caption,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
Caption=request.QueryString("Caption")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim catarr,valarr
catarr=split(categories,",")
valarr=split(values,",")
o.line chart_bgColor,chartCaption,chartCaption_fontColor,Caption,catarr,valarr,width,height
set o=nothing
end sub
sub serline()
On Error Resume Next
set o=new owc
dim chart_bgcolor,chartCaption,chartCaption_fontColor,color,SeriesNames,categories,values,width,height
chart_bgColor=request.QueryString("chart_bgColor")
if chart_bgColor="" then chart_bgColor="#FFFFFF"
chartCaption=request.QueryString("chartCaption")
chartCaption_fontColor=request.QueryString("chartCaption_fontColor")
color=request.QueryString("color")
SeriesNames=request.QueryString("SeriesNames")
categories=request.QueryString("categories")
values=request.QueryString("values")
width=request.QueryString("width")
if width="" then width="400"
height=request.QueryString("height")
if height="" then height="300"
dim colarr,serarr,catarr,valarr
colarr=split(color,",")
serarr=split(SeriesNames,",")
catarr=split(categories,",")
valarr=split(values,",")
o.serline chart_bgColor,chartCaption,chartCaption_fontColor,colarr,serarr,catarr,valarr,width,height
set o=nothing
end sub
%>
1 <%@LANGUAGE="VBSCRIPT" CODEPAGE="950"%>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=big5" />
6 <title>test owc</title>
7 </head>
8
9 <body>
10 <%
11 url="chart.asp?chartType=bar"&_
12 "&chart_bgcolor=" & server.URLEncode("#FFFFFF") &_
13 "&chartCaption=" & server.URLEncode("報表標題") &_
14 "&chartCaption_fontColor=" & server.URLEncode("BLUE") &_
15 "&Interior_Color=" & server.URLEncode("#CCCC00") &_
16 "&Caption=" & server.URLEncode("組別") &_
17 "&categories=" & server.URLEncode("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") &_
18 "&values=" & server.urlencode("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") &_
19 "&width=" & server.urlencode("800") &_
20 "&height=" & server.URLEncode("500")
21 'url="t.asp"
22 %>
23 <img src="<%=url %>" />
24 </body>
25 </html>
26
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <meta http-equiv="Content-Type" content="text/html; charset=big5" />
6 <title>test owc</title>
7 </head>
8
9 <body>
10 <%
11 url="chart.asp?chartType=bar"&_
12 "&chart_bgcolor=" & server.URLEncode("#FFFFFF") &_
13 "&chartCaption=" & server.URLEncode("報表標題") &_
14 "&chartCaption_fontColor=" & server.URLEncode("BLUE") &_
15 "&Interior_Color=" & server.URLEncode("#CCCC00") &_
16 "&Caption=" & server.URLEncode("組別") &_
17 "&categories=" & server.URLEncode("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") &_
18 "&values=" & server.urlencode("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") &_
19 "&width=" & server.urlencode("800") &_
20 "&height=" & server.URLEncode("500")
21 'url="t.asp"
22 %>
23 <img src="<%=url %>" />
24 </body>
25 </html>
26
申明
非源创博文中的内容均收集自网上,若有侵权之处,请及时联络,我会在第一时间内删除.再次说声抱歉!!!
博文欢迎转载,但请给出原文连接。