-
13 Mar 2012 3:03 AM #1
Treemap not working
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 :
Can you tell what am I missing ? ThanksCode: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' }] }) }); } });
-
13 Mar 2012 5:09 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,666
- Vote Rating
- 435
For the TreeStore you shouldn't use the data config, you should use the root config.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
13 Mar 2012 6:58 AM #3
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: 'Défense', 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' }] }) }); } });
-
14 Mar 2012 7:21 AM #4
For those of you who might have the problem I just forgot to include the offset property in my serie.


Reply With Quote