问题与HighChart的StockChart。获得highcharts不是一个功能 [英] Issue with HighChart's StockChart. Getting highcharts is not a function
问题描述
我无法理解两种方式来初始化一个高图:
第一种方式:
var lineChart = new Highcharts.Chart(
{
chart:{
alignTicks:true,
type:'StockChart',
renderTo:'container',
...
第二种方式:
< $ p $ $('#container')。highcharts('StockChart',{
图表:{
alignTicks:true,
type:'StockChart' ,
renderTo:'container',
...
Q2:
在 http://jsfiddle.net/上使用第二种方式时ezk2mg72 / 我能够得到想要的结果,但在本地尝试时,我得到以下异常:
** Uncaught TypeError:$(...)。highcharts不是函数**
PS:js文件的顺序是正确的建议:
pre $ (我在本地有脚本)
< script type =text / javascriptsrc = JS / jQuery的latest.js>< /脚本>
< script type =text / javascriptsrc =js / highstock.js>< / script>
< script type =text / javascriptsrc =js / exporting.js>< / script>
在此错误之前取消错误编号Uncaught TypeError并点击您的控制台上的链接查看问题的详细信息:
$ b
未捕获错误:Highcharts错误#16:www.highcharts.com/错误/ 16
祝您好运!
So I have two doubts:
Q1:
I am unable to understand the difference between the two ways to initialize a High Chart:
1st way:
var lineChart = new Highcharts.Chart(
{
chart: {
alignTicks: true,
type : 'StockChart',
renderTo : 'container',
...
2nd way:
$('#container').highcharts('StockChart', {
chart: {
alignTicks: true,
type : 'StockChart',
renderTo : 'container',
...
Q2:
When Using the 2nd way on http://jsfiddle.net/ezk2mg72/ I am able to get desired result but when trying in local I am getting following exception:
**Uncaught TypeError: $(...).highcharts is not a function**
PS: the order of js files is correct as per different posts of stackoverflow suggested:
(I have scripts in local)
<script type="text/javascript" src="js/jquery-latest.js"></script>
<script type="text/javascript" src="js/highstock.js"></script>
<script type="text/javascript" src="js/exporting.js"></script>
Loot at the error number before this error Uncaught TypeError and click to the link on your console to view the problem detail :
Uncaught Error: Highcharts error #16: www.highcharts.com/errors/16
And Good luck !
这篇关于问题与HighChart的StockChart。获得highcharts不是一个功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!