// 传参示例 export const paramsExample = { title: 'CPU', // 标题 height: '100px', // 默认100px width: '100px', // 默认100px data: [ { name: 'xx', value: '1' } ] } // 图表颜色 export const getColor = (data:Array) => { let startColor = [ '#9f3edd', '#00cefc', '#16BB8C', '#fac858', '#16a3e7', ] let endColor = [ '#ae86db', '#367bec', '#7fedcd', '#d3bc89', '#94cfeb' ] const addColor = () => { startColor = startColor.concat( startColor.slice(0, data.length - startColor.length) ) endColor = endColor.concat( endColor.slice(0, data.length - endColor.length) ) } while(data.length > startColor.length || data.length > endColor.length) { addColor() } return { startColor, endColor } }