如图是绘制echarts的代码
myChart.setOption({
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type : 'category',
splitLine: {show:false},
data : item.charts.date.map(function(str){
return str.replace('-','/')
}),
axisLine:{
lineStyle:{
color:'#2EBFF4',
}
},
axisLabel: {
textStyle: {
color: '#666',//坐标值得具体的颜色
fontStyle:'italic'
}
},
},
{
type : 'category',
splitLine: {show:false},
data :item.charts.yy,
axisLine:{
lineStyle:{
color:'#2EBFF4',
}
},
axisLabel: {
textStyle: {
color: '#666',//坐标值得具体的颜色
}
},
}
],
yAxis: {
name:'g/L',
nameTextStyle:{
color:'#666'
},
type : 'value',
//设置刻度线样式
splitLine:{
show:true,
lineStyle:{
type:'dotted',
color:'#D6D6D6'
}
},
//设置坐标轴颜色
axisLine:{
lineStyle:{
color:'#2EBFF4',
}
},
axisLabel: {
textStyle: {
color: '#666',//坐标值得具体的颜色
}
},
},
stack: 'component',
xAxisIndex: 1,
yAxisIndex: 1,
itemStyle: {
normal: {
color: '#eee'
}
},
series: [
{ // For shadow
type: 'bar',
itemStyle: {
normal: {color: '#F8F5F5'}
},
barGap:'-100%',
barCategoryGap:'40%',
data: dataShadow,
animation: false
},
{
name: '辅助',
type: 'bar',
stack: '总量',
label:{
// backgroundColor:'#D3F3F9'
},
itemStyle: {
normal: {
color: '#F8F5F5'
},
},
barGap:'-100%',
barCategoryGap:'40%',
data: [0, 20, 40, 60, 80, 0]
},
{
name: '生活费',
type: 'bar',
stack: '总量',
label: {
normal: {
show: true,
position: 'inside',
color:'#2EBFF4',
verticalAlign: 'middle',
// backgroundColor:{
// image:images,
// repeat:'norepeat',
// width:0.5,
// height:0.6
// },
lineHeight: 56,
rich: {
b: {
backgroundColor: {
image: images,
height: 10
},
height: 10,
lineHeight:10
},
}
}
},
itemStyle: {
normal: {
color: '#D3F3F9'
},
},
data:data,
}
]
})
效果图如下,想控制这个背景图片的大小改不了,根据echarts给的配置参数设置无用,为啥,求各位大神指教
问题已解决,可通过series下面的markPoint设置,具体代码如下,详见markPoint
echartsDrawxhdb(e,res,item){