diff --git a/assets/js/lib/echarts.js b/assets/js/lib/echarts.js index 891e65c68..19e63e80e 100644 --- a/assets/js/lib/echarts.js +++ b/assets/js/lib/echarts.js @@ -1,42 +1,4 @@ -import params from "@params"; import * as echarts from "echarts"; -if (params.bundle === true) { - // // Import themes - // import 'echarts/theme/macarons.js' - // import 'echarts/theme/dark.js' - // // Import the echarts core module, which provides the necessary interfaces for using echarts. - // import * as echarts from 'echarts/core' - // // Import bar charts, all suffixed with Chart - // import { BarChart, LineChart } from 'echarts/charts' - // // Import the tooltip, title, rectangular coordinate system, dataset and transform components - // // all suffixed with Component - // import { - // TitleComponent, - // TooltipComponent, - // GridComponent, - // DatasetComponent, - // TransformComponent - // } from 'echarts/components' - // // Features like Universal Transition and Label Layout - // import { LabelLayout, UniversalTransition } from 'echarts/features' - // // Import the Canvas renderer - // // Note that introducing the CanvasRenderer or SVGRenderer is a required step - // import { CanvasRenderer } from 'echarts/renderers' - // // Register the required components - // echarts.use([ - // TitleComponent, - // TooltipComponent, - // GridComponent, - // DatasetComponent, - // TransformComponent, - // BarChart, - // LineChart, - // LabelLayout, - // UniversalTransition, - // CanvasRenderer - // ]) -} - window._echartsOnSwitchTheme = () => { window._echartsArr = window._echartsArr || []; for (let i = 0; i < window._echartsArr.length; i++) { @@ -51,9 +13,8 @@ window._echartsOnSwitchTheme = () => { }; window.switchThemeEventSet.add(window._echartsOnSwitchTheme); window._echartsOnSwitchTheme(); -window._echartsOnResize = () => { +window.addEventListener("resize", () => { for (let i = 0; i < window._echartsArr.length; i++) { window._echartsArr[i].resize(); } -}; -window.resizeEventSet.add(window._echartsOnResize); +}); diff --git a/assets/js/theme.ts b/assets/js/theme.ts index e43e2e512..19c6cb706 100644 --- a/assets/js/theme.ts +++ b/assets/js/theme.ts @@ -771,7 +771,6 @@ function onResize() { if (!window._resizeTimeout) { window._resizeTimeout = window.setTimeout(() => { window._resizeTimeout = null; - for (const event of window.resizeEventSet) event(); initSearch(); }, 100); } @@ -861,7 +860,6 @@ function init() { window.newScrollTop = getScrollTop(); window.oldScrollTop = window.newScrollTop; window.scrollEventSet = new Set(); - window.resizeEventSet = new Set(); window.clickMaskEventSet = new Set(); if (window.objectFitImages) objectFitImages(); initMenuMobile();