feat: reduce echarts bundle size

This commit is contained in:
草师傅 2025-08-10 19:40:17 +08:00
parent 5772bc9bcd
commit 28baacbf0d
Signed by: gb
GPG key ID: 43330A030E2D6478

View file

@ -43,8 +43,30 @@ const allData = [
</div> </div>
</div> </div>
<script> <script>
import * as echarts from 'echarts'; // Import the echarts core module, which provides the necessary interfaces for using echarts.
console.log(JSON.parse(document.getElementById('heatmap-data')?.getAttribute('data-chartdata'))) import * as echarts from 'echarts/core';
import { HeatmapChart } from 'echarts/charts';
// Import the title, tooltip, calendar and visual map components
import {
TitleComponent,
TooltipComponent,
VisualMapComponent,
CalendarComponent,
} from 'echarts/components';
// Import the Canvas renderer
import { CanvasRenderer } from 'echarts/renderers';
// Register the required components
echarts.use([
HeatmapChart,
TitleComponent,
TooltipComponent,
VisualMapComponent,
CalendarComponent,
CanvasRenderer
]);
function setupHeatmap() { function setupHeatmap() {
const chartElement = document.getElementById('heatmap-chart'); const chartElement = document.getElementById('heatmap-chart');
if (!chartElement) { if (!chartElement) {