retention chart

This commit is contained in:
syuilo 2022-12-28 14:13:47 +09:00
parent 2547c8c117
commit 8b73f215eb
5 changed files with 236 additions and 47 deletions

View file

@ -39,6 +39,7 @@ import * as os from '@/os';
import { defaultStore } from '@/store';
import { useChartTooltip } from '@/scripts/use-chart-tooltip';
import { chartVLine } from '@/scripts/chart-vline';
import { alpha } from '@/scripts/color';
const props = defineProps({
src: {
@ -101,13 +102,6 @@ Chart.register(
const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b));
const negate = arr => arr.map(x => -x);
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 colors = {
blue: '#008FFB',