OZONE Asylum
Forums
DHTML/Javascript
Javascript - string as variable name?
This page's ID:
32042
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
I tested it and it seemed to work [code] var chart, id=''; var objs=[] set1 = {name:'Set 1',data:[1,2,5,8,9,6,3,4,7,8],color:'#c66',id:'set1'}; set2 = {name:'Set 2',data:[5,8,9,3,1,4,7,8,9,6],color:'#6c6',id:'set2'}; set3 = {name:'Set 3',data:[8,5,7,4,2,3,6,9,4,1],color:'#666',id:'set3'}; objs[set1.id]=set1 objs[set2.id]=set2 objs[set3.id]=set3 //--------------------------------------- chart = new Highcharts.Chart({ chart: { renderTo: 'container' }, series: [set1] }); //--------------------------------------- $("#controls input").each(function(){ $(this).click(function(){ var sID = $(this).attr('id'); if($(this).attr('checked') == true){ chart.addSeries(objs[$(this).attr('id')]); //don't know how to make this reference the variable above...? } else{ chart.get($(this).attr('id')).remove(); } }); [/code]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »