Sign in to follow this  
sushma_rkd

Bind The Data To Linked Charts Using Pie Chart Dynamically

Recommended Posts

Hi

 

here's the code that doesnt work properly..

 

$(document).ready(function() {

$.ajax({

type: "POST",

url: "DrillDownPieChapter1.aspx/BindChart",

data: "{}",

contentType: "application/json; charset=utf-8",

dataType: "json",

async: true,

success: function(msg) {

var json = $.xml2json(msg.d);

jsonString = {

"chart": {

"caption": "Yearly Sales", "xaxisname": "Year", "yaxisname": "Sales"

},

"data": [],

"linkeddata": [{

"id": [],

"linkedchart": {

"chart": {

"caption": " Sales Summary", "subcaption": "For the year 2004", "xaxisname": "Quarter", "yaxisname": "Sales", "numberprefix": "$", "useroundedges": "1"

},

"data": []

}

}]

}

 

if (json.Table.length > 0) {

for (i = 0; i < json.Table.length; i++) {

var dataSeries = {};

dataSeries.label = json.Table.City;

var item = parseFloat(json.Table.Value);

dataSeries.value = item;

dataSeries.link = json.Table.link;

jsonString.data.push(dataSeries);

}

}

 

if (json.Table.length > 0) {

for (i = 0; i < json.Table.length; i++) {

var dataSeries1 = {};

dataSeries1.label = json.Table.Property;

var item = parseFloat(json.Table.Value);

dataSeries1.value = item;

var idseries = {};

idseries.id = json.Table.City;

jsonString.linkeddata[0].id.push(idseries);

jsonString.linkeddata[0].linkedchart.data.push(dataSeries1);

}

}

 

 

var pieContainer = new FusionCharts("Scripts/Pie3D.swf", "Pie2D", "485", "280", "0", "1");

pieContainer.setJSONData(jsonString);

pieContainer.render("ActualDatawise-Pie");

}

});

 

 

 

 

});

</script>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this