mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 12:03:05 +08:00
Merge pull request #2483 from dataease/pr@dev@perf_map
perf: 地图调色手柄文字跟随仪表板主题色
This commit is contained in:
commit
dd07c62fc5
@ -33,6 +33,7 @@
|
|||||||
:search-count="searchCount"
|
:search-count="searchCount"
|
||||||
:terminal-type="scaleCoefficientType"
|
:terminal-type="scaleCoefficientType"
|
||||||
:scale="scale"
|
:scale="scale"
|
||||||
|
:theme-style="element.commonBackground"
|
||||||
class="chart-class"
|
class="chart-class"
|
||||||
@onChartClick="chartClick"
|
@onChartClick="chartClick"
|
||||||
@onJumpClick="jumpClick"
|
@onJumpClick="jumpClick"
|
||||||
@ -47,6 +48,7 @@
|
|||||||
:search-count="searchCount"
|
:search-count="searchCount"
|
||||||
:terminal-type="scaleCoefficientType"
|
:terminal-type="scaleCoefficientType"
|
||||||
:scale="scale"
|
:scale="scale"
|
||||||
|
:theme-style="element.commonBackground"
|
||||||
@onChartClick="chartClick"
|
@onChartClick="chartClick"
|
||||||
@onJumpClick="jumpClick"
|
@onJumpClick="jumpClick"
|
||||||
/>
|
/>
|
||||||
|
@ -774,6 +774,7 @@ export const BASE_MAP = {
|
|||||||
inRange: {
|
inRange: {
|
||||||
color: ['lightskyblue', 'yellow', 'orangered']
|
color: ['lightskyblue', 'yellow', 'orangered']
|
||||||
},
|
},
|
||||||
|
textStyle: {},
|
||||||
right: 0
|
right: 0
|
||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
|
@ -306,3 +306,9 @@ const yExtFormatter = function(value) {
|
|||||||
return valueFormatter(value, yExtAxisLabelFormatter)
|
return valueFormatter(value, yExtAxisLabelFormatter)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const reverseColor = colorValue => {
|
||||||
|
colorValue = '0x' + colorValue.replace(/#/g, '')
|
||||||
|
const str = '000000' + (0xFFFFFF - colorValue).toString(16)
|
||||||
|
return '#' + str.substring(str.length - 6, str.length)
|
||||||
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// import { hexColorToRGBA } from '@/views/chart/chart/util'
|
// import { hexColorToRGBA } from '@/views/chart/chart/util'
|
||||||
import { componentStyle } from '../common/common'
|
import { componentStyle, reverseColor } from '../common/common'
|
||||||
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
|
import { DEFAULT_TOOLTIP } from '@/views/chart/chart/chart'
|
||||||
|
|
||||||
export function baseMapOption(chart_option, chart) {
|
export function baseMapOption(chart_option, chart, themeStyle) {
|
||||||
// 处理shape attr
|
// 处理shape attr
|
||||||
let customAttr = {}
|
let customAttr = {}
|
||||||
if (chart.customAttr) {
|
if (chart.customAttr) {
|
||||||
@ -69,6 +69,11 @@ export function baseMapOption(chart_option, chart) {
|
|||||||
chart_option.visualMap.inRange.color = customAttr.color.colors
|
chart_option.visualMap.inRange.color = customAttr.color.colors
|
||||||
chart_option.visualMap.inRange.colorAlpha = customAttr.color.alpha / 100
|
chart_option.visualMap.inRange.colorAlpha = customAttr.color.alpha / 100
|
||||||
}
|
}
|
||||||
|
if (themeStyle && themeStyle.backgroundColorSelect) {
|
||||||
|
const panelColor = themeStyle.color
|
||||||
|
const reverseValue = reverseColor(panelColor)
|
||||||
|
chart_option.visualMap.textStyle = { color: reverseValue }
|
||||||
|
}
|
||||||
for (let i = 0; i < valueArr.length; i++) {
|
for (let i = 0; i < valueArr.length; i++) {
|
||||||
const y = valueArr[i]
|
const y = valueArr[i]
|
||||||
y.name = chart.data.x[i]
|
y.name = chart.data.x[i]
|
||||||
|
@ -120,6 +120,11 @@ export default {
|
|||||||
type: Number,
|
type: Number,
|
||||||
required: false,
|
required: false,
|
||||||
default: 1
|
default: 1
|
||||||
|
},
|
||||||
|
themeStyle: {
|
||||||
|
type: Object,
|
||||||
|
required: false,
|
||||||
|
default: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -279,7 +284,11 @@ export default {
|
|||||||
this.$echarts.registerMap('MAP', geoJson)
|
this.$echarts.registerMap('MAP', geoJson)
|
||||||
// this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson)
|
// this.$echarts.getMap('MAP') || this.$echarts.registerMap('MAP', geoJson)
|
||||||
const base_json = JSON.parse(JSON.stringify(BASE_MAP))
|
const base_json = JSON.parse(JSON.stringify(BASE_MAP))
|
||||||
const chart_option = baseMapOption(base_json, chart)
|
let themeStyle = null
|
||||||
|
if (this.themeStyle) {
|
||||||
|
themeStyle = JSON.parse(JSON.stringify(this.themeStyle))
|
||||||
|
}
|
||||||
|
const chart_option = baseMapOption(base_json, chart, themeStyle)
|
||||||
this.myEcharts(chart_option)
|
this.myEcharts(chart_option)
|
||||||
const opt = this.myChart.getOption()
|
const opt = this.myChart.getOption()
|
||||||
if (opt && opt.series) {
|
if (opt && opt.series) {
|
||||||
|
@ -765,6 +765,7 @@
|
|||||||
:obj="{chart}"
|
:obj="{chart}"
|
||||||
:chart-id="chart.id"
|
:chart-id="chart.id"
|
||||||
:chart="chart"
|
:chart="chart"
|
||||||
|
:theme-style="curComponent.commonBackground"
|
||||||
class="chart-class"
|
class="chart-class"
|
||||||
@onChartClick="chartClick"
|
@onChartClick="chartClick"
|
||||||
/>
|
/>
|
||||||
@ -774,6 +775,7 @@
|
|||||||
:chart-id="chart.id"
|
:chart-id="chart.id"
|
||||||
:chart="chart"
|
:chart="chart"
|
||||||
class="chart-class"
|
class="chart-class"
|
||||||
|
:theme-style="curComponent.commonBackground"
|
||||||
@onChartClick="chartClick"
|
@onChartClick="chartClick"
|
||||||
/>
|
/>
|
||||||
<chart-component-g2
|
<chart-component-g2
|
||||||
|
Loading…
Reference in New Issue
Block a user