bugfixing
This commit is contained in:
parent
fefb1ec1a8
commit
2756964376
@ -68,10 +68,7 @@
|
|||||||
body: JSON.stringify(postData),
|
body: JSON.stringify(postData),
|
||||||
});
|
});
|
||||||
|
|
||||||
toast.success("Thank you for your feedback", {
|
toast.success("Thank you for your feedback");
|
||||||
style:
|
|
||||||
"border-radius: 5px; background: #fff; color: #000; border-color: #4B5563; font-size: 15px;",
|
|
||||||
});
|
|
||||||
|
|
||||||
rating = "";
|
rating = "";
|
||||||
inputValue = "";
|
inputValue = "";
|
||||||
|
|||||||
@ -55,27 +55,36 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Filter the data based on the calculated start date
|
// Filter the data based on the calculated start date
|
||||||
let filteredData = historicalData?.filter((item) => {
|
let filteredData =
|
||||||
if (!item?.date) return false;
|
historicalData?.filter((item) => {
|
||||||
const itemDate = new Date(item.date);
|
if (!item || !item.date) return false; // Ensure item and date are valid
|
||||||
return itemDate >= startDate && itemDate <= currentDate;
|
const itemDate = new Date(item.date);
|
||||||
});
|
return (
|
||||||
|
!isNaN(itemDate) && itemDate >= startDate && itemDate <= currentDate
|
||||||
|
);
|
||||||
|
}) || [];
|
||||||
|
|
||||||
filteredData?.forEach((entry) => {
|
filteredData.forEach((entry) => {
|
||||||
const matchingData = data?.getHistoricalPrice?.find(
|
const matchingData = data?.getHistoricalPrice?.find(
|
||||||
(d) => d?.time === entry?.date,
|
(d) => d?.time === entry?.date,
|
||||||
);
|
);
|
||||||
if (matchingData) {
|
if (matchingData) {
|
||||||
entry.price = matchingData?.close;
|
entry.price = matchingData?.close ?? null; // Ensure price is valid
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Extract the dates and gamma values from the filtered data
|
// Extract the dates and gamma values from the filtered data
|
||||||
const dateList = filteredData?.map((item) => item.date);
|
const dateList = filteredData
|
||||||
const dataList = filteredData?.map((item) =>
|
.map((item) => item.date)
|
||||||
title === "Gamma" ? item.netGex : item.netDex,
|
.filter((date) => date != null); // Filter out null/undefined
|
||||||
);
|
|
||||||
const priceList = filteredData?.map((item) => item.price);
|
const dataList = filteredData
|
||||||
|
.map((item) => (title === "Gamma" ? item.netGex : item.netDex))
|
||||||
|
.filter((value) => value != null); // Filter out null/undefined
|
||||||
|
|
||||||
|
const priceList = filteredData
|
||||||
|
.map((item) => item.price)
|
||||||
|
.filter((price) => price != null); // Filter out null/undefined
|
||||||
|
|
||||||
return { dateList, dataList, priceList };
|
return { dateList, dataList, priceList };
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1204,7 +1204,7 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<slot />
|
<slot />
|
||||||
<Toaster />
|
<Toaster position="top-center" />
|
||||||
|
|
||||||
{#if Cookie && $showCookieConsent === true}
|
{#if Cookie && $showCookieConsent === true}
|
||||||
<Cookie />
|
<Cookie />
|
||||||
|
|||||||
@ -37,18 +37,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function plotData() {
|
function plotData() {
|
||||||
// First, sort and filter your dataset just like before.
|
console.log(dataset);
|
||||||
const plotDataset = [...dataset]?.sort(
|
const plotDataset = [...dataset]?.sort(
|
||||||
(a, b) => new Date(a.date) - new Date(b.date),
|
(a, b) => new Date(a?.date) - new Date(b?.date),
|
||||||
);
|
);
|
||||||
const xData = plotDataset
|
const xData = plotDataset
|
||||||
.filter((item) => item.value !== null) // Filter out null values
|
?.filter((item) => item?.value !== null && item?.value !== undefined) // Filter out null values
|
||||||
.map((item) => item.date); // Get the date strings
|
?.map((item) => item?.date); // Get the date strings
|
||||||
|
|
||||||
const valueList = [];
|
const valueList = [];
|
||||||
for (let i = 0; i < plotDataset.length; i++) {
|
for (let i = 0; i < plotDataset?.length; i++) {
|
||||||
if (plotDataset[i].value !== null) {
|
if (plotDataset[i]?.value) {
|
||||||
valueList.push(plotDataset[i].value);
|
valueList?.push(plotDataset[i]?.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user