折线图想在工具栏显示不同的配色,其他几个选项都很正常,但是magictype只能使用一种颜色
配置项如下
option = {
title: {
text: '收缴金额',
subtext: '折线图',
textStyle: {
color: '#333333',
fontStyle: 'normal',
fontWeight: 'bolder',
fontFamily: '微软雅黑',
fontSize: "18",
align: 'center'
},
subtextStyle: {
color: '#aaaaaa',
fontStyle: 'normal',
fontWeight: 'normal',
fontFamily: '微软雅黑',
fontSize: "12",
align: 'center'
},
backgroudcolor: 'transparent',
left: 'auto',
right: 'auto',
top: 'auto',
bottom: 'auto'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'line',
axis: 'x',
},
// formatter: '{b0}<br /><span style="display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:#3398DB;"></span>{c0}',
backgroundColor: '#6a7985',
textStyle: {
color: '#ffffff',
fontStyle: 'normal',
fontWeight: 'normal',
fontFamily: '微软雅黑',
fontSize: "14"
}
},
legend: {
textStyle: {
color: '#333333',
fontStyle: 'normal',
fontWeight: 'normal',
fontFamily: '微软雅黑',
fontSize: "12"
},
data: ['收缴金额']
},
toolbox: {
// borderColor:['#1e90ff','#22bb22','#4b0082',],
show: true,
orient: 'horizontal',
itemSize: '20',
itemGrap: '15',
feature: {
dataView: {
show: true,
iconStyle: {
borderColor: '#1e90ff'
},
emphasis:{
iconStyle: {
borderColor: '#1e90ff'
},
}
},
magicType: {
show: true,
type: ['line', 'bar'],
iconStyle: {
borderColor: '#22bb22'
},
emphasis:{
iconStyle: {
borderColor: '#22bb22'
},
}
},
restore: {
show: true,
iconStyle: {
borderColor: '#4b0082'
},
emphasis:{
iconStyle: {
borderColor: '#4b0082'
},
}
},
saveAsImage: {
show: true,
iconStyle: {
borderColor: '#d2691e'
},
emphasis:{
iconStyle: {
borderColor: '#d2691e'
},
}
}
}
},
xAxis
:
{
type:'category',
axisTick
:
{
alignWithLabel:true
}
,
data: [2015 - 12 - 27, 2015 - 12 - 28, 2015 - 12 - 23, 2015 - 12 - 24, 2015 - 12 - 22, 2015 - 12 - 08, 2015 - 12 - 01, 2016 - 01 - 28, 2016 - 01 - 29, 2016 - 01 - 30, 2016 - 01 - 31, 2016 - 01 - 24, 2016 - 01 - 25, 2016 - 01 - 26, 2016 - 01 - 27, 2016 - 01 - 20, 2016 - 01 - 21, 2016 - 01 - 22, 2016 - 01 - 23, 2016 - 01 - 16, 2016 - 01 - 17, 2016 - 01 - 18, 2016 - 01 - 19, 2016 - 01 - 13, 2016 - 01 - 12, 2016 - 12 - 17, 2016 - 01 - 15, 2016 - 01 - 14, 2016 - 01 - 09, 2016 - 01 - 08, 2016 - 01 - 11, 2016 - 01 - 10, 2016 - 01 - 05, 2016 - 01 - 04, 2016 - 01 - 07, 2016 - 01 - 06, 2016 - 01 - 01, 2016 - 01 - 03, 2016 - 01 - 02, 2016 - 12 - 15, 2016 - 12 - 16, 2016 - 12 - 13, 2016 - 12 - 14, 2016 - 12 - 11, 2016 - 12 - 12, 2016 - 12 - 09, 2016 - 12 - 10, 2016 - 12 - 07, 2016 - 12 - 08, 2015 - 06 - 08, 2016 - 12 - 05, 2016 - 12 - 06, 2015 - 06 - 09, 2016 - 12 - 04, 2016 - 12 - 01, 2015 - 07 - 02, 2015 - 07 - 01, 2015 - 07 - 10, 2015 - 07 - 08, 2015 - 07 - 09]
}
,
yAxis: {
type:'value'
}
,
series: [{
name: '收缴金额',
type: 'line',
lineStyle: {
color: '#3398DB',
width: '2',
type: 'solid'
},
label:{
formatter: '{c} {name|{a}}'
},
data: [100, 100, 100, 200, 200, 10, 20, 710166, 874929, 385192, 406040, 408170, 1466390, 1357935, 945685, 1225241, 1157592, 1132562, 386527, 403586, 397261, 1119655, 1028158, 923678, 1340582, 100, 839152, 930394, 382790, 822592, 1394991, 390365, 946148, 1032238, 850501, 843305, 345249, 459505, 422255, 40, 50, 20, 250, 200, 20, 20, 100, 200, 100, 100, 20, 320, 200, 250, 260, 100, 200, 200, 6600, 2500]
}]
}
;
if (option && typeof option === "object") {
myChart.setOption(option, true);
}