GitHub user dosubot[bot] added a comment to the discussion: How to modify the setDataMask method.
<!-- Greeting --> Hi @MidnightOakMapleNote! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team. <!-- Answer --> To persist your x-axis highlighting across cross-filter interactions, you’ll need to ensure that your custom selection/highlighting state is included in the data mask managed by setDataMask and that your chart components read from this state when rendering. The setDataMask method is a Redux action creator used throughout Superset’s frontend to update filter and selection state for cross-filtering. It’s typically called from chart components or hooks (like useSetDataMask), and the updated state is stored in Redux and consumed by charts for rendering. If your highlighting disappears after cross-filtering, it’s likely because the custom state (e.g., which x-axis value is highlighted) isn’t being persisted or merged correctly in the data mask when other charts dispatch setDataMask updates. To address this, you should: - Extend the dataMask payload to include your custom highlighting state (for example, add a highlightedXValue or similar property). - Update your chart’s rendering logic to read this property from the data mask and apply the correct highlighting/greying. - Ensure that when setDataMask is called (by any chart), it merges or preserves your custom state as needed, rather than overwriting it. This may require customizing the reducer or the logic that constructs the new data mask object, so your highlighting state isn’t lost on unrelated filter changes. You can see how setDataMask is wired up in components like ChartRenderer, where it’s bound to updateDataMask and dispatched to Redux. Cross-filtering is managed via hooks and properties like emitCrossFilters in chart containers, and the data mask is updated conditionally based on user interactions. For more details, see the relevant code and discussions: - [ChartRenderer and setDataMask usage](https://github.com/apache/superset/pull/33779) - [Cross-filtering and data mask management in deck.gl charts](https://github.com/apache/superset/pull/33789) - [Redux data mask state handling](https://github.com/apache/superset/pull/33271) Carefully test your changes to ensure your custom state persists across all relevant interactions. If you need to support more complex state merging, you may need to adjust the reducer logic that handles SET_DATA_MASK actions. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b78a668e-c371-44f5-82ec-77f09ea3861c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b78a668e-c371-44f5-82ec-77f09ea3861c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b78a668e-c371-44f5-82ec-77f09ea3861c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b78a668e-c371-44f5-82ec-77f09ea3861c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b78a668e-c371-44f5-82ec-77f09ea3861c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b78a668e-c371-44f5-82ec-77f09ea3861c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b78a668e-c371-44f5-82ec-77f09ea3861c?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)& nbsp;[](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34343) GitHub link: https://github.com/apache/superset/discussions/34343#discussioncomment-13904922 ---- This is an automatically sent email for notifications@superset.apache.org. To unsubscribe, please send an email to: notifications-unsubscr...@superset.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org