ui fix
This commit is contained in:
parent
110b5d10cf
commit
0f96dd5dc3
@ -65,13 +65,21 @@
|
|||||||
item?.close,
|
item?.close,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Find the lowest & highest close values
|
// Convert close values to numbers and filter out any non-numeric entries
|
||||||
const minValue = Math.min(...rawData?.map((item) => item?.close));
|
const validPrices = rawData
|
||||||
const maxValue = Math.max(...rawData?.map((item) => item?.close));
|
?.map((item) => Number(item?.close))
|
||||||
|
?.filter((price) => !isNaN(price));
|
||||||
|
|
||||||
|
// If there are no valid prices, set some default values (or handle this case appropriately)
|
||||||
|
if (validPrices.length === 0) {
|
||||||
|
return {}; // or set default yAxis values
|
||||||
|
}
|
||||||
const padding = 0.015;
|
const padding = 0.015;
|
||||||
|
const minValue = Math.min(...validPrices);
|
||||||
|
const maxValue = Math.max(...validPrices);
|
||||||
const yMin = minValue * (1 - padding);
|
const yMin = minValue * (1 - padding);
|
||||||
const yMax = maxValue * (1 + padding);
|
const yMax = maxValue * (1 + padding);
|
||||||
|
console.log(yMin, yMax);
|
||||||
|
|
||||||
const baseDate =
|
const baseDate =
|
||||||
rawData && rawData?.length ? new Date(rawData?.at(0)?.time) : new Date();
|
rawData && rawData?.length ? new Date(rawData?.at(0)?.time) : new Date();
|
||||||
@ -218,7 +226,7 @@
|
|||||||
{
|
{
|
||||||
value:
|
value:
|
||||||
displayData === "1D"
|
displayData === "1D"
|
||||||
? priceData?.at(0)?.close
|
? data?.getStockQuote?.previousClose
|
||||||
: priceData?.at(0)?.close,
|
: priceData?.at(0)?.close,
|
||||||
dashStyle: "Dash",
|
dashStyle: "Dash",
|
||||||
color: "#fff", // Choose a contrasting color if needed
|
color: "#fff", // Choose a contrasting color if needed
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user