|
|
@@ -358,6 +358,17 @@ const chartColorMap: Record<string, string> = {
|
|
|
作业场所: '#ff00ff'
|
|
|
}
|
|
|
|
|
|
+const childChartColorPalette = [
|
|
|
+ '#4f8dff',
|
|
|
+ '#43c7ca',
|
|
|
+ '#ff981f',
|
|
|
+ '#8d8cff',
|
|
|
+ '#ff7a7a',
|
|
|
+ '#52c41a',
|
|
|
+ '#13c2c2',
|
|
|
+ '#faad14'
|
|
|
+]
|
|
|
+
|
|
|
const hexToRgba = (hex: string, alpha: number) => {
|
|
|
const normalizedHex = hex.replace('#', '')
|
|
|
const safeHex =
|
|
|
@@ -375,16 +386,16 @@ const hexToRgba = (hex: string, alpha: number) => {
|
|
|
return `rgba(${red}, ${green}, ${blue}, ${alpha})`
|
|
|
}
|
|
|
|
|
|
-const getBarBaseColor = (name: string, isDrilldown: boolean) => {
|
|
|
- if (isDrilldown && currentDrilldownKey.value) {
|
|
|
- return chartColorMap[currentDrilldownKey.value] || '#67c23a'
|
|
|
+const getBarBaseColor = (name: string, isDrilldown: boolean, index: number) => {
|
|
|
+ if (isDrilldown) {
|
|
|
+ return childChartColorPalette[index % childChartColorPalette.length]
|
|
|
}
|
|
|
|
|
|
return chartColorMap[name] || '#409eff'
|
|
|
}
|
|
|
|
|
|
-const getBarItemStyle = (name: string, isDrilldown: boolean) => {
|
|
|
- const baseColor = getBarBaseColor(name, isDrilldown)
|
|
|
+const getBarItemStyle = (name: string, isDrilldown: boolean, index: number) => {
|
|
|
+ const baseColor = getBarBaseColor(name, isDrilldown, index)
|
|
|
|
|
|
return {
|
|
|
color: {
|
|
|
@@ -487,11 +498,11 @@ const socChartOption = computed<EChartsOption>(() => {
|
|
|
shadowOffsetY: 8
|
|
|
}
|
|
|
},
|
|
|
- data: sourceData.map((item) => ({
|
|
|
+ data: sourceData.map((item, index) => ({
|
|
|
id: item.id,
|
|
|
name: item.name,
|
|
|
value: item.value,
|
|
|
- itemStyle: getBarItemStyle(item.name, isDrilldown)
|
|
|
+ itemStyle: getBarItemStyle(item.name, isDrilldown, index)
|
|
|
})),
|
|
|
label: {
|
|
|
show: true,
|