Skip to content

TypeError: $(...).epoch is not a function  #248

@wangzhankun

Description

@wangzhankun

ENV

  • OS: WINDOWS
  • nodejs 14.16.1
  • electron
    #error
Uncaught TypeError: Cannot read property 'format' of undefined
    at epoch.min.js:1
Uncaught TypeError: $(...).epoch is not a function
    at test_epoch.html:34

image

test file

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <script src="./node_modules/jquery/dist/jquery.min.js"></script>
    <script src="./node_modules/d3/dist/d3.min.js"></script>
    <link rel="stylesheet" type="text/css" href="./node_modules/epoch-charting/dist/css/epoch.min.css">
    <script src="./node_modules/epoch-charting/dist/js/epoch.min.js"></script>

    <script type="module">

        import * as d3 from "https://cdn.skypack.dev/d3@7";

        const div = d3.selectAll("div");

    </script>

    <title>show</title>
</head>

<body>

    <div id="area" class="epoch category10" style="height: 200px;"></div>
    <script>
        const $ = require("jquery")
        var data = [
            { label: 'Layer 1', values: [{ x: 0, y: 0 }, { x: 1, y: 1 }, { x: 2, y: 2 }] },
            { label: 'Layer 2', values: [{ x: 0, y: 0 }, { x: 1, y: 1 }, { x: 2, y: 4 }] }
        ];
        var areaChartInstance = $('#area').epoch({
            type: 'area',
            data: data,
            axes: ['left', 'right', 'bottom']
        });
    </script>


</body>


</html>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions