I am not sure how to use the "Time" type on a chart axis. I have tried setting a field for the date and defining it with a model type of "date" and later an axis type of "Time". I'm not sure if Ext can interpret a date like "2011-02-01", so I have also tried a timestamp like 1296540000.
In both cases if I set the type to "Time" my date axis labels are blank. I do get date axis labels if I set the type to "Category", but I would like to use the features of the "Time" type.
Here is an example of the relevant code (let me know if it isn't enough to go by):
Code:
var chartOutArray = [
{datetime : "2011-02-01", data : "60468.045614243"},
{datetime : "2011-02-02", data : "60056.363753319"},
{datetime : "2011-02-03", data : "61733.438416481"},
{datetime : "2011-02-04", data : "57087.04464817"},
{datetime : "2011-02-05", data : "23854.768070221"}
];
or like this:
Code:
var chartOutArray = [
{datetime : 1296540000, data : "60468.045614243"},
{datetime : 1296626400, data : "60056.363753319"},
{datetime : 1296712800, data : "61733.438416481"},
{datetime : 1296799200, data : "57087.04464817"},
{datetime : 1296885600, data : "23854.768070221"}
];
And my model:
Code:
Ext.regModel('out', {
fields: [
{name: 'datetime', type: 'date'},
{name: 'data', type: 'float'}
]
});
and the relevant part of the Date axis:
Code:
{
type: 'Time',
position: 'bottom',
fields: ['datetime'],
title: 'Date',
dateFormat: 'M d',
groupBy: 'year,month,day',
}
Am I formatting the dates wrong in my data array? Should I not set the field type to 'date'? Am I missing a crucial option in the axis' parameters? So many places to go wrong... Thanks for any help!