gpt4 book ai didi

javascript - 高库存,错误 : Uncaught TypeError: w[(intermediate value)(intermediate value)(intermediate value)] is not a constructor

转载 作者:数据小太阳 更新时间:2023-10-29 03:53:28 25 4
gpt4 key购买 nike

我正在尝试创建 highstock 图表,但出现以下错误:

error: Uncaught TypeError: w[(intermediate value)(intermediate value)(intermediate value)] is not a constructor

我的 JSON 似乎有效,我的 javascript 也有效,知道如何解决这个问题吗?

Javascript:

    $.getJSON('<?php echo SITE_URL; ?>analytic/weekly_views_json', function(data) 
{
// Create the chart
$('#container2').highcharts('StockChart', {

rangeSelector: {
selected: 1
},

title: {
text: 'AAPL Stock Price'
},

series: [{
name: 'AAPL Stock Price',
data: data,
type: 'spline',

}]
});
});

JSON:

[[1420547368,1],[1423225768,1],[1425644968,1],[1428319768,1],[1430911768,1],[1433590168,1],[1452083368,1],[1454761768,1],[1457267368,1],[1458131368,1],[1459942168,1],[1494070168,1]]

最佳答案

第一种解决方案:

我有同样的错误,我在我的 HTML 代码中使用了 highchart 如下:

<head>
<script src="https://code.highcharts.com/highcharts.js"></script>
...
</head>

我的 js 代码是:

$('#container').highcharts('StockChart', {
...
});

关于 highchart documention ,我们必须使用 Highcharts.Chart 来创建新的 highstock。所以我将代码更改为:

<head>
<script src="https://code.highcharts.com/highcharts.js"></script>
...
</head>

我的 js 代码是:

var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
...
});

这个错误已经解决了!

第二种方案:

也关于this documentation ,如果您同时运行 Chart 和 StockChart,则只需加载 highstock.js 文件。

所以将我的代码更改为:

<head>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
...
</head>

我的 js 代码是:

var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
...
});

关于javascript - 高库存,错误 : Uncaught TypeError: w[(intermediate value)(intermediate value)(intermediate value)] is not a constructor,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36862124/

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