refactor
This commit is contained in:
parent
4c24bd3933
commit
2547c8c117
7 changed files with 42 additions and 77 deletions
|
@ -34,6 +34,7 @@ import { defaultStore } from '@/store';
|
|||
import { useChartTooltip } from '@/scripts/use-chart-tooltip';
|
||||
import { MatrixController, MatrixElement } from 'chartjs-chart-matrix';
|
||||
import { chartVLine } from '@/scripts/chart-vline';
|
||||
import { alpha } from '@/scripts/color';
|
||||
|
||||
Chart.register(
|
||||
ArcElement,
|
||||
|
@ -53,14 +54,6 @@ Chart.register(
|
|||
MatrixController, MatrixElement,
|
||||
);
|
||||
|
||||
const alpha = (hex, a) => {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)!;
|
||||
const r = parseInt(result[1], 16);
|
||||
const g = parseInt(result[2], 16);
|
||||
const b = parseInt(result[3], 16);
|
||||
return `rgba(${r}, ${g}, ${b}, ${a})`;
|
||||
};
|
||||
|
||||
const rootEl = $ref<HTMLDivElement>(null);
|
||||
const chartEl = $ref<HTMLCanvasElement>(null);
|
||||
const now = new Date();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue