Thursday, 5 September 2013

json parsing error. what's wrong?

json parsing error. what's wrong?

What is wrong with the syntax? I tried the same syntax on the highcharts
demo and it works. but json didn't parse it properly and throwing syntax
error. Please help
http://jsfiddle.net/gQ9M7/2/ Below string is for illustration of dynamic
data....
var
datax="{\"name\":\"Tokyo\",\"data\":[[\"test\",7.0],[\"test2\",6.9]]},{\"name\":\"New
York\",\"data\":[[\"test\",5.0],[\"test2\",8.9]]}";
$(function () {
$('#container').highcharts({
title: {
text: 'Monthly Average Temperature',
x: -20 //center
},
subtitle: {
text: 'Source: WorldClimate.com',
x: -20
},
xAxis: {
type: 'category'
},
yAxis: {
title: {
text: 'Temperature (°C)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: '°C'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [$.parseJSON(datax)]
});
});

No comments:

Post a Comment