From 9fdae3334446572025b0ef3e224a984532a89454 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Sun, 18 Aug 2024 15:58:41 +0200 Subject: [PATCH] ui fix --- src/lib/components/AnalystEstimate.svelte | 2 + src/routes/hedge-funds/[slug]/+page.svelte | 45 ++++++++++++++++++++-- 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/src/lib/components/AnalystEstimate.svelte b/src/lib/components/AnalystEstimate.svelte index 19ffbe6c..c547d8c8 100644 --- a/src/lib/components/AnalystEstimate.svelte +++ b/src/lib/components/AnalystEstimate.svelte @@ -71,10 +71,12 @@ const getAnalystEstimate = async (ticker) => { }); analystEstimateList = await response?.json(); + analystEstimateList = analystEstimateList?.filter(item => !item.date.toString().startsWith("19")); // Cache the data for this specific tickerID with a specific name 'getAnalystEstimate' setCache(ticker, analystEstimateList, 'getAnalystEstimate'); } + if(analystEstimateList?.length !== 0) { $analystEstimateComponent = true; } else { diff --git a/src/routes/hedge-funds/[slug]/+page.svelte b/src/routes/hedge-funds/[slug]/+page.svelte index a04195e4..6889ba19 100644 --- a/src/routes/hedge-funds/[slug]/+page.svelte +++ b/src/routes/hedge-funds/[slug]/+page.svelte @@ -10,10 +10,10 @@ import { Chart } from 'svelte-echarts' import { init, use } from 'echarts/core' -import { BarChart } from 'echarts/charts' +import { BarChart, PieChart } from 'echarts/charts' import { GridComponent, TooltipComponent } from 'echarts/components' import { CanvasRenderer } from 'echarts/renderers' -use([BarChart, GridComponent, TooltipComponent, CanvasRenderer]) +use([BarChart, PieChart, GridComponent, TooltipComponent, CanvasRenderer]) import { onMount } from 'svelte'; @@ -23,13 +23,13 @@ use([BarChart, GridComponent, TooltipComponent, CanvasRenderer]) let isLoaded = false; + let optionsPie; let rawData = data?.getHedgeFundsData; let rawList = [] let displayList = []; let optionsData = {}; let currentPage=1; const itemsPerPage = 50; - let images = {}; let numOfAssets; @@ -328,8 +328,39 @@ async function handleMode(i) { return option; } +async function getPieChart() { + const options = { + animation: false, + silent: true, + series: [ + { + name: 'Access From', + type: 'pie', + radius: ['70%', '90%'], + avoidLabelOverlap: false, + label: { + show: false, + position: 'center' + }, + labelLine: { + show: false + }, + data: [ + { value: 1048, name: 'Search Engine' }, + { value: 735, name: 'Direct' }, + { value: 580, name: 'Email' }, + { value: 484, name: 'Union Ads' }, + ], + color: ['#C8603E', '#B53199', '#5DAD85', '#9969FB', '#AB33B2'] + } + ] +}; + return options; +} + onMount(async () => { optionsData = await getPerformancePlot(); + //optionsPie = await getPieChart(); isLoaded = true; }); @@ -466,7 +497,13 @@ onMount(async () => { - + + +