echart 样式修改
坐标轴,字体颜色,如下:
const option = {
tooltip: {
show: true,
trigger: 'axis',
backgroundColor: "#fff",
textStyle: {
color: "#333333",
},
axisPointer: {
type: 'shadow',
},
formatter: function (params) {
const res = {}
params.map(item => {
res.name = item.name,
res.color = item.color,
res.value = item.value,
res.ratio = parseInt(item.value * 100 / calculateData.totalArea)
}) return `
`
},
}, xAxis: { type: 'category', data: dataX, axisLabel: { show: true, textStyle: { color: '#fff' } }, axisLine: { lineStyle: { type: 'solid', color: '#0A55EB', } }, }, yAxis: { type: 'value', axisLabel: { // formatter: '{value}', textStyle: { color: '#fff' } }, splitLine: { show: false }, axisLine: { lineStyle: { type: 'solid', color: '#0A55EB', } }, }, series: [ { name: '面积', type: 'bar', barWidth: '40%', data: seriesDataTemp, }, ], };
}) return `
${res.name}
面积:${res.value}m2
占比:${res.ratio}%}, xAxis: { type: 'category', data: dataX, axisLabel: { show: true, textStyle: { color: '#fff' } }, axisLine: { lineStyle: { type: 'solid', color: '#0A55EB', } }, }, yAxis: { type: 'value', axisLabel: { // formatter: '{value}', textStyle: { color: '#fff' } }, splitLine: { show: false }, axisLine: { lineStyle: { type: 'solid', color: '#0A55EB', } }, }, series: [ { name: '面积', type: 'bar', barWidth: '40%', data: seriesDataTemp, }, ], };