Announcement

Collapse
No announcement yet.

Create web page with data chart on the fly

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Create web page with data chart on the fly

    I'm looking to see how I can create a webpage that when I visit it it goes off and gathers the relevant data to send to Google Charts and then shows the returned chart.

    Currently I am just getting HS to run a script every minute which actually just creates the .html webpage with the relevant code in it as per the example below, but I think this is unnecessary as it must be possible just to get the info when a webpage is loaded.

    PHP Code:
    <html>
    <
    head>
    <
    title>My Web-page</title>
    <
    meta http-equiv='refresh' content='60' >
    </
    head>
    <
    body bgcolor='white'>
    <
    img src='http://chart.googleapis.com/chart?cht=ls&chds=a&chs=700x400&chco=FF0000,00FF00,0000FF&chtt=Electricity+Usage+-+Last+Hour&chxt=x,y&chxs=0,ff0000,12,0,lt|1,0000ff,10,1,lt&chdl=Usage|Generating|Grid+Usage&chd=t:330,431,415,407,401,415,399,403,393,395,390,384,404,391,398,323,328,338,323,330,323,328,327,328,327,326,326,321,326,317,322,348,353,352,346,352,571,484,581,679,722,673,814,639,620,608,668,641,636,611,695,613,629,622,606,708,624,616,617,647|371,342,337,401,402,434,457,411,352,498,535,580,446,511,484,798,854,832,840,538,671,635,899,583,629,647,700,563,464,406,447,453,560,651,637,549,593,685,654,639,683,653,666,1273,650,1480,702,466,394,1215,980,1203,1229,1191,1240,1236,1321,1234,1392,1314|-41,89,78,6,-1,-19,-58,-8,41,-103,-145,-196,-42,-120,-86,-475,-526,-494,-517,-208,-348,-307,-572,-255,-302,-321,-374,-242,-138,-89,-125,-105,-207,-299,-291,-197,-22,-201,-73,40,39,20,148,-634,-30,-872,-34,175,242,-604,-285,-590,-600,-569,-634,-528,-697,-618,-775,-667&chxl=0:|07:20|07:31|07:42|07:53|08:05|08:15|08:25'>
    </
    img>
    </
    body>
    </
    html
    I might also like to be able to change some parameters on the page so I can select a date, etc.

    Anyone got anything similar that I could have a look at ?

    Thanks
    Simon
    Last edited by Simonk; June 16, 2012, 03:00 AM.

    #2
    The two methods that just are ones I think of (may be more) could either be you have an ASP page that connects to the DB and performs the SQL query itself (using ADODB) all in the HTML page and creates the chart string. The other method is you call a function within a script that returns the URL of the chart (something I have never done from a web page but I think it is possible) and handle the connection/query in the script.

    Comment

    Working...
    X