PDA

View Full Version : Months duplicated even when time axis has month step



bluezz
3 May 2012, 9:50 AM
I have a simple bar chart with about 4 (sometimes 5) data points per months. I have set my X-axis type to 'Time' and I also set the step on month. However, I see months duplicated on my x-axis. I want to see simply 11 ticks from Jun-11 to Apr-12. Can someone please help?




Ext.onReady(function () {

var storeConfig = {
autoLoad: false,
fields: ['mydata', 'Date'],
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'data'
}
},
data: []
};

var store1 = new Ext.data.Store(storeConfig);
store1.loadData([{ mydata: 3446.7344, Date: new Date('2011/06/06')},
{ mydata: 1057.0173, Date: new Date('2011/06/13')},
{ mydata: 1716.1444, Date: new Date('2011/06/20')},
{ mydata: 861.8891, Date: new Date('2011/06/27')},
{ mydata: 281.0034, Date: new Date('2011/07/05')},
{ mydata: 1082.1227, Date: new Date('2011/07/11')},
{ mydata: 590.5334, Date: new Date('2011/07/18')},
{ mydata: 390.4603, Date: new Date('2011/07/25')},
{ mydata: 1730.0774, Date: new Date('2011/08/01')},
{ mydata: 1792.0851, Date: new Date('2011/08/08')},
{ mydata: 3750.9949, Date: new Date('2011/08/15')},
{ mydata: 840.3297, Date: new Date('2011/08/22')},
{ mydata: 544.4893, Date: new Date('2011/08/29')},
{ mydata: 1205.2519, Date: new Date('2011/09/06')},
{ mydata: 914.4819, Date: new Date('2011/09/12')},
{ mydata: 1416.176, Date: new Date('2011/09/19')},
{ mydata: 2585.4423, Date: new Date('2011/09/26')},
{ mydata: 2351.2535, Date: new Date('2011/10/03')},
{ mydata: 457.1782, Date: new Date('2011/10/11')},
{ mydata: 3167.1884, Date: new Date('2011/10/17')},
{ mydata: 788.2377, Date: new Date('2011/10/24')},
{ mydata: 416.3967, Date: new Date('2011/10/31')},
{ mydata: 1292.4613, Date: new Date('2011/11/07')},
{ mydata: 2205.7852, Date: new Date('2011/11/14')},
{ mydata: 218.0573, Date: new Date('2011/11/21')},
{ mydata: 1383.9865, Date: new Date('2011/11/28')},
{ mydata: 463.1435, Date: new Date('2011/12/05')},
{ mydata: 678.3506, Date: new Date('2011/12/12')},
{ mydata: 327.1762, Date: new Date('2011/12/19')},
{ mydata: 61.2811, Date: new Date('2011/12/27')},
{ mydata: 415.3909, Date: new Date('2012/01/03')},
{ mydata: 463.3604, Date: new Date('2012/01/09')},
{ mydata: 431.4, Date: new Date('2012/01/17')},
{ mydata: 510.258, Date: new Date('2012/01/23')},
{ mydata: 2095.4739, Date: new Date('2012/01/30')},
{ mydata: 622.9253, Date: new Date('2012/02/06')},
{ mydata: 532.31, Date: new Date('2012/02/13')},
{ mydata: 690.2423, Date: new Date('2012/02/21')},
{ mydata: 990.7539, Date: new Date('2012/02/27')},
{ mydata: 717.2181, Date: new Date('2012/03/05')},
{ mydata: 1341.7162, Date: new Date('2012/03/12')},
{ mydata: 1125.5939, Date: new Date('2012/03/19')},
{ mydata: 1074.8506, Date: new Date('2012/03/26')},
{ mydata: 433.6162, Date: new Date('2012/04/02')},
{ mydata: 1426.4139, Date: new Date('2012/04/09')},
{ mydata: 327.168, Date: new Date('2012/04/16')},
{ mydata: 657.9678, Date: new Date('2012/04/23')}], false);

var chart = Ext.create('Ext.chart.Chart', {
xtype: 'chart',
style: 'background:#fff',
animate: false,
store: store1,
shadow: false,
theme: 'Category1',
axes: [{
type: 'Numeric',
position: 'left',
fields: ['mydata'],
title: 'Data'
}, {
type: 'Time',
position: 'bottom',
fields: ['Date'],
dateFormat: 'M-y',
step : [Ext.Date.Month, 1],
groupBy: 'year,month,day,hour,minute',
title: false
}],
series: [{
type: 'column',
axis: 'left',
xField: 'Date',
highlight: true,
yField: 'mydata',
tips: {
trackMouse: true,
width: 65,
height: 28,
renderer: function(storeItem, item) {
this.setTitle(String(item.value[1].toFixed(2)));
}
}
}]
});

var win = Ext.create('Ext.Window', {
width: 900,
height: 500,
hidden: false,
maximizable: true,
title: 'RT Chart Test',
renderTo: Ext.getBody(),
layout: 'fit',
items: chart
});

});




34844

bluezz
4 May 2012, 6:35 AM
*Bump*

Shouldn't this be easy to do since most of the charts have a time axis? I've been reading bugs and issues that time axis has but if I change the axis type to 'Category' and override the renderer to display dates, I still would want to somehow step and not show duplicate months like in the screenshot.