fix(stock-price): align sparkline color with displayed price change (#5181)
This commit is contained in:
1 parent
8b79e54245
commit
bbf0adf31a
1 file changed
+2
-1
@@ -33,6 +33,7 @@ export default function StockPriceWidget({ options, width, height }: WidgetCompo
|
|||||||
|
|
||||||
const stockValuesMin = Math.min(...data.priceHistory);
|
const stockValuesMin = Math.min(...data.priceHistory);
|
||||||
const stockGraphValues = data.priceHistory.map((value) => value - stockValuesMin + 50);
|
const stockGraphValues = data.priceHistory.map((value) => value - stockValuesMin + 50);
|
||||||
|
const trendColor = stockValuesChange > 0 ? "green.7" : stockValuesChange < 0 ? "red.7" : "gray.6";
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex h="100%" w="100%">
|
<Flex h="100%" w="100%">
|
||||||
@@ -43,7 +44,7 @@ export default function StockPriceWidget({ options, width, height }: WidgetCompo
|
|||||||
h={height > 280 ? "75%" : "50%"}
|
h={height > 280 ? "75%" : "50%"}
|
||||||
data={stockGraphValues}
|
data={stockGraphValues}
|
||||||
curveType="linear"
|
curveType="linear"
|
||||||
trendColors={{ positive: "green.7", negative: "red.7", neutral: "gray.6" }}
|
color={trendColor}
|
||||||
fillOpacity={0.6}
|
fillOpacity={0.6}
|
||||||
strokeWidth={2.5}
|
strokeWidth={2.5}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user