PDA

View Full Version : Dynamic Pie Chart Help



vader1014
25 May 2011, 1:15 PM
I am trying to get my pie chart to read dynamic data. I read this tutorial: http://technopaper.blogspot.com/2010/05/working-with-extjs-pie-charts.html and tried to copy what they did, but yet I cannot get my graph to appear. Could anyone please help me?


/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* [email protected]
* http://www.sencha.com/license
*/
Ext.chart.Chart.CHART_URL = 'http://winors.tzo.com/cgi-bin/ext-3.3/resources/charts.swf';


Ext.onReady(function(){
var store = new Ext.data.JsonStore({
fields: ['season', 'total'],
url: 'piechartdata.html'
});

new Ext.Panel({
width: 400,
height: 400,
title: 'Sector Analysis',
renderTo: 'container',
items: {
store: store,
xtype: 'piechart',
dataField: 'total',
categoryField: 'season',
//extra styles get applied to the chart defaults
extraStyle:
{
legend:
{
display: 'bottom',
padding: 5,
font:
{
family: 'Tahoma',
size: 13
}
}
}
}
});
});


piechartdata.html:

[{season: 'Summer', total: 150},{season: 'Fall', total: 245},{season: 'Winter', total: 117},{season: 'Spring', total: 184}]