This commit is contained in:
MuslemRahimi 2024-11-10 12:52:57 +01:00
parent 33edefa9bd
commit a4f621d5ec
3 changed files with 16 additions and 6 deletions

View File

@ -353,6 +353,11 @@ export function formatString(inputString) {
} }
export function abbreviateNumber(number, addDollarSign = false) { export function abbreviateNumber(number, addDollarSign = false) {
// Check if number is null or undefined, return "-" if true
if (number == null) {
return "-";
}
const negative = number < 0; const negative = number < 0;
// Handle special case for exactly 1000 // Handle special case for exactly 1000

View File

@ -108,6 +108,8 @@
name: "PE Ratio", name: "PE Ratio",
data: valueList, data: valueList,
type: "line", type: "line",
areaStyle: { opacity: 0.2 },
smooth: true,
symbol: "none", symbol: "none",
itemStyle: { itemStyle: {
color: "#fff", color: "#fff",
@ -293,7 +295,7 @@
<td <td
class="text-sm sm:text-[1rem] whitespace-nowrap {item?.changesPercentage !== class="text-sm sm:text-[1rem] whitespace-nowrap {item?.changesPercentage !==
null && item?.changesPercentage >= 0 null && item?.changesPercentage >= 0
? 'text-[#00FC50]' ? "before:content-['+'] text-[#00FC50]"
: item?.changesPercentage < 0 : item?.changesPercentage < 0
? 'text-[#FF2F1F]' ? 'text-[#FF2F1F]'
: 'text-white'} text-end" : 'text-white'} text-end"

View File

@ -207,8 +207,11 @@
class="mb-4 px-0.5 text-white xs:text-[1.05rem] lg:leading-normal" class="mb-4 px-0.5 text-white xs:text-[1.05rem] lg:leading-normal"
> >
The PE ratio is {rawData?.priceEarningsRatio} and the forward PE The PE ratio is {rawData?.priceEarningsRatio} and the forward PE
ratio is {rawData?.forwardPE}. {companyName}'s PEG ratio is ratio is {rawData?.forwardPE}.
{rawData?.peg}. {rawData?.peg !== null
? `${companyName}'s PEG ratio is
${rawData?.peg}.`
: ""}
</p> </p>
<table class="w-full"> <table class="w-full">
@ -267,7 +270,7 @@
</td> </td>
<td <td
class="px-[5px] py-1.5 text-right font-semibold xs:px-2.5 xs:py-2" class="px-[5px] py-1.5 text-right font-semibold xs:px-2.5 xs:py-2"
>{rawData?.peg}</td >{rawData?.peg !== null ? rawData?.peg : "n/a"}</td
> >
</tr></tbody </tr></tbody
> >