@ -237,15 +237,18 @@ export default {
symbol : 'roundRect' ,
symbol : 'roundRect' ,
itemStyle : {
itemStyle : {
color : '#284c89' ,
color : '#284c89' ,
borderWidth : 2 ,
borderColor : '#fff' ,
borderRadius : 4 , / / 圆 角 半 径 , 值 越 大 圆 角 越 明 显
} ,
} ,
/ / 动 态 计 算 节 点 大 小 : 宽 度 = 最 长 文 本 宽 度 , 高 度 = 行 数 * 行 高 + 内 边 距
/ / 动 态 计 算 节 点 大 小 : 宽 度 = 最 长 文 本 宽 度 , 高 度 = 行 数 * 行 高 + 内 边 距
symbolSize : params => {
symbolSize : ( val , params ) => {
/ / 容 错 : p a r a m s 为 空 / 无 n a m e 时 给 默 认 值
/ / 容 错 : p a r a m s 为 空 / 无 n a m e 时 给 默 认 值
const nodeName = params ? . name || '未知节点' ;
const nodeName = params ? . name || '未知节点' ;
const childCount = params ? . children ? . length || 0 ;
const childCount = params ? . children ? . length || 0 ;
const childText = ` ${ childCount } 个子件 ` ;
const childText = ` ${ childCount } 个子件 ` ;
/ / 计 算 文 本 宽 度
/ / 计 算 文 本 宽 度
const textWidth = Math . max ( nodeName . length * 12 , childText . length * 12 ) + 2 0;
const textWidth = Math . max ( nodeName . length * 12 , childText . length * 12 ) + 3 0;
return [ Math . max ( textWidth , 100 ) , 60 ] ; / / 高 度 设 为 6 0 p x ( 适 配 两 行 文 本 )
return [ Math . max ( textWidth , 100 ) , 60 ] ; / / 高 度 设 为 6 0 p x ( 适 配 两 行 文 本 )
} ,
} ,
@ -258,9 +261,11 @@ export default {
lineHeight : 20 ,
lineHeight : 20 ,
color : '#fff' ,
color : '#fff' ,
formatter : params => {
formatter : params => {
const childText = params . data . quota >= 0 ? ` ${ params . data . quota } 个 ` : ''
const childText = params . data . quota >= 0 ? ` ${ params . data . quota } 个 ` : '' ;
/ / 去 掉 模 板 字 符 串 缩 进 , 用 \ n 换 行 , 避 免 多 余 空 白
/ / 去 掉 模 板 字 符 串 缩 进 , 用 \ n 换 行 , 避 免 多 余 空 白
return ` ${ params . name } ${ childText ? '\n' + childText : '' } ` ;
return ` ${ params . data . partCode } \ n ${ params . name } ${
childText ? '\n' + childText : ''
} ` ;
} ,
} ,
} ,
} ,
} ,
} ,