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) {
// Check if number is null or undefined, return "-" if true
if (number == null) {
return "-";
}
const negative = number < 0;
// Handle special case for exactly 1000
@ -362,8 +367,8 @@ export function abbreviateNumber(number, addDollarSign = false) {
? "-$1K"
: "$1K"
: negative
? "-1K"
: "1K";
? "-1K"
: "1K";
}
if (Math.abs(number) !== 0 && Math.abs(number) > 1000) {

View File

@ -108,6 +108,8 @@
name: "PE Ratio",
data: valueList,
type: "line",
areaStyle: { opacity: 0.2 },
smooth: true,
symbol: "none",
itemStyle: {
color: "#fff",
@ -293,7 +295,7 @@
<td
class="text-sm sm:text-[1rem] whitespace-nowrap {item?.changesPercentage !==
null && item?.changesPercentage >= 0
? 'text-[#00FC50]'
? "before:content-['+'] text-[#00FC50]"
: item?.changesPercentage < 0
? 'text-[#FF2F1F]'
: '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"
>
The PE ratio is {rawData?.priceEarningsRatio} and the forward PE
ratio is {rawData?.forwardPE}. {companyName}'s PEG ratio is
{rawData?.peg}.
ratio is {rawData?.forwardPE}.
{rawData?.peg !== null
? `${companyName}'s PEG ratio is
${rawData?.peg}.`
: ""}
</p>
<table class="w-full">
@ -267,7 +270,7 @@
</td>
<td
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
>