Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wangzhankun opened this issue Jun 20, 2021 · 1 comment
Open

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

wangzhankun opened this issue Jun 20, 2021 · 1 comment

Comments

@wangzhankun
Copy link

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>
@adarshpunj
Copy link

epoch() isn't available on d3.v4, try switching to d3.v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants