|
@@ -8,6 +8,7 @@
|
|
import { ModuleDataChart } from '/@/views/vent/deviceManager/configurationTable/types';
|
|
import { ModuleDataChart } from '/@/views/vent/deviceManager/configurationTable/types';
|
|
import { EChartsOption, graphic } from 'echarts';
|
|
import { EChartsOption, graphic } from 'echarts';
|
|
import { getData, getFormattedText } from '../../hooks/helper';
|
|
import { getData, getFormattedText } from '../../hooks/helper';
|
|
|
|
+ import { install$10 } from 'echarts/types/dist/shared';
|
|
|
|
|
|
const props = withDefaults(
|
|
const props = withDefaults(
|
|
defineProps<{
|
|
defineProps<{
|
|
@@ -77,6 +78,37 @@
|
|
};
|
|
};
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // if (type === 'pie') {
|
|
|
|
+ // return {
|
|
|
|
+ // textStyle,
|
|
|
|
+ // legend: {
|
|
|
|
+ // textStyle,
|
|
|
|
+ // show: legend.show,
|
|
|
|
+ // },
|
|
|
|
+ // tooltip: {
|
|
|
|
+ // trigger: 'item',
|
|
|
|
+ // },
|
|
|
|
+ // color: ['#d9a1ff', '#00d1ff', '#82fe78'],
|
|
|
|
+ // series: baseSeries.map((serie) => {
|
|
|
|
+ // return {
|
|
|
|
+ // type: 'pie',
|
|
|
|
+ // radius: ['50%', '75%'],
|
|
|
|
+ // center: ['50%', '55%'],
|
|
|
|
+ // labelLine: { show: false },
|
|
|
|
+ // label: { show: false },
|
|
|
|
+ // itemStyle: {
|
|
|
|
+ // shadowBlur: 20,
|
|
|
|
+ // shadowColor: '#259bcf',
|
|
|
|
+ // },
|
|
|
|
+ // data: serie.data.map((e) => ({
|
|
|
|
+ // name: e[0],
|
|
|
|
+ // value: e[1],
|
|
|
|
+ // })),
|
|
|
|
+ // };
|
|
|
|
+ // }),
|
|
|
|
+ // };
|
|
|
|
+ // }
|
|
|
|
+
|
|
if (type === 'pie') {
|
|
if (type === 'pie') {
|
|
return {
|
|
return {
|
|
textStyle,
|
|
textStyle,
|
|
@@ -87,24 +119,89 @@
|
|
tooltip: {
|
|
tooltip: {
|
|
trigger: 'item',
|
|
trigger: 'item',
|
|
},
|
|
},
|
|
- color: ['#d9a1ff', '#00d1ff', '#82fe78'],
|
|
|
|
- series: baseSeries.map((serie) => {
|
|
|
|
- return {
|
|
|
|
|
|
+ color: ['#73C0DE', '#5470C6', '#91CC75', '#FAC858', '#ED6666', '#17d1b2', '#2ae271', '#11bce7', '#c127f0', '#ee125b'],
|
|
|
|
+ series: baseSeries.reduce((curr: EChartsOption[], serie, index) => {
|
|
|
|
+ const colors = ['#73C0DE', '#5470C6', '#91CC75', '#FAC858', '#ED6666', '#17d1b2', '#2ae271', '#11bce7', '#c127f0', '#ee125b'];
|
|
|
|
+ if (baseSeries.length === 1) {
|
|
|
|
+ curr.push({
|
|
|
|
+ ...serie,
|
|
|
|
+ type: 'pie',
|
|
|
|
+ radius: ['30%', '64%'],
|
|
|
|
+ center: ['50%', '55%'],
|
|
|
|
+ z: 1,
|
|
|
|
+ padAngle: 5,
|
|
|
|
+ itemStyle: {
|
|
|
|
+ shadowColor: 'rgba(0, 0, 0, 0.5)',
|
|
|
|
+ borderWidth: 10,
|
|
|
|
+ },
|
|
|
|
+ label: {
|
|
|
|
+ show: true,
|
|
|
|
+ position: 'inner',
|
|
|
|
+ formatter: '{d}%',
|
|
|
|
+ color: '#fff',
|
|
|
|
+ fontSize: 14,
|
|
|
|
+ rich: {
|
|
|
|
+ d: {
|
|
|
|
+ fontFamily: '微软雅黑',
|
|
|
|
+ fontSize: 16,
|
|
|
|
+ color: '#fff',
|
|
|
|
+ lineHeight: 30,
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ labelLine: { show: false },
|
|
|
|
+ data: serie.data.map((e) => ({
|
|
|
|
+ name: e[0],
|
|
|
|
+ value: e[1],
|
|
|
|
+ })),
|
|
|
|
+ });
|
|
|
|
+ curr.push({
|
|
|
|
+ ...serie,
|
|
|
|
+ type: 'pie',
|
|
|
|
+ radius: ['64%', '74%'],
|
|
|
|
+ center: ['50%', '55%'],
|
|
|
|
+ labelLine: { show: false },
|
|
|
|
+ label: { show: false },
|
|
|
|
+ padAngle: 5,
|
|
|
|
+ avoidLabelOverlap: false,
|
|
|
|
+ itemStyle: {
|
|
|
|
+ borderWidth: 10,
|
|
|
|
+ normal: {
|
|
|
|
+ color: function (obj) {
|
|
|
|
+ return `${colors[obj['dataIndex']]}88`;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ data: serie.data.map((e) => ({
|
|
|
|
+ name: e[0],
|
|
|
|
+ value: e[1],
|
|
|
|
+ })),
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ curr.push({
|
|
|
|
+ ...serie,
|
|
type: 'pie',
|
|
type: 'pie',
|
|
- radius: ['50%', '75%'],
|
|
|
|
|
|
+ radius: ['25%', '30%'],
|
|
center: ['50%', '55%'],
|
|
center: ['50%', '55%'],
|
|
labelLine: { show: false },
|
|
labelLine: { show: false },
|
|
label: { show: false },
|
|
label: { show: false },
|
|
|
|
+ z: 5,
|
|
|
|
+ padAngle: 5,
|
|
itemStyle: {
|
|
itemStyle: {
|
|
- shadowBlur: 20,
|
|
|
|
- shadowColor: '#259bcf',
|
|
|
|
|
|
+ borderWidth: 10,
|
|
|
|
+ normal: {
|
|
|
|
+ color: function (obj) {
|
|
|
|
+ return `${colors[obj['dataIndex']]}88`;
|
|
|
|
+ },
|
|
|
|
+ },
|
|
},
|
|
},
|
|
data: serie.data.map((e) => ({
|
|
data: serie.data.map((e) => ({
|
|
name: e[0],
|
|
name: e[0],
|
|
value: e[1],
|
|
value: e[1],
|
|
})),
|
|
})),
|
|
- };
|
|
|
|
- }),
|
|
|
|
|
|
+ });
|
|
|
|
+ return curr;
|
|
|
|
+ }, []),
|
|
};
|
|
};
|
|
}
|
|
}
|
|
|
|
|
|
@@ -464,7 +561,8 @@
|
|
};
|
|
};
|
|
}),
|
|
}),
|
|
series: baseSeries.reduce((curr: EChartsOption[], serie, index) => {
|
|
series: baseSeries.reduce((curr: EChartsOption[], serie, index) => {
|
|
- const colors = ['#66ffff', '#00ff66', '#ffff66'];
|
|
|
|
|
|
+ // const colors = ['#66ffff', '#00ff66', '#ffff66'];
|
|
|
|
+ const colors = ['#73C0DE', '#ED6666', '#5470C6', '#91CC75', '#FAC858', '#17d1b2', '#2ae271', '#11bce7', '#c127f0', '#ee125b'];
|
|
if (baseSeries.length === 1) {
|
|
if (baseSeries.length === 1) {
|
|
curr.push({
|
|
curr.push({
|
|
...serie,
|
|
...serie,
|
|
@@ -496,7 +594,7 @@
|
|
curr.push({
|
|
curr.push({
|
|
...serie,
|
|
...serie,
|
|
type: 'bar',
|
|
type: 'bar',
|
|
- silent: true,
|
|
|
|
|
|
+ // silent: true,
|
|
yAxisIndex: index,
|
|
yAxisIndex: index,
|
|
barWidth: 20,
|
|
barWidth: 20,
|
|
barGap: '100%',
|
|
barGap: '100%',
|
|
@@ -509,6 +607,18 @@
|
|
]),
|
|
]),
|
|
borderRadius: [5, 5, 0, 0],
|
|
borderRadius: [5, 5, 0, 0],
|
|
},
|
|
},
|
|
|
|
+ label: {
|
|
|
|
+ show: true, //开启显示
|
|
|
|
+ position: 'top', //在上方显示
|
|
|
|
+ textStyle: {
|
|
|
|
+ //数值样式
|
|
|
|
+ color: '#ffffffbb',
|
|
|
|
+ fontSize: 13,
|
|
|
|
+ },
|
|
|
|
+ formatter: function (obj) {
|
|
|
|
+ return obj['data'][1];
|
|
|
|
+ },
|
|
|
|
+ },
|
|
});
|
|
});
|
|
|
|
|
|
return curr;
|
|
return curr;
|