2013-02-25 70 views
2

我需要使用prototype.js来进行Web服务调用,然后使用highchart.js来绘制图表。 我正在使用prototype-adapter.js,但仍然出现错误,如果我尝试使用在一起(高图和原型)。 我创建了一个的jsfiddleHighchart with Prototype

http://jsfiddle.net/j5Grq/6/

$(function() { 
var chart; 
$(document).ready(function() { 
    chart = new Highcharts.Chart({ 
     chart: { 
      renderTo: 'container', 
      type: 'line', 
      marginRight: 130, 
      marginBottom: 25 
     }, 
     title: { 
      text: 'Monthly Average Temperature', 
      x: -20 //center 
     }, 
     subtitle: { 
      text: 'Source: WorldClimate.com', 
      x: -20 
     }, 
     xAxis: { 
      categories: ['09/10', '09/11', '09/12', '09/13', '09/14'] 
     }, 
     yAxis: { 
      title: { 
       text: 'Temperature (°C)' 
      }, 
      plotLines: [{ 
       value: 0, 
       width: 1, 
       color: '#808080' 
      }] 
     }, 
     tooltip: { 
      formatter: function() { 
       return '<b>' + this.series.name + '</b><br/>' + this.x + ': ' + this.y + '°C'; 
      } 
     }, 
     legend: { 
      layout: 'vertical', 
      align: 'right', 
      verticalAlign: 'top', 
      x: -10, 
      y: 100, 
      borderWidth: 0 
     }, 
     series: [{ 
      name: 'ABCD', 
      data: [648.47, 636.43, 643.97, 640.92] 
     }, { 
      name: 'ABCD1', 
      data: [899.46, 882.80, 893.29, 889.07] 
     }, { 
      name: 'ABCD2', 
      data: [1359.06, 1328.04, 1349.74, 1342.52] 
     }] 
    }); 
}); 

});

如果我删除的prototype.js ANS原型adapter.js然后绘制图表很好,但如果我有他们的图表不起作用。 我需要prototype.js来进行Web服务调用。

请帮忙。

三江源

+0

嘿体我得到了同样的错误....我花了3个月,仍然没有得到答案 – 2014-04-29 14:54:28

回答

0

它不工作,因为你用的$(document)。就绪();这是jQuery的声明。

+0

那么,塞巴斯蒂安是什么,他需要做这方面的工作? – 2014-04-29 14:55:28

+0

I.e window.onload = function(){// code} – 2014-04-30 10:03:23

0

试试这个代码,没有问题会工作。

我刚刚更换

$(function() {  

jQuery(function($) { 

这里是你的图了答案。

http://jsfiddle.net/j5Grq/17/