var option = { tooltip: {//提示框组件。 trigger: 'axis',//触发类型。 formatter : function(params, ticket, callback) { //提示框浮层内容格式器,支持字符串模板和回调函数两种形式。當前是囘調模式 var str=params[0].name + "點:"; for(var i=0;i<params.length;i++) { str+= " <br />" +params[i].marker + params[i].value + "%"; } return str; } }, legend: {//图例组件。 data: ['達成率', '目標'], textStyle: { color: '#fff', fontWeight: 'bold', fontSize: 16 } }, toolbox: { show: true, feature: { restore: { show: true, iconStyle: { borderColor: '#fff'} }, //圖標顯色 saveAsImage: { show: true, iconStyle: { borderColor: '#fff'},backgroundColor:'#000' } } }, calculable: true, //X軸 xAxis: [ { type: 'category', boundaryGap: false, data: [], axisLabel: { show: true, interval: 0, textStyle: { color: '#fff', fontWeight: 'bold', fontSize: 16 } }, //设置轴线的属性 axisLine:{ lineStyle:{ color:'#fff', 1,//这里是为了突出显示加上的 } } } ], yAxis: [ { type: 'value', max: 100, min: 90, axisLine: { //调节Y轴样式、颜色 lineStyle:{ color:'#fff', 1,//这里是为了突出显示加上的 } }, splitLine: { //调节网格线样式、颜色 show: false, lineStyle: { color: '#fff' } }, axisLabel: {//文字格式 formatter: function (value, index) { return value.toFixed(0)+'%'; } , textStyle: { color: '#fff', fontWeight: 'bold', fontSize: 16 } } } ], series: [ { name: '達成率', type: 'line', color: '#F34444', data: [], markPoint: { data: [ {type: 'max', name: '最大值'}, ] }, }, { name: '目標', type: 'line', color: '#35EC35',
itemStyle: {
normal: {
lineStyle: {
3 //折线宽度
}
}
},
data: []
},
]
};