PDA

View Full Version : Bar chart axis not in sync with bar size if min/max given



jweymarn
30 Dec 2011, 2:34 AM
Hey Gurus!

I want to have bar charts where the axis starts from 0. This works if I add more than one dataset into yField but not if I only use just one dataset.

If I dont specify minimum: 0, I get a correctly drawn graph like so:
30375

But when i give
minimum = 0,
maximum = 100,it draws with an axis from 0 to 100 but the bars are identical to earlier as so:
30376


Is this a bug or am I doing something wrong?


Whole barChart code:

Ext.define('barChart2', {
extend: 'Ext.data.Model',
fields: ["Valitukset_muutoksenhaut_ja_lausuntopyynnot", "Aika"]
});
var varUrl = 'json/foobar/valitukset_muutoksenhaut_ja_lausuntopyynnot_graph.json';

var barChart2store = Ext.create('Ext.data.Store', {
model: 'barChart2',
proxy: {
type: 'rest',
url : varUrl,
reader: {
type: 'json',
root: 'data'
}
},
autoLoad: true
});
barChart2 = new Ext.create('Ext.chart.Chart', {
width: 700,
height: 400,
animate: true,
store: barChart2store,
axes: [{
type: 'Numeric',
position: 'top',
fields: ['Valitukset_muutoksenhaut_ja_lausuntopyynnot'],
label: {
renderer: Ext.util.Format.numberRenderer('0')
},
title: 'Muistutusten, valitusten ja kanteluiden määrä',
grid: true,
minimum: 0,
maximum: 100
}, {
type: 'Category',
position: 'left',
fields: ['Aika']
}],
series: [{
type: 'bar',
axis: 'bottom',
highlight: true,
tips: {
trackMouse: true,
width: 140,
height: 28,
renderer: function(storeItem, item) {
this.setTitle(storeItem.get('Aika') + ': ' + storeItem.get('Valitukset_muutoksenhaut_ja_lausuntopyynnot') + ' kpl');
}
},
label: {
display: 'insideEnd',
field: 'Valitukset_muutoksenhaut_ja_lausuntopyynnot',
renderer: Ext.util.Format.numberRenderer('0'),
orientation: 'horizontal',
color: '#333',
'text-anchor': 'middle'
},
xField: 'Aika',
yField: ['Valitukset_muutoksenhaut_ja_lausuntopyynnot']

}]
});
(P.S. value is text is of course added later to the image. has noting to do with Ext JS)

mitchellsimoens
30 Dec 2011, 9:12 AM
Looks like a bug and smells like a bug. You can post in the bugs forum with as much info as you can and a locally runable test case.

jweymarn
5 Jan 2012, 5:10 AM
Posted as a bug @ http://www.sencha.com/forum/showthread.php?170722-Bar-chart-axis-and-bars-length-not-in-sync