question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Jinja filter_values function not working in charts used as annotation in another chart

See original GitHub issue

Expected 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

  1. Create a line chart to be used as a annotation in another chart. The datasource query should use the filter_values function
  2. Create another line chart, add the previosly created line chart as a annotation
  3. 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
  4. 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 image

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
oashtoncommented, Sep 28, 2020

@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

1reaction
issue-label-bot[bot]commented, Sep 9, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found