// 预设柱状图颜色3种颜色
export const barColorList = [
'#1875F0',
'#68CFA0',
];
// 预设图表颜色3种颜色
export const colorList = [
'#1875F0',
'#68CFA0',
'#FDB336'
];
export const fontColor = '#6C7E8E';
// 条状图
let clickIndex = {};
export function echartOptionForShadow(nameList, valueList) {
return {
color: barColorList,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
},
position: function (point, params, dom, rect, size) {
return [10, point[1] + 20];
},
// formatter: function (params) {
// clickIndex = params;
// return params[0].axisValueLabel + ':' + params[0].data.value + '%';
// }
},
grid: {
left: '3%',
right: '8%',
bottom: '20px',
top: '20px',
containLabel: true
},
xAxis: {
type: 'value',
scale: true,
// max: 120,
min: 0,
minInterval: 1, // 设置分割线最小间隔为1
boundaryGap: [0, 0.01],
show: true,
axisLine: { // 设置主轴线的样式
show: true,
lineStyle: {
color: fontColor
}
},
axisLabel: { // 设置主轴的文字样式
fontSize: 14,
color: fontColor
},
splitLine: { // 设置分割线样式
show: true,
lineStyle: {
type: 'dashed'
echart样式属性设置
于 2022-08-19 10:57:31 首次发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)