E-chart相关问题设置
【折线图中,折线的宽度】
series: [{ name: type[0], type: 'line', stack: '总量', areaStyle: {}, data: value[0], itemStyle: { normal: { lineStyle: { width: 5 } }, } }]
【X轴过长,缩放显示】
dataZoom: [{ type: 'slider', show: true, xAxisIndex: [0], left: '12%', bottom: 0, height: 20, width: 650, start: 0, end: 10, textStyle: { color: '#fff', fontSize: 12, } }]
【不隐藏X轴文字,旋转角度】
xAxis: [{ type: 'category', data: name, axisLabel: { interval: 0, rotate: 0 } }]
【饼图隐藏折线提示】
series: [ { type: 'pie', label: { normal: { position: 'inner', show : false } } }]
【提示文字,显示在折线上方,通过换行实现】
labelLine: {
normal: {
length: 30,
length2: 90, //第二条折线长度
}
},
label: {
formatter: "{c|{c}}\n{b}\n\n\n", //文字相对折线的位置(上下)
borderWidth: 20,
borderRadius: 4,
padding: [0, -70], //文字相对折线的位置(左右)
fontSize: 20,
rich: {
c: { //自定义提示文字样式,c表示自定义样式名,{c}表示值
fontSize: 20,
align: "center",
}
}
},
富文本标签:https://echarts.apache.org/zh/tutorial.html#%E5%AF%8C%E6%96%87%E6%9C%AC%E6%A0%87%E7%AD%BE
【定制颜色,①定义颜色组;②在series中设置color】
color: function(params) { var colorList = [‘#C33531’,’#EFE42A’,’#64BD3D’,’#EE9201’,’#29AAE3’, ‘#B74AE5’,’#0AAF9F’,’#E89589’,’#16A085’,’#4A235A’ ]; return colorList[params.dataIndex] }
【随机生成深色浅色】
https://blog.csdn.net/chidiantou7237/article/details/100927524 var getRandomColor = function() { return '#' + (function(color) { return(color += '5678956789defdef' [Math.floor(Math.random() * 16)]) && (color.length == 6) ? color : arguments.callee(color); })(''); }
// 0123401234abcabc
【渐变色数组写法】
color:[ new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ {offset: 0, color: '#008B8B'}, {offset: 0.5, color: '#00D1D1'}, {offset: 1, color: '#00FBFB'} ] ), new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ {offset: 0, color: '#008CB9'}, {offset: 0.5, color: '#00A5DC'}, {offset: 1, color: '#00B7F3'} ] ), new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ {offset: 0, color: '#BA9E02'}, {offset: 0.5, color: '#D1B204'}, {offset: 1, color: '#EDC908'} ] ), new echarts.graphic.LinearGradient( 0, 0, 0, 1, [ {offset: 0, color: '#1AB886'}, {offset: 0.5, color: '#14D99B'}, {offset: 1, color: '#11EBA6'} ] ) ]