%@ LANGUAGE="VBScript" %>
<% start_time = Time %>
<%
Dim Chart
Dim timdat()
Dim measurement1()
Dim measurement2()
Dim Color(8)
Color(0) = vbRed
Color(1) = vbBlue
Color(2) = vbYellow
Color(3) = vbGreen
Color(4)= vbMagenta
Color(5)= vbCyan
Color(6)= vbWhite
Color(7)= vbBlack
If IsEmpty(Request("measurement_id")) Then
measurement_id="Bias"
Else
measurement_id=Request("measurement_id")
End If
If IsEmpty(Request("days")) Then
days=1
Else
days=CInt(Request("days"))-1
If days<0 Then
days=0
End If
End If
Set Connection = Server.CreateObject("ADODB.Connection")
Connection.Mode = adModeRead
Connection.Open phdb_rd
SQLStmt0 = "select fpi.description,fpi.meas1_name n1,fpi.meas1_units u1,fpi.meas1_min mi1,fpi.meas1_max ma1, "
SQLStmt0 = SQLStmt0 & " fpi.meas2_name n2,fpi.meas2_units u2,fpi.meas2_min mi2,fpi.meas2_max ma2"
SQLStmt0 = SQLStmt0 & " FROM phoffline.fec_power_id fpi "
SQLStmt0 = SQLStmt0 & " where fpi.measurement_id='" & measurement_id & "' "
' response.write(SQLStmt0 & "
" )
Set RS0 = Connection.Execute(SQLStmt0)
'
' Get initialization parameters
'
If Not RS0.EoF Then
description=RS0("description")
val_max1=RS0("ma1")
val_min1=RS0("mi1")
units1=RS0("u1")
name1=RS0("n1")
val_max2=RS0("ma2")
val_min2=RS0("mi2")
units2=RS0("u2")
name2=RS0("n2")
Else
description="Unknown"
val_max1=100.
val_min1=0
units1="Unknown"
name1="Unknown"
val_max2=100.
val_min2=0.
units2="Unknown"
name2="Unknown"
End If
If days>0 Then
title= description & ", last " & days+1 & " days"
Else
title= description & ", today"
End if
SQLStmt = "select to_char(fp.logdate,'hh24:mi:ss') ttime,to_char(fp.logdate,'mm/dd/yyyy') tdate,fp.meas1 m1,fp.meas2 m2 "
SQLStmt = SQLStmt & " FROM phoffline.fec_power fp "
SQLStmt = SQLStmt & " where fp.measurement_id='" & measurement_id & "' "
SQLStmt = SQLStmt & " and fp.logdate>to_date(to_char(sysdate,'DD-MON-YYYY'),'DD-MON-YYYY')-" & days
SQLStmt = SQLStmt & " order by fp.logdate "
' response.write(SQLStmt & "
" )
Set RS1 = Connection.Execute(SQLStmt)
%>
Note: the line plot interpolates between measurements. Occasional hiccups of slow monitoring resulting in data mising for an extended period of time can be masked by interpolation
<%=name1%>
<% ' ' Fill arrays with database data ' If Not RS1.EOF Then time_begin=DateValue(Now()-days) End If npoints=0 Do While Not RS1.Eof ReDim Preserve timdat(npoints) timdat(npoints)=TimeValue(RS1("ttime"))+DateValue(RS1("tdate"))-time_begin ReDim Preserve measurement1(npoints) measurement1(npoints)=RS1("m1") ReDim Preserve measurement2(npoints) measurement2(npoints)=RS1("m2") npoints=npoints+1 RS1.MoveNext Loop npoints=npoints-1 ' Prepare current plot seed=-(second(now())+60*minute(now())+3600*hour(now())+3600*24*day(now())) filename="fecvolt" & cstr(int(100000.*rnd(seed))) & ".jpg" filename_full=ph_image_directory & filename rem ********************************************************************** rem * Instantiate the Chart component rem ********************************************************************** Set Chart = Server.CreateObject ("ASPChart.Chart") rem ********************************************************************** rem * Create x Array rem ********************************************************************** Chart.AddSeries 8 Chart.SeriesTitle = description & " plot" Chart.LineWidth = 2.0 Chart.Stairs = false Chart.SeriesInLegend = false color_1=vbBlue For i=0 to npoints Chart.AddXY Cdbl(timdat(i)),CDbl(measurement1(i)), "",color_1 Next rem ********************************************************************** rem * Add and format the title rem ********************************************************************** Chart.View3D = false Chart.LegendVisible = false Chart.LegendStyle = cSeries Chart.LegendPosition = cBottom Chart.AxisGridLines = true Chart.Frame = false If days<3 Then Chart.BottomAxisIncrement = 0.25 Else Chart.BottomAxisIncrement = 1.00 End If rem ********************************************************************** rem * Remove the OuterBevel, add a gradient fill to chart panel rem ********************************************************************** Chart.BevelOuter = 0 Chart.GradientVisible = true Chart.GradientStartColor = vbWhite Chart.GradientEndColor = vbYellow Chart.PanelColor = Color(6) rem ********************************************************************** rem * Set the Width and Height of the image rem ********************************************************************** Chart.Height = 300 Chart.Width = 600 Chart.HorizAxisMin = 0. Chart.HorizAxisMax = days+1 Chart.VertAxisMax = val_max1 Chart.VertAxisMin = val_min1 Chart.AddAxisLabel 1 , name1 & "[" & units1 & "]" Chart.AddAxisLabel 2 , "Time [days] (starts at midnight before)" rem ********************************************************************** rem * Set the filename, save the image and write the image tag rem ********************************************************************** Chart.FileName = filename_full Chart.SaveChart line="
<%=name2%>
<% ' Prepare current plot seed=-(second(now())+60*minute(now())+3600*hour(now())+3600*24*day(now())) filename="feccurr" & cstr(int(100000.*rnd(seed))) & ".jpg" filename_full=ph_image_directory & filename rem ********************************************************************** rem * Instantiate the Chart component rem ********************************************************************** Set Chart = Server.CreateObject ("ASPChart.Chart") rem ********************************************************************** rem * Create x Array rem ********************************************************************** Chart.AddSeries 5 Chart.SeriesTitle = description & " plot" Chart.LineWidth = 2.0 Chart.Stairs = false Chart.SeriesInLegend = false color_1=vbBlue For i=0 to npoints Chart.AddXY Cdbl(timdat(i)),CDbl(measurement2(i)), "",color_1 Next rem ********************************************************************** rem * Add and format the title rem ********************************************************************** Chart.View3D = false Chart.LegendVisible = false Chart.LegendStyle = cSeries Chart.LegendPosition = cBottom Chart.AxisGridLines = true Chart.Frame = false If days<3 Then Chart.BottomAxisIncrement = 0.25 Else Chart.BottomAxisIncrement = 1.00 End If rem ********************************************************************** rem * Remove the OuterBevel, add a gradient fill to chart panel rem ********************************************************************** Chart.BevelOuter = 0 Chart.GradientVisible = true Chart.GradientStartColor = vbWhite Chart.GradientEndColor = vbYellow Chart.PanelColor = Color(6) rem ********************************************************************** rem * Set the Width and Height of the image rem ********************************************************************** Chart.Height = 300 Chart.Width = 600 Chart.HorizAxisMin = 0. Chart.HorizAxisMax = days+1 Chart.VertAxisMax = val_max2 Chart.VertAxisMin = val_min2 Chart.AddAxisLabel 1 , name2 & "[" & units2 & "]" Chart.AddAxisLabel 2 , "Time [days] (starts at midnight before)" rem ********************************************************************** rem * Set the filename, save the image and write the image tag rem ********************************************************************** Chart.FileName = filename_full Chart.SaveChart line="