{
name: 'R&D经费投入强度(%)',
yAxisIndex: 1,
lineStyle: {
color: '#FFB93F'
},
label: {
show: true,
position: 'top',
color: '#FFB93F'
},
itemStyle: {
color: "#FFB93F"
},
data: [1.81, 1.86, 1.92, 2.25],
type: 'line'
}
import * as echarts from '../ec-canvas/echarts';
function getBarOption() {
return {
title: {
top: -10,
left: 17,
subtext: '2016-2019年R&D经费支出及投入强度(亿元、%)',
subtextStyle: {
color: '#999',
fontSize: 12
}
},
legend:{
data: ['蒸发量', '降水量'],
show:true
},
tooltip: {
trigger: 'axis',
confine: true,
},
grid: {
left: 40,
bottom: 30,
top: 40,
right: 35
},
xAxis: {
type: 'category',
axisLabel: {
color: '#333',
},
axisLine: {
show: false
},
axisTick: {
show: false
},
data: ['2016年', '2017年', '2018年', '2019年']
},
yAxis: [{
nameGap: 10,
type: 'value',
axisLabel: {
color: '#999'
},
axisLine: {
show: false
},
axisTick: {
show: false
},
splitLine: {
lineStyle: {
// 使用深浅的间隔色
color: ['rgba(219, 219, 219, 0.3)']
}
}
}, {
nameGap: 10,
type: 'value',
axisLabel: {
color: '#999'
},
axisLine: {
lineStyle: {
color: '#999'
}
},
axisTick: {
lineStyle: {
color: '#999'
}
},
splitLine: {
show: false
}
}],
series: [{
name: 'R&D经费支出(亿元)',
barWidth: 12,
label: {
show: true,
position: 'top',
color: '#01A1FD'
},
labelLine: {
show: true
},
itemStyle: {
normal: {
barBorderRadius: [12, 12, 0, 0],
color: {
type: 'linear',
x: 0,
y: 0,
x2: 0,
y2: 1,
colorStops: [{
offset: 0, color: '#00A1FD' // 0% 处的颜色
}, {
offset: 1, color: '#2CDCFC' // 100% 处的颜色
}],
globalCoord: false // 缺省为 false
}
}
},
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowColor: 'rgba(0, 0, 0, 0.5)',
}
},
data: [40.95, 46.91, 52.4, 63.92],
type: 'bar'
}, {
name: 'R&D经费投入强度(%)',
yAxisIndex: 1,
lineStyle: {
color: '#FFB93F'
},
label: {
show: true,
position: 'top',
color: '#FFB93F'
},
itemStyle: {
color: "#FFB93F"
},
data: [1.81, 1.86, 1.92, 2.25],
type: 'line'
}]
};
}
Page({
data: {
ecBar: {
onInit: function (canvas, width, height, dpr) {
const barChart = echarts.init(canvas, null, {
width: width,
height: height,
devicePixelRatio: dpr // new
});
canvas.setChart(barChart);
barChart.setOption(getBarOption());
return barChart;
}
},
},
touchStart() {
},
touchMove() {
},
touchEnd() {
}
});