Menu

Trouble w. Javascript updating PHPlot graph

2011-06-09
2012-09-07
  • David Nicholls

    David Nicholls - 2011-06-09

    I have a PHPlot PNG graph that loads fine in a browser. When it is loaded, the
    script reads a data file and plots what it finds. The data file is updated
    every minute. I have tried to write a Javascript routine that auto-updates
    just the graph, not the whole page, using jQuery. The PHPlot output is
    embedded in an HTML IMG tag:

    <img src="../scw.php" width="720" height="360" alt="sky temperature graph" />
    

    The javascript I'm using is supposed to look for an id in the tag and reload
    the object identified by the id.

    If I set the IMG tag in

    tags and add the id to the

    tag:

    the file is reloaded, but it is treated as text and the PNG is
    rendered as a long character string. If I associate the id with the IMG tag:
    then the image does not reload. (I have tried adding a
    ?+random suffix, no difference)

    I don't know if this is something to do with Javascript, or whether it has to
    do with the PNG file generated by PHPlot, but I mention it here in case it is
    PHPlot related.

    Advice appreciated.

    DN

     
  • David Nicholls

    David Nicholls - 2011-06-09

    Looks like it was a Javascript problem. I tried yet another update method and
    it worked, but it was a matter of creating more of the HTML in Javascript, not
    just a simple image replace based on ID.

    DN

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.