开发者

jQuery Google Charting - changing series data

开发者 https://www.devze.com 2023-04-09 06:10 出处:网络
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开发者_开发问答:

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

精彩评论

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

关注公众号