diff --git a/src/chart/chart-types.ts b/src/chart/chart-types.ts index 97bacf1..842dd78 100644 --- a/src/chart/chart-types.ts +++ b/src/chart/chart-types.ts @@ -1,17 +1,8 @@ -import { ChartType, ChartData, ChartOptions, DefaultDataPoint, Plugin } from 'chart.js'; +import { ChartType, ChartData, ChartOptions, DefaultDataPoint } from 'chart.js'; export const EVENT_CHART_CHANGED: string = "chart/changed"; export const EVENT_CHART_PARSE: string = "chart/parse"; -/** - * Main props for the Chart - */ -export interface TypeChartProps, TLabel = unknown> { - data: ChartData; - options: ChartOptions | OptionsGeoChart; - plugins?: Plugin[]; -} - export type OptionsParameters = { chart: ChartType; featuresUsePalette?: boolean; diff --git a/src/chart/chart.tsx b/src/chart/chart.tsx index c67b203..a34f8c8 100644 --- a/src/chart/chart.tsx +++ b/src/chart/chart.tsx @@ -1,7 +1,7 @@ // import { useEffect, useState } from 'react'; import { Box } from '@mui/material'; -import { ChartType, ChartData, ChartOptions, DefaultDataPoint } from 'chart.js'; -import { TypeChartProps, ChartPayloadChanged, ChartPayloadParse, OptionsGeoChart, EVENT_CHART_CHANGED, EVENT_CHART_PARSE } from './chart-types'; +import { ChartType, ChartData, ChartOptions, DefaultDataPoint, Plugin } from 'chart.js'; +import { ChartPayloadChanged, ChartPayloadParse, OptionsGeoChart, EVENT_CHART_CHANGED, EVENT_CHART_PARSE } from './chart-types'; import { formatGenericData, formatGenericOptions } from './chart-parser'; import { ChartDoughnut } from './charts/chart-doughnut'; import { ChartBarsVertical } from './charts/chart-bars-vertical'; @@ -9,13 +9,23 @@ import { ChartPie } from './charts/chart-pie'; import { ChartLine } from './charts/chart-line'; import styles from "./chart.module.css"; + +/** + * Main props for the Chart + */ +export interface TypeChartProps, TLabel = string> { + data: ChartData; + options: ChartOptions | OptionsGeoChart; + plugins?: Plugin[]; +} + /** * Create a customized Chart UI * * @param {TypeChartProps} props the properties passed to the Chart element * @returns {JSX.Element} the created Chart element */ -export function Chart(props: TypeChartProps, unknown>): JSX.Element { +export function Chart(props: TypeChartProps, string>): JSX.Element { // Fetch the cgpv module const w = window as any; const cgpv = w['cgpv'];