echarts
echarts copied to clipboard
tree树形图,series中生成多个(数量级在100以上),出现不展示图表
One-line summary [问题简述]
tree树形图,series中生成多个(数量级在100以上),出现不展示图表
Version & Environment [版本及环境]
- ECharts version [ECharts 版本]:ECharts 3.8, vue
- Browser version [浏览器类型和版本]:Chrome 63
- OS Version [操作系统类型和版本]:window 7,window 10, ISO
Expected behaviour [期望结果]
ECharts option [ECharts配置项]
let series = [];
// 获取 树结构数据中第一个实体有多少实例
if (self.option.children && self.option.children.length > 0 ) {
let len = self.option.children.length;
self.option.children.forEach((item, index)=> {
series.push({
type: 'tree',
name: self.option.name,
layout: "orthogonal", //radial orthogonal
symbol: 'emptyCircle',
initialTreeDepth: 3,
data: [self.option.children[index]],
top: (100/len)*index + "%" ,
bottom: 100 -((100/len)*(index + 1)) + "%",
left: '7%',
right: '7%',
symbolSize: 10,
roam: true,
label: {
normal: {
position: 'right',
verticalAlign: 'middle',
align: 'left', // 环形布局需要注释
color: "#FFF",
fontSize: 16,
offset:[-45,10]
}
},
leaves: {
label: {
normal: {
position: 'right', // 标签的位置
verticalAlign: 'middle', // 文字的对齐方式
align: 'left', // 文字水平对齐方式 环形布局需要注释
offset:[-45,10]
}
},
itemStyle: {
normal: {
color: "#ff2023" //树图中叶子节点的样式(字体颜色)。
}
}
},
expandAndCollapse: true,
animationDuration: 500,
animationDurationUpdate: 750,
orient: "horizontal", // 控制方向 vertical horizontal
lineStyle: {
normal: {
curveness: 0.2 // 节点之间的连线的弧度
}
}
})
});
}
let option = {
series: series
};
Other comments [其他信息]
是否有报错?
没有报错,最近还发现,tree节点的数量达到1000以上,图标也显示不出来了
其实本质原因因该是画布高度超过4w像素,会导致渲染不出来,只有展示数据的画布控制在4w以下就可以避免这个问题