Search code examples
htmlchartsflotr

Flotr Chart Unable to display


I am new to flotr javascript libary. when i create a chart and execute. it showing white page and my chart is unable to view. can any one correct me where i went wrong and what are the js files i need to add for flotr ?

<html>
 <head>
  <title>Chart</title>
  <style>
  body {
        margin: 0px;
        padding: 0px;

      }
      #container {
        width : 600px;
        height: 384px;
        margin: 8px auto;
      }
  </style>
 </head>

 <body>
 <div id="container"></div>
  <script type="text/javascript" src="./js/flotr2.min.js"></script>

    <script type="text/javascript">
(function basic() {
var container = document.getElementById('container'),
    var d1 = [
        [0, 3],
        [4, 8],
        [8, 5],
        [9, 13]
    ], graph;

    graph = Flotr.draw(container,[d1],
    {
        xaxis:
        {
            minorTickFreq: 4
        },
        grid: 
        {
            minorVerticalLines: true
        }
    });
})
(document.getElementById("editor-render-0"));

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

Solution

  • Do you have the actual file located in the location that you gave it? Also this is the file path you have now: ./js/flotr2.min.js but you should try it with 2 periods before the js. like so: ../js/flotr2.min.js