forked from github/dataease
fix(图表): 修复柱线组合图左轴无法根据维度进行自定义颜色问题
This commit is contained in:
parent
512f36a0dc
commit
ca3ba00618
@ -29,7 +29,8 @@ export const CHART_MIX_EDITOR_PROPERTY_INNER: EditorPropertyInner = {
|
|||||||
'lineSymbolSize',
|
'lineSymbolSize',
|
||||||
'lineSmooth',
|
'lineSmooth',
|
||||||
'radiusColumnBar',
|
'radiusColumnBar',
|
||||||
'subSeriesColor'
|
'subSeriesColor',
|
||||||
|
'seriesColor'
|
||||||
],
|
],
|
||||||
'x-axis-selector': [
|
'x-axis-selector': [
|
||||||
'name',
|
'name',
|
||||||
|
@ -279,6 +279,25 @@ export class ColumnLineMix extends G2PlotChartView<DualAxesOptions, DualAxes> {
|
|||||||
...options
|
...options
|
||||||
}
|
}
|
||||||
const basicStyle = parseJson(chart.customAttr).basicStyle as MixChartBasicStyle
|
const basicStyle = parseJson(chart.customAttr).basicStyle as MixChartBasicStyle
|
||||||
|
|
||||||
|
const { seriesColor } = basicStyle
|
||||||
|
if (seriesColor?.length) {
|
||||||
|
const seriesMap = seriesColor.reduce((p, n) => {
|
||||||
|
p[n.id] = n
|
||||||
|
return p
|
||||||
|
}, {})
|
||||||
|
const { yAxis } = chart
|
||||||
|
yAxis?.forEach((axis, index) => {
|
||||||
|
const curAxisColor = seriesMap[axis.id]
|
||||||
|
if (curAxisColor) {
|
||||||
|
if (index + 1 > basicStyle.colors.length) {
|
||||||
|
basicStyle.colors.push(curAxisColor.color)
|
||||||
|
} else {
|
||||||
|
basicStyle.colors[index] = curAxisColor.color
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
//左轴
|
//左轴
|
||||||
const color = basicStyle.colors.map(ele => {
|
const color = basicStyle.colors.map(ele => {
|
||||||
const tmp = hexColorToRGBA(ele, basicStyle.alpha)
|
const tmp = hexColorToRGBA(ele, basicStyle.alpha)
|
||||||
@ -568,10 +587,6 @@ export class GroupColumnLineMix extends ColumnLineMix {
|
|||||||
axis: AxisType[] = [...this['axis'], 'xAxisExt']
|
axis: AxisType[] = [...this['axis'], 'xAxisExt']
|
||||||
propertyInner = {
|
propertyInner = {
|
||||||
...CHART_MIX_EDITOR_PROPERTY_INNER,
|
...CHART_MIX_EDITOR_PROPERTY_INNER,
|
||||||
'dual-basic-style-selector': [
|
|
||||||
...CHART_MIX_EDITOR_PROPERTY_INNER['dual-basic-style-selector'],
|
|
||||||
'seriesColor'
|
|
||||||
],
|
|
||||||
'label-selector': ['vPosition', 'seriesLabelFormatter'],
|
'label-selector': ['vPosition', 'seriesLabelFormatter'],
|
||||||
'tooltip-selector': [
|
'tooltip-selector': [
|
||||||
...CHART_MIX_EDITOR_PROPERTY_INNER['tooltip-selector'],
|
...CHART_MIX_EDITOR_PROPERTY_INNER['tooltip-selector'],
|
||||||
@ -683,10 +698,6 @@ export class StackColumnLineMix extends ColumnLineMix {
|
|||||||
axis: AxisType[] = [...this['axis'], 'extStack']
|
axis: AxisType[] = [...this['axis'], 'extStack']
|
||||||
propertyInner = {
|
propertyInner = {
|
||||||
...CHART_MIX_EDITOR_PROPERTY_INNER,
|
...CHART_MIX_EDITOR_PROPERTY_INNER,
|
||||||
'dual-basic-style-selector': [
|
|
||||||
...CHART_MIX_EDITOR_PROPERTY_INNER['dual-basic-style-selector'],
|
|
||||||
'seriesColor'
|
|
||||||
],
|
|
||||||
'label-selector': ['vPosition', 'seriesLabelFormatter'],
|
'label-selector': ['vPosition', 'seriesLabelFormatter'],
|
||||||
'tooltip-selector': [
|
'tooltip-selector': [
|
||||||
...CHART_MIX_EDITOR_PROPERTY_INNER['tooltip-selector'],
|
...CHART_MIX_EDITOR_PROPERTY_INNER['tooltip-selector'],
|
||||||
|
Loading…
Reference in New Issue
Block a user