apache / apache/superset

Problem Exporting Charts as Image

Open
#28,713 22 comments 5 reactions 0 assignees View on GitHub
viz:charts:export
Dominant language
Python
Stars
74.8k
Forks
18.3k
Avg merge
2d 7h
Merged PRs (30d)
692

Description

### Bug description

Hi Superset Community,

I have a problem exporting Charts as Image, from multiple Dashboards and instance of Superset.

### How to reproduce the bug

1. Go to a Dashboards with Charts
2. Click the three dots on the top right of a charts
3. Download => Download as Image

### Screenshots/recordings

Here is the result for my charts :
![valeur-moyennes-selon-surface-2024-05-27T14-20-12 529Z](https://github.com/apache/superset/assets/100453363/127e9e1e-e5b7-49dc-a538-f1401d9a9ed8)

I was wondering if maybe this was related to the fact that the query is quite complicated + a lot of filters in the dashboard so i tried to export another charts from the examples datasets.

![genders-2024-05-27T14-21-50 342Z](https://github.com/apache/superset/assets/100453363/a736255c-cdd2-4469-bae8-d7e95fcd02be)

Not quite right too...

### Superset version

4.0.1

### Python version

3.10

### Node version

Not applicable

### Browser

Firefox

### Additional context

I use Apache Superset 4.0.1 in Local using Windows and a WSL Backend, but this problem was also on my prod. env with Apache Superset 4.0.0 used with Cloudron which handles the deployment.

Even if template processing is ON, i can't download image, with or without Jinja Templating in them.

Here are my superset_config.py flags in local :
```
SECRET_KEY` = ""

SQLALCHEMY_DATABASE_URI = ''

WTF_CSRF_ENABLED = True (tried with False too...)
WTF_CSRF_EXEMPT_LIST = []
# A CSRF token that expires in 1 year
WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365

MAPBOX_API_KEY = ''

LANGUAGES = {
'en': {'flag': 'us', 'name': 'English'},
'fr': {'flag': 'fr', 'name': 'French'}
}

ENABLE_JAVASCRIPT_CONTROLS = True

APP_NAME = "Superset Local"

WELCOME_MESSAGE = "secret"

PRIMARY_COLOR = "green"

ENABLE_TEMPLATE_PROCESSING = True

CONTENT_SECURITY_POLICY_WARNING = False

TALISMAN_ENABLED = False

DEFAULT_FEATURE_FLAGS = {
"ENABLE_TEMPLATE_PROCESSING" : True,
}
```

Here is my python stack trace, minus the get and post request :
````
Superset.explore_json This API endpoint is deprecated and will be removed in version 4.0.0
2024-05-27 16:34:36,711:WARNING:superset.views.base:Superset.explore_json This API endpoint is deprecated and will be removed in version 4.0.0
2024-05-27 16:34:36,717:DEBUG:parsedatetime:eval - with context - False, False
```

### Checklist

- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] 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.

Contributor guide

Open the contributing guide

Research direction

Reproduce the Download as Image flow from a dashboard chart in Superset 4.0.1 using Firefox, including an example dataset, and inspect the Superset.explore_json log entry shown in the report. Compare the exported result with the chart shown in the dashboard; the issue is done when image exports render the chart correctly for both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.