Hi, I can't get the refreshed data to show in the chart.  
I have tried with using the JavaScript "setInterval" function, and I also 
put a clock on the screen to see that its actually running, but still the 
original data is shown.
Code is located on a IIS server connected to msSQL called by ASP classic, 
Java Script and HTML.  Clients are windows 7.

<html>

<head>
    <script type="text/javascript" 
src="https://www.gstatic.com/charts/loader.js";></script>
    <script type="text/javascript">
        google.charts.load('current', {
            'packages': ['corechart']
        });
        google.charts.setOnLoadCallback(drawChart);

        function drawChart() {
            var chart = new 
google.visualization.BarChart(document.getElementById('takt_diagram'));

            function updateChart() {
                var d = new Date();
                document.getElementById("tid").innerHTML = 
d.toLocaleTimeString();
                <%
T = DateAdd("h", DatePart("h", Now()), DateValue(Now()))
Tminus1 = DateAdd("h", -1, T)
Tminus2 = DateAdd("h", -2, T)
Tminus3 = DateAdd("h", -3, T)
Tminus4 = DateAdd("h", -4, T)
Tminus5 = DateAdd("h", -5, T)
Tminus6 = DateAdd("h", -6, T)
Tminus7 = DateAdd("h", -7, T)
Tminus8 = DateAdd("h", -8, T)
Tminus9 = DateAdd("h", -9, T)
Location = request.querystring("Loc")
set conn=Server.CreateObject("ADODB.Connection")
conn.Open 
"Provider=SQLOLEDB;Server=SKSAP012\SQLEXPRESS;Database=IPS;Uid=Excel;Pwd=Krokodi1;"
 
set rs=Server.CreateObject("ADODB.recordset")
rs.CursorType = adOpenStatic
SelectSats = "SELECT COUNT(*) as Total FROM [IPS].[dbo].[Loggar_SprLog] 
where Loc ='" & Location & "'"
SelectNow = SelectSats & " AND Tim < '" & Now() & "' AND Tim >= '" & T & "'"
rs.Open SelectNow, conn
h=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & T & "' AND Tim >= '" & Tminus1 & 
"'"
rs.Open SelectNow, conn
i=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & Tminus1 & "' AND Tim >= '" & 
Tminus2 & "'"
rs.Open SelectNow, conn
j=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & Tminus2 & "' AND Tim >= '" & 
Tminus3 & "'"
rs.Open SelectNow, conn
k=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & Tminus3 & "' AND Tim >= '" & 
Tminus4 & "'"
rs.Open SelectNow, conn
l=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & Tminus4 & "' AND Tim >= '" & 
Tminus5 & "'"
rs.Open SelectNow, conn
m=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & Tminus5 & "' AND Tim >= '" & 
Tminus6 & "'"
rs.Open SelectNow, conn
n=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & Tminus6 & "' AND Tim >= '" & 
Tminus7 & "'"
rs.Open SelectNow, conn
o=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & Tminus7 & "' AND Tim >= '" & 
Tminus8 & "'"
rs.Open SelectNow, conn
p=rs("Total")
rs.close
SelectNow = SelectSats & " AND Tim < '" & Tminus8 & "' AND Tim >= '" & 
Tminus9 & "'"
rs.Open SelectNow, conn
q=rs("Total")
rs.close
%>
                var data = new google.visualization.arrayToDataTable([
                    ['Period', 'Takt'],
                    ['<%=Hour(T) & ".00 - " & Time() %>', <%=h%>],
                    ['<%=hour(Tminus1) & ".00 - " & hour(T) & ".00" %>', 
<%=i%>],
                    ['<%=hour(Tminus2) & ".00 - " & hour(Tminus1) & ".00" 
%>', <%=j%>],
                    ['<%=hour(Tminus3) & ".00 - " & hour(Tminus2) & ".00" 
%>', <%=k%>],
                    ['<%=hour(Tminus4) & ".00 - " & hour(Tminus3) & ".00" 
%>', <%=l%>],
                    ['<%=hour(Tminus5) & ".00 - " & hour(Tminus4) & ".00" 
%>', <%=m%>],
                    ['<%=hour(Tminus6) & ".00 - " & hour(Tminus5) & ".00" 
%>', <%=n%>],
                    ['<%=hour(Tminus7) & ".00 - " & hour(Tminus6) & ".00" 
%>', <%=o%>],
                    ['<%=hour(Tminus8) & ".00 - " & hour(Tminus7) & ".00" 
%>', <%=p%>],
                    ['<%=hour(Tminus9) & ".00 - " & hour(Tminus8) & ".00" 
%>', <%=q%>]
                ]);
                var options = {
                    title: 'TAKT Maskin:<%=Location%>',
                    vAxis: {
                        title: 'Period'
                    },
                    legend: {
                        position: 'none'
                    },
                    isStacked: true
                };

                chart.draw(data, options);
            }
            updateChart();
            setInterval(updateChart, 5000);
        }
    </script>
</head>

<body>
    <p id="tid"></p>
    <div id="takt_diagram" style="width: 1000px; height: 600px;"></div>

</body>

</html>




-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/1fcf4337-1313-490a-a49c-99f54b7b1ec9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to