title: Using chart.js inside node.js
body: <p>I'm creating a site that gets live data from <a href="http://services.swpc.noaa.gov/text/ace-swepam.txt" rel="nofollow">http://services.swpc.noaa.gov/text/ace-swepam.txt</a>, and I want it to output this data to charts using chart.js. I've got the time, date (all fields) proton density, bulk speed and ion temperature in arrays, but I can't figure out how to use chart.js with this set-up. All I've managed to do successfully so far is </p>
  
  <pre><code>npm install chart.js
  </code></pre>
  
  <p>is that it in terms of set up? </p>
  
  <p>I know I need to set up the charts and data in Javascript, and draw the canvas in HTML. But I don't know where to put the js/css. I've tried putting it inside script tags in the response.write() section of the code, but even using all single quotes inside double quotes, it's still messing up and telling me things are illegal. </p>
  
  <p>I've also tried making a separate html page complete with all the Javascript and CSS I need, using fs.readFile, but then I don't know how to use my data arrays from node within the html.</p>
  
  <pre><code> // console.log(year, month, day, time, statusno, proton, bulksp, iontemp);    
  http.createServer(function (request, response) {
          //works but I can't pass values into it
           fs.readFile('index.html',function (err, data){
          response.writeHead(200, {'Content-Type': 'text/html'});
          response.write(data);
          //Doesn't like it when I try adding more complicated code (like javascript etc)
        //  response.write('&lt;html&gt;\n&lt;head&gt;\n&lt;title&gt;Solar Activity&lt;/title&gt;\n&lt;/head&gt;\n&lt;body&gt;'+iontemp+'&lt;/body&gt;\n&lt;/html&gt;');
          response.end();
           });
      }).listen(8124);
  </code></pre>