diff --git a/src/lib/components/RatingsChart.svelte b/src/lib/components/RatingsChart.svelte index d866d97d..8e96b65b 100644 --- a/src/lib/components/RatingsChart.svelte +++ b/src/lib/components/RatingsChart.svelte @@ -123,13 +123,20 @@ .map((rating) => ({ // Marker at the rating's date type: "max", // Marking the rating date - name: rating.rating_current, + name: rating?.rating_current, coord: [ rating.date, closeValues[dates.indexOf(rating.date)], // Find the close value corresponding to the rating date ], label: { - formatter: rating.rating_current, // Display the rating_current text + formatter: rating.rating_current + ?.replace("Sector Perform", "Hold") + ?.replace("Equal-Weight", "Hold") + ?.replace("Market Perform", "Hold") + ?.replace("Overweight", "Buy") + ?.replace("Outperform", "Buy") + ?.replace("Underperform", "Sell") + ?.replace("Underweight", "Sell"), // Display the rating_current text position: "top", // Position the label above the point color: "white", // Set label color (can be customized) fontSize: 14, // Set font size (increase for better visibility) @@ -257,26 +264,38 @@
{#if isLoaded && optionsData !== null} -
-
- {#each ["1Y", "3Y", "5Y", "Max"] as item} - - {/each} + {#if historicalData?.length > 0} +
+
+ {#each ["1Y", "3Y", "5Y", "Max"] as item} + + {/each} +
+

+ {symbol} - {numOfRatings} Ratings +

+
-

- {symbol} - {numOfRatings} Ratings -

- -
+ {:else} +
+
+
+ No chart data available for {symbol} +
+
+
+ {/if} {:else}
diff --git a/src/routes/etf/[tickerID]/+layout.svelte b/src/routes/etf/[tickerID]/+layout.svelte index 2fdef3ce..dc5e3358 100644 --- a/src/routes/etf/[tickerID]/+layout.svelte +++ b/src/routes/etf/[tickerID]/+layout.svelte @@ -148,7 +148,7 @@ socket.addEventListener("open", () => { console.log("WebSocket connection opened"); // Send only current watchlist symbols - const tickerList = [$etfTicker] || []; + const tickerList = [$etfTicker?.toUpperCase()] || []; sendMessage(tickerList); }); diff --git a/src/routes/stocks/[tickerID]/+layout.svelte b/src/routes/stocks/[tickerID]/+layout.svelte index 57677570..0cfff9d1 100644 --- a/src/routes/stocks/[tickerID]/+layout.svelte +++ b/src/routes/stocks/[tickerID]/+layout.svelte @@ -157,7 +157,7 @@ socket.addEventListener("open", () => { console.log("WebSocket connection opened"); // Send only current watchlist symbols - const tickerList = [$stockTicker] || []; + const tickerList = [$stockTicker?.toUpperCase()] || []; sendMessage(tickerList); });