Jinja filter_values function not working in charts used as annotation in another chart
See original GitHub issueExpected results
the filter_values
function should work in a datasource query used in a chart, even if the chart is used as a annotation chart
Actual results
if a chart is used as a annotation in another chart, the filter_values
function used inside the datasource query doesn’t work, it doesn’t return any value. Important to note: a filter value is selected in the dashboard.
How to reproduce the bug
- Create a line chart to be used as a annotation in another chart. The datasource query should use the
filter_values
function - Create another line chart, add the previosly created line chart as a annotation
- Add the line chart created in the previous step in a dashboard, add a filter box with the same field used as a parameter in the
filter_values
of the Step 1 - The annotation doesn’t show up as expected
Environment
- superset version:
superset version
Superset 0.37.0: Python 3.6.9 Flask 1.1.2 Werkzeug 1.0.1 - python version:
python --version
Python: 3.6.9 - node.js version:
node -v
node: v12.10.0 - npm version:
npm -v
npm: 6.10.3
Checklist
Make sure these boxes are checked before submitting your issue - thank you!
- I have checked the superset logs for python stacktraces and included it here as text if there are any.
- I have reproduced the issue with at least the latest released version of superset.
- I have checked the issue tracker for the same issue and I haven’t found one similar.
Additional context
I changed the following the line if (!isDashboardRequest && fd) {
(line 254) in chartAction.js
to if (fd !== null) {
and it solved the problem but I’m not sure about the impact in other behaviours
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Jinja filter_values function not working in charts used ... - GitHub
if a chart is used as a annotation in another chart, the filter_values function used inside the datasource query doesn't work, it doesn't...
Read more >Template Designer Documentation - Jinja
Template Designer Documentation¶. This document describes the syntax and semantics of the template engine and will be most useful as reference to those ......
Read more >Annotation chart: Filter the data does not work on chart?
I would like to have a question about Google Annotation Chart on the Option Filter Data (displayAnnotationsFilter).
Read more >Intro To Jinja Templating in Apache Superset™ | Preset
The dashboard filters worked by injecting state that the user provides and only whatever is in the filter state can be passed into...
Read more >Superset / Preset : Jinja template to do Filters in array elements
This video explains how to use Jinja templates to filter on array columns and select distinct elements.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lilila , it doesn’t work in explore mode, right now I don’t know how to change it. Thanks for the reference to the issue #10115… so the behaviour is by design.
I agree with you, I don’t get why lose the possibility to add dynamic behaviours to the annotation. Let’s see what @graceguo-supercat says about this.
cc @camilo-uptime, check this thread, this is why we weren’t receiving the filter values in the annotation line chart from the dashboard
Issue-Label Bot is automatically applying the label
#bug
to this issue, with a confidence of 0.95. Please mark this comment with 👍 or 👎 to give our bot feedback!Links: app homepage, dashboard and code for this bot.