0

I get the content of the HTML but not the data as a graph in the server side. FLOT = A Javascript charting library for jQuery

PIC of the graph, The area between the texts is place for the graph

HTML file:

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Flot</title>
    <link href="../examples.css" rel="stylesheet" type="text/css">
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../../excanvas.min.js"></script><![endif]-->
    <script language="javascript" type="text/javascript" src="flot/jquery.js"></script>
    <script language="javascript" type="text/javascript" src="flot/jquery.flot.js"></script>
    <script language="javascript" type="text/javascript" src="index.js"></script>
    <script type="text/javascript">
    $(function plot() {

    var data = [];
    $.plot("#placeholder", [ data ]);
    // Add the Flot version string to the footer
    $("#footer").prepend("Flot " + $.plot.version + " &ndash; ");


});
</script>

part of JS file:

//POST http://localhost:2456/temps
//html file read and sent with
app.post('/temps',function(req,resp){
    resp.writeHead(200, { 'Content-Type': 'text/html' });
    fs.readFile("flot.html", function (error, pgResp) {
        if (error) {
            resp.writeHead(404);
            resp.write('Contents you are looking are Not Found');
        } else {

            resp.write(pgResp);
            //resp.render(pgResp)
            //resp.send(pgResp);
            console.log("result of pgresp:", pgResp)
        }
        resp.end();
    });
H Zam
  • 21
  • 1
  • 4
  • [This answer](https://stackoverflow.com/a/21530235/2610249) explains how to render a Flot graph on the server. – Raidri Aug 02 '17 at 08:36
  • thanks for reply. but I want to get html file in server side not png. The graph part is not shown as you see in the pic that I uploaded. The other part of the html is sent to the server – H Zam Aug 02 '17 at 13:08

0 Answers0