zhzf/client/src/utils/echart.js

141 lines
2.4 KiB
JavaScript

const barOptions = {
"grid": {
"left": "1%",
"right": "1%",
"bottom": "1%",
"top": "5%"
},
"xAxis": {
"show": false,
"type": "category",
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
},
"yAxis": {
"show": false,
"type": "value"
},
"series": {
"data": [120, 200, 150, 80, 70, 110, 130],
"type": "bar",
"barWidth": 3,
"itemStyle": {
"borderRadius": [5, 5, 0, 0]
}
}
}
const pieOptions = {
"tooltip": {
"trigger": "item",
"show": false
},
"legend": {
"show": false
},
"grid": {
"left": "1%",
"right": "1%",
"bottom": "1%",
"top": "5%"
},
"series": {
"type": "pie",
"radius": ["75%", "100%"],
"avoidLabelOverlap": false,
"label": {
"show": false,
"position": "center"
},
"labelLine": {
"show": false
},
"data": [
{
"value": 1048,
"itemStyle": {
"color": "#5EA1FF"
}
},
{
"value": 735,
"itemStyle": {
"color": "#FFD93E"
}
},
{
"value": 313,
"itemStyle": {
"color": "rgba(94, 161, 255, 0.08)"
}
}
]
}
}
const LineOptions = {
"xAxis": {
"type": "category",
"data": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
"show": false,
"axisTick": {
"show": false
},
"axisLine": {
"show": false
},
"axisLabel": {
"show": false
},
"splitLine": {
"show": false
}
},
"yAxis": {
"type": "value",
"show": false,
"axisTick": {
"show": false
},
"axisLine": {
"show": false
},
"axisLabel": {
"show": false
},
"splitLine": {
"show": false
}
},
"grid": {
"left": "1%",
"right": "1%",
"bottom": "1%",
"top": "5%"
},
"series": {
"showSymbol": false,
"data": [820, 720, 901, 934, 1390, 1110, 900],
"type": "line",
"areaStyle": {},
"lineStyle": {
"width": 1.5
}
}
}
export const getBarOptions = (colorObj) => {
barOptions.series = colorObj.gztIndexOneColor
return barOptions
}
export const getLineOptions = (colorObj) => {
LineOptions.series = colorObj.gztIndexOneColor
return LineOptions
}
export const getPieOptions = (colorObj) => {
pieOptions.series = colorObj.gztIndexOneColor
return pieOptions
}