1. #1
    Sencha User sfahey's Avatar
    Join Date
    Apr 2010
    Posts
    5
    Vote Rating
    1
    sfahey is on a distinguished road

      0  

    Default Date Type for Chart Axis

    Date Type for Chart Axis


    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!

  2. #2
    Ext JS Premium Member
    Join Date
    May 2010
    Posts
    8
    Vote Rating
    0
    keltnerj is on a distinguished road

      0  

    Default


    Just to let you know, you are not alone - I haven't been able to get a type:Time axis to display either. And the two Sencha ext-4.0-pr3 examples I've found that use a Time axis (Live Updated Chart and Live Animated Chart) don't display it either. These same examples in earlier 4.0 code (see the 09 February 2011, Countdown to Ext JS 4: Drawing and Charting, blog) did work. A little patience is required... it's a great package, and will be well worth the wait.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    7
    Vote Rating
    0
    chaya is on a distinguished road

      0  

    Default


    Same here, i get some difficulties to make work Time axis! Maybe someone have an example code ?

Similar Threads

  1. How can i add a label for x-axis and y-axis for a chart?
    By madhu_g in forum Ext GWT: Discussion
    Replies: 7
    Last Post: 7 Jul 2014, 11:31 PM
  2. Chart, no y-axis, blank?
    By MeeMMeeM in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 9 Mar 2010, 2:41 AM
  3. [CLOSED][3.??] Chart Error with Date Axis
    By hectormendozao in forum Ext 3.x: Bugs
    Replies: 2
    Last Post: 24 Sep 2009, 7:27 AM

Thread Participants: 2