Getting chart data to work within a function
Posted
by StealthRT
on Stack Overflow
See other posts from Stack Overflow
or by StealthRT
Published on 2010-03-31T00:23:39Z
Indexed on
2010/03/31
1:53 UTC
Read the original article
Hit count: 594
JavaScript
|jQuery
Hey all i am in need of some help trying to figure out how to pass a string into an array field for a chart. The chart i am using is this [http://www.highcharts.com/]
Here is the chart code:
function drawChart(theDATA)
{
var chart = new Highcharts.Chart({
chart: {renderTo: 'container',defaultSeriesType: 'column'},
title: {text: 'March 2010 Confirmed User Visit\'s'},
xAxis: {categories: ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']},
yAxis: {min: 0,title: {text: 'User Visit\'s'}},
legend: {layout: 'vertical',backgroundColor: '#FFFFFF',style: {left: '100px',top: '70px',bottom: 'auto'}},
tooltip: {formatter: function() {return this.y;}},
plotOptions: {column: {pointPadding: 0.2,borderWidth: 0}},
series: [{name: 'Confirmed Users Visit\'s',
data: [theDATA]
}]
});
}
With the code above, you would think that theDATA would work but it does not display the data within it.
Say that theDATA is '2,5,4,7,8,9'. If i had this:
data: [2,5,4,7,8,9]
Then it would work just fine. But if i use those same numbers...
theData = "2,5,4,7,8,9"
data: [theData]
It does nothing on the chart...
So what am i doing wrong????
David
© Stack Overflow or respective owner