ASP中OWC的使用

<%                   
                      
dim ctype()
                      
dim values()
                      
redim ctype(ubound(show_arr,2))
                      
redim values(ubound(show_arr,2))
                    
'''中间步骤对数组ctype()和values()进行赋值
                    'set chart=createobject("owc.chart")
                    set chart = server.CreateObject("OWC11.Chartspace"'//office2003
                    chart.clear
                    
set ochart=chart.charts.add               '添加一个chat类  
                    set oconst=chart.constants                '调用chat的命名常数
                    set oseries=ochart.seriescollection.add   '生成一个series序列

                    
with oseries
                        .caption
=FlowYear&"年Q"&FlowQuarter&"机型移动图"
                        .setdata oconst.chdimcategories,oconst.chdataliteral,ctype          
'赋值横坐标值
                        .setdata oconst.chdimvalues,oconst.chdataliteral,values                '赋纵坐标值
                        .type=19
                        
with .DataLabelsCollection.Add
                            .HasPercentage 
= True
                            .hasvalue
=false
                            .Font.Size 
= 10
                        
end with
                    
end with

                    
with ochart
                        .hastitle
=true                                   '使图标有标题
                        .title.caption=FlowYear&"年Q"&FlowQuarter&"机型移动图"
                        .title.font.size
=12
                        .title.font.bold
=true
                        .title.font.color 
= rgb(0,0,155)
                        .WidthRatio 
= 50 
                        
''''if charttype="5" then
                        .haslegend=true                                  '使图表有图例
                        .legend.position=oconst.chlegendpositionright    '设定标注的图表位置(bottom)
                        .legend.font.size = 9
                       
''''end if
                    end with

                    sFname
=server.mappath("../image/report_SaleTrend.gif")
                    vFname
="../image/report_SaleTrend.gif"'生成图表的iis虚拟路径名
                    width = 450
                    height 
= 300
                    chart.exportPicture   sFname,
"gif",width ,height'将图表到处导服务器的物理路径中
                    set chart=nothing
                    
set ochart=nothing
                    
set oconst=nothing
                    
set oseries=nothing                   
                   
%>
                    
<img align="center" border="0" src=<%=vFname %> />     
posted @ 2006-08-22 14:26  blueKnight  Views(1756)  Comments(3Edit  收藏  举报