0

I'm trying follow along with the example on the getting started page for c3.js.

I have the following html page:

<html>
    <head>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
        <link rel = "stylesheet" href = "static/css/c3.min.css">
        <script type="text/javascript" src="static/js/c3.min.js"></script>
    </head>

    <body>
        <script type="text/javascript">
            var chart = c3.generate({
                bindto: '#chart',
                data: {
                  columns: [
                    ['data1', 30, 200, 100, 400, 150, 250],
                    ['data2', 50, 20, 10, 40, 15, 25]
                  ]
                }
            });
        </script>
        <div id="chart"></div>
    </body>

</html>

However, when I open it in my browser, I only see a blank page. I don't see any errors in the console either. I have been googling for hours and have found no leads. Can someone help me figure out why a graph isn't showing up when the page loads?

If I copy and paste the javascript into the console, then the graph will show up, but not on page load.

            var chart = c3.generate({
                bindto: '#chart',
                data: {
                  columns: [
                    ['data1', 30, 200, 100, 400, 150, 250],
                    ['data2', 50, 20, 10, 40, 15, 25]
                  ]
                }
            });

Does anyone have any ideas why this is not working?

cweiske
  • 27,869
  • 13
  • 115
  • 180
quantumbutterfly
  • 1,424
  • 2
  • 17
  • 33

0 Answers0