From 1052f52512b01ccd2e68aaf35118b4b122c33bb9 Mon Sep 17 00:00:00 2001 From: MuslemRahimi Date: Mon, 12 Aug 2024 00:14:22 +0200 Subject: [PATCH] update dividend and insider --- .../etf/[tickerID]/dividends/+page.svelte | 10 ++----- .../stocks/[tickerID]/dividends/+page.svelte | 10 ++----- .../stocks/[tickerID]/insider/+page.svelte | 27 ++++++++++++++----- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/routes/etf/[tickerID]/dividends/+page.svelte b/src/routes/etf/[tickerID]/dividends/+page.svelte index 13a9415d..de8503b4 100644 --- a/src/routes/etf/[tickerID]/dividends/+page.svelte +++ b/src/routes/etf/[tickerID]/dividends/+page.svelte @@ -65,15 +65,10 @@ show: false, // Disable x-axis grid lines }, }, - { - type: 'value', - splitLine: { - show: false, - }, - }, { type: 'value', axisLabel: { + show: false, formatter: '{value} %', }, splitLine: { @@ -96,7 +91,6 @@ data: growthList, type: 'bar', barWidth: '80%', - smooth: true, yAxisIndex: 1, itemStyle: { color: (params) => { @@ -390,7 +384,7 @@ @media (max-width: 640px) { .app { - height: 300px; + height: 200px; } } diff --git a/src/routes/stocks/[tickerID]/dividends/+page.svelte b/src/routes/stocks/[tickerID]/dividends/+page.svelte index 515ed4c2..3b7fc497 100644 --- a/src/routes/stocks/[tickerID]/dividends/+page.svelte +++ b/src/routes/stocks/[tickerID]/dividends/+page.svelte @@ -65,15 +65,10 @@ async function plotDividend(dividendList, growthList, dateList) { show: false, // Disable x-axis grid lines }, }, - { - type: 'value', - splitLine: { - show: false, - }, - }, { type: 'value', axisLabel: { + show: false, formatter: '{value} %', }, splitLine: { @@ -96,7 +91,6 @@ async function plotDividend(dividendList, growthList, dateList) { data: growthList, type: 'bar', barWidth: '80%', - smooth: true, yAxisIndex: 1, itemStyle: { color: (params) => { @@ -390,7 +384,7 @@ onMount(async() => { @media (max-width: 640px) { .app { - height: 300px; + height: 200px; } } diff --git a/src/routes/stocks/[tickerID]/insider/+page.svelte b/src/routes/stocks/[tickerID]/insider/+page.svelte index ba37d1fc..18903687 100644 --- a/src/routes/stocks/[tickerID]/insider/+page.svelte +++ b/src/routes/stocks/[tickerID]/insider/+page.svelte @@ -125,7 +125,7 @@ const handleMessage = async (event) => { silent: true, grid: { left: '0%', - right: '0%', + right: '2%', top: '10%', bottom: '10%', containLabel: true, @@ -150,7 +150,14 @@ const handleMessage = async (event) => { type: 'value', axisLabel: { color: '#fff', - formatter: '${value}', + formatter: function (value, index) { + // Display every second tick + if (index % 2 === 0) { + return '$'+`${value}` // Format value in millions + } else { + return ''; // Hide this tick + } + } }, splitLine: { show: false, // Disable x-axis grid lines @@ -159,9 +166,15 @@ const handleMessage = async (event) => { { type: 'value', axisLabel: { - formatter: function (value) { - return (value / denominator)?.toFixed(0) + unit; // Format value in millions - }, + formatter: function (value, index) { + // Display every second tick + if (index % 2 === 0) { + value = Math.max(value, 0); + return (value / denominator)?.toFixed(0) + unit; // Format value in millions + } else { + return ''; // Hide this tick + } + }, }, splitLine: { show: false, // Disable x-axis grid lines @@ -606,14 +619,14 @@ onMount(async() => {