diff --git a/libs/ui-toolkit/src/components/sparkline/sparkline.stories.tsx b/libs/ui-toolkit/src/components/sparkline/sparkline.stories.tsx index 395ee8dee..7d468d2c6 100644 --- a/libs/ui-toolkit/src/components/sparkline/sparkline.stories.tsx +++ b/libs/ui-toolkit/src/components/sparkline/sparkline.stories.tsx @@ -72,7 +72,7 @@ LessThan24HoursIncrease.args = { export const LessThan24HoursDecrease = Template.bind({}); LessThan24HoursDecrease.args = { - data: [20, 21, 22, 23, 24, 6, 7, 9, 11, 13, 11, 9], + data: [20990000, 20939973, 20980130], width: 110, height: 30, }; diff --git a/libs/ui-toolkit/src/components/sparkline/sparkline.tsx b/libs/ui-toolkit/src/components/sparkline/sparkline.tsx index f34df357c..7839bce68 100644 --- a/libs/ui-toolkit/src/components/sparkline/sparkline.tsx +++ b/libs/ui-toolkit/src/components/sparkline/sparkline.tsx @@ -44,14 +44,12 @@ export const SparklineView = ({ return null; } - const midValue = (min + max) / 2; - // Market may be less than 24hr old so padd the data array // with values that is the mid value (avg of min and max). // This will rendera horizontal line until the real data shifts the line - const padCount = data.length < points ? points - data.length : 0; - const padArr = new Array(padCount).fill(midValue); const trimmedData = data.slice(-points); + const padCount = data.length < points ? points - data.length : 0; + const padArr = new Array(padCount).fill(trimmedData[0]); // Get the last 24 values if data has more than needed const lineData: [number, number][] = [...padArr, ...trimmedData].map(