Results 1 to 2 of 2

Thread: Time axis in line chart

  1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Mlheim an der Ruhr, Germany
    Posts
    82
    Answers
    5
    Vote Rating
    0
      0  

    Default Time axis in line chart

    Hi,
    i have an problem in updating from ext 4.0 to ext 4.1.1a.

    In a line chart is not displayed the bottom time axis

    in ext 4.0 works it perfect:

    here is a part of the store:
    Code:
    [{'id':20,'sprenger':357,'ba':347,'sopart':402,'datum':'2011-09-15'},
    {'id':21,'sprenger':200,'ba':211,'sopart':242,'datum':'2011-10-13'},
    {'id':22,'sprenger':205,'ba':196,'sopart':250,'datum':'2011-11-15'},
    {'id':23,'sprenger':159,'ba':150,'sopart':186,'datum':'2011-12-15'},
    here the chart:
    Code:
    var dia = Ext.create ('Ext.chart.Chart', {
                        xtype: 'chart',
                        id: 'chartCmp',
       width: 800,
       height: 450,
       store: mystore334,
       legend: {
                    position: 'right'
                },
           axes: [
                   {
                title: 'Anzahl',
                type: 'Numeric',
                position: 'left',
                fields: ['sprenger','ba','sopart'],
                grid: true,
            }
            ,
            {
                title: 'Meldemonat',
                type: 'time',
                position: 'bottom',
                fields: ['datum'],
                dateFormat:'m.Y',
                grid: true,
                label: {
                    rotate: {
                        degrees: 270
                    }
                }
            }
        ],
        series: [
             {
                type: 'line',
                axis: 'left',
                xField: 'datum',
                yField: 'sprenger',
                tips: {
                        trackMouse: true,
                        width: 40,
                        height: 25,
                        renderer: function(storeItem, item) {
                            this.setTitle(storeItem.get('sprenger'));
                        }}
            },
            {
                type: 'line',
                axis: 'left',
                xField: 'datum',
                yField: 'ba',
                fill: true,
                highlight: {
                        size: 7,
                        radius: 7
                    },
                            tips: {
                        trackMouse: true,
                        width: 40,
                        height: 25,
                        renderer: function(storeItem, item) {
                            this.setTitle(storeItem.get('ba'));
                        }}
            },
            {
                type: 'line',
                axis: 'left',
                xField: 'datum',
                yField: 'sopart',
                            tips: {
                        trackMouse: true,
                        width: 40,
                        height: 25,
                        renderer: function(storeItem, item) {
                            this.setTitle(storeItem.get('sopart'));
                        }}
            }
          
        ]
        
    });
    I can't use fromDate, because i don't know when the time axis must start.
    In bottom line he displayed me Nan.0NaN. The load time is much longer, or the browser wants to abort the script. When he loads the store, the browser also displayed Nan.0NaN.
    I search in the forum, but i only find the hint with fromDate. When i use fromDate (for test) then he loads very long and displayed the lines right, but the bottom line is always wrong.

    Someone an idea?

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      1  

    Default

    Using this code I see both axis:

    Code:
    Ext.create('Ext.chart.Chart', {
        xtype    : 'chart',
        renderTo : document.body,
        width    : 800,
        height   : 450,
        store    : {
            fields : ['id', 'sprenger', 'ba', 'sopart',
                {
                    name       : 'datum',
                    type       : 'date',
                    dateFormat : 'Y-m-d'
                }
            ],
            data   : [
                {'id' : 20, 'sprenger' : 357, 'ba' : 347, 'sopart' : 402, 'datum' : '2011-09-15'},
                {'id' : 21, 'sprenger' : 200, 'ba' : 211, 'sopart' : 242, 'datum' : '2011-10-13'},
                {'id' : 22, 'sprenger' : 205, 'ba' : 196, 'sopart' : 250, 'datum' : '2011-11-15'},
                {'id' : 23, 'sprenger' : 159, 'ba' : 150, 'sopart' : 186, 'datum' : '2011-12-15'}
            ]
        },
        legend   : {
            position : 'right'
        },
        axes     : [
            {
                title    : 'Anzahl',
                type     : 'Numeric',
                position : 'left',
                fields   : ['sprenger', 'ba', 'sopart'],
                grid     : true
            },
            {
                title      : 'Meldemonat',
                type       : 'time',
                position   : 'bottom',
                fields     : ['datum'],
                dateFormat : 'm.Y',
                grid       : true,
                label      : {
                    rotate : {
                        degrees : 270
                    }
                }
            }
        ],
        series   : [
            {
                type   : 'line',
                axis   : 'left',
                xField : 'datum',
                yField : 'sprenger',
                tips   : {
                    trackMouse : true,
                    width      : 40,
                    height     : 25,
                    renderer   : function (storeItem, item) {
                        this.setTitle(storeItem.get('sprenger'));
                    }}
            },
            {
                type      : 'line',
                axis      : 'left',
                xField    : 'datum',
                yField    : 'ba',
                fill      : true,
                highlight : {
                    size   : 7,
                    radius : 7
                },
                tips      : {
                    trackMouse : true,
                    width      : 40,
                    height     : 25,
                    renderer   : function (storeItem, item) {
                        this.setTitle(storeItem.get('ba'));
                    }}
            },
            {
                type   : 'line',
                axis   : 'left',
                xField : 'datum',
                yField : 'sopart',
                tips   : {
                    trackMouse : true,
                    width      : 40,
                    height     : 25,
                    renderer   : function (storeItem, item) {
                        this.setTitle(storeItem.get('sopart'));
                    }
                }
            }
        ]
    });
    Looking like there is an error in 4.1.1 showing the dates in the bottom axis which looks to be fixed in 4.1.3
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •