refactor
This commit is contained in:
@@ -44,6 +44,7 @@ import { i18n } from '@/i18n';
|
||||
import { useChartTooltip } from '@/scripts/use-chart-tooltip';
|
||||
import { chartVLine } from '@/scripts/chart-vline';
|
||||
import { defaultStore } from '@/store';
|
||||
import { alpha } from '@/scripts/color';
|
||||
|
||||
Chart.register(
|
||||
ArcElement,
|
||||
@@ -63,14 +64,6 @@ Chart.register(
|
||||
gradient,
|
||||
);
|
||||
|
||||
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 chartLimit = 50;
|
||||
const chartEl = $ref<HTMLCanvasElement>();
|
||||
const chartEl2 = $ref<HTMLCanvasElement>();
|
||||
|
Reference in New Issue
Block a user