Question

I am plotting some csv data using a java applet embedded in my simple html code. Things run fine when I plot the data without any frill; if I add labels and title I don't see the graphs anymore. What should I change in the html code, reported below?

<html>
    <head>
        <script type="text/javascript"
            src="dygraph-combined.js"></script>
    </head>
    <body>
        <div id="graphdiv"
            style="width:1000px; height:600px;"></div><br>
        <script type="text/javascript">
            g2 = new Dygraph(
                             document.getElementById("graphdiv"),
                             "combined_file.csv", // path to CSV file
                             {  title: 'Title',
                                xlabel: 'Time'
                                ylabel: 'Space',
                                legend: 'always',
                                labelsDivStyles: {'textAlign': 'right'},
                             });
            </script>
    </body>
</html>

For the plotting options, I followed this example.

Was it helpful?

Solution

You forgot a comma after the xlabel property. It should be this:

{  title: 'Title',
   xlabel: 'Time',
   ylabel: 'Space',
   legend: 'always',
   labelsDivStyles: {'textAlign': 'right'},
});

As a result, there was a javascript error stopping execution. To debug this yourself, use your browser's web developer tools and look at the console. It will report any javascript errors.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top