2013-05-30 47 views
0

我對VS和Highcharts很新。所以我需要你的幫助!Highcharts:代碼在小提琴中工作,但不是我Visual Studio

我得到的,當我在VS運行我的代碼如下錯誤:

Uncaught TypeError: Object [object Object] has no method 'highcharts' Hse:95 

(匿名函數)

它在小提琴做工精細! 有沒有人有任何想法如何解決這個問題?

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> 

<script type="text/javascript" src="@Url.Content("/Scripts/ext/sparkline.js")"></script> 
<script type="text/javascript" src="@Url.Content("/Scripts/ext/highcharts.js")"></script> 
<script src="http://code.highcharts.com/modules/exporting.js"></script> 

     <div> 
     <span class="inlinesparkline"></span> 
     <span class="dynamicbar" ></span> 
     <span class="container"></span> 
    </div> 


    </div> 
</div> 


<div class="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div> 
</div> 

<script type="text/javascript"> 
     $(function() { 
      //Highcharts 
      $('.container').highcharts({ 
       chart: { 
        type: 'spline' 

       }, 
       title: { 
        text: 'Snow depth in the Vikjafjellet mountain, Norway' 
       }, 
       subtitle: { 
        text: 'An example of irregular time data in Highcharts JS' 
       }, 
       xAxis: { 
        type: 'datetime', 
        dateTimeLabelFormats: { // don't display the dummy year 
         month: '%e. %b', 
         year: '%b' 
        } 
       }, 
       yAxis: { 
        title: { 
         text: 'Snow depth (m)' 
        }, 
        min: 0 
       }, 
       tooltip: { 
        formatter: function() { 
         return '<b>' + this.series.name + '</b><br/>' + 
         Highcharts.dateFormat('%e. %b', this.x) + ': ' + this.y + ' m'; 
        } 
       }, 

       series: [{ 
        name: 'Winter 2007-2008', 
        data: [ 
         [Date.UTC(1970, 9, 27), 0], 
         [Date.UTC(1970, 10, 10), 0.6], 
         [Date.UTC(1970, 10, 18), 0.7], 
         [Date.UTC(1970, 11, 2), 0.8], 
         [Date.UTC(1971, 0, 8), 0.78], 
         [Date.UTC(1971, 0, 12), 0.98], 
         [Date.UTC(1971, 0, 27), 1.84], 
         [Date.UTC(1971, 1, 10), 1.80], 
         [Date.UTC(1971, 1, 18), 1.80], 
         [Date.UTC(1971, 1, 24), 1.92], 
         [Date.UTC(1971, 2, 4), 2.49] 

        ] 
       }, { 
        name: 'Winter 2008-2009', 
        data: [ 
         [Date.UTC(1970, 9, 18), 0], 
         [Date.UTC(1970, 9, 26), 0.2], 
         [Date.UTC(1970, 11, 1), 0.47], 
         [Date.UTC(1970, 11, 11), 0.55], 
         [Date.UTC(1970, 11, 25), 1.38], 
         [Date.UTC(1971, 0, 8), 1.38], 
         [Date.UTC(1971, 3, 19), 1.6], 
         [Date.UTC(1971, 4, 25), 0.6], 
         [Date.UTC(1971, 4, 31), 0.35], 
         [Date.UTC(1971, 5, 7), 0] 
        ] 
       }, { 
        name: 'Winter 2009-2010', 
        data: [ 
         [Date.UTC(1971, 1, 23), 0.77], 
         [Date.UTC(1971, 2, 8), 0.77], 
         [Date.UTC(1971, 2, 14), 0.79], 
         [Date.UTC(1971, 2, 24), 0.86], 
         [Date.UTC(1971, 3, 4), 0.8], 
         [Date.UTC(1971, 3, 18), 0.94], 
         [Date.UTC(1971, 3, 24), 0.9], 
         [Date.UTC(1971, 4, 16), 0.39], 
         [Date.UTC(1971, 4, 21), 0] 
        ] 
       }] 
      }); 
     }); 

</script> 

這是鏈接到我的小提琴: ,這是鏈接到我的小提琴:

http://jsfiddle.net/vbsvbs/LFXBd/ 提前感謝!

回答

0

請看輸出的html,並檢查URL是否爲highcharts.js是正確的。

如果沒有,你應該調整

src="@Url.Content("/Scripts/ext/highcharts.js" 
相應

。您的錯誤消息表明情況並非如此。

可選地從它們的CDN加載:

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

/卡斯帕

相關問題