1. #1
    Sencha Premium Member
    Join Date
    Feb 2012
    Location
    Mülheim an der Ruhr, Germany
    Posts
    79
    Vote Rating
    0
    Answers
    5
    blade226 is on a distinguished road

      0  

    Default Unanswered: Time axis in line chart

    Unanswered: 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 - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    Answers
    3575
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      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 @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1