mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-11 09:14:23 +01:00
5ce3003b Merge pull request #47 from aCursedComrade/patch-1 c9887cb1 Fix team template git-subtree-dir: CTFd/themes/core-beta git-subtree-split: 5ce3003b4d68352e629ee2d390bc999e7d6b071e
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
import * as echarts from "echarts/core";
|
|
import { LineChart } from "echarts/charts";
|
|
import {
|
|
TitleComponent,
|
|
TooltipComponent,
|
|
GridComponent,
|
|
DatasetComponent,
|
|
TransformComponent,
|
|
LegendComponent,
|
|
ToolboxComponent,
|
|
DataZoomComponent,
|
|
} 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([
|
|
LineChart,
|
|
TitleComponent,
|
|
TooltipComponent,
|
|
GridComponent,
|
|
DatasetComponent,
|
|
TransformComponent,
|
|
LegendComponent,
|
|
ToolboxComponent,
|
|
DataZoomComponent,
|
|
LabelLayout,
|
|
UniversalTransition,
|
|
CanvasRenderer,
|
|
]);
|
|
|
|
export function embed(target, option) {
|
|
let chart = echarts.init(target);
|
|
chart.setOption(option);
|
|
|
|
window.addEventListener("resize", () => {
|
|
if (chart) {
|
|
chart.resize();
|
|
}
|
|
});
|
|
}
|