gpt4 book ai didi

javascript - Magento:类型错误:N 不是函数

转载 作者:行者123 更新时间:2023-12-03 11:47:18 27 4
gpt4 key购买 nike

我正在尝试将 highcharts 添加到 magento,但出现以下错误

TypeError: N is not a function (highcharts.js line 192)

我的local.xml

<adminhtml_mymodule_show>
<reference name="head">
<action method="addJs"><file>mymodule/js/highcharts.js</file></action>
<action method="addJs"><file>mymodule/js/my_charts.js</file></action>
</reference>
</adminhtml_mymodule_show>

my_charts.js

document.observe("dom:loaded", function() {
var chart = new Highcharts.Chart({

chart: {
renderTo: 'container',
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]},
{
name: 'John',
data: [5, 7, 3]}]
});
});

我的 View 文件

<div class="entry-edit">
<div class="entry-edit-head">
<h4 class="icon-head head-customer-view">
<?php echo $this->__('Test header') ?></h4>
</div>
<h1><?php echo $this->test; ?></h1>

<div id="container" style="width:100%; height:400px;"></div>
</div>

我检查了 Firebug,这些文件被添加到 head 标签内。我还尝试添加prototype-adapter.js或使用独立框架,但它不起作用 - 我每次都会从标题中得到错误。

我使用 magento 1.9 和 highcharts 4.0.4。

感谢您的帮助

最佳答案

Javascript 无法识别 highchart.js 中的 N。可能还有外部js需要与highchart.js一起加载。

确保 jQuery 在 highchart.js 之前加载。

关于javascript - Magento:类型错误:N 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25998995/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com