Merge pull request #12902 from dataease/pr@dev-v2@refactor_tooltip_trigger_area

refactor(图表): 扩大提示的触发范围 #11331 #12044 #12168
This commit is contained in:
wisonic-s 2024-10-24 19:58:17 +08:00 committed by GitHub
commit 09e05f8425
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 3 additions and 142 deletions

View File

@ -47,46 +47,7 @@ export class Bar extends G2PlotChartView<ColumnOptions, Column> {
yField: 'value',
seriesField: 'category',
isGroup: true,
data: [],
interactions: [
{
type: 'legend-active',
cfg: {
start: [{ trigger: 'legend-item:mouseenter', action: ['element-active:reset'] }],
end: [{ trigger: 'legend-item:mouseleave', action: ['element-active:reset'] }]
}
},
{
type: 'legend-filter',
cfg: {
start: [
{
trigger: 'legend-item:click',
action: [
'list-unchecked:toggle',
'data-filter:filter',
'element-active:reset',
'element-highlight:reset'
]
}
]
}
},
{
type: 'tooltip',
cfg: {
start: [{ trigger: 'interval:mousemove', action: 'tooltip:show' }],
end: [{ trigger: 'interval:mouseleave', action: 'tooltip:hide' }]
}
},
{
type: 'active-region',
cfg: {
start: [{ trigger: 'interval:mousemove', action: 'active-region:show' }],
end: [{ trigger: 'interval:mouseleave', action: 'active-region:hide' }]
}
}
]
data: []
}
axis: AxisType[] = [...BAR_AXIS_TYPE]

View File

@ -131,7 +131,6 @@ export class BidirectionalHorizontalBar extends G2PlotChartView<
},
position: 'bottom'
},
interactions: [{ type: 'active-region' }],
yField: ['value', 'valueExt'],
appendPadding: getPadding(chart),
meta: {

View File

@ -68,46 +68,7 @@ export class HorizontalBar extends G2PlotChartView<BarOptions, Bar> {
xField: 'value',
yField: 'field',
seriesField: 'category',
isGroup: true,
interactions: [
{
type: 'legend-active',
cfg: {
start: [{ trigger: 'legend-item:mouseenter', action: ['element-active:reset'] }],
end: [{ trigger: 'legend-item:mouseleave', action: ['element-active:reset'] }]
}
},
{
type: 'legend-filter',
cfg: {
start: [
{
trigger: 'legend-item:click',
action: [
'list-unchecked:toggle',
'data-filter:filter',
'element-active:reset',
'element-highlight:reset'
]
}
]
}
},
{
type: 'tooltip',
cfg: {
start: [{ trigger: 'interval:mousemove', action: 'tooltip:show' }],
end: [{ trigger: 'interval:mouseleave', action: 'tooltip:hide' }]
}
},
{
type: 'active-region',
cfg: {
start: [{ trigger: 'interval:mousemove', action: 'active-region:show' }],
end: [{ trigger: 'interval:mouseleave', action: 'active-region:hide' }]
}
}
]
isGroup: true
}
async drawChart(drawOptions: G2PlotDrawOptions<Bar>): Promise<Bar> {

View File

@ -68,46 +68,7 @@ export class RangeBar extends G2PlotChartView<BarOptions, Bar> {
xField: 'values',
yField: 'field',
colorField: 'category',
isGroup: true,
interactions: [
{
type: 'legend-active',
cfg: {
start: [{ trigger: 'legend-item:mouseenter', action: ['element-active:reset'] }],
end: [{ trigger: 'legend-item:mouseleave', action: ['element-active:reset'] }]
}
},
{
type: 'legend-filter',
cfg: {
start: [
{
trigger: 'legend-item:click',
action: [
'list-unchecked:toggle',
'data-filter:filter',
'element-active:reset',
'element-highlight:reset'
]
}
]
}
},
{
type: 'tooltip',
cfg: {
start: [{ trigger: 'interval:mousemove', action: 'tooltip:show' }],
end: [{ trigger: 'interval:mouseleave', action: 'tooltip:hide' }]
}
},
{
type: 'active-region',
cfg: {
start: [{ trigger: 'interval:mousemove', action: 'active-region:show' }],
end: [{ trigger: 'interval:mouseleave', action: 'active-region:hide' }]
}
}
]
isGroup: true
}
async drawChart(drawOptions: G2PlotDrawOptions<Bar>): Promise<Bar> {

View File

@ -83,13 +83,6 @@ export class Area extends G2PlotChartView<AreaOptions, G2Area> {
]
}
},
{
type: 'tooltip',
cfg: {
start: [{ trigger: 'point:mousemove', action: 'tooltip:show' }],
end: [{ trigger: 'point:mouseleave', action: 'tooltip:hide' }]
}
},
{
type: 'active-region',
cfg: {

View File

@ -100,13 +100,6 @@ export class Line extends G2PlotChartView<LineOptions, G2Line> {
]
}
},
{
type: 'tooltip',
cfg: {
start: [{ trigger: 'point:mousemove', action: 'tooltip:show' }],
end: [{ trigger: 'point:mouseleave', action: 'tooltip:hide' }]
}
},
{
type: 'active-region',
cfg: {

View File

@ -126,13 +126,6 @@ export class Scatter extends G2PlotChartView<ScatterOptions, G2Scatter> {
}
]
}
},
{
type: 'tooltip',
cfg: {
start: [{ trigger: 'point:mousemove', action: 'tooltip:show' }],
end: [{ trigger: 'point:mouseleave', action: 'tooltip:hide' }]
}
}
]
}