bugfixing forecast page
This commit is contained in:
parent
f2763c6e32
commit
a3e41cb908
@ -123,14 +123,13 @@
|
|||||||
|
|
||||||
function findIndex(data) {
|
function findIndex(data) {
|
||||||
const currentYear = new Date().getFullYear();
|
const currentYear = new Date().getFullYear();
|
||||||
|
|
||||||
// Find the index where the item's date is greater than or equal to the current year and revenue is null
|
// Find the index where the item's date is greater than or equal to the current year and revenue is null
|
||||||
const index = data.findIndex(
|
let index = data.findIndex(
|
||||||
(item) => item.date > currentYear && item.revenue === null,
|
(item) => item.date >= currentYear && item?.revenue === null,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check if there is any item for the current year with non-null revenue
|
// Check if there is any item for the current year with non-null revenue
|
||||||
const hasNonNullRevenue = data.some(
|
const hasNonNullRevenue = data?.some(
|
||||||
(item) => item.date === currentYear && item.revenue !== null,
|
(item) => item.date === currentYear && item.revenue !== null,
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -171,19 +170,21 @@
|
|||||||
dates.push(`FY${date}`);
|
dates.push(`FY${date}`);
|
||||||
switch (dataType) {
|
switch (dataType) {
|
||||||
case "Revenue":
|
case "Revenue":
|
||||||
valueList.push(item?.revenue);
|
valueList.push(isAfterStartIndex ? null : item.revenue);
|
||||||
avgList.push(isAfterStartIndex ? item.estimatedRevenueAvg : null);
|
avgList.push(isAfterStartIndex ? item?.estimatedRevenueAvg : null);
|
||||||
lowList.push(isAfterStartIndex ? item.estimatedRevenueLow : null);
|
lowList.push(isAfterStartIndex ? item?.estimatedRevenueLow : null);
|
||||||
highList.push(isAfterStartIndex ? item.estimatedRevenueHigh : null);
|
highList.push(
|
||||||
|
isAfterStartIndex ? item?.estimatedRevenueHigh : null,
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case "EPS":
|
case "EPS":
|
||||||
valueList.push(item?.eps);
|
valueList.push(isAfterStartIndex ? null : item.eps);
|
||||||
avgList.push(isAfterStartIndex ? item.estimatedEpsAvg : null);
|
avgList.push(isAfterStartIndex ? item.estimatedEpsAvg : null);
|
||||||
lowList.push(isAfterStartIndex ? item.estimatedEpsLow : null);
|
lowList.push(isAfterStartIndex ? item.estimatedEpsLow : null);
|
||||||
highList.push(isAfterStartIndex ? item.estimatedEpsHigh : null);
|
highList.push(isAfterStartIndex ? item.estimatedEpsHigh : null);
|
||||||
break;
|
break;
|
||||||
case "NetIncome":
|
case "NetIncome":
|
||||||
valueList.push(item?.netIncome);
|
valueList.push(isAfterStartIndex ? null : item.netIncome);
|
||||||
avgList.push(isAfterStartIndex ? item.estimatedNetIncomeAvg : null);
|
avgList.push(isAfterStartIndex ? item.estimatedNetIncomeAvg : null);
|
||||||
lowList.push(isAfterStartIndex ? item.estimatedNetIncomeLow : null);
|
lowList.push(isAfterStartIndex ? item.estimatedNetIncomeLow : null);
|
||||||
highList.push(
|
highList.push(
|
||||||
@ -191,7 +192,7 @@
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "Ebitda":
|
case "Ebitda":
|
||||||
valueList.push(item?.ebitda);
|
valueList.push(isAfterStartIndex ? null : item.ebitda);
|
||||||
avgList.push(isAfterStartIndex ? item.estimatedEbitdaAvg : null);
|
avgList.push(isAfterStartIndex ? item.estimatedEbitdaAvg : null);
|
||||||
lowList.push(isAfterStartIndex ? item.estimatedEbitdaLow : null);
|
lowList.push(isAfterStartIndex ? item.estimatedEbitdaLow : null);
|
||||||
highList.push(isAfterStartIndex ? item.estimatedEbitdaHigh : null);
|
highList.push(isAfterStartIndex ? item.estimatedEbitdaHigh : null);
|
||||||
@ -300,6 +301,7 @@
|
|||||||
const growth = listToUse?.find((r) => r.FY === fy); // Find matching FY
|
const growth = listToUse?.find((r) => r.FY === fy); // Find matching FY
|
||||||
return growth ? growth?.growth : null; // Return growth or null if not found
|
return growth ? growth?.growth : null; // Return growth or null if not found
|
||||||
});
|
});
|
||||||
|
|
||||||
const option = {
|
const option = {
|
||||||
silent: true,
|
silent: true,
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
|||||||
@ -285,8 +285,6 @@
|
|||||||
estimatedEPSAvgNextYear,
|
estimatedEPSAvgNextYear,
|
||||||
estimatedEpsAvg,
|
estimatedEpsAvg,
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(changeRevenue, revenue, estimatedRevenueAvg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPriceForecastChart() {
|
function getPriceForecastChart() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user