forked from github/dataease
Merge pull request #12902 from dataease/pr@dev-v2@refactor_tooltip_trigger_area
refactor(图表): 扩大提示的触发范围 #11331 #12044 #12168
This commit is contained in:
commit
09e05f8425
@ -47,46 +47,7 @@ export class Bar extends G2PlotChartView<ColumnOptions, Column> {
|
|||||||
yField: 'value',
|
yField: 'value',
|
||||||
seriesField: 'category',
|
seriesField: 'category',
|
||||||
isGroup: true,
|
isGroup: true,
|
||||||
data: [],
|
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' }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
axis: AxisType[] = [...BAR_AXIS_TYPE]
|
axis: AxisType[] = [...BAR_AXIS_TYPE]
|
||||||
|
@ -131,7 +131,6 @@ export class BidirectionalHorizontalBar extends G2PlotChartView<
|
|||||||
},
|
},
|
||||||
position: 'bottom'
|
position: 'bottom'
|
||||||
},
|
},
|
||||||
interactions: [{ type: 'active-region' }],
|
|
||||||
yField: ['value', 'valueExt'],
|
yField: ['value', 'valueExt'],
|
||||||
appendPadding: getPadding(chart),
|
appendPadding: getPadding(chart),
|
||||||
meta: {
|
meta: {
|
||||||
|
@ -68,46 +68,7 @@ export class HorizontalBar extends G2PlotChartView<BarOptions, Bar> {
|
|||||||
xField: 'value',
|
xField: 'value',
|
||||||
yField: 'field',
|
yField: 'field',
|
||||||
seriesField: 'category',
|
seriesField: 'category',
|
||||||
isGroup: true,
|
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' }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async drawChart(drawOptions: G2PlotDrawOptions<Bar>): Promise<Bar> {
|
async drawChart(drawOptions: G2PlotDrawOptions<Bar>): Promise<Bar> {
|
||||||
|
@ -68,46 +68,7 @@ export class RangeBar extends G2PlotChartView<BarOptions, Bar> {
|
|||||||
xField: 'values',
|
xField: 'values',
|
||||||
yField: 'field',
|
yField: 'field',
|
||||||
colorField: 'category',
|
colorField: 'category',
|
||||||
isGroup: true,
|
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' }]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async drawChart(drawOptions: G2PlotDrawOptions<Bar>): Promise<Bar> {
|
async drawChart(drawOptions: G2PlotDrawOptions<Bar>): Promise<Bar> {
|
||||||
|
@ -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',
|
type: 'active-region',
|
||||||
cfg: {
|
cfg: {
|
||||||
|
@ -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',
|
type: 'active-region',
|
||||||
cfg: {
|
cfg: {
|
||||||
|
@ -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' }]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user