undefined不是函数epoch js

时间:2015-01-12 02:23:35

标签: javascript d3.js

我正在尝试运行epoch中的折线图的基本示例(它建立在d3之上)http://fastly.github.io/epoch/basic/

以下是网站提供的代码:

<html>
    <head>
        <script type="text/javascript" src="d3.min.js"></script>
        <script type="text/javascript" src="epoch.min.js"></script>
        <script type="text/javascript" src="jquery-1.11.2.min.js"></script>
        <link rel="stylesheet" type="text/css" href="css/epoch.min.css">
    </head>
    <body>
    <div id="lineChart" style="width: 800px; height: 200px"></div>
    <script>

        var lineChartData = [
          // First series
          {
            label: "Series 1",
            values: [ {time: 1370044800, y: 100}, {time: 1370044801, y: 1000}]
          },

          // The second series
          {
            label: "Series 2",
            values: [ {time: 1370044800, y: 78}, {time: 1370044801, y: 98}]
          },
        ];

      $('#lineChart').epoch({
        type: 'time.bar',
        data: lineChartData
      });   
      </script>
    </body>
</html>

我得到:未捕获TypeError:undefined不是函数index.html :(其中包含epoch关键字的行)(匿名函数)

这里错过了什么想法?

1 个答案:

答案 0 :(得分:2)

你只需要稍微切换你的脚本包括,首先放jquery:

<script type="text/javascript" src="jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="d3.min.js"></script>
<script type="text/javascript" src="epoch.min.js"></script>