[ 1 post ]

Ajay Malempati

  • Username: princenani
  • Joined: Tue Jun 19, 2012 11:12 am
  • Posts: 3
  • IRC: AJ
  • Offline
  • Profile

XML Data and Chart

Post Posted: Wed Jun 20, 2012 8:35 am
+0-
Hi .. I am new to YUI .. I wasnt able to render the chart. Please let me know if I anything wrong in the code.. using YUI 3.5.1 libraries ..

Thank you very much in advance..

XML file is
<?xml version="1.0" encoding="UTF-8"?>
<Rowsets DateCreated="2012-05-22T16:09:29" EndDate="2012-05-22T13:03:55" StartDate="2012-05-22T13:03:55" Version="12.1.7 Build(47)">
<Rowset>
<Columns>
<Column Description="" MaxRange="1" MinRange="0" Name="Type" SQLDataType="1" SourceColumn="Type"/>
<Column Description="" MaxRange="1" MinRange="0" Name="Quantity" SQLDataType="1" SourceColumn="Quantity"/>
</Columns>
<Row>
<Type>Hyco</Type>
<Quantity>7</Quantity>
</Row>

HTML Code ...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Pie Chart Sample - Yahoo
</title>
<script src="/xx/yui/build/yui/yui-min.js"></script>

<script>
// Create a new YUI instance and populate it with the required modules.
YUI().use("datasource-io", "datasource-xmlschema", "charts", function(Y) {

var myDataSource = new Y.DataSource.IO({source:"/xx/Server=XacuteConnector&Mode=Query&Transaction=Test/FuelMix&OutputParameter=Output&Content-Type=text/xml"}),
myCallback = {
success: function(e){
alert(e.response);
},
failure: function(e){
alert("Could not retrieve data: " + e.error.message);
}
};

myDataSource.plug(Y.Plugin.DataSourceXMLSchema, {
schema: {
resultListLocator: "//Row",
resultFields: ["Type", "Quantity"]
}
});

myDataSource.sendRequest({
callback:myCallback
});


myDataSource.after("response", function() {
alert("loaded..")
var mychart = new Y.Chart({
dataProvider: myDataSource,
categoryKey: "Type",
render: "#mychart",
type: "Pie"
});
}
);

});

</script>
</head>
<body style="font-family: Arial;border: 0 none;" >
<div id="mychart" style="width: 600px; height: 400px;"></div>
</body>
</html>
  [ 1 post ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum