diff --git a/frontend/src/components/GradientColorSelector/DeColorPicker.vue b/frontend/src/components/GradientColorSelector/DeColorPicker.vue index 7bbc039149..8a2831b96f 100644 --- a/frontend/src/components/GradientColorSelector/DeColorPicker.vue +++ b/frontend/src/components/GradientColorSelector/DeColorPicker.vue @@ -1,486 +1,540 @@ \ No newline at end of file + diff --git a/frontend/src/components/GradientColorSelector/base.js b/frontend/src/components/GradientColorSelector/base.js index 4851dd95fd..557047a9a5 100644 --- a/frontend/src/components/GradientColorSelector/base.js +++ b/frontend/src/components/GradientColorSelector/base.js @@ -88,8 +88,8 @@ export const gradientColorCases = [ name: '渐变色1', value: 'gradient1', colors: [ - ['rgba(144,202,249,0.5)', 'rgba(1,87,155,0.9)'], - ['rgba(127,222,234,1)', 'rgba(0,77,65,1)'], + ['rgba(144,202,249,0.5)', 'rgba(1,87,155,0.9)'], + ['rgba(127,222,234,1)', 'rgba(0,77,65,1)'], ['rgba(129,199,132,1)', 'rgba(26,94,32,1)'], ['rgba(255,213,79,1)', 'rgba(230,81,0,1)'], ['rgba(186,105,200,1)', 'rgba(74,20,140,1)'], @@ -100,4 +100,4 @@ export const gradientColorCases = [ export const isGradientValue = value => { return value && gradientColorCases.some(item => item.value === value) -} \ No newline at end of file +} diff --git a/frontend/src/components/GradientColorSelector/index.vue b/frontend/src/components/GradientColorSelector/index.vue index fd607f6cac..e770b40f41 100644 --- a/frontend/src/components/GradientColorSelector/index.vue +++ b/frontend/src/components/GradientColorSelector/index.vue @@ -1,13 +1,28 @@ \ No newline at end of file + diff --git a/frontend/src/views/chart/chart/map/map.js b/frontend/src/views/chart/chart/map/map.js index c7987c5207..ead8013c8f 100644 --- a/frontend/src/views/chart/chart/map/map.js +++ b/frontend/src/views/chart/chart/map/map.js @@ -10,20 +10,19 @@ const linearCOlor = (start, end) => { x2: 0, y2: 1, colorStops: [ - {offset: 0, color: start}, - {offset: 1, color: end}, + { offset: 0, color: start }, + { offset: 1, color: end } ], global: false } } const fillGradientColor = (data, colors) => { - if(!data || !data.length) return data - const dataLen = data.length + if (!data || !data.length) return data const colorLen = colors.length data.forEach((item, index) => { const colorIndex = index % colorLen const colorArr = colors[colorIndex] - if(Array.isArray(colorArr)) { + if (Array.isArray(colorArr)) { item.itemStyle = { normal: { areaColor: linearCOlor(colorArr[0], colorArr[1]), @@ -44,7 +43,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) { let isGradient = false if (chart.customAttr) { customAttr = JSON.parse(chart.customAttr) - + if (customAttr.color) { const colorValue = customAttr.color.value isGradient = isGradientValue(colorValue) @@ -99,8 +98,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) { } const valueArr = chart.data.series[0].data // visualMap - if(!isGradient) { - + if (!isGradient) { if (valueArr && valueArr.length > 0) { const values = [] valueArr.forEach(function(ele) { @@ -124,11 +122,10 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) { chart_option.visualMap.inRange.colorAlpha = customAttr.color.alpha / 100 } if (themeStyle) { - chart_option.visualMap.textStyle = { color: themeStyle } } } - + for (let i = 0; i < valueArr.length; i++) { const y = valueArr[i] y.name = chart.data.x[i] @@ -138,7 +135,7 @@ export function baseMapOption(chart_option, chart, themeStyle, curAreaCode) { chart_option.series[0].data = fillGradientColor(chart_option.series[0].data, customAttr.color.colors) delete chart_option.visualMap } - + if (chart.senior) { const senior = JSON.parse(chart.senior) diff --git a/frontend/src/views/chart/components/shape-attr/ColorSelector.vue b/frontend/src/views/chart/components/shape-attr/ColorSelector.vue index 9d1b1fcc62..6d2a8037bc 100644 --- a/frontend/src/views/chart/components/shape-attr/ColorSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/ColorSelector.vue @@ -8,10 +8,21 @@ size="mini" >
- - + + - +