<%@ LANGUAGE="VBScript" %> <% Dim Chart ' ' Open Database connection, read only ! ' Set Connection = Server.CreateObject("ADODB.Connection") Connection.Mode = adModeRead Connection.Open phdb_rd 'Monster sqlstatement SQLstmt = "select avg(intervaldose) avedose, max(intervaldose) maxdose, min(intervaldose) mindose, startinterval, stopinterval, tp.position position, description from" SQLstmt = SQLstmt & " (select dose*(stopinterval-startinterval)/(stopdate-startdate) intervaldose, startinterval, stopinterval, td.position position from" SQLstmt = SQLstmt & " (select startinterval, min(stopinterval) stopinterval, position from" SQLstmt = SQLstmt & " (select startinterval, stopinterval, starttable.position position from" SQLstmt = SQLstmt & " (select unique datetemp startinterval, position from" SQLstmt = SQLstmt & " ((select startdate datetemp, position" SQLstmt = SQLstmt & " from phoffline.tld_data" SQLstmt = SQLstmt & " where stopdate is not null" 'SQLstmt = SQLstmt & " and dose is not null)" SQLstmt = SQLstmt & " and dose is not null" SQLstmt = SQLstmt & " and position in (" & CStr(Request("positions")) & "))" SQLstmt = SQLstmt & " union" SQLstmt = SQLstmt & " (select stopdate datetemp, position" SQLstmt = SQLstmt & " from phoffline.tld_data" SQLstmt = SQLstmt & " where stopdate is not null" 'SQLstmt = SQLstmt & " and dose is not null))) starttable," SQLstmt = SQLstmt & " and dose is not null" SQLstmt = SQLstmt & " and position in (" & CStr(Request("positions")) & ")))) starttable," SQLstmt = SQLstmt & " (select unique datetemp stopinterval, position from" SQLstmt = SQLstmt & " ((select startdate datetemp, position" SQLstmt = SQLstmt & " from phoffline.tld_data" SQLstmt = SQLstmt & " where stopdate is not null" 'SQLstmt = SQLstmt & " and dose is not null)" SQLstmt = SQLstmt & " and dose is not null" SQLstmt = SQLstmt & " and position in (" & CStr(Request("positions")) & "))" SQLstmt = SQLstmt & " union" SQLstmt = SQLstmt & " (select stopdate datetemp, position" SQLstmt = SQLstmt & " from phoffline.tld_data" SQLstmt = SQLstmt & " where stopdate is not null" 'SQLstmt = SQLstmt & " and dose is not null))) stoptable" SQLstmt = SQLstmt & " and dose is not null" SQLstmt = SQLstmt & " and position in (" & CStr(Request("positions")) & ")))) stoptable" SQLstmt = SQLstmt & " where starttable.position=stoptable.position" SQLstmt = SQLstmt & " and startinterval=stopinterval) doseintervaltable," SQLstmt = SQLstmt & " phoffline.tld_positions tp" SQLstmt = SQLstmt & " where doseintervaltable.position=tp.position" SQLstmt = SQLstmt & " group by tp.position, startinterval, stopinterval, description" SQLstmt = SQLstmt & " order by tp.position, startinterval" Set RS = Connection.Execute(SQLstmt) rem ********************************************************************** rem * Instantiate the Chart component rem ********************************************************************** Set Chart = Server.CreateObject ("ASPChart.Chart") Dim Color(8) Color(0)=vbBlue Color(1)=vbRed Color(2)=vbGreen Color(3)=vbMagenta Color(4)=vbBlack Color(5)=vbCyan position_old = -1 integrated_dose = 0.0 plot_num = -1 Do While Not RS.EOF If position_old<>CInt(RS("position")) Then position_old=CInt(RS("position")) plot_num = plot_num+1 Chart.AddSeries 5 Chart.LineWidth = 2 Chart.SeriesInLegend = true Chart.SeriesTitle = "Pos" & CStr(RS("position")) dt=CDate(RS("startinterval")) integrated_dose=0.0 Chart.AddXY dt, CDbl(integrated_dose),CStr (Month (dt)) + "/" + CStr (Day (dt)) + "/" + CStr (Year (dt)), Color(plot_num mod 6) End If dt=CDate(RS("stopinterval")) integrated_dose = integrated_dose + CDbl(RS("avedose")) Chart.AddXY dt, integrated_dose, CStr (Month (dt)) + "/" + CStr (Day (dt)) + "/" + CStr (Year (dt)), Color(plot_num mod 6) RS.MoveNext Loop Chart.View3D = false Chart.LegendVisible = true Chart.LegendStyle = cSeries 'Chart.LegendPosition = cBottom Chart.AddAxisLabel 1 , "Dose [mRads]" Chart.AddAxisLabel 2 , "Date" Chart.ProgressiveJPEGEncoding = true Chart.JPEGQuality = 100 Response.ContentType = "image/JPEG" Response.BinaryWrite Chart.Image Set Chart=nothing Connection.Close Set Connection=nothing Set RS=nothing %> TLD Dose Graph