real time graph data from csv file, by using dimple.js or dygraph

1.1k views Asked by At

the code i tried in dimple

 <html>
   <head>
   <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
      <script src="http://d3js.org/d3.v3.min.js"></script>
      <script src="http://dimplejs.org/dist/dimple.v2.1.2.min.js"></script>
   </head>
   <body>

      <script type="text/javascript">

    $.ajax("data.csv", {
    success: function(data) {
     var csv = d3.csv.parse(data);
        var svg = dimple.newSvg("body", 490, 430);
        var chart = new dimple.chart(svg, csv);
chart.addCategoryAxis("x", "Reading time");
chart.addMeasureAxis("y", "Level");
chart.addSeries(null, dimple.plot.bar);
chart.draw();
    }
});   

 </script>
   </body>
</html>

the code i tried in dygraph is,

'<html>
    <head>
  <script type="text/javascript"
  src="https://cdnjs.cloudflare.com/ajax/libs/dygraph/1.1.0/dygraph-combined-dev.js"></script>
    </head>
    <body>
        <div id="graphdiv2"
            style="width:100%; height:75%;"></div><br>
        <script type="text/javascript">
            g2 = new Dygraph(
                             document.getElementById("graphdiv2"),
                             "te1.csv", // path to CSV file
                             {  title: 'Title',
                                xlabel: 'date',
                                ylabel: 'pressure',
                                legend: 'always',
                                labelsDivStyles: {'textAlign': 'right'},
                               
                             } );
            </script>
    </body>
</html>'

I tried so many examples, bcoz i'm new i couldn't understand to get my result. in my csv file i have date,time,datay., in this i want date and time in X axis and datay in Y axis if necessary i can make date time in one cell, datay in another cell also in csv so that

i can utilize this example var format = d3.time.format("%Y-%m-%d %H:%M:%S");

but i dont know how to connect my csv file with this dimplejs and how to edit attributes according to my various input

in dygraph i dont know how to get time and date in one axis, i have 100data per single day to show in graph. in this it takes only single data per day

bcoz i have one year data in csv to be shown in line graph in a webpage.. PLs guide me., so confused after seeing lots of example in dygraph and dimple.js i'm not getting it..

0

There are 0 answers