PDA

View Full Version : StackedBarChart issue



oddy
31 Aug 2009, 5:08 AM
How can I rotate this example chart http://extjs.com/deploy/dev/examples/chart/stacked-bar-chart.html by 90 deg.? For example, what should I do, If I want those horizontal bars to be vertical?

steffenk
31 Aug 2009, 6:10 AM
as the charts are coming from YUI you should also have a look here:
http://developer.yahoo.com/yui/docs/module_charts.html

oddy
31 Aug 2009, 12:08 PM
as the charts are coming from YUI you should also have a look here:
http://developer.yahoo.com/yui/docs/module_charts.html
I still don't understand how would I do that :( I just need those stacked bar charts to render vertically, so my x points should be y poins and vice versa. I'm not very comfortable with charts actually. I think because there is not enough examples out there either for Ext charts or for YAHOO charts.

BlueCamel
31 Aug 2009, 1:00 PM
You want a stacked column chart. Change the xtype accordingly and swap the xAxis and yAxis values around as well. Taking the example:


Ext.chart.Chart.CHART_URL = '../../resources/charts.swf';

Ext.onReady(function(){
var store = new Ext.data.JsonStore({
fields: ['year', 'comedy', 'action', 'drama', 'thriller'],
data: [
{year: 2005, comedy: 34000000, action: 23890000, drama: 18450000, thriller: 20060000},
{year: 2006, comedy: 56703000, action: 38900000, drama: 12650000, thriller: 21000000},
{year: 2007, comedy: 42100000, action: 50410000, drama: 25780000, thriller: 23040000},
{year: 2008, comedy: 38910000, action: 56070000, drama: 24810000, thriller: 26940000}
]
});

new Ext.Panel({
width: 600,
height: 400,
renderTo: 'container',
title: 'Stacked Bar Chart - Movie Takings by Genre',
items: {
xtype: 'stackedcolumnchart',
store: store,
xField: 'year',
yAxis: new Ext.chart.NumericAxis({
stackingEnabled: true,
labelRenderer: Ext.util.Format.usMoney
}),
series: [{
yField: 'comedy',
displayName: 'Comedy'
},{
yField: 'action',
displayName: 'Action'
},{
yField: 'drama',
displayName: 'Drama'
},{
yField: 'thriller',
displayName: 'Thriller'
}]
}
});
});

oddy
31 Aug 2009, 1:48 PM
You want a stacked column chart.
Thank you! Thank you! :D

matiz2909
5 Apr 2010, 7:59 AM
I also wanna thank BlueCamel.

Pada
3 May 2010, 5:42 AM
Thanks BlueCamel.

It was not trivial to know that I had to change the graph type from 'stackedbarchart' to 'stackedcolumnchart'. Simply swapping the x & y fields corrupted the chart completely.

Igor_89
31 Mar 2011, 3:54 AM
Thank you very much

@naresh
22 Sep 2013, 4:44 AM
BlueCamel (http://www.sencha.com/forum/member.php?25916-BlueCamel)

i am really happy to your answer .thanks you very much for the help.