Uncaught TypeError: undefined n’est pas une fonction – Highcharts – MVC

J’essaie d’utiliser Highcharts dans mon application Web MVC. J’ai chargé tous les prérequirejs pour faire fonctionner Highcharts. Mais apparemment, “highchart” n’est toujours pas reconnu par la page. Je vérifie la page rendue par l’outil de développement Google et elle indique que tous les fichiers javascript de JQuery et Highchart sont chargés correctement. De l’aide?

Ceci est mon code .cshtml:

@using System.Web.Optimization 
@section Scripts { @Scripts.Render("~/bundles/jqueryval") @Scripts.Render("~/Scripts/Highcharts-4.0.1/js/highcharts.js") @Scripts.Render("~/Scripts/Highcharts-4.0.1/js/modules/exporting.js") $(function() { var chart; debugger; $(document).ready(function() { debugger; // Build the chart $('#container').highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, title: { text: 'Browser market shares at a specific website, 2014' }, tooltip: { pointFormat: '{series.name}: {point.percentage:.1f}%' }, plotOptions: { pie: { allowPointSelect: true, cursor: 'pointer', dataLabels: { enabled: true, format: '{point.name}: {point.percentage:.1f} %', style: { color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black' } } } }, series: [{ type: 'pie', name: 'Browser share', data: [ ['Firefox', 45.0], ['IE', 26.8], { name: 'Chrome', y: 12.8, sliced: true, selected: true }, ['Safari', 8.5], ['Opera', 6.2], ['Others', 0.7] ] }] }); }); }); }

Donc, cela fait l’affaire (ce qui est un peu bizarre!):

J’ai besoin de changer cette ligne:

 $('#container').highcharts({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false }, 

A cette ligne:

 chart = new Highcharts.Chart({ chart: { plotBackgroundColor: null, plotBorderWidth: null, plotShadow: false, renderTo: 'container' }, 

C’est le lien qui m’a aidé à travers: http://developmentpassion.blogspot.com/2013/09/bar-charts-and-graphs-in-aspnet-mvc.html