Search code examples
javascriptextjsextjs4date-formattingextjs-chart

Labels on an ExtJS4 Time-Axis


I have a bottom time axis, which is defined as following:

{
  "title":"Date",
  "description":"",
  "position":"bottom",
  "type":"Time",
  "fields":["date"],
  "dateFormat":"d.m.Y"
}

But all the labels are "NaN.NaN.0NaN"

When I look in the store, the date field is a normal Date object with the right values. But when I look in the drawLabel function of Axis, me.labels has no objects, so nothing gets drawn.


Solution

  • I have a renderer for the time axis:

    getDateRenderer: function(v) {
        return Ext.util.Format.date(v, 'd.m.Y');
    }
    

    and here setting it to it:

    this.chart.axes.items[2].label.renderer = this.getDateRenderer;