Skip to content

Commit

Permalink
Update chart
Browse files Browse the repository at this point in the history
  • Loading branch information
Ru Chern Chong committed Nov 16, 2023
1 parent e996321 commit 13eab00
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions components/Infographic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useState } from "react";
import dynamic from "next/dynamic";
import { ChartData, ChartOptions } from "chart.js";
import { getUniqueMonths } from "@/lib/getUniqueMonths";
import { stringToUniqueColour } from "@/lib/stringToUniqueColour";
// import { stringToUniqueColour } from "@/lib/stringToUniqueColour";
import { transformDataToDatasets } from "@/lib/transformDataToDatasets";
import type { Car, ChartDataset, Dataset } from "@/types";

Expand All @@ -19,8 +19,8 @@ export const Infographic = ({ electricCars }: InfographicProps) => {
electricCars,
).map((car: Dataset) => ({
...car,
borderColor: stringToUniqueColour(car.label),
checked: car.data.some((item) => item >= 10),
// borderColor: stringToUniqueColour(car.label),
checked: car.data.some((item) => item >= 25),
}));

const [datasets, setDatasets] = useState(initialDatasets);
Expand Down Expand Up @@ -63,9 +63,10 @@ export const Infographic = ({ electricCars }: InfographicProps) => {
},
},
y: {
suggestedMin: 0,
title: {
display: true,
text: "No. of Registration",
text: "No. of Registrations",
font: {
weight: "bold",
},
Expand Down
2 changes: 1 addition & 1 deletion types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ export type Dataset = {
};

export interface ChartDataset extends Dataset {
borderColor: string;
// borderColor: string;
checked: boolean;
}

0 comments on commit 13eab00

Please sign in to comment.