mirror of
https://github.com/apache/superset.git
synced 2026-05-07 08:54:23 +00:00
fix(bugs): fixing bugs for world map chart (#38030)
This commit is contained in:
@@ -244,18 +244,20 @@ function WorldMap(element: HTMLElement, props: WorldMapProps): void {
|
||||
},
|
||||
];
|
||||
}
|
||||
onContextMenu(pointerEvent.clientX, pointerEvent.clientY, {
|
||||
drillToDetail: drillToDetailFilters,
|
||||
crossFilter: getCrossFilterDataMask(source),
|
||||
drillBy: { filters: drillByFilters, groupbyFieldName: 'entity' },
|
||||
});
|
||||
if (onContextMenu) {
|
||||
onContextMenu(pointerEvent.clientX, pointerEvent.clientY, {
|
||||
drillToDetail: drillToDetailFilters,
|
||||
crossFilter: getCrossFilterDataMask(source),
|
||||
drillBy: { filters: drillByFilters, groupbyFieldName: 'entity' },
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const map = new Datamap({
|
||||
element,
|
||||
width,
|
||||
height,
|
||||
data: processedData,
|
||||
data: mapData,
|
||||
fills: {
|
||||
defaultFill: theme.colorBorder,
|
||||
},
|
||||
@@ -268,6 +270,7 @@ function WorldMap(element: HTMLElement, props: WorldMapProps): void {
|
||||
highlightFillColor: color,
|
||||
highlightBorderWidth: 1,
|
||||
popupTemplate: (geo, d) =>
|
||||
d &&
|
||||
`<div class="hoverinfo"><strong>${d.name}</strong><br>${formatter(
|
||||
d.m1,
|
||||
)}</div>`,
|
||||
@@ -298,7 +301,8 @@ function WorldMap(element: HTMLElement, props: WorldMapProps): void {
|
||||
.selectAll('.datamaps-subunit')
|
||||
.on('contextmenu', handleContextMenu)
|
||||
.on('click', handleClick)
|
||||
.on('mouseover', function onMouseOver() {
|
||||
// Use namespaced events to avoid overriding Datamaps' default tooltip handlers
|
||||
.on('mouseover.fillPreserve', function onMouseOver() {
|
||||
if (inContextMenu) {
|
||||
return;
|
||||
}
|
||||
@@ -311,7 +315,7 @@ function WorldMap(element: HTMLElement, props: WorldMapProps): void {
|
||||
// Store original fill color for restoration
|
||||
element.attr('data-original-fill', originalFill);
|
||||
})
|
||||
.on('mouseout', function onMouseOut() {
|
||||
.on('mouseout.fillPreserve', function onMouseOut() {
|
||||
if (inContextMenu) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user