<% Dim OutputStream Set TChart1 = CreateObject("TeeChart.TChart") TChart1.Header.Font.Size = 25 ' 标题字体大小 TChart1.Header.Text(0)="2007第一季度销售额统计图"'标题 TChart1.Height = 550 TChart1.Width = 850 TChart1.Panel.Gradient.Visible = True ' 图表设有底色 TChart1.Panel.Gradient.StartColor = RGB(250,0,250) ' 图表底色开始颜色 TChart1.Panel.Gradient.EndColor = RGB(0 ,255,0) ' 图表底色结束颜色 TChart1.Aspect.Chart3DPercent = 40 ' 若是3D图形，表示其倾斜度 TChart1.AddSeries(1) TChart1.Series(0).ColorEachPoint = true TChart1.Axis.Left.Title.Caption = "金额(万元)" ' Y轴标题 TChart1.Axis.Left.Title.Font.Size= 15 ' Y轴标题字体大小 TChart1.Axis.Left.Title.Font.Name= "楷体_GB2312" ' Y轴标题字体 TChart1.Axis.Left.Title.Font.Color= RGB(255,255,128) ' Y轴标题颜色 TChart1.Axis.Bottom.Title.Caption = "图书分类" ' X轴标题 TChart1.Axis.Bottom.Title.Font.Size= 15 ' X轴标题字体大小 TChart1.Axis.Bottom.Title.Font.Name= "楷体_GB2312" ' X轴标题字体 TChart1.Axis.Bottom.Title.Font.Color= RGB(255,255,128) ' X轴标题颜色 Set Conn=Server.CreateObject("ADODB.Connection") '建立ADODB.Connection连接对象 Set Rst=Server.CreateObject("ADODB.Recordset") '建立Recordset对象 Conn.Open "driver={microsoft access driver (*.mdb)};dbq="&server.mappath("db1.mdb") strsql = "select * from 表1" Rst.Open strsql,conn,1,1 IF rst.RecordCount > 0 THEN TChart1.Series(0).Datasource = rst TChart1.Series(0).LabelsSource="分类" TChart1.Series(0).YValues.ValueSource="数量" ELSE TChart1.Series(0).Fillsamplevalues(10) TChart1.Header.Text(0)="读取数据为空" END IF TChart1.Series(0).Marks.Visible=True TChart1.Series(0).Marks.Style=0 TChart1.Export.SaveToJPEGFile server.mappath("MyChart.jpg"),False,JPEGBestQuality,100,TChart1.Width, TChart1.Height Set TChart1 = nothing '释放图表对象 Rst.Close '关闭Rst对象 Set Conn = nothing '释放建立的连接 %>