Closed calebeaires closed 3 years ago
Trying to sort treemap in a way that the name A goes to the first position from top to bottom. Sort function of hierarchyConfig does not work as it should work.
import { Treemap } from '@antv/g2plot'; const data = { name: 'root', children: [ { name: 'a', value: 9 }, { name: 'b', value: 8 }, { name: 'c', value: 7 }, { name: 'd', value: 6 }, { name: 'e', value: 5 }, { name: 'f', value: 4 }, { name: 'g', value: 10 }, ], }; const treemapPlot = new Treemap('container', { data, colorField: 'name', hierarchyConfig: { field: 'value', tile: 'treemapSquarify', sort: () => 1, } }); treemapPlot.render();
sort config is supported in #2337, new version will be released recently.
You can try it by clone code and run npm start.
Trying to sort treemap in a way that the name A goes to the first position from top to bottom. Sort function of hierarchyConfig does not work as it should work.