1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
| dim objConstants
dim objChart
dim objCSpace
dim strFileName
'dim objFS
dim objFolder
Response.ContentType = "image/gif"
strFileName = "YTD_avg_turnaround"
Set oConn = Server.CreateObject("ADODB.connection")
oConn.Open "Driver={Microsoft Access Driver (*.mdb)};"&_
"DBQ=le chemin de ma base.mdb;"
Set RS=Server.CreateObject("ADODB.recordset")
RS.open "SELECT * FROM tbl_Recap", oConn, 3, 4
Set objCSpace=Server.CreateObject("OWC11.ChartSpace") 'Declaration de l'espace graphique
Set objChart = objCSpace.Charts.Add() 'Ajout d'un graphique dans l'espace graphique
Set objConstants = objCSpace.Constants
objChart.Type = objConstants.chChartTypeLine 'Definition du type de graphique ( une ligne sans marqueurs )
objChart.HasLegend = true
set objCSpace.DataSource = RS 'Definition du datasource pour le graphique
objChart.SetData objConstants.chDimSeriesNames, 0, "Year"
objChart.SetData objConstants.chDimCategories, 0, "Months" 'Les X sont les mois
objChart.SetData objConstants.chDimValues, 0, "Turnaround" 'Les Y sont les turnaround time
objChart.HasTitle = true
objChart.Title.Caption = "YTD Average Turnaround Time"
for each Axis in objChart.Axes
if Axis.type = objConstants.chCategoryAxis then
Axis.HasTitle = True
Axis.Title.Caption = "Months"
else
Axis.HasTitle = True
Axis.Title.Caption = "Turnaround Time"
end if
next
strChartAbsPath = Server.MapPath("/GIF")
strChartRelPath = "GIF"
Randomize
strFileName = Timer & Rnd & ".gif"
response.write(strChartAbsPath & "\" & strFileName & "<br>")
objCSpace.ExportPicture strChartAbsPath & "\" & strFileName, "gif", 800, 400
strChartFile = strChartRelPath & "/" & strFileName
response.write("<img src=""" & strChartFile & """>" & "<p>") |
Partager