You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "xavier-GitHub76 (via GitHub)" <gi...@apache.org> on 2024/07/17 14:32:00 UTC
[I] On Country Map, Cross-Filtering is not operational as a source [superset]
xavier-GitHub76 opened a new issue, #29623:
URL: https://github.com/apache/superset/issues/29623
Hello,
Country Map can be filtered by the cross-filtering but it is not operational as a source because a click do zoom on map
Best regards
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] On Country Map, Cross-Filtering is not operational as a source [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #29623: On Country Map, Cross-Filtering is not operational as a source
URL: https://github.com/apache/superset/issues/29623
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] On Country Map, Cross-Filtering is not operational as a source [superset]
Posted by "imad-hl (via GitHub)" <gi...@apache.org>.
imad-hl commented on issue #29623:
URL: https://github.com/apache/superset/issues/29623#issuecomment-2741031617
Any updates on this subject ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] On Country Map, Cross-Filtering is not operational as a source [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #29623:
URL: https://github.com/apache/superset/issues/29623#issuecomment-2233800966
Yep. This is not a bug, really, but a lack of design/implementation for that plugin. Any interest in taking this on? We might close this as an Issue, but I'm happy to move it to an "Ideas" discussion if you want to figure out how to solve it or try to find help with it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] On Country Map, Cross-Filtering is not operational as a source [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #29623:
URL: https://github.com/apache/superset/issues/29623#issuecomment-2233484658
<!-- Answer -->
The `CountryMap` component currently only handles zooming behavior when clicked, and does not apply filters for cross-filtering. To enable cross-filtering, you need to modify the component to include the `emitCrossFilters` prop and handle click events accordingly.
Here's a brief guide on how to do it:
1. **Add the `emitCrossFilters` Prop:**
Ensure that the `CountryMap` component includes the `emitCrossFilters` prop.
```js
const propTypes = {
// ... other props
emitCrossFilters: PropTypes.bool,
// ... other props
};
```
2. **Handle Click Events for Cross-Filtering:**
Modify the click event handler to apply cross-filters if `emitCrossFilters` is enabled.
```js
const handleClick = source => {
if (!emitCrossFilters) {
return;
}
const pointerEvent = d3.event;
pointerEvent.preventDefault();
getCrossFilterDataMask(source);
const dataMask = getCrossFilterDataMask(source)?.dataMask;
if (dataMask) {
setDataMask(dataMask);
}
};
```
3. **Implement `getCrossFilterDataMask`:**
Ensure you have a function to construct the data mask based on the selected country.
```js
const getCrossFilterDataMask = source => {
const selected = Object.values(filterState.selectedValues || {});
const key = source.id || source.country;
const country = mapData[key]?.name || mapData[key]?.country;
if (!country) {
return undefined;
}
let values;
if (selected.includes(key)) {
values = [];
} else {
values = [country];
}
return {
dataMask: {
extraFormData: {
filters: values.length
? [
{
col: entity,
op: 'IN',
val: values,
},
]
: [],
},
filterState: {
value: values.length ? values : null,
selectedValues: values.length ? [key] : null,
},
},
isCurrentValueSelected: selected.includes(key),
};
};
```
By implementing these changes, you can enable cross-filtering functionality in the `CountryMap` component <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.js)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/legacy-plugin-chart-world-map/src/WorldMap.js)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [I] On Country Map, Cross-Filtering is not operational as a source [superset]
Posted by "xavier-GitHub76 (via GitHub)" <gi...@apache.org>.
xavier-GitHub76 commented on issue #29623:
URL: https://github.com/apache/superset/issues/29623#issuecomment-2304278873
I agree that you move this issue to a discussion
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org