Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion frontend/src/components/DashboardCharts.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,42 @@
<script lang="ts">
import { onMount, onDestroy } from "svelte";
import Chart from "chart.js/auto";
// chart.js/auto registers every controller/scale/plugin Chart.js ships
// (radar, bubble, scatter, filler, decimation...) - none of which this
// dashboard uses. Registering only line/bar/pie + what they need cuts
// the bundle roughly in half.
import {
Chart,
LineController,
BarController,
PieController,
CategoryScale,
LinearScale,
PointElement,
LineElement,
BarElement,
ArcElement,
Title,
Legend,
Tooltip,
} from "chart.js";
import { CURRENCY_SYMBOL } from "../lib/format";
import type { ExploitationDashboard } from "../lib/types";

Chart.register(
LineController,
BarController,
PieController,
CategoryScale,
LinearScale,
PointElement,
LineElement,
BarElement,
ArcElement,
Title,
Legend,
Tooltip,
);

export let dashboard: ExploitationDashboard;

let costCanvas: HTMLCanvasElement;
Expand Down
Loading