Skip to content

Conversation

@umairabid
Copy link
Contributor

@umairabid umairabid commented Sep 7, 2025

Enhancement: Dynamic ECharts Theme Loading

This pull request introduces a new function, RailsCharts.loadTheme, to improve how ECharts themes are managed and loaded within the gem. When loaded via rails the IIFE of themes seems to miss the context of windows and hence this becomes undefined. This PR fixes it by adding a function to dynamically load the themes file, while using windows as context

How to Use

Users should now import themes by calling the new RailsCharts.loadTheme function

// application.js
import "echarts" 
import "echarts.themeloader"

// Load the desired theme dynamically
RailsCharts.loadTheme('dark');

@umairabid
Copy link
Contributor Author

Fixes #34 and closes #25

@igorkasyanchuk
Copy link
Contributor

@umairabid could you please add this to readme. And I think this should be mentioned as alternative option how to load themes doesn't work.

@umairabid
Copy link
Contributor Author

@igorkasyanchuk Updated

@igorkasyanchuk igorkasyanchuk merged commit 05a3755 into railsjazz:main Sep 13, 2025
@igorkasyanchuk
Copy link
Contributor

thank you! plan to release today

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants