update metrics page
This commit is contained in:
parent
48fe6ca96e
commit
7d41ba229a
@ -804,7 +804,7 @@ function handleTypeOfTrade(state:string)
|
|||||||
: 'bg-[#09090B]'} mt-1 h-[3px] rounded-full w-[2rem]"
|
: 'bg-[#09090B]'} mt-1 h-[3px] rounded-full w-[2rem]"
|
||||||
/>
|
/>
|
||||||
</li>
|
</li>
|
||||||
{#if $stockTicker?.toLowerCase() === "nvda"}
|
{#if ["nvda", "aapl", "gme"]?.includes($stockTicker?.toLowerCase())}
|
||||||
<li class="cursor-pointer flex flex-col items-center">
|
<li class="cursor-pointer flex flex-col items-center">
|
||||||
<a
|
<a
|
||||||
href={`/stocks/${$stockTicker}/metrics`}
|
href={`/stocks/${$stockTicker}/metrics`}
|
||||||
|
|||||||
@ -12,11 +12,15 @@
|
|||||||
import { LineChart, BarChart } from "echarts/charts";
|
import { LineChart, BarChart } from "echarts/charts";
|
||||||
import { GridComponent, TooltipComponent } from "echarts/components";
|
import { GridComponent, TooltipComponent } from "echarts/components";
|
||||||
import { CanvasRenderer } from "echarts/renderers";
|
import { CanvasRenderer } from "echarts/renderers";
|
||||||
import { onMount } from "svelte";
|
|
||||||
use([LineChart, BarChart, GridComponent, TooltipComponent, CanvasRenderer]);
|
use([LineChart, BarChart, GridComponent, TooltipComponent, CanvasRenderer]);
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
|
const names =
|
||||||
|
data?.getBusinessMetrics?.revenue?.names?.map((name) =>
|
||||||
|
name?.toLowerCase()?.replace(/[ &]+/g, "-"),
|
||||||
|
) || [];
|
||||||
|
|
||||||
let isLoaded = false;
|
let isLoaded = false;
|
||||||
let optionsData;
|
let optionsData;
|
||||||
|
|
||||||
@ -95,34 +99,12 @@
|
|||||||
isLoaded = false;
|
isLoaded = false;
|
||||||
dataset = [];
|
dataset = [];
|
||||||
tableList = [];
|
tableList = [];
|
||||||
|
// Find the index of the current getParams value in the names array
|
||||||
|
const index = names?.indexOf(data.getParams);
|
||||||
dataset = rawData?.map((entry) => ({
|
dataset = rawData?.map((entry) => ({
|
||||||
date: entry.date,
|
date: entry.date,
|
||||||
value:
|
value: index !== -1 ? entry.value[index] : null,
|
||||||
data?.getParams === "data-center"
|
valueGrowth: index !== -1 ? entry.valueGrowth[index] : null,
|
||||||
? entry?.value[0]
|
|
||||||
: data?.getParams === "gaming"
|
|
||||||
? entry?.value[1]
|
|
||||||
: data?.getParams === "visualization"
|
|
||||||
? entry?.value[2]
|
|
||||||
: data?.getParams === "automotive"
|
|
||||||
? entry?.value[3]
|
|
||||||
: data?.getParams === "oem-other"
|
|
||||||
? entry?.value[4]
|
|
||||||
: null,
|
|
||||||
|
|
||||||
valueGrowth:
|
|
||||||
data?.getParams === "data-center"
|
|
||||||
? entry?.valueGrowth[0]
|
|
||||||
: data?.getParams === "gaming"
|
|
||||||
? entry?.valueGrowth[1]
|
|
||||||
: data?.getParams === "visualization"
|
|
||||||
? entry?.valueGrowth[2]
|
|
||||||
: data?.getParams === "automotive"
|
|
||||||
? entry?.valueGrowth[3]
|
|
||||||
: data?.getParams === "oem-other"
|
|
||||||
? entry?.valueGrowth[4]
|
|
||||||
: null,
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
tableList = [...dataset];
|
tableList = [...dataset];
|
||||||
@ -130,6 +112,7 @@
|
|||||||
tableList = tableList?.sort(
|
tableList = tableList?.sort(
|
||||||
(a, b) => new Date(b?.date) - new Date(a?.date),
|
(a, b) => new Date(b?.date) - new Date(a?.date),
|
||||||
);
|
);
|
||||||
|
|
||||||
optionsData = plotData();
|
optionsData = plotData();
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user