Results 1 to 4 of 4

Thread: Treemap not working

  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    30

    Default Treemap not working

    Hi,

    I'm trying to use the treemap chart with a in memory TreeStore and it does not work, here is my code :

    Code:
    Ext.setup({
        onReady: function() {
            new Ext.chart.Panel({
                fullscreen: true,
                chart: new Ext.chart.Chart({
                    store: new Ext.data.TreeStore({
                        fields: ['name', 'area', 'children', 'id'],
                        data: {
                            name: 'Budget',
                            area: 1,
                            id: 'root',
                            children: [{
                                name: 'Defense',
                                id: 'defense',
                                area: 0.5,
                                children: []
                            }, {
                                name: 'Education',
                                id: 'education',
                                area: 0.3,
                                children: []
                            }, {
                                name: 'Debt',
                                id: 'debt',
                                area: 0.2,
                                children: []
                            }]
                        },
                        proxy: 'memory'
                    }),
                    series: [{
                        type: 'treemap',
                        layout: 'squarified',
                        orientation: 'horizontal',
                        rootName: 'Budget',
                        titleField: 'name',
                        areaField: 'area'
                    }]
                })
            });
        }
    });
    Can you tell what am I missing ? Thanks

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448

    Default

    For the TreeStore you shouldn't use the data config, you should use the root config.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    30

    Default

    Thanks for you answer, I tried to change data to root in my store but it does not change anything :

    Code:
    Ext.setup({
        onReady: function() {
            new Ext.chart.Panel({
                fullscreen: true,
                chart: new Ext.chart.Chart({
                    store: new Ext.data.TreeStore({
                        fields: ['name', 'area', 'children', 'id'],
                        root: {
                            name: 'Budget',
                            area: 1,
                            id: 'root',
                            children: [{
                                name: 'Dfense',
                                id: 'defense',
                                area: 0.5,
                                children: []
                            }, {
                                name: 'Education',
                                id: 'education',
                                area: 0.3,
                                children: []
                            }, {
                                name: 'Dette',
                                id: 'debt',
                                area: 0.2,
                                children: []
                            }]
                        },
                        proxy: 'memory'
                    }),
                    series: [{
                        type: 'treemap',
                        layout: 'squarified',
                        orientation: 'horizontal',
                        rootName: 'Budget',
                        titleField: 'name',
                        areaField: 'area'
                    }]
                })
            });
        }
    });

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    30

    Default

    For those of you who might have the problem I just forgot to include the offset property in my serie.

Posting Permissions

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