The code below is an example of using Echart's treemap. I want each series to be arranged in vertical order, then connected to each series, and then resized according to the data.
In this example, each series will be randomly ordered by its size.
https://echarts.apache.org/examples/an/editor.html?c=treemap-disk
myChart.showLoading(); $.get(ROOT_PATH + '/data/asset/data/disk.tree.json', function (diskData) { myChart.hideLoading(); const formatUtil = echarts.format; function getLevelOption() { return [ { itemStyle: { borderWidth: 0, gapWidth: 5 } }, { itemStyle: { gapWidth: 1 } }, { colorSaturation: [0.35, 0.5], itemStyle: { gapWidth: 1, borderColorSaturation: 0.6 } } ]; } myChart.setOption( (option = { title: { text: '磁盘使用情况', left: 'center' }, tooltip: { formatter: function (info) { var value = info.value; var treePathInfo = info.treePathInfo; var treePath = []; for (var i = 1; i < treePathInfo.length; i++) { treePath.push(treePathInfo[i].name); } return [ '<div class="tooltip-title">' + formatUtil.encodeHTML(treePath.join('/')) + '</div>', '磁盘使用情况: ' + formatUtil.addCommas(value) + ' KB' ].join(''); } }, series: [ { name: '磁盘使用情况', type: 'treemap', visibleMin: 300, label: { show: true, formatter: '{b}' }, itemStyle: { borderColor: '#fff' }, levels: getLevelOption(), data: diskData } ] }) ); });
This is the result I expect. Enter image description here
As far as I know, it seems impossible at the moment. You can affect the shape of the area via the
squareRatio
property, but I can't align it vertically.If you don't need panning and zooming, you can place a treemap for each category and adjust the position accordingly (eg:
left: '20%'
) and Size (for example:width: '25%'
).Here is an example: