带原型的Highchart [英] Highchart with Prototype
问题描述
我需要使用prototype.js来进行Web服务调用,然后使用highchart.js来绘制图表。
我建议使用prototype-adapter.js,但如果我尝试同时使用它们(高图和原型),仍会出现错误。
我创建了一个jsFiddle
$(function(){
var chart;
$(document).ready (函数(){
chart = new Highcharts.Chart({
图:{
renderTo:'container',
类型:'line',
marginRight: 130,
marginBottom:25
},
标题:{
text:'Monthly Average Temperature',
x:-20 // center
},
字幕:{
text:'Source:WorldClimate.com',
x:-20
},
xAxis:{
categories:['09 / 10','09 / 11','09 / 12','09 / 13','09 / 14']
},
yAxis:{
title:{
文本:'温度(°C)'
},
plotLines:[{
value:0,
width:1,
color:'#808080'
}]
},
tooltip:{
formatter:function(){
return'< b>'+ this.series.name +'< / b>< br />'+ this.x +':'+ this.y +'°C';
}
},
图例:{
layout:'vertical',
align:'right',
verticalAlign:'top',
x:-10,
y:100,
borderWidth:0
},
series:[{
name:'ABCD',
data: [648.47,636.43,643.97,640.92]
},{
名称:'ABCD1',
数据:[899.46,882.80,893.29,889.07]
},{
name:'ABCD2',
data:[1359.06,1328.04,1349.74,1342.52]
}]
});
});
});
prototype.js和prototype-adaptor.js然后图表绘制得很好,但如果我包括他们图表不起作用。
我需要prototype.js来进行Web服务调用。
请帮助。
Thankyou
试试这段代码,不会出现任何问题。
我刚刚取代了
$(function(){
for this
jQuery(function($){
以下是图表的答案。
http://jsfiddle.net/j5Grq/17/
I needed to use prototype.js to make web service call and then use highchart.js to plot the chart. I am using the prototype-adapter.js as advised but still i get error if i try to use both together(highchart and prototype). I created a jsFiddle
$(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]
}]
});
});
});
If i remove the prototype.js ans prototype-adapter.js then chart plotted well but if i include them chart doesn't work. I needed the prototype.js to make a web service call.
Please help.
Thankyou
Try this code and will work without problems.
I just replaced
$(function () {
for this
jQuery(function($) {
Here is the answer with your graph.
http://jsfiddle.net/j5Grq/17/
这篇关于带原型的Highchart的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!