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