View Full Version : Extjs 4.2.1 Stacked bar chart Minimum and maximium values changes based on store

prem kumar
25 Sep 2013, 11:07 PM
Hi i am working on a extjs 4.2.1 application in which i am using the bar chart (stacked) . In x axis i want range from -100(minimum) to maximum (100) with a difference of 20 (majorTickSteps=10).

Below is the code

var store = Ext.create('Ext.data.JsonStore', {fields: ['name', 'cost','sell'],data: [ {'name': "2013", 'cost': -36.483395098129556, 'sell': 25.516604901870444}, {'name': "2013", 'cost': -27.483395098129556, 'sell': 8.516604901870444}, {'name': "2013", 'cost': -35.483395098129556, 'sell': 19.516604901870444}, {'name': "2013", 'cost': -25.483395098129556, 'sell': 33.516604901870444}]});
Ext.create('Ext.chart.Chart', { renderTo: Ext.getBody(), id:'chart', width: 580, height: 165, animate: true, store: store, axes: [{ type: 'Numeric', position: 'bottom', fields: ['cost','sell'], grid: true, minimum: -100, maximum:100 }, { type: 'Category', position: 'left', fields: ['name'] }], series: [{ type: 'bar', axis: 'bottom', stacked: true, xField: 'name', yField: ['cost','sell'] }] });

if stacked = true , x axis minimum and maximum values are changed based on the store
if stacked = false, x axis minimum and maximum remains same , but it is not stacked.
I need stacked bar chart with minimum and maximum values which i specified. How can i proceed . Any help would be greatly appreciated.

Gary Schlosberg
14 Oct 2013, 1:19 PM
I put your code into this fiddle:

Not sure exactly what your intent is here. Are you looking to have the stacked setting toggle on a button.