mirror of
https://github.com/dataease/dataease.git
synced 2026-06-16 11:21:44 +08:00
fix(图表): 优化图例导航方向和布局逻辑
This commit is contained in:
@@ -421,6 +421,7 @@ export class Bar extends G2ChartView<ViewSpec, G2Column> {
|
||||
? 'flex-end'
|
||||
: 'center'
|
||||
}
|
||||
const verticalLegend = position === 'left' || position === 'right'
|
||||
legend = {
|
||||
color: {
|
||||
orientation: orient,
|
||||
@@ -435,9 +436,8 @@ export class Bar extends G2ChartView<ViewSpec, G2Column> {
|
||||
navPageNumFontSize: legendSize,
|
||||
navPageNumFill: legendColor,
|
||||
navButtonSize: legendSize,
|
||||
navOrientation:
|
||||
position === 'left' || position === 'right' ? 'vertical' : 'horizontal',
|
||||
maxRows: 1,
|
||||
navOrientation: verticalLegend ? 'vertical' : 'horizontal',
|
||||
...(verticalLegend ? { maxCols: 1 } : { maxRows: 1 }),
|
||||
navControllerSpacing: 20
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ export abstract class G2ChartView<
|
||||
} else {
|
||||
position = l.hPosition
|
||||
}
|
||||
const verticalLegend = position === 'left' || position === 'right'
|
||||
legend = {
|
||||
position,
|
||||
layout: {
|
||||
@@ -70,7 +71,9 @@ export abstract class G2ChartView<
|
||||
navPageNumFontSize: legendSize,
|
||||
navPageNumFill: legendColor,
|
||||
navButtonSize: legendSize,
|
||||
navOrientation: position === 'left' || position === 'right' ? 'vertical' : 'horizontal'
|
||||
navOrientation: verticalLegend ? 'vertical' : 'horizontal',
|
||||
navControllerSpacing: 4,
|
||||
...(verticalLegend ? { maxCols: 1 } : { maxRows: 1 })
|
||||
}
|
||||
} else {
|
||||
legend = false
|
||||
@@ -136,6 +139,8 @@ export abstract class G2ChartView<
|
||||
}
|
||||
|
||||
public setupSubSeriesColor(chart: ChartObj, data?: any[]): ChartBasicStyle['seriesColor'] {
|
||||
void chart
|
||||
void data
|
||||
return undefined
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user