Jinja template + dataframe access from Separator'esque Viz
See original GitHub issueMake 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 any
- I have checked the superset logs for python stacktraces and included it here as text if 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
Superset version
0.26
Expected results
A Separator’esque widget that can render not just html or text, but can interpolate variables and even include branching logic. I’d imagine that being able to insert Jinja templating with access to the pandas dataframe would suffice.
The reason for it, is that I want to create more descriptive text that might help to explain the data being visualised. For example, the final rendered text may look something like:
“USA’s population is growing slower (by 5%) than Australia’s”
And the Jinja template may look something like (It’s been years since I’ve done Jinja, so forgive any errors):
<text>
{% if df[df.country == 'USA'].growth < if df[df.country == 'Australia'].growth %}
USA's population is growing slower by ( {{ df[df.country == 'USA'].growth }} )
than Australia's.
{% else %}
USA's population is growing faster than Australia's.
{% endif %}
</text>
I have spent only 5 minutes looking at this, but I suspect we would need a viz object that builds a dataframe based on the form data (i.e columns, metrics, group by etc) as other Viz objects do, but also have a textarea like MarkupViz
to save our template.
Anyway, the implementation details would need to be worked out, but for me this would be a great addition as well as for others potentially.
Thoughts ?
Actual results
This feature does not exist AFAIK.
Steps to reproduce
Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:12 (2 by maintainers)
Top GitHub Comments
Here’s a screen-shot of the first iteration of it.
Sorry, just seeing this comment now. I have been using it on our local Superset instance. Will push a patch up this evening but from memory it doesn’t look totally different to yours @ankoh