You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "Vance-Chen (via GitHub)" <gi...@apache.org> on 2025/12/24 14:06:10 UTC
[I] Annotation cannot be updated synchronously with filter changes. [superset]
Vance-Chen opened a new issue, #36830:
URL: https://github.com/apache/superset/issues/36830
### Bug description
I have a line chart, and add a event annotation to it , the event annotation is a table which change follow the filter changing, but when i change the filter, line chart update, but the annotation in char still older, i need refresh the chart by manual. how to fix it ?
I guess when apply the new filter, the line chart updates, the table which add as a event annotation also updates, but it doesn't render to the line chart.
### Screenshots/recordings
_No response_
### Superset version
master / latest-dev
### Python version
3.9
### Node version
16
### Browser
Chrome
### Additional context
_No response_
### Checklist
- [ ] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [ ] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
--
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] Annotation cannot be updated synchronously with filter changes. [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #36830:
URL: https://github.com/apache/superset/issues/36830#issuecomment-3689894560
<!-- Answer -->
There isn’t a built-in way in Superset to include annotation logic directly in the main chart query, but you can achieve synchronous updates by merging your annotation/event data with your main chart data in a single SQL query. For example, you can use a `UNION ALL` or a `LEFT JOIN` to combine your main data and annotation events, and add a column to distinguish between them (like `series_type = 'main'` or `'event'`). Here’s a simplified example:
```sql
SELECT
date,
value,
'main' AS series_type
FROM main_table
WHERE {{ filter_condition }}
UNION ALL
SELECT
event_date AS date,
NULL AS value,
'event' AS series_type
FROM annotation_table
WHERE {{ filter_condition }}
```
Then, in Superset, plot both series on the same line chart (or Mixed Chart) using the `series_type` column to split the lines or markers. This way, both your main data and annotation events will update together with filters, since they’re fetched in the same query and subject to the same filter propagation.
This approach works best for time series and line charts that support multiple series. You may need to adjust your chart configuration to display the annotation series as markers or lines, and style them differently for clarity. Be aware that this method can increase query complexity and may not be ideal for very large datasets or all chart types.
There’s no official example in the Superset docs, but this pattern is a common workaround and is discussed in community threads as a way to keep reference lines or events in sync with chart data [[source]](https://github.com/apache/superset/issues/35856). The Superset codebase also shows that annotation data is often merged into the main chart data array before rendering, which is similar in spirit to this approach [[source]](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js#L728-L1023).
Let me know if you want a more detailed SQL example or help configuring the chart!
<!-- 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/7465c461-efc2-4e14-b5e5-d051ed12507a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/7465c461-efc2-4e14-b5e5-d051ed12507a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/7465c461-efc2-4e14-b5e5-d051ed12507a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/7465c461-efc2-4e14-b5e5-d051ed12507a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/7465c461-efc2-4e14-b5e5-d051ed12507a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/7465c461-efc2-4e14-b5e5-d051ed12507a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/7465c461-efc2-4e14-b5e5-d051ed12507a?feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=There%20isn%E2%80%99t%20a%20built-in%20way%20in%20Superset%20to%20include%20annotation%20logic%20directly%20in%20the%20main%20chart%20query%2C%20but%20you%20can%20achieve%20synchronous%20updates%20by%20merging%20your%20annotation/event%20data%20with%20your%20main%20chart%20data%20in%20a%20single%20SQL%20query.%20For%20example%2C%20you%20can%20use%20a%20%60UNION%20ALL%60%20or%20a%20%60LEFT%20JOIN%60%20to%20combine%20your%20main%20data%20and%20annotation%20events%2C%20and%20add%20a%20column%20to%20distinguish%20between%20them%20%28like%20%60series_type%20%3D%20%27main%27%60%20or%20%60%27event%27%60%29.%20Here%E2%80%99s%20a%20simplified%20example%3A%0A%0A%60%60%60sql%0ASELECT%0A%20%20date%2C%0A%20%20value%2C%0A%20%20%27main%27%20AS%20series_type%0AFRO
M%20main_table%0AWHERE%20%7B%7B%20filter_condition%20%7D%7D%0A%0AUNION%20ALL%0A%0ASELECT%0A%20%20event_date%20AS%20date%2C%0A%20%20NULL%20AS%20value%2C%0A%20%20%27event%27%20AS%20series_type%0AFROM%20annotation_table%0AWHERE%20%7B%7B%20filter_condition%20%7D%7D%0A%60%60%60%0A%0AThen%2C%20in%20Superset%2C%20plot%20both%20series%20on%20the%20same%20line%20chart%20%28or%20Mixed%20Chart%29%20using%20the%20%60series_type%60%20column%20to%20split%20the%20lines%20or%20markers.%20This%20way%2C%20both%20your%20main%20data%20and%20annotation%20events%20will%20update%20together%20with%20filters%2C%20since%20they%E2%80%99re%20fetched%20in%20the%20same%20query%20and%20subject%20to%20the%20same%20filter%20propagation.%0A%0AThis%20approach%20works%20best%20for%20time%20series%20and%20line%20charts%20that%20support%20multiple%20series.%20You%20may%20need%20to%20adjust%20your%20chart%20configuration%20to%20display%20the%20annotation%20series%20as%20markers%20or%20lines%2C%20and%20style%20them%20diff
erently%20for%20clarity.%20Be%20aware%20that%20this%20method%20can%20increase%20query%20complexity%20and%20may%20not%20be%20ideal%20for%20very%20large%20datasets%20or%20all%20chart%20types.%0A%0AThere%E2%80%99s%20no%20official%20example%20in%20the%20Superset%20docs%2C%20but%20this%20pattern%20is%20a%20common%20workaround%20and%20is%20discussed%20in%20community%20threads%20as%20a%20way%20to%20keep%20reference%20lines%20or%20events%20in%20sync%20with%20chart%20data%20%5B%5Bsource%5D%5D%28https%3A//github.com/apache/superset/issues/35856%29.%20The%20Superset%20codebase%20also%20shows%20that%20annotation%20data%20is%20often%20merged%20into%20the%20main%20chart%20data%20array%20before%20rendering%2C%20which%20is%20similar%20in%20spirit%20to%20this%20approach%20%5B%5Bsource%5D%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset-frontend/plugins/legacy-preset-chart-nvd3/src/NVD3Vis.js%23L728-L1023%29.%0A%0ALet%20me%20know%20if%20you%20want%20a%2
0more%20detailed%20SQL%20example%20or%20help%20configuring%20the%20chart%21) [](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/issues/36830)
--
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] Annotation cannot be updated synchronously with filter changes. [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on issue #36830:
URL: https://github.com/apache/superset/issues/36830#issuecomment-5722441076
moving this to discussions in case if we want to revamp annotations.
--
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] Annotation cannot be updated synchronously with filter changes. [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on issue #36830:
URL: https://github.com/apache/superset/issues/36830#issuecomment-5486062045
This is intentional — #10115 explicitly excludes dashboard filters from annotation queries. Leaving this open since Annotations could use a revamp anyway.
--
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] Annotation cannot be updated synchronously with filter changes. [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe closed issue #36830: Annotation cannot be updated synchronously with filter changes.
URL: https://github.com/apache/superset/issues/36830
--
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] Annotation cannot be updated synchronously with filter changes. [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #36830:
URL: https://github.com/apache/superset/issues/36830#issuecomment-3745708752
Agreed passing filters through to Annotations may make sense in some cases, but not others. The Jinja templating is indeed one way, but honestly, that Annotations feature is in need of a revamp, and "filter controls" should be part of that 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
Re: [I] Annotation cannot be updated synchronously with filter changes. [superset]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #36830:
URL: https://github.com/apache/superset/issues/36830#issuecomment-3689868557
<!-- Greeting -->
Hi @Vance-Chen! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the superset team.
<!-- Answer -->
This is a known limitation in Superset: event annotation layers on line charts do not always update in sync with filter changes. The main chart updates, but the annotation lines can remain stale until you manually refresh the chart or dashboard. This behavior is confirmed by other users and tracked in issues like [#9842](https://github.com/apache/superset/issues/9842).
Technically, annotation queries are supposed to re-run with the latest filters when a chart refreshes, but because annotation fetching and chart data fetching are handled as separate asynchronous requests, they can get out of sync—especially if there are delays or state desynchronization. Recent improvements (see [PR #34383](https://github.com/apache/superset/pull/34383) and [PR #34709](https://github.com/apache/superset/pull/34709)) have made annotation synchronization more robust, but there is still no built-in guarantee that annotations will always update perfectly with every filter change.
Workarounds include: manually refreshing the chart, or (if possible) including the annotation logic in your main chart query so that everything updates together. Also, check your cache settings, as aggressive caching can sometimes cause stale annotation data to persist. For now, minimizing reliance on dynamic annotation tables for critical visual cues is recommended until further improvements land.
You can follow ongoing improvements in the Superset changelog and GitHub for future updates to annotation synchronization.
<!-- 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/aea29a83-09e7-44f3-b850-c1d07760ba9d?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/aea29a83-09e7-44f3-b850-c1d07760ba9d?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/aea29a83-09e7-44f3-b850-c1d07760ba9d?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/aea29a83-09e7-44f3-b850-c1d07760ba9d?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/aea29a83-09e7-44f3-b850-c1d07760ba9d?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/aea29a83-09e7-44f3-b850-c1d07760ba9d?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/aea29a83-09e7-44f3-b850-c1d07760ba9d?feedback_type=other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github) [](https://cursor.com/link/prompt?text=This%20is%20a%20known%20limitation%20in%20Superset%3A%20event%20annotation%20layers%20on%20line%20charts%20do%20not%20always%20update%20in%20sync%20with%20filter%20changes.%20The%20main%20chart%20updates%2C%20but%20the%20annotation%20lines%20can%20remain%20stale%20until%20you%20manually%20refresh%20the%20chart%20or%20dashboard.%20This%20behavior%20is%20confirmed%20by%20other%20users%20and%20tracked%20in%20issues%20like%20%5B%239842%5D%28https%3A//github.com/apache/superset/issues/9842%29.%0A%0ATechnically%2C%20annotation%20queries%20are%20supposed%20to%20re-run%20with%20the%20latest%20filters%20when%20a%20chart%20refreshes%2C%20but%20because%20annotation%20fetching%20and%20chart%20data%20fetching%20are%20handled%20as%20separate%20asynchronous%20req
uests%2C%20they%20can%20get%20out%20of%20sync%E2%80%94especially%20if%20there%20are%20delays%20or%20state%20desynchronization.%20Recent%20improvements%20%28see%20%5BPR%20%2334383%5D%28https%3A//github.com/apache/superset/pull/34383%29%20and%20%5BPR%20%2334709%5D%28https%3A//github.com/apache/superset/pull/34709%29%29%20have%20made%20annotation%20synchronization%20more%20robust%2C%20but%20there%20is%20still%20no%20built-in%20guarantee%20that%20annotations%20will%20always%20update%20perfectly%20with%20every%20filter%20change.%0A%0AWorkarounds%20include%3A%20manually%20refreshing%20the%20chart%2C%20or%20%28if%20possible%29%20including%20the%20annotation%20logic%20in%20your%20main%20chart%20query%20so%20that%20everything%20updates%20together.%20Also%2C%20check%20your%20cache%20settings%2C%20as%20aggressive%20caching%20can%20sometimes%20cause%20stale%20annotation%20data%20to%20persist.%20For%20now%2C%20minimizing%20reliance%20on%20dynamic%20annotation%20tables%20for%20critical%20visual%2
0cues%20is%20recommended%20until%20further%20improvements%20land.%0A%0AYou%20can%20follow%20ongoing%20improvements%20in%20the%20Superset%20changelog%20and%20GitHub%20for%20future%20updates%20to%20annotation%20synchronization.) [](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/issues/36830)
--
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] Annotation cannot be updated synchronously with filter changes. [superset]
Posted by "Vance-Chen (via GitHub)" <gi...@apache.org>.
Vance-Chen commented on issue #36830:
URL: https://github.com/apache/superset/issues/36830#issuecomment-3689878649
Hi Dosu, thank you for you reply.
> including the annotation logic in your main chart query so that everything updates together
for this way, any example to reference?
--
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