Skip to content

Commit

Permalink
fix: echarts resize
Browse files Browse the repository at this point in the history
  • Loading branch information
HEIGE-PCloud committed May 16, 2024
1 parent 1101df2 commit 1a1ab16
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 43 deletions.
43 changes: 2 additions & 41 deletions assets/js/lib/echarts.js
Original file line number Diff line number Diff line change
@@ -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++) {
Expand All @@ -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);
});
2 changes: 0 additions & 2 deletions assets/js/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 1a1ab16

Please sign in to comment.