Created
May 31, 2011 17:32
-
-
Save tripp/1000926 to your computer and use it in GitHub Desktop.
Chart with DataSource
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var pieGraph = new Y.Chart({ | |
render:"#mychart", | |
categoryKey:"Domain", | |
seriesKeys:["Hit"], | |
dataProvider:[], | |
type:"pie", | |
seriesCollection:[ | |
{ | |
categoryKey:"Domain", | |
valueKey:"Hit" | |
} | |
] | |
}); | |
var myDataValues = new Y.DataSource.IO({source:"getdata.php"}), | |
myCallBack = { | |
success: function(e) { | |
pieGraph.set("dataProvider", e.response.results); | |
}, | |
failure: function(e) { | |
//handle failure | |
} | |
}; | |
myDataValues.plug({fn: Y.Plugin.DataSourceJSONSchema, cfg: { | |
schema: { | |
resultListLocator: "results", | |
resultFields: ["Domain", {key:"Hit", parser:"number"}] | |
} | |
}}); | |
myDataValues.sendRequest({ | |
request:"?json", | |
callback: myCallBack | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment