Question: Please advise me why I can't create this example in my home html file?

Here is an example from the [site](http://jsfiddle.net/eM2Mg/) and my html file:

```
<head>
<script src="http://dygraphs.com/dygraph-dev.js"></script>
<script>
g = new Dygraph(document.getElementById("graph"),
                 "X,Y,Z\n" +
                 "1,0,3\n" +
                 "2,2,6\n" +
                 "8,14,3\n",
                 {
                     legend: 'always',
                     animatedZooms: true,
                     title: 'dygraphs chart template'
                 });          
</script>
<style>
.dygraph-title {
    color: gray;
}
</style>
</head>
<body>
<div id="graph"></div>
</body>

```

what am I doing wrong?

Answer: 
javascript script must be after div or you need to use document ready to load body first and then script

```
<html>
<head>
  <title></title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://dygraphs.com/dygraph-dev.js"></script>
<style>
.dygraph-title {
    color: gray;
}
</style>
</head>
<body>
<div id="graph"></div>
<script>
g = new Dygraph(document.getElementById("graph"),
                 "X,Y,Z\n" +
                 "1,0,3\n" +
                 "2,2,6\n" +
                 "8,14,3\n",
                 {
                     legend: 'always',
                     animatedZooms: true,
                     title: 'dygraphs chart template'
                 });          
</script>
</body>
</html>

```
Because your `getElementById` call will return null because the element doesn't exist yet when you run the Javascript code.

Put the code in the load event so that it runs after the page has been parsed:

```
window.onload = function(){

  g = new Dygraph(document.getElementById("graph"),
    ...

};

```