Auto update Chart with Java Script setInterval don't refresh Chart data.

974 views
Skip to first unread message

Niklas Nässén

unread,
Jul 5, 2016, 1:59:26 AM7/5/16
to Google Visualization API
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>




Niklas Nässén

unread,
Jul 6, 2016, 2:25:45 PM7/6/16
to Google Visualization API
Seems to be a misuse of ASP and JavaScript.   The page is allready processed on the server. It was too long time ago I was doing this so I totally forgot.
I will try to write the JavaScript from ASP instead.

Response.Write("<script type=""text/javascript"">")

Niklas Nässén

unread,
Jul 7, 2016, 6:38:47 AM7/7/16
to Google Visualization API
Added Response.Write with no luck, however saving the resulting page source of this asp script,  then it works.  I am confused.


<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<%
Response.Write("<script type=""text/javascript"">")
Response.Write("google.charts.load(""visualization"", ""1"", {packages:[""corechart""], ""callback"": drawChart});")
      Response.Write("google.charts.setOnLoadCallback(drawChart);")
Response.Write("function drawChart() {")
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 & "'"
Response.Write("var data = google.visualization.arrayToDataTable([")
Response.Write("['Period', 'Takt', 'Mål'],")
Response.Write("['" & Hour(T)  & ".00 - " & Time() & "', " & h & ",40],")
Response.Write("['" & hour(Tminus1) & ".00 - " & hour(T) & ".00', " & i & ",40],")
Response.Write("['" & hour(Tminus2) & ".00 - " & hour(Tminus1) & ".00', " & j & ",40],")
Response.Write("['" & hour(Tminus3) & ".00 - " & hour(Tminus2) & ".00', " & k & ",40],")
Response.Write("['" & hour(Tminus4) & ".00 - " & hour(Tminus3) & ".00', " & l & ",40],")
Response.Write("['" & hour(Tminus5) & ".00 - " & hour(Tminus4) & ".00', " & m & ",40],")
Response.Write("['" & hour(Tminus6) & ".00 - " & hour(Tminus5) & ".00', " & n & ",40],")
Response.Write("['" & hour(Tminus7) & ".00 - " & hour(Tminus6) & ".00', " & o & ",40],")
Response.Write("['" & hour(Tminus8) & ".00 - " & hour(Tminus7) & ".00', " & p & ",40],")
Response.Write("['" & hour(Tminus9) & ".00 - " & hour(Tminus8) & ".00', " & q & ",40]")
Response.Write("]);")

