Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The solution achieved, finally, was like this:</p> <p>I did it with a jQuery statement and reusing the javascript code of <strong>Google Charts</strong>.</p> <p>First I added javascript and jQuery tags in the html file:</p> <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type='text/javascript' src='https://www.google.com/jsapi'&gt;&lt;/script&gt; </code></pre> <p>Then I merged jquery code and javascript code that I had in one script:</p> <pre><code>&lt;script type='text/javascript'&gt; // Needed this var so that I could use it in other places of the code var t; jQuery.get('http://url_to_my_rpi/file_to_download.txt',function(data){ console.log(data) t=data; },'text'); google.load('visualization', '1', {packages:['gauge']}); google.setOnLoadCallback(drawChart); function drawChart() { t=eval(t); var data = google.visualization.arrayToDataTable([ ['Label', 'Value'], ['Temp', t],]); // (... more javascript with Google Charts options, display parameters..) &lt;/script&gt; </code></pre> <p>Finally, and even if it's not listed as the main question, be sure to enable *mod_headers* on your apache and add <em>Header set</em> to <em>apache2.conf</em> file (In my case: <em>/etc/apache2/apache2.conf</em>)</p> <p><strong>1) Enable the module:</strong></p> <p>a2enmod headers</p> <p><strong>2) Add the line on your configuration file</strong></p> <p>Header set Access-Control-Allow-Origin "*"</p> <p><strong>3) Restart apache 2</strong></p> <p><strong>4) In case the 3 steps above didn't work</strong>, follow the instrcutions by entering in <a href="http://harthur.wordpress.com/2009/10/15/configure-apache-to-accept-cross-site-xmlhttprequests-on-ubuntu/" rel="nofollow">this website</a> or reinstall apache2.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload