$(...)。epoch不是函数TypeError

时间:2016-09-09 08:04:45

标签: javascript d3.js epoch.js

我正在尝试从网站http://epochjs.github.io/epoch/real-time运行一个基本示例,我收到以下错误

jQuery.Deferred exception: $(...).epoch is not a function TypeError: $(...).epoch is not a function

这是我的index.html

<html>
  <head>
    <script type="text/javascript" src="js/jquery-3.1.0.slim.min.js"></script>
    <script type="text/javascript" src="js/d3.v4.min.js"></script>
    <script type="text/javascript" src="js/epoch.min.js"></script>
    <link rel="stylesheet" type="text/css" href="css/epoch.min.css">
  </head>
  <body>
    <div id="areaChart" style="width: 800px; height: 200px"></div>
    <script>
      $(function () {
        var areaChartData = [
          {
            label: "Layer 1",
            values: [ {x: 0, y: 100}, {x: 20, y: 1000} ]
          },
          {
            label: "Layer 2",
            values: [ {x: 0, y: 78}, {x: 20, y: 98}]
          }];
        $('#areaChart').epoch({
          type: 'area',
          data: areaChartData
        });
      });
    </script>
  </body>
</html>

enter image description here

1 个答案:

答案 0 :(得分:3)

epoch似乎使用了d3.time中不存在的d3.time,因此将其切换为d3.v3可以解决问题。

{
  "UserLogin": "mbar",

  "Password": "*****",

  "Ticket" : 
  {
    "Title": "raz dwa trzy",
    "Queue": "Raw",
    "Lock": "unlock",
    "Type": "Unclassified",
    "State": "new",
    "Priority": "3 normal",
    "Owner": "mbar",
    "CustomerUser": "mbar"
  },

  "Article":
  {
    "Subject" : "jakiś temat",
    "Body" : "test test tes test",
    "ContentType": "text/plain; charset=utf8"       

  }
}