diff --git a/src/lib/components/FinancialTable.svelte b/src/lib/components/FinancialTable.svelte
index 8af88673..d476915e 100644
--- a/src/lib/components/FinancialTable.svelte
+++ b/src/lib/components/FinancialTable.svelte
@@ -9,6 +9,13 @@
let config = null;
+ let modalLabel;
+ let highestValue;
+ let highestValueDate;
+ let lowestValueDate;
+ let lowestValue;
+ let fiveYearsGrowth;
+
const marginKeys = new Set([
/*
"pretaxProfitMargin",
@@ -48,11 +55,28 @@
const valueList = rawData?.map((item) => item[key]);
+ // Calculate highest and lowest value
+ highestValue = Math.max(...valueList);
+ lowestValue = Math.min(...valueList);
+ let highestValueIndex = valueList.indexOf(highestValue);
+ let lowestValueIndex = valueList.indexOf(lowestValue);
+
+ highestValueDate = dateList[highestValueIndex] || null;
+ lowestValueDate = dateList[lowestValueIndex] || null;
+
+ // Calculate last 5 years growth
+ fiveYearsGrowth = null;
+ if (valueList?.length >= 5) {
+ let firstValue = valueList[valueList.length - 5];
+ let lastValue = valueList[valueList.length - 1];
+ fiveYearsGrowth = ((lastValue - firstValue) / Math.abs(firstValue)) * 100;
+ }
+
const options = {
chart: {
type: "column",
- backgroundColor: $mode === "light" ? "#fff" : "#09090B",
- plotBackgroundColor: $mode === "light" ? "#fff" : "#09090B",
+ backgroundColor: $mode === "light" ? "#fff" : "#2A2E39",
+ plotBackgroundColor: $mode === "light" ? "#fff" : "#2A2E39",
height: 360,
animation: false,
},
@@ -98,7 +122,7 @@
},
yAxis: {
gridLineWidth: 1,
- gridLineColor: $mode === "light" ? "#e5e7eb" : "#111827",
+ gridLineColor: $mode === "light" ? "#e5e7eb" : "#404657",
labels: {
style: { color: $mode === "light" ? "black" : "white" },
formatter: function () {
@@ -125,7 +149,7 @@
this.points.forEach((point) => {
tooltipContent += `${point.series.name}:
${abbreviateNumber(
- point.y,
+ point.y?.toFixed(2),
)}
`;
});
return tooltipContent;
@@ -146,6 +170,7 @@
}
async function handleChart(label, key) {
+ modalLabel = label;
config = plotData(label, key);
}
@@ -157,7 +182,7 @@
- {label}
+ {label}
|