Hi
I am trying to display a remote XML data in a bar chart. Below is my code.
My XML is as below,
When I run it, an error comes saying opportunitycount is not defined.
When I use the same data in a json (without the schema section above), it works.
Is there a way to directly bind XML elements in series section?
Thanks in advance,
Ishan
PS: I personally think your example should cover XML data binding as well. Almost all examples are based on JSON.
I am trying to display a remote XML data in a bar chart. Below is my code.
<script type="text/javascript"> $(document).ready(function() { $("#chart").kendoChart({ dataSource: { transport: { read: { url: "asat.xml", dataType: "xml" } }, schema: { type: "xml", data: "/cCRMGetForecastByStageResponse/ForecastStages/ForecastStage", model: { fields: { opportunitycount: "opportunitycount/text()", leadscount: "leadscount/text()", description: "description/text()" } } } }, title: { text: "Forecast Count by Stage" }, legend: { position: "top" }, seriesDefaults: { type: "column" }, series: [{ field: opportunitycount, name: "Opportunities" }, { field: leadscount, name: "Leads" }], categoryAxis: { field: "description", labels: { rotation: -90 }, majorGridLines: { visible: false } }, valueAxis: { labels: { format: "N0" }, majorUnit: 1, line: { visible: false } }, tooltip: { visible: true, format: "N0" } }); }); </script>My XML is as below,
<?xml version="1.0"?><cCRMGetForecastByStageResponse xmlns="http://www.pronto.net/crm/1.0"> <ForecastStages> <ForecastStage> <description>Initial Stage</description> <opportunycount>2</opportuny-count> <opportunyamount>1256</opportuny-amount> <leadscount>0</leads-count> <leadsamount>0</leads-amount> </ForecastStage> <ForecastStage/> <ForecastStage> <description>First Stage</description> <opportunitycount>1</opportunitycount> <opportunyamount>100</opportuny-amount> <leadscount>1</leadscount> <leadsamount>80000</leads-amount> </ForecastStage> </ForecastStages></cCRMGetForecastByStageResponse >When I run it, an error comes saying opportunitycount is not defined.
When I use the same data in a json (without the schema section above), it works.
Is there a way to directly bind XML elements in series section?
Thanks in advance,
Ishan
PS: I personally think your example should cover XML data binding as well. Almost all examples are based on JSON.