diff --git a/src/routes/hedge-funds/[slug]/+page.svelte b/src/routes/hedge-funds/[slug]/+page.svelte index 4635169b..900a3051 100644 --- a/src/routes/hedge-funds/[slug]/+page.svelte +++ b/src/routes/hedge-funds/[slug]/+page.svelte @@ -3,16 +3,14 @@ import { screenWidth, numberOfUnreadNotification, displayCompanyName } from '$lib/store'; import cardBackground from "$lib/images/bg-hedge-funds.png"; import defaultAvatar from "$lib/images/hedge_funds/default-avatar.png"; - - import { abbreviateNumber, formatString } from '$lib/utils'; import { Chart } from 'svelte-echarts' import { init, use } from 'echarts/core' -import { LineChart } from 'echarts/charts' -import { GridComponent } from 'echarts/components' +import { BarChart } from 'echarts/charts' +import { GridComponent, TooltipComponent } from 'echarts/components' import { CanvasRenderer } from 'echarts/renderers' -use([LineChart, GridComponent, CanvasRenderer]) +use([BarChart, GridComponent, TooltipComponent, CanvasRenderer]) import { onMount } from 'svelte'; @@ -177,9 +175,6 @@ function formatToFY(dateString) { } -function getYearFromDate(dateString) { - return new Date(dateString).getFullYear(); -} async function getPlotOptions() { // Initialize boughtList and soldList arrays @@ -198,6 +193,11 @@ function getYearFromDate(dateString) { const option = { silent: true, + animation: false, + tooltip: { + trigger: 'axis', + hideDelay: 100, // Set the delay in milliseconds + }, grid: { left: $screenWidth < 640 ? '0.5%' : '0.5%', right: $screenWidth < 640 ? '1%' : '5%', @@ -207,6 +207,9 @@ function getYearFromDate(dateString) { xAxis: { data: dates, type: 'category', + axisLabel: { + color: '#fff' + } }, yAxis: [ { @@ -215,7 +218,7 @@ function getYearFromDate(dateString) { show: false, // Disable x-axis grid lines }, axisLabel: { - color: '#6E7079', // Change label color to white + color: '#fff', // Change label color to white formatter: function (value) { return value >= 0 ? +(value / denominator)?.toFixed(0) + unit+'%' : ''; // Format value in millions }, @@ -226,18 +229,18 @@ function getYearFromDate(dateString) { { name: 'SPY', data: spyPerformance, - type: 'line', + type: 'bar', showSymbol: false, itemStyle: { - color: '#36A2EB' // Change bar color to white + color: '#FF9E21' // Change bar color to white }, }, { name: 'Hedge Fund', data: hedgeFundPerformance, - type: 'line', + type: 'bar', showSymbol: false, itemStyle: { - color: '#FF6384' // Change bar color to white + color: '#36A2EB' // Change bar color to white }, }, ] @@ -248,7 +251,6 @@ function getYearFromDate(dateString) { } onMount(async () => { - isLoaded = false; await loadImages(); optionsData = await getPlotOptions(); isLoaded = true; @@ -286,7 +288,7 @@ onMount(async () => { } } - $: totalPages = Math.ceil(rawList.length / itemsPerPage); + $: totalPages = Math?.ceil(rawList.length / itemsPerPage); let charNumber = 40; $: { @@ -535,26 +537,27 @@ onMount(async () => { Performance History -