Response.Write("var options = {hAxis: {viewWindow: {min: 0, max:70}, ticks: [0, 10 , 20, 30, 40, 50 , 60 , 70]},series: {1: {type: 'line'}}}")
Response.Write("var chart = new google.visualization.BarChart(document.getElementById('chart_div'));")
Response.Write("chart.draw(data, options);")
Response.Write("setInterval(function() {")
T = DateAdd("h", DatePart("h", Now()), DateValue(Now()))
SelectNow = SelectSats & " AND Tim < '" & Now() & "' AND Tim >= '" & T & "'"
rs.Open SelectNow, conn
h=rs("Total")
rs.close
Response.Write("alert(""" & SelectNow & """);")
Response.Write("data.setValue(0, 1, " & h & " + Math.random());")
Response.Write("chart.draw(data, options);")
Response.Write("}, 1000);")
Response.Write("}")
Response.Write("</script>")
%>

</head>
<body>
<div id="chart_div" style="width: 1200px; height: 700px;"></div>
</body>
</html>


<html>

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

    function drawChart() {
        var data = google.visualization.arrayToDataTable([
            ['Period', 'Takt', 'Mål'],
            ['12.00 - 12:26:52', 5, 40],
            ['11.00 - 12.00', 34, 40],
            ['10.00 - 11.00', 26, 40],
            ['9.00 - 10.00', 39, 40],
            ['8.00 - 9.00', 34, 40],
            ['7.00 - 8.00', 37, 40],
            ['6.00 - 7.00', 32, 40],
            ['5.00 - 6.00', 0, 40],
            ['4.00 - 5.00', 0, 40],
            ['3.00 - 4.00', 0, 40]
        ]);
        var options = {
            hAxis: {
                viewWindow: {
                    min: 0,
                    max: 70
                },
                ticks: [0, 10, 20, 30, 40, 50, 60, 70]
            },
            series: {
                1: {
                    type: 'line'
                }
            }
        }
        var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
        chart.draw(data, options);
        setInterval(function() {
            alert("SELECT COUNT(*) as Total FROM [IPS].[dbo].[Loggar_SprLog] WHERE Loc ='GB03' AND Tim < '2016-07-07 12:26:52' AND Tim >= '2016-07-07 12:00:00'");
            data.setValue(0, 1, 5 + Math.random());
            chart.draw(data, options);
        }, 1000);
    }
    </script>

</head>

<body>
    <div id="chart_div" style="width: 1200px; height: 700px;"></div>
</body>

</html>





Den tisdag 5 juli 2016 kl. 07:59:26 UTC+2 skrev Niklas Nässén:

Niklas Nässén

unread,
Jul 7, 2016, 7:49:04 AM7/7/16
to Google Visualization API
I'm soon about to give up.    It is too difficult to find help or a working example of how to use auto update of Google Charts when data is located on a msSQL server. 




Den tisdag 5 juli 2016 kl. 07:59:26 UTC+2 skrev Niklas Nässén:

Niklas Nässén

unread,
Jul 10, 2016, 3:19:56 PM7/10/16
to Google Visualization API
I failed in ASP. Now I switch to PHP. I whish there where a sample in connecting to a live database.

Investigating to use jQuery.



    function getData() {
        jQuery.ajax({
            url: 'ajax.php',
            type: 'GET',
            dataType: 'json',
            mimeType: 'multipart/form-data',
            contentType: false,
            cache: false,
            processData: false,
            success: function( data, jqXHR ) {
                if( data == "null" ) {
                    // just in case
                } else {
                    drawGraph( data );
                }
            },
            error: function( textStatus ) {
                console.log(" error. damm. ");
            }
        });
    }




Den tisdag 5 juli 2016 kl. 07:59:26 UTC+2 skrev Niklas Nässén:

Niklas Nässén

unread,
Jul 14, 2016, 9:33:54 AM7/14/16
to Google Visualization API
Solved it !   Last trick was the sqldriver, and server tweaking. Attached you find the result.


1) Installed Apache with PHP, made it as Service.   Cheated and used XAMPP then from the command prompt at the Apache bin subdirectory: httpd.exe -k install
2) Installed Sqlsrv SQLSRV32.EXE   (I extracted the dll's into php/ext folder)
3) Added to php.ini :   extension=php_sqlsrv_56_ts.dll
4) Started Apache


Here comes the working code:


createJSON.php

<?php

include_once 'connection.php';

$Tminus0 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-0 hour'))->format('Y-m-d H:i:s');
$Tminus1 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-1 hour'))->format('Y-m-d H:i:s');
$Tminus2 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-2 hour'))->format('Y-m-d H:i:s');
$Tminus3 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-3 hour'))->format('Y-m-d H:i:s');
$Tminus4 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-4 hour'))->format('Y-m-d H:i:s');
$Tminus5 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-5 hour'))->format('Y-m-d H:i:s');
$Tminus6 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-6 hour'))->format('Y-m-d H:i:s');
$Tminus7 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-7 hour'))->format('Y-m-d H:i:s');
$Tminus8 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-8 hour'))->format('Y-m-d H:i:s');
$Tminus9 = date_add(date_create(date("Y-m-d H:00:00")), date_interval_create_from_date_string('-9 hour'))->format('Y-m-d H:i:s');
$Interval0 = substr($Tminus0, -8,2)  ;
//$Interval1 = substr($Tminus1, -8,2)  . "-" . substr($Tminus0, -8,2) ;
//$Interval2 = substr($Tminus2, -8,2)  . "-" . substr($Tminus1, -8,2) ;
//$Interval3 = substr($Tminus3, -8,2)  . "-" . substr($Tminus2, -8,2) ;
//$Interval4 = substr($Tminus4, -8,2)  . "-" . substr($Tminus3, -8,2) ;
//$Interval5 = substr($Tminus5, -8,2)  . "-" . substr($Tminus4, -8,2) ;
//$Interval6 = substr($Tminus6, -8,2)  . "-" . substr($Tminus5, -8,2) ;
//$Interval7 = substr($Tminus7, -8,2)  . "-" . substr($Tminus6, -8,2) ;
//$Interval8 = substr($Tminus8, -8,2)  . "-" . substr($Tminus7, -8,2) ;
//$Interval9 = substr($Tminus9, -8,2)  . "-" . substr($Tminus8, -8,2) ;



$Interval1 = substr($Tminus1, -8,2) ;
$Interval2 = substr($Tminus2, -8,2) ;
$Interval3 = substr($Tminus3, -8,2) ;
$Interval4 = substr($Tminus4, -8,2) ;
$Interval5 = substr($Tminus5, -8,2) ;
$Interval6 = substr($Tminus6, -8,2) ;
$Interval7 = substr($Tminus7, -8,2) ;
$Interval8 = substr($Tminus8, -8,2) ;
$Interval9 = substr($Tminus9, -8,2) ;
$SQL = "SELECT COUNT(*) as Total FROM [IPS].[dbo].[Loggar_SprLog] where Loc ='GB03'";
$SQL9 = " AND Tim >= '" . $Tminus0 . "' AND Tim < '2030-01-01 00:00:00'";
$SQL8 = " AND Tim >= '" . $Tminus1 . "' AND Tim < '" . $Tminus0 . "'";
$SQL7 = " AND Tim >= '" . $Tminus2 . "' AND Tim < '" . $Tminus1 . "'";
$SQL6 = " AND Tim >= '" . $Tminus3 . "' AND Tim < '" . $Tminus2 . "'";
$SQL5 = " AND Tim >= '" . $Tminus4 . "' AND Tim < '" . $Tminus3 . "'";
$SQL4 = " AND Tim >= '" . $Tminus5 . "' AND Tim < '" . $Tminus4 . "'";
$SQL3 = " AND Tim >= '" . $Tminus6 . "' AND Tim < '" . $Tminus5 . "'";
$SQL2 = " AND Tim >= '" . $Tminus7 . "' AND Tim < '" . $Tminus6 . "'";
$SQL1 = " AND Tim >= '" . $Tminus8 . "' AND Tim < '" . $Tminus7 . "'";
$SQL0 = " AND Tim >= '" . $Tminus9 . "' AND Tim < '" . $Tminus8 . "'";

$sql = $SQL . $SQL9;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal0 = sqlsrv_get_field( $stmt, 0);

$sql = $SQL . $SQL8;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal1 = sqlsrv_get_field( $stmt, 0);

$sql = $SQL . $SQL7;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal2 = sqlsrv_get_field( $stmt, 0);

$sql = $SQL . $SQL6;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal3 = sqlsrv_get_field( $stmt, 0);
$sql = $SQL . $SQL5;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal4 = sqlsrv_get_field( $stmt, 0);
$sql = $SQL . $SQL4;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal5 = sqlsrv_get_field( $stmt, 0);
$sql = $SQL . $SQL3;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal6 = sqlsrv_get_field( $stmt, 0);
$sql = $SQL . $SQL2;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal7 = sqlsrv_get_field( $stmt, 0);
$sql = $SQL . $SQL1;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal8 = sqlsrv_get_field( $stmt, 0);

$sql = $SQL . $SQL0;
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
    die( print_r( sqlsrv_errors(), true) );
}
if( sqlsrv_fetch( $stmt ) === false) {
     die( print_r( sqlsrv_errors(), true));
}
$Antal9 = sqlsrv_get_field( $stmt, 0);


$rows = array();
$row9 = array($Interval0, $Antal0);  
$row8 = array($Interval1, $Antal1);  
$row7 = array($Interval2, $Antal2);  
$row6 = array($Interval3, $Antal3);  
$row5 = array($Interval4, $Antal4);
$row4 = array($Interval5, $Antal5);
$row3 = array($Interval6, $Antal6);
$row2 = array($Interval7, $Antal7);
$row1 = array($Interval8, $Antal8);
$row0 = array($Interval9, $Antal9);
array_push($rows,$row0);
array_push($rows,$row1);
array_push($rows,$row2);
array_push($rows,$row3);
array_push($rows,$row4);
array_push($rows,$row5);
array_push($rows,$row6);
array_push($rows,$row7);
array_push($rows,$row8);
array_push($rows,$row9);

print json_encode($rows);
?>


index.php

<!doctype html >
<?php date_default_timezone_set('Europe/Stockholm');?>
<html lang="en" >
<head>
<meta charset="utf-8" >
<link href="style.css" rel="stylesheet" type="text/css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" > </script>
<!-- Load the AJAX API -->
<script type="text/javascript" src="https://www.google.com/jsapi?autoload=
{'modules':[{'name':'visualization','version':'1.1','packages':
['corechart']}]}"></script>
<script type="text/javascript" >
    /* Get data from the database */
    function getData() {
        jQuery.ajax({
            url: 'createJSON.php',

            type: 'GET',
            dataType: 'json',
            mimeType: 'multipart/form-data',
            contentType: false,
            cache: false,
            processData: false,
            success: function( data) {

                if( data == "null" ) {
                    // just in case
                } else {
                    drawGraph( data );
                }
            },
            error: function( textStatus ) {
                console.log(" error. damm. ");
            }
        });
    }
   
    /* Initialization of Google Charts API */
    google.setOnLoadCallback( getData );
   
    /* Chart to render time-user graphs */
    function drawGraph( data ) {
        for( var i = data.length; i > 0; i-- ) {
             data[i] = data[i - 1];
  }         
  data[0] = [ 'Tid', 'Antal' ];
        var chartData = google.visualization.arrayToDataTable( data );
     var options = {
  'chartArea': {'width': '90%', 'height': '80%'},
      width: 1750,
      height: 990,
   legend: { position: 'none' },
   vAxis: { gridlines: { count: 8 } },
    
       vAxis: {
   minValue:0,
   maxValue:35,
   ticks: [0, 5, 10, 15, 20, 25, 30, 35],
   textStyle: {fontSize: 60}
   },
  hAxis: {textStyle: {fontSize: 60}}
  
   
    };

        var chart = new google.visualization.SteppedAreaChart( document.getElementById( 'chart_div' ) );
        chart.draw( chartData , options );
    }
 
 setInterval(function(){
 document.getElementById("Tiden").innerHTML =  new Date().toLocaleString();
 getData();
 },1000);
 
</script>
</head>
<body>
  <div class="chartWithOverlay">
   <div id="chart_div" ></div>
   <div class="overlay">
    <div style="font-family:'Arial Black'; font-size: 100px;">GB03</div>
    <div style="color: #b44; font-family:'Arial Black'; font-size: 32px; letter-spacing: .12em; margin-top:0px; margin-left:5px;">Antal producerat per timma</div>
    <div style="color: #444; font-family:'Arial Black'; font-size: 32px; letter-spacing: .10em; margin-top:0px; margin-left:5px;">ENHET D, IAC Group AB Skara <div id="Tiden"><?=date('Y-m-d H:i:s', time());?></div></div>
  </div>
 </div>
</body>
</html>

Connection.php

<?php
$serverName = "sksap012\sqlexpress"; //serverName\instanceName
$connectionInfo = array( "Database"=>"IPS", "UID"=>"Excel", "PWD"=>"XXXXXXX");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn ) {
}else{
     echo "Connection could not be established.<br />";
     die( print_r( sqlsrv_errors(), true));
}
?>



style.css

* {
    margin: 0 auto;
    padding: 0;
}

.container {
    margin: 0 auto;
    width: 1850px;
    padding: 20px 20px;
    background-color: #fff;
}
h3 {
    text-align: center;
}
p {
    margin: 0px;
}
#chart_div {
    width: 1800px;
    height: 1000px;
}

.chartWithOverlay {
    position: relative;
    width: 1800px;
}
.overlay {
opacity: 0.3;
    width: 700px;
    height: 200px;
    position: absolute;
    top: 60px;  
    left: 180px;
}


ChartMsSQLLiveData.jpg

Daniel LaLiberte

unread,
Jul 14, 2016, 10:12:45 AM7/14/16
to Google Visualization API
Glad you got it working, and without a peep from anyone else to help you. :)  Thanks for the updates, and hopefully this will help others in the future with similar issues.

--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
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/67793509-f702-4ede-a81b-1ab8bb93b744%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages