Ovilia commented on code in PR #20705:
URL: https://github.com/apache/echarts/pull/20705#discussion_r1924783380


##########
src/core/echarts.ts:
##########
@@ -693,10 +685,30 @@ class ECharts extends Eventful<ECEventDefinition> {
     }
 
     /**
-     * @deprecated
+     * Update theme with name or theme option and repaint the chart.
+     * @param theme Theme name or theme option.
      */
-    private setTheme(): void {
-        deprecateLog('ECharts#setTheme() is DEPRECATED in ECharts 3.0');
+    setTheme(theme: string | ThemeOption): void {
+        this._updateTheme(theme);
+        if (this._model) {
+            this._model.setTheme(this._theme);
+            // Force refresh to apply theme changes
+            updateMethods.prepareAndUpdate.call(this, {
+                type: 'themeChanged'
+            });
+        }

Review Comment:
   By calling `updateMethods.prepareAndUpdate`, it will re-render as soon as 
calling `setTheme`. See the demo of test case:
   
   ```ts
   onclick: function () {
       const riverTheme = {
           backgroundColor: '#ccf',
           color: ['#00f'],
           title: {
               textStyle: {
                   color: '#00f'
               }
           }
       };
       chart.setTheme(riverTheme);
   }
   ```
   
   Anything else I need to change?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to