diff --git a/src/LineChart.tsx b/src/LineChart.tsx index d42642e..5b98c0d 100644 --- a/src/LineChart.tsx +++ b/src/LineChart.tsx @@ -43,10 +43,6 @@ const getExtraConfig = (extraConfig: ExtraConfig): ExtraConfig => { activeOffsetX: extraConfig.activeOffsetX || EXTRA_CONFIG.activeOffsetX, animationConfig: extraConfig.animationConfig || EXTRA_CONFIG.animationConfig, - invertLineOrder: - extraConfig.invertLineOrder !== undefined - ? extraConfig.invertLineOrder - : EXTRA_CONFIG.invertLineOrder, }; }; function LineChart({ diff --git a/src/SvgPath.tsx b/src/SvgPath.tsx index 88fb9c7..7214999 100644 --- a/src/SvgPath.tsx +++ b/src/SvgPath.tsx @@ -4,7 +4,6 @@ import React, { ReactElement, useCallback, useEffect, - useMemo, } from 'react'; import { interpolate, @@ -88,35 +87,30 @@ const SvgPath = ({ return activeIndexLocal; }, [activeTouchX, lines[0]?.data]); - const checkedLines = useMemo(() => { - if (extraConfig?.invertLineOrder) { - return [...lines].reverse(); - } - return lines; - }, [lines, extraConfig?.invertLineOrder]); - return ( <> - {checkedLines.map((line, index) => { - if (line?.data) { - return ( - - ); - } - // @ts-ignore - return ; - })} + {lines + .filter((line) => line?.data) + .map((line, index) => { + if (line?.data) { + return ( + + ); + } + // @ts-ignore + return ; + })} ); }; diff --git a/src/defaults.tsx b/src/defaults.tsx index e310c12..40fe202 100644 --- a/src/defaults.tsx +++ b/src/defaults.tsx @@ -29,7 +29,6 @@ export const EXTRA_CONFIG = { calculateChartYAxisMinMax: undefined, activeOffsetX: [0, 0], animationConfig: undefined, - invertLineOrder: false, }; export const LINE_CHART = { diff --git a/src/types.ts b/src/types.ts index 3d96a59..ff0a5d5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -221,11 +221,6 @@ export interface ExtraConfig { * Animation configuration */ animationConfig?: AnimationConfig; - /** - * Invert the order of the lines (useful when you want to show the last line on top) - * @default false - */ - invertLineOrder?: boolean; } /**