开发者

jQuery Google Charting - changing series data

I am sure there is a simple solution to this but I can't seem to get it working.

I need to change the series data for my chart开发者_开发问答:

This works (in my function):

var data = [$.gchart.series('title1', [50], '#F5B800'), 
            $.gchart.series('title2', [40], 'red')]; 

$('#chart').gchart('change', {series: data}); 

but I would like to set the series values dynamically from a passed value:

(ex)

value1 = '[70]';

var data = [$.gchart.series('title1', value1, '#F5B800'), 
            $.gchart.series('title2', [40], 'red')]; 

$('#chart').gchart('change', {series: data}); 

This causes a js error and the chart does not render.

I've tried a number of combinations without any success.

Any ideas?


Try:

value1 = "70";
var data = [$.gchart.series('title1', (value1), '#F5B800'), 
            $.gchart.series('title2', [40], 'red')]; 

$('#chart').gchart('change', {series: data}); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