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: 
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"),
    ...

};

```
One main issue is that your code is running too early. You are trying to operate on DOM elements before they have even been loaded. Code running in the `<head>` section cannot yet access elements in the DOM because it has not yet been loaded.

You can move your second `<script>` tag to right before the `</body>` tag and that problem should go away.