score:48

Accepted answer

i was having this issue, too. ensure jquery is imported before highchart.js. that fixed the issue for me.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>

score:1

the approach taken from the official examples is working well. they defined the include script tag within the body tag therefore the solution given by kabulan0lak is better i think.

<html>
<head>
    <title>highcharts example</title>

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#container').highcharts({
                chart: {
                    type: 'spline'
                }
                // ... other options and data/series
            });
        });
    </script>
</head>

<body>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
</body>
</html>

score:1

it happens with me too. in my case, i need click in a button to load the chart and if i click twice or more the chart stops to work. i was setting the color like this:

highcharts.setoptions({
        colors: highcharts.map(highcharts.getoptions().colors, function (color) {
            return {
                radialgradient: {
                    cx: 0.5,
                    cy: 0.3,
                    r: 0.7
                },
                stops: [
                    [0, color],
                    [1, highcharts.color(color).brighten(-0.3).get('rgb')] // darken
                ]
            };
        })
    });

$.getjson("./mydatagraph.php", function(response){
        // create the chart
        var chart = highcharts.chart('mygraph', {
            chart: {
                plotbackgroundcolor: null,
                plotborderwidth: null,
                plotshadow: false,
                type: 'pie'
            },
... });

i couldn't solve the error, but i remove the "highcharts.setoptions" and the chart works!!!

score:2

i was using an old version of the high charts version. from their website i assumed that the version listed under specific version was their latest version and used that so it wouldn't auto update on me. however the version they had listed was super old so changing it to the actual latest version fixed the issue.

score:38

what happens if you replace

$('#container').highcharts({
        colors: ["#7cb5ec", "#f7a35c"],
        chart: {
            type: 'column'
        },
        /* ... */

by

var chart = new highcharts.chart({
                colors: ["#7cb5ec", "#f7a35c"],
                chart: {
                    type: 'column',
                    renderto: 'container'
                },
                /* ... */

?

i had the same issue as you a while ago and i resolved it by using this type of initialization.


Related Query

More Query from same tag