|
@@ -571,6 +571,25 @@ export default {
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
},
|
|
},
|
|
|
|
|
+ lineOption: {
|
|
|
|
|
+ grid: { top: 10, left: 15, right: 15, bottom: 20 },
|
|
|
|
|
+ color: ['#0977fd'],
|
|
|
|
|
+ tooltip: { trigger: 'item', formatter: '{b} : {c}', backgroundColor: 'transparent' },
|
|
|
|
|
+ xAxis: {
|
|
|
|
|
+ type: 'category',
|
|
|
|
|
+ data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
|
|
|
|
|
+ },
|
|
|
|
|
+ yAxis: {
|
|
|
|
|
+ type: 'value',
|
|
|
|
|
+ },
|
|
|
|
|
+ series: [
|
|
|
|
|
+ {
|
|
|
|
|
+ data: [],
|
|
|
|
|
+ type: 'line',
|
|
|
|
|
+ smooth: true,
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
|
|
+ },
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
@@ -642,41 +661,21 @@ export default {
|
|
|
const chart = echarts.init(document.getElementById(`chart${i + 1}`), 'carp');
|
|
const chart = echarts.init(document.getElementById(`chart${i + 1}`), 'carp');
|
|
|
const res = initType === 'init' ? data?.data?.result || [] : data?.data || [];
|
|
const res = initType === 'init' ? data?.data?.result || [] : data?.data || [];
|
|
|
// 使用刚指定的配置项和数据显示图表。
|
|
// 使用刚指定的配置项和数据显示图表。
|
|
|
- if ([0, 1, 2].includes(i)) {
|
|
|
|
|
- chart.setOption({
|
|
|
|
|
- ...this.barOption,
|
|
|
|
|
- xAxis: {
|
|
|
|
|
- type: 'category',
|
|
|
|
|
- data: res?.map(item => item.subName),
|
|
|
|
|
|
|
+ // if ([0, 1, 2].includes(i)) {
|
|
|
|
|
+ chart.setOption({
|
|
|
|
|
+ ...this.lineOption,
|
|
|
|
|
+ xAxis: {
|
|
|
|
|
+ type: 'category',
|
|
|
|
|
+ data: res?.map(item => item.subName),
|
|
|
|
|
+ },
|
|
|
|
|
+ series: [
|
|
|
|
|
+ {
|
|
|
|
|
+ data: res?.map(item => item.total),
|
|
|
|
|
+ type: 'line',
|
|
|
},
|
|
},
|
|
|
- series: [
|
|
|
|
|
- {
|
|
|
|
|
- data: res?.map(item => item.total),
|
|
|
|
|
- type: 'bar',
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- if ([3, 4, 5].includes(i)) {
|
|
|
|
|
- chart.setOption({
|
|
|
|
|
- ...this.pieOption,
|
|
|
|
|
- series: [
|
|
|
|
|
- {
|
|
|
|
|
- data: res?.map(item => ({ name: item.subName, value: item.total })),
|
|
|
|
|
- type: 'pie',
|
|
|
|
|
- radius: ['25%', '55%'],
|
|
|
|
|
- center: ['50%', '60%'],
|
|
|
|
|
- emphasis: {
|
|
|
|
|
- itemStyle: {
|
|
|
|
|
- shadowBlur: 10,
|
|
|
|
|
- shadowOffsetX: 0,
|
|
|
|
|
- shadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
- ],
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ],
|
|
|
|
|
+ });
|
|
|
|
|
+ // }
|
|
|
//根据窗口的大小变动图表
|
|
//根据窗口的大小变动图表
|
|
|
window.onresize = function () {
|
|
window.onresize = function () {
|
|
|
chart.resize();
|
|
chart.resize();
|