feat: 新增渐变色AntV图库的所有柱状图、面积图、饼图、环形图、仪表盘
This commit is contained in:
parent
abeb1911aa
commit
03634cd100
@ -915,6 +915,7 @@ export default {
|
|||||||
password_input_error: 'Original password input error'
|
password_input_error: 'Original password input error'
|
||||||
},
|
},
|
||||||
chart: {
|
chart: {
|
||||||
|
gradient: 'Gradient',
|
||||||
layer_controller: 'Quota switch',
|
layer_controller: 'Quota switch',
|
||||||
suspension: 'Suspension',
|
suspension: 'Suspension',
|
||||||
chart_background: 'Component background',
|
chart_background: 'Component background',
|
||||||
|
|||||||
@ -915,6 +915,7 @@ export default {
|
|||||||
password_input_error: '原始密碼輸入錯誤'
|
password_input_error: '原始密碼輸入錯誤'
|
||||||
},
|
},
|
||||||
chart: {
|
chart: {
|
||||||
|
gradient: '漸變',
|
||||||
layer_controller: '指標切換',
|
layer_controller: '指標切換',
|
||||||
suspension: '懸浮',
|
suspension: '懸浮',
|
||||||
chart_background: '組件背景',
|
chart_background: '組件背景',
|
||||||
|
|||||||
@ -914,6 +914,7 @@ export default {
|
|||||||
password_input_error: '原始密码输入错误'
|
password_input_error: '原始密码输入错误'
|
||||||
},
|
},
|
||||||
chart: {
|
chart: {
|
||||||
|
gradient: '渐变',
|
||||||
layer_controller: '指标切换',
|
layer_controller: '指标切换',
|
||||||
suspension: '悬浮',
|
suspension: '悬浮',
|
||||||
chart_background: '组件背景',
|
chart_background: '组件背景',
|
||||||
|
|||||||
@ -103,6 +103,11 @@ export function baseBarOptionAntV(plot, container, chart, action, isGroup, isSta
|
|||||||
options.isPercent = chart.type === 'percentage-bar-stack'
|
options.isPercent = chart.type === 'percentage-bar-stack'
|
||||||
// custom color
|
// custom color
|
||||||
options.color = antVCustomColor(chart)
|
options.color = antVCustomColor(chart)
|
||||||
|
if (customAttr.color.gradient) {
|
||||||
|
options.color = options.color.map((ele) => {
|
||||||
|
return `l(270) 0:#ffffff00 1:${ele}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 开始渲染
|
// 开始渲染
|
||||||
if (plot) {
|
if (plot) {
|
||||||
@ -199,6 +204,11 @@ export function hBaseBarOptionAntV(plot, container, chart, action, isGroup, isSt
|
|||||||
}
|
}
|
||||||
// custom color
|
// custom color
|
||||||
options.color = antVCustomColor(chart)
|
options.color = antVCustomColor(chart)
|
||||||
|
if (customAttr.color.gradient) {
|
||||||
|
options.color = options.color.map((ele) => {
|
||||||
|
return `l(0) 0:#ffffff00 1:${ele}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 开始渲染
|
// 开始渲染
|
||||||
if (plot) {
|
if (plot) {
|
||||||
|
|||||||
@ -28,6 +28,7 @@ export const DEFAULT_COLOR_CASE = {
|
|||||||
tableBorderColor: '#E6E7E4',
|
tableBorderColor: '#E6E7E4',
|
||||||
seriesColors: [], // 格式:{"name":"s1","color":"","isCustom":false}
|
seriesColors: [], // 格式:{"name":"s1","color":"","isCustom":false}
|
||||||
areaBorderColor: '#303133',
|
areaBorderColor: '#303133',
|
||||||
|
gradient: false,
|
||||||
areaBaseColor: '#FFFFFF'
|
areaBaseColor: '#FFFFFF'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -124,6 +124,8 @@ export function baseGaugeOptionAntV(plot, container, chart, action, scale = 1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
console.log('hasThreshold', hasThreshold)
|
||||||
|
|
||||||
if (hasThreshold) {
|
if (hasThreshold) {
|
||||||
options.range = {
|
options.range = {
|
||||||
color: theme.styleSheet.paletteQualitative10,
|
color: theme.styleSheet.paletteQualitative10,
|
||||||
@ -152,6 +154,17 @@ export function baseGaugeOptionAntV(plot, container, chart, action, scale = 1) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (customAttr.color.gradient) {
|
||||||
|
const colorList = (theme.styleSheet?.paletteQualitative10 || []).map((ele) => `l(0) 0:#ffffff00 1:${ele}`)
|
||||||
|
if (!options.range) {
|
||||||
|
options.range = {
|
||||||
|
color: colorList
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
options.range.color = colorList
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 开始渲染
|
// 开始渲染
|
||||||
if (plot) {
|
if (plot) {
|
||||||
plot.destroy()
|
plot.destroy()
|
||||||
|
|||||||
@ -178,6 +178,17 @@ export function baseAreaOptionAntV(plot, container, chart, action, isStack) {
|
|||||||
}
|
}
|
||||||
// custom color
|
// custom color
|
||||||
options.color = antVCustomColor(chart)
|
options.color = antVCustomColor(chart)
|
||||||
|
const areaColors = [...options.color, ...options.color]
|
||||||
|
if (customAttr.color.gradient) {
|
||||||
|
options.areaStyle = () => {
|
||||||
|
const cr = areaColors.shift()
|
||||||
|
if (cr) {
|
||||||
|
return {
|
||||||
|
fill: `l(270) 0:#ffffff00 1:${cr}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 开始渲染
|
// 开始渲染
|
||||||
if (plot) {
|
if (plot) {
|
||||||
|
|||||||
@ -82,6 +82,12 @@ export function basePieOptionAntV(plot, container, chart, action) {
|
|||||||
// custom color
|
// custom color
|
||||||
options.color = antVCustomColor(chart)
|
options.color = antVCustomColor(chart)
|
||||||
|
|
||||||
|
if (customAttr.color.gradient) {
|
||||||
|
options.color = options.color.map((ele) => {
|
||||||
|
return `l(270) 0:#ffffff00 1:${ele}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 开始渲染
|
// 开始渲染
|
||||||
if (plot) {
|
if (plot) {
|
||||||
plot.destroy()
|
plot.destroy()
|
||||||
@ -159,6 +165,12 @@ export function basePieRoseOptionAntV(plot, container, chart, action) {
|
|||||||
// custom color
|
// custom color
|
||||||
options.color = antVCustomColor(chart)
|
options.color = antVCustomColor(chart)
|
||||||
|
|
||||||
|
if (customAttr.color.gradient) {
|
||||||
|
options.color = options.color.map((ele) => {
|
||||||
|
return `l(270) 0:#ffffff00 1:${ele}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// 开始渲染
|
// 开始渲染
|
||||||
if (plot) {
|
if (plot) {
|
||||||
plot.destroy()
|
plot.destroy()
|
||||||
|
|||||||
@ -280,6 +280,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'color-selector': [
|
'color-selector': [
|
||||||
'value',
|
'value',
|
||||||
'custom',
|
'custom',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -464,7 +465,8 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
'alpha'
|
'alpha',
|
||||||
|
'gradient'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
'lineWidth',
|
'lineWidth',
|
||||||
@ -624,6 +626,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -703,6 +706,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -782,6 +786,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -861,6 +866,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -1004,6 +1010,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -1083,6 +1090,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -1160,6 +1168,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -1219,6 +1228,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -1279,6 +1289,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -1336,6 +1347,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
@ -1396,6 +1408,7 @@ export const TYPE_CONFIGS = [
|
|||||||
'value',
|
'value',
|
||||||
'colorPanel',
|
'colorPanel',
|
||||||
'customColor',
|
'customColor',
|
||||||
|
'gradient',
|
||||||
'alpha'
|
'alpha'
|
||||||
],
|
],
|
||||||
'size-selector-ant-v': [
|
'size-selector-ant-v': [
|
||||||
|
|||||||
@ -151,6 +151,17 @@
|
|||||||
</el-popover>
|
</el-popover>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item
|
||||||
|
v-show="showProperty('gradient')"
|
||||||
|
:label="$t('chart.gradient')"
|
||||||
|
class="form-item"
|
||||||
|
>
|
||||||
|
<el-checkbox
|
||||||
|
v-model="colorForm.gradient"
|
||||||
|
@change="changeColorCase('gradient')"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item
|
<el-form-item
|
||||||
v-show="showProperty('quotaColor')"
|
v-show="showProperty('quotaColor')"
|
||||||
:label="$t('chart.quota_color')"
|
:label="$t('chart.quota_color')"
|
||||||
@ -420,6 +431,7 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
gradientColorChange(colorDto) {
|
gradientColorChange(colorDto) {
|
||||||
|
console.log('gradientColorChange')
|
||||||
const modifyNames = ['value', 'colors', 'seriesColors']
|
const modifyNames = ['value', 'colors', 'seriesColors']
|
||||||
modifyNames.forEach(item => {
|
modifyNames.forEach(item => {
|
||||||
this.colorForm['modifyName'] = item
|
this.colorForm['modifyName'] = item
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user