From 7f90fd1a80ee06838e1b1f560b77a3bda7dbc130 Mon Sep 17 00:00:00 2001 From: Neshura Date: Fri, 2 Jun 2023 01:22:41 +0200 Subject: [PATCH] Chart Labels fix --- components/charts/pops.tsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/components/charts/pops.tsx b/components/charts/pops.tsx index 5ce7d8a..6eba935 100644 --- a/components/charts/pops.tsx +++ b/components/charts/pops.tsx @@ -3,7 +3,7 @@ import useSWR from "swr"; import { Chart as ChartJS, registerables } from 'chart.js'; import { Pie } from "react-chartjs-2"; -import ChartDataLabels from 'chartjs-plugin-datalabels'; +import ChartDataLabels, { Context } from 'chartjs-plugin-datalabels'; import { Species } from '../../types/stellaris'; const fetcher = async (url:any) => await fetch(url).then((res) => res.json()); @@ -74,7 +74,7 @@ export const PopChart = () => { display: true }, datalabels: { - formatter: (value: any, context: any) => { + formatter: (value: any, context: Context) => { if (value > 0) { return Species[context.dataIndex]; } @@ -82,8 +82,7 @@ export const PopChart = () => { return ""; } }, - anchor: 'center', - align: 'end', + color: 'black' }, },