bugfixing
This commit is contained in:
parent
918f2578ce
commit
c8723ddca0
@ -66,25 +66,27 @@ function computeWinRate(data) {
|
|||||||
|
|
||||||
|
|
||||||
function getPlotOptions() {
|
function getPlotOptions() {
|
||||||
let dates = [];
|
let dates = [];
|
||||||
const returnMap = {};
|
const returnMap = {};
|
||||||
const reverseData = data?.getCramerTracker?.reverse();
|
|
||||||
// Iterate over the data and sum the returnSince values for each unique date
|
|
||||||
reverseData?.forEach(item => {
|
|
||||||
const { date, returnSince } = item;
|
|
||||||
|
|
||||||
if (returnMap[date]) {
|
// Iterate over the data and sum the returnSince values for each unique date
|
||||||
returnMap[date] += returnSince; // Add to the existing return
|
rawData?.forEach(item => {
|
||||||
} else {
|
const { date, returnSince } = item;
|
||||||
returnMap[date] = returnSince; // Initialize the return for this date
|
|
||||||
dates.push(date); // Save the unique date in the dates array
|
if (returnMap[date]) {
|
||||||
}
|
returnMap[date] += returnSince; // Add to the existing return
|
||||||
});
|
} else {
|
||||||
|
returnMap[date] = returnSince; // Initialize the return for this date
|
||||||
|
dates.push(date); // Save the unique date in the dates array
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Sort dates in ascending order (earliest date first, latest date last)
|
||||||
|
dates?.sort((a, b) => new Date(a) - new Date(b));
|
||||||
|
|
||||||
|
// Convert the returnMap to an array of objects (cumulativeList) in the correct order
|
||||||
|
cumulativeList = dates?.map(date => (returnMap[date]?.toFixed(1)));
|
||||||
|
|
||||||
// Convert the returnMap to an array of objects (cumulativeList)
|
|
||||||
cumulativeList = Object?.keys(returnMap)?.map(date => (
|
|
||||||
returnMap[date]?.toFixed(1)
|
|
||||||
));
|
|
||||||
|
|
||||||
//console.log('Cumulative List:', cumulativeList);
|
//console.log('Cumulative List:', cumulativeList);
|
||||||
//console.log('Unique Dates:', dates);
|
//console.log('Unique Dates:', dates);
|
||||||
@ -373,7 +375,6 @@ function getPlotOptions() {
|
|||||||
</Card.Root>
|
</Card.Root>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user