Dygraph dynamic update example not working in MeteorJS


#1

This works in jsfiddle:

http://jsfiddle.net/2trxmpr5/

http://dygraphs.com/download.html

But in my MeteorJS setup:

$ meteor npm install dygraphs

client/main.html

<head>
    <title>hello</title>
    <script type="text/javascript" src="../node_modules/dygraphs/dygraph-combined.js"></script>
    <script type="text/javascript">
        $(function () {
            var data = [];
            var t = new Date();
            for (var i = 10; i >= 0; i--) {
                var x = new Date(t.getTime() - i * 1000);
                data.push([x, Math.random()]);
            }

            var g = new Dygraph(document.getElementById('div_g'), data, {
                drawPoints: true,
                showRoller: true,
                valueRange: [0.0, 1.2],
                labels: ['Time', 'Random']
            });

            window.intervalId = setInterval(function () {
                var x = new Date();
                var y = Math.random();
                data.push([x, y]);
                g.updateOptions({'file': data});
            }, 1000);
        });
    </script>
</head>

<body>
  {{> info}}
</body>


<template name="info">
    <div id="div_g" style="width: 600px; height: 300px;"></div>
</template>

Returns:

Uncaught SyntaxError: Unexpected token < dygraph-combined.js:1
Uncaught ReferenceError: $ is not defined < (index):8