You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "richardfogaca (via GitHub)" <gi...@apache.org> on 2025/03/19 14:10:55 UTC
[D] Plotly plugin [superset]
GitHub user richardfogaca created a discussion: Plotly plugin
# Plotly Plugin for Superset
## Contribution Summary
New plugin that brings Plotly dynamic visualizations to Superset.
## What We Added
We created a new visualization plugin that lets you use Python and Plotly to create custom charts in Superset. This plugin:
1. Adds a Python code editor directly in Superset's UI
2. Executes Python code on the server to generate Plotly visualizations
3. Renders interactive Plotly charts in Superset dashboards
## How It Works
### Frontend
- A code editor with Python syntax highlighting lets you write Plotly code
- The standard Superset query builder provides data to your visualization
- The Plotly chart renders using react-plotly.js for optimal performance
### Future Improvements (Planned)
- Enhanced error handling with user-friendly error messages
- Syntax validation before submission to prevent server-side errors
- Code templates and snippets for common visualization types
### Backend
- Your Python code runs on the server with access to the query results
- Security measures prevent dangerous code execution
- The generated Plotly JSON is sent to the frontend for rendering
### Security Enhancements (Planned):
- Execution time limits
- Restrict certain imports for security reasons
- Expanded allowlist for safe imports (pandas, numpy, etc.)
## Screenshot
<img width="1181" alt="plotly" src="https://github.com/user-attachments/assets/328e1e5c-f8de-4cf8-84a9-c96c61d377b5" />
## Example Code
Here's a simple example of what you can write in the code editor:
```python
import plotly.graph_objects as go
import plotly.express as px
def get_plotly(df):
# Create a bar chart using the query results
fig = px.bar(
df,
x="category",
y="revenue",
color="region",
title="Revenue by Category and Region"
)
# Customize the layout
fig.update_layout(
legend_title="Region",
xaxis_title="Category",
yaxis_title="Revenue ($)"
)
return fig
```
## Why This Matters
This plugin solves several problems:
1. Visualization Limitations: Standard Superset charts don't cover all use cases
2. Custom Analytics: Some analyses require specialized visualizations
3. Python Workflow: Data scientists often work in Python but need to share results
4. Dynamic Visualizations: Unlike standard ECharts-based visualizations, Plotly charts can be completely customized with Python code, enabling dynamic graphics that adapt to the data
## Limitations
- Cross-Filter: The Plotly plugin currently doesn't support Superset's cross-filtering capabilities (where clicking on one chart filters other charts in the dashboard).
GitHub link: https://github.com/apache/superset/discussions/32756
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this [fork](https://github.com/richardfogaca/superset/tree/plotly-prototype) I'm also attaching a chart I created.
If this feature is interesting for superset just let me know :)
<img width="1213" alt="Screenshot 2025-04-01 at 10 37 16" src="https://github.com/user-attachments/assets/456192e9-0549-4253-8176-fecf18128f7a" />
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
GitHub user rusackas added a comment to the discussion: Plotly plugin
Is it available somewhere to install or preview? Looks cool!
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12623927
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "khomyak5 (via GitHub)" <gi...@apache.org>.
GitHub user khomyak5 added a comment to the discussion: Plotly plugin
@richardfogaca can you send your mail? Your project is very interesting. I want to use your plugin in my work. Tell me, please, do you already have a working version or just a test one? In your repository everything is called "plotly-prototype"
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-13219437
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca added a comment to the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this fork, I'm also attaching a chart I created.
If this feature is interesting for superset just let me know and we can work on a much better version of the plugin :)
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this fork, I'm also attaching a chart I created.
If this feature is interesting for superset just let me know :)
<img width="1213" alt="Screenshot 2025-04-01 at 10 37 16" src="https://github.com/user-attachments/assets/456192e9-0549-4253-8176-fecf18128f7a" />
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this fork, I'm also attaching a chart I created.
If this feature is interesting for superset just let me know and we can work on a much better version of the plugin :)
<img width="1213" alt="Screenshot 2025-04-01 at 10 37 16" src="https://github.com/user-attachments/assets/456192e9-0549-4253-8176-fecf18128f7a" />
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
GitHub user rusackas added a comment to the discussion: Plotly plugin
I love the idea of adding more... the only issue would be that of supporting/maintaining them, where we're already still building/improving/fixing ECharts and haven't completed all the migrations from legacy charts yet.
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12916190
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this fork [fork](https://github.com/richardfogaca/superset/tree/plotly-prototype) I'm also attaching a chart I created.
If this feature is interesting for superset just let me know :)
<img width="1213" alt="Screenshot 2025-04-01 at 10 37 16" src="https://github.com/user-attachments/assets/456192e9-0549-4253-8176-fecf18128f7a" />
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this fork [](https://github.com/richardfogaca/superset/tree/plotly-prototype) I'm also attaching a chart I created.
If this feature is interesting for superset just let me know :)
<img width="1213" alt="Screenshot 2025-04-01 at 10 37 16" src="https://github.com/user-attachments/assets/456192e9-0549-4253-8176-fecf18128f7a" />
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this [fork] (https://github.com/richardfogaca/superset/tree/plotly-prototype), it is based on the tag 5.0.0rc1.
I'm also attaching a chart I created. If this feature is interesting for superset please just let me know :)
<img width="1213" alt="Screenshot 2025-04-01 at 10 37 16" src="https://github.com/user-attachments/assets/456192e9-0549-4253-8176-fecf18128f7a" />
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
> @richardfogaca can you send your mail? Your project is very interesting. I want to use your plugin in my work. Tell me, please, do you already have a working version or just a test one? In your repository everything is called "plotly-prototype"
Hello, I'm glad you enjoyed the plugin :) the version I use at work is in a private repo but what I have in this branch is basically the same: https://github.com/richardfogaca/superset/tree/plotly-prototype
Feel free to reach out at richardfogaca@gmail.com if you have questions
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-13222136
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca added a comment to the discussion: Plotly plugin
> @richardfogaca can you send your mail? Your project is very interesting. I want to use your plugin in my work. Tell me, please, do you already have a working version or just a test one? In your repository everything is called "plotly-prototype"
Hello, I'm glad you enjoyed the plugin :) the version I have in this branch is basically the same as my working version: https://github.com/richardfogaca/superset/tree/plotly-prototype
Feel free to reach out at richardfogaca@gmail.com if you have questions
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-13222136
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this [fork] (https://github.com/richardfogaca/superset/tree/plotly-prototype), it is based on the tag 5.0.0rc1 I'm also attaching a chart I created.
If this feature is interesting for superset just let me know :)
<img width="1213" alt="Screenshot 2025-04-01 at 10 37 16" src="https://github.com/user-attachments/assets/456192e9-0549-4253-8176-fecf18128f7a" />
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "richardfogaca (via GitHub)" <gi...@apache.org>.
GitHub user richardfogaca edited a comment on the discussion: Plotly plugin
Hi @rusackas , I'm glad you liked the idea. I implemented a test version on this [fork] (https://github.com/richardfogaca/superset/tree/plotly-prototype)
I'm also attaching a chart I created. If this feature is interesting for superset please just let me know :)
<img width="1213" alt="Screenshot 2025-04-01 at 10 37 16" src="https://github.com/user-attachments/assets/456192e9-0549-4253-8176-fecf18128f7a" />
[chart_export_20250401T130236.zip](https://github.com/user-attachments/files/19551965/chart_export_20250401T130236.zip)
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12688987
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "ZadeFrontier (via GitHub)" <gi...@apache.org>.
GitHub user ZadeFrontier added a comment to the discussion: Plotly plugin
Plotly is probably the best and the most used charts library available in the market, and I think superset should add it. Most developers love it and use it and its widely used in the BIG DATA realm and Machine Learning use-cases. If superset is not having, its high time we start building this!
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-13467034
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "sudathkg (via GitHub)" <gi...@apache.org>.
GitHub user sudathkg added a comment to the discussion: Plotly plugin
Great Idea, i will look your plotly-prototype
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-13680757
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "CoderSxy (via GitHub)" <gi...@apache.org>.
GitHub user CoderSxy added a comment to the discussion: Plotly plugin
Looks cool! I have used it and added raw queryMode to it
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-14704942
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "lilila (via GitHub)" <gi...@apache.org>.
GitHub user lilila added a comment to the discussion: Plotly plugin
This is a Wonderfull functionality, thanks for sharing
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-12552909
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "ZadeFrontier (via GitHub)" <gi...@apache.org>.
GitHub user ZadeFrontier edited a comment on the discussion: Plotly plugin
Plotly is widely regarded as one of the best and most popular charting libraries available. It is extensively used in the Big Data and Machine Learning domains due to its versatility and ability to handle millions of data points with ease. Given its popularity among developers and its robust capabilities, I strongly believe Superset should integrate Plotly into its offerings. If it is not currently supported, I recommend prioritizing its addition. This would significantly enhance Superset's functionality and align it with the expectations of the developer community. @Dosu, @rusackas, please consider this as a high-priority enhancement.
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-13467036
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [D] Plotly plugin [superset]
Posted by "ZadeFrontier (via GitHub)" <gi...@apache.org>.
GitHub user ZadeFrontier added a comment to the discussion: Plotly plugin
Plotly is probably the best and the most used charts library available in the market, and I think superset should add it. Most developers love it and use it and its widely used in the BIG DATA realm and Machine Learning use-cases. If superset is not having, its high time we start building this!
GitHub link: https://github.com/apache/superset/discussions/32756#discussioncomment-13467036
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org