HighCharts TypeError: ha is not a function

I am having trouble using HighChart in my php codes.

I originally created graph.php and managed to get it up and running myself.

However, when I integrated it into another php (adminlist.php), the graph doesn't appear and after debugging, the error shows "TypeError: ha is not a function" and TypeError: $ (...). not a function (sorry but failed to attach photos here)

My code in adminlist.php looks like this:

<ul class="nav nav-pills nav-stacked">
<li <?php if($_GET['function'] == 'graph'){echo 'class="active"';}?>><a href="adminlist.php?function=graph">Analyzer</a></li>
</ul>
                        if ($_GET['function'] == 'graph'){
                    include('graph.php');

                    }

      

My code is in graph.php (it works if I call graph.php directly, but not when I include it in adminlist.php). The source code looks like this:

<div id="mostpopular" style="height: 400px"></div>
<script src="bootstrap-3.2.0-dist/js/jquery.min.js"></script>
<script src="bootstrap-3.2.0-dist/js/bootstrap.min.js"></script>
<script src="bootstrap-3.2.0-dist/js/bootstrap-markdown.js"></script>
<script src="bootstrap-3.2.0-dist/js/jquery.hotkeys.js"></script>
<script src="Highcharts-4.0.4/js/highcharts.js"></script>
<script src="Highcharts-4.0.4/js/highcharts-3d.js"></script>
<script src="Highcharts-4.0.4/js/modules/exporting.js"></script>

<script type="text/javascript">

$(function () {
    $('#mostpopular').highcharts({
        chart: {
            type: 'column',
            margin: 75,
            options3d: {

                alpha: 10,
                beta: 25,
                depth: 70
            }
        },
        title: {
            text: 'Sale transaction volume'
        },
        subtitle: {
            text: 'List of total sales by food category'
        },
        plotOptions: {
            column: {
                depth: 25
            }
        },
        xAxis: {
            categories: ['<?php echo $foodnamearr[0]; ?>', '<?php echo $foodnamearr[1]; ?>','<?php echo $foodnamearr[2]; ?>','<?php echo $foodnamearr[3]; ?>','<?php echo $foodnamearr[4]; ?>','<?php echo $foodnamearr[5]; ?>','<?php echo $foodnamearr[6]; ?>','<?php echo $foodnamearr[7]; ?>']
        },
        yAxis: {
            opposite: true
        },
        series: [{
            name: 'Sales',
            data: [<?php echo $qty[0]; ?>,<?php echo $qty[1]; ?>, <?php echo $qty[2]; ?>, <?php echo $qty[3]; ?>, <?php echo $qty[4]; ?>, <?php echo $qty[5]; ?>, <?php echo $qty[6]; ?>, <?php echo $qty[7]; ?>]
        }]
    });
});
        </script>

      

+3


source to share


2 answers


Old question, but if someone finds themselves searching:

Since version 4.0.4, ha

this is a mini version of the method error

. One time in the script where it error

is called before it is defined is on line 106 where it checks for the dirty Highcharts namespace:

if (win.Highcharts) {
  error(16, true);
} else {
  Highcharts = win.Highcharts = {};
}

      



You won't get the actual error because of the error. Estimated output:

uncaught exception: Highcharts error #16: www.highcharts.com/errors/16

      

Note: Of course, depending on your version of Highcharts, the code may change.

+5


source


Make sure you are not importing the same javascript files in tall template in the template you are working in and the template you include.



In my case, it solved the problem.

0


source







All Articles