I am using Ext4 js to create diagrams. My charts are line charts showing the evolution of events over time, so my bottom axes are time axes:
{
type: 'Time',
position: 'bottom',
grid: grid,
fields: 'name',
title: false,
dateFormat: 'd/m/y',
groupBy: 'year,month,day',
aggregateOp: 'sum',
label: {
orientation: 'horizontal',
rotate: {
degrees: label_rotation
}
}
I have links to zoom. Clicking on one of these links should change the dateformat and groupby options. Here is the code:
scaleGroups = {
'DAY': {
dateFormat: 'd/m/y',
groupBy: 'year,month,day'
},
'MONTH' :{
dateFormat: 'M Y',
groupBy: 'year,month'
},
'YEAR' :{
dateFormat: 'Y',
groupBy: 'year'
}
};
function changeChartScale(chart_id, scale) {
var chart = Ext.getCmp(chart_id);
var axis = chart.axes.get(1);
selectedGroup = scaleGroups[scale];
axis.dateFormat = selectedGroup.dateFormat;
axis.groupBy = selectedGroup.groupBy;
chart.redraw();
}
The problem is that the transition from the scale to another, for example from days to several months, remains the same. So, the line is correct, but I see both daily marks and month marks.
Does anyone know why?
Thanks in advance, Sabrina
UPDATE 06/06/2011 : The same code on a sample html page importing only this javascript library works.
, javascript, (JQuery, googlempas...).
- ?