delay point updates and fix randomizer

This commit is contained in:
3zachm 2023-01-29 22:55:49 -08:00
parent 21d02b7d31
commit 1df852500d
2 changed files with 22 additions and 16 deletions
components/userpage

View file

@ -18,7 +18,20 @@ interface RankChartProps {
Chart.register(CategoryScale, LinearScale, PointElement, LineElement, Tooltip);
function RankChart(props: RankChartProps) {
let delayed: boolean;
const options: ChartOptions<"line"> = {
animation: {
onComplete: () => {
delayed = true;
},
delay: (context) => {
let delay = 0;
if (context.type === "data" && context.mode === "default" && !delayed) {
delay = context.dataIndex * 9;
}
return delay;
},
},
plugins: {
tooltip: {
mode: "index",