PDA

View Full Version : set yAxis range?



duncan1a
4 Sep 2009, 7:59 AM
Hi

I'm new to Extjs so this might be obvious, but I can't seem to find the answer anywhere.

I need to have line charts where the yAxis range is always 0 to 100. At the moment the range is automatic around the values, but I need yAxis to always be 0-100. How can I do it?

Thanks

Duncan

duncan1a
4 Sep 2009, 1:07 PM
I just realised that if the value is >90 then the y-axis goes up to 105. Sine this is a percentage I really need to limit it to 0-100.

Surely this is possible??

duncan1a
5 Sep 2009, 1:36 AM
I've tried using NumericAxis:maximum but it doesn't seem to do anything, so perhaps I'm using it wrongly?

Here's my test code:

new Ext.Panel({
title: 'Graph',
renderTo: 'main_content',
width: 500,
height: 300,
layout: 'fit',
yAxis: new Ext.chart.NumericAxis({
maximum: 100
}),

items: {
xtype: 'linechart',
store: store,
xField: 'name',
yField: 'visits',
listeners: {
itemclick: function(o){
var rec = store.getAt(o.index);
Ext.example.msg('Item Selected', 'You chose {0}.', rec.get('name'));
}
}
}
});

duncan1a
5 Sep 2009, 1:55 AM
found the problem: yAxis needs to be inside items:

Now it works