diff --git a/src/routes/etf/[tickerID]/+page.svelte b/src/routes/etf/[tickerID]/+page.svelte index 5301f547..1befcfb9 100644 --- a/src/routes/etf/[tickerID]/+page.svelte +++ b/src/routes/etf/[tickerID]/+page.svelte @@ -91,8 +91,8 @@ ? "#047857" : "#00FC50"; const fillColorStart = isNegative - ? "rgba(204, 38, 26, 0.3)" - : "rgb(4, 120, 87, 0.3)"; //"rgba(0, 252, 80, 0.3)"; + ? "rgba(204, 38, 26, 0.4)" + : "rgb(4, 120, 87, 0.4)"; //"rgba(0, 252, 80, 0.3)"; const fillColorEnd = isNegative ? "rgba(204, 38, 26, 0.004)" : "rgb(4, 120, 87, 0.004)"; //"rgba(0, 252, 80, 0.004)"; @@ -119,8 +119,8 @@ const options = { chart: { backgroundColor: $mode === "light" ? "#fff" : "#09090B", - height: 360, animation: false, + height: 360, events: { // Add touch event handling to hide tooltip on mobile load: function () { @@ -212,26 +212,29 @@ }, labels: { style: { color: $mode === "light" ? "black" : "white" }, - distance: 20, + distance: 10, formatter: function () { const date = new Date(this?.value); if (displayData === "1D") { - return date?.toLocaleTimeString("en-US", { - hour: "2-digit", - minute: "2-digit", + const timeString = date?.toLocaleTimeString("en-US", { + hour: "numeric", + hour12: true, }); + return `${timeString.replace(/\s/g, " ")}`; } else if (["1W", "1M"].includes(displayData)) { - return date?.toLocaleDateString("en-US", { + const timeString = date?.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC", }); + return `${timeString}`; } else { - return date?.toLocaleDateString("en-US", { + const timeString = date?.toLocaleDateString("en-US", { year: "2-digit", month: "short", timeZone: "UTC", }); + return `${timeString}`; } }, }, @@ -290,7 +293,7 @@ data: displayData === "1D" ? seriesData : priceList, animation: false, color: lineColor, - lineWidth: 1.3, + lineWidth: 1.5, marker: { enabled: false, }, @@ -307,7 +310,6 @@ return options; } - //const startTimeTracking = performance.now(); //==========================// diff --git a/src/routes/index/[tickerID]/+page.svelte b/src/routes/index/[tickerID]/+page.svelte index 7562a224..63964b7c 100644 --- a/src/routes/index/[tickerID]/+page.svelte +++ b/src/routes/index/[tickerID]/+page.svelte @@ -89,8 +89,8 @@ ? "#047857" : "#00FC50"; const fillColorStart = isNegative - ? "rgba(204, 38, 26, 0.3)" - : "rgb(4, 120, 87, 0.3)"; //"rgba(0, 252, 80, 0.3)"; + ? "rgba(204, 38, 26, 0.4)" + : "rgb(4, 120, 87, 0.4)"; //"rgba(0, 252, 80, 0.3)"; const fillColorEnd = isNegative ? "rgba(204, 38, 26, 0.004)" : "rgb(4, 120, 87, 0.004)"; //"rgba(0, 252, 80, 0.004)"; @@ -117,8 +117,8 @@ const options = { chart: { backgroundColor: $mode === "light" ? "#fff" : "#09090B", - height: 360, animation: false, + height: 360, events: { // Add touch event handling to hide tooltip on mobile load: function () { @@ -210,26 +210,29 @@ }, labels: { style: { color: $mode === "light" ? "black" : "white" }, - distance: 20, + distance: 10, formatter: function () { const date = new Date(this?.value); if (displayData === "1D") { - return date?.toLocaleTimeString("en-US", { - hour: "2-digit", - minute: "2-digit", + const timeString = date?.toLocaleTimeString("en-US", { + hour: "numeric", + hour12: true, }); + return `${timeString.replace(/\s/g, " ")}`; } else if (["1W", "1M"].includes(displayData)) { - return date?.toLocaleDateString("en-US", { + const timeString = date?.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC", }); + return `${timeString}`; } else { - return date?.toLocaleDateString("en-US", { + const timeString = date?.toLocaleDateString("en-US", { year: "2-digit", month: "short", timeZone: "UTC", }); + return `${timeString}`; } }, }, @@ -288,7 +291,7 @@ data: displayData === "1D" ? seriesData : priceList, animation: false, color: lineColor, - lineWidth: 1.3, + lineWidth: 1.5, marker: { enabled: false, }, diff --git a/src/routes/stocks/[tickerID]/+page.svelte b/src/routes/stocks/[tickerID]/+page.svelte index 2e3ded80..fd51d162 100644 --- a/src/routes/stocks/[tickerID]/+page.svelte +++ b/src/routes/stocks/[tickerID]/+page.svelte @@ -93,8 +93,8 @@ ? "#047857" : "#00FC50"; const fillColorStart = isNegative - ? "rgba(204, 38, 26, 0.5)" - : "rgb(4, 120, 87, 0.5)"; //"rgba(0, 252, 80, 0.3)"; + ? "rgba(204, 38, 26, 0.4)" + : "rgb(4, 120, 87, 0.4)"; //"rgba(0, 252, 80, 0.3)"; const fillColorEnd = isNegative ? "rgba(204, 38, 26, 0.004)" : "rgb(4, 120, 87, 0.004)"; //"rgba(0, 252, 80, 0.004)"; @@ -295,7 +295,7 @@ data: displayData === "1D" ? seriesData : priceList, animation: false, color: lineColor, - lineWidth: 1.8, + lineWidth: 1.5, marker: { enabled: false, }, @@ -757,7 +757,7 @@ >Bid {$wsBidPrice !== 0 && $wsBidPrice !== null ? $wsBidPrice : ((data?.getStockQuote?.bid !== 0 @@ -791,7 +791,7 @@ >Revenue (ttm) {@html stockDeck?.revenueTTM !== null && stockDeck?.revenueTTM !== 0 ? abbreviateNumber(stockDeck?.revenueTTM, false, true) @@ -805,7 +805,7 @@ >Net Income (ttm) {@html stockDeck?.netIncomeTTM !== null ? abbreviateNumber(stockDeck?.netIncomeTTM, false, true) : "n/a"}EPS (ttm) {data?.getStockQuote?.eps ?? "n/a"} @@ -830,7 +830,7 @@ >PE Ratio (ttm) {data?.getStockQuote?.pe ?? "n/a"} @@ -841,7 +841,7 @@ >Forward PE {stockDeck?.forwardPE ?? "n/a"} @@ -861,7 +861,7 @@ > {data?.getAnalystSummary?.consensusRating !== null && data?.getAnalystSummary?.consensusRating !== "n/a" && data?.getAnalystSummary?.consensusRating !== undefined @@ -880,7 +880,7 @@ >Ask {$wsAskPrice !== 0 && $wsAskPrice !== null ? $wsAskPrice : ((data?.getStockQuote?.ask !== 0 @@ -895,7 +895,7 @@ >Volume {data?.getStockQuote?.volume?.toLocaleString( "en-us", )}Avg. Volume (20D) {data?.getStockQuote?.avgVolume !== undefined ? data?.getStockQuote?.avgVolume?.toLocaleString( "en-us", @@ -923,7 +923,7 @@ >Open {data?.getStockQuote?.open?.toFixed(2)} @@ -934,7 +934,7 @@ >Previous Close {data?.getStockQuote?.previousClose?.toFixed(2)} @@ -945,7 +945,7 @@ >Day's Range {data?.getStockQuote?.dayLow?.toFixed(2)} - {data?.getStockQuote?.dayHigh?.toFixed( 2, )}52-Week Range {data?.getStockQuote?.yearLow?.toFixed(2)} - {data?.getStockQuote?.yearHigh?.toFixed( 2, )}Beta {stockDeck?.beta?.toFixed(2)} diff --git a/src/routes/stocks/[tickerID]/profile/employees/+page.server.ts b/src/routes/stocks/[tickerID]/profile/employees/+page.server.ts index 86a6987f..778e82f0 100644 --- a/src/routes/stocks/[tickerID]/profile/employees/+page.server.ts +++ b/src/routes/stocks/[tickerID]/profile/employees/+page.server.ts @@ -6,7 +6,7 @@ export const load = async ({ locals, params }) => { }; // make the POST request to the endpoint - const response = await fetch(apiURL + "/history-employees", { + const response = await fetch(apiURL + "/historical-employees", { method: "POST", headers: { "Content-Type": "application/json", diff --git a/src/routes/stocks/[tickerID]/profile/employees/+page.svelte b/src/routes/stocks/[tickerID]/profile/employees/+page.svelte index cce02599..02c17e66 100644 --- a/src/routes/stocks/[tickerID]/profile/employees/+page.svelte +++ b/src/routes/stocks/[tickerID]/profile/employees/+page.svelte @@ -39,7 +39,7 @@ function sortByDate(liste) { //Slice copies the list otherwise employeesHistory will reverse too return liste?.slice()?.sort(function (a, b) { - return new Date(b?.filingDate) - new Date(a?.filingDate); + return new Date(b?.date) - new Date(a?.date); }); } @@ -49,12 +49,12 @@ // Create a sorted copy of the employee history from oldest to newest const sortedHistory = [...employeeHistory].sort( - (a, b) => new Date(a.filingDate) - new Date(b.filingDate), + (a, b) => new Date(a.date) - new Date(b.date), ); if (sortBy === "Total") { sortedHistory.forEach((record) => { - dateList.push(record.filingDate.slice(0, 4)); + dateList.push(record.date.slice(0, 4)); valueList.push(record.employeeCount); }); } else if (sortBy === "Change") { @@ -64,7 +64,7 @@ const change = next - current; // Push the later date since the change happens between current and next - dateList.push(sortedHistory[i + 1].filingDate.slice(0, 4)); + dateList.push(sortedHistory[i + 1].date.slice(0, 4)); valueList.push(change); } } else if (sortBy === "Growth") { @@ -78,7 +78,7 @@ } else { valueList.push(0); } - dateList.push(sortedHistory[i + 1].filingDate.slice(0, 4)); + dateList.push(sortedHistory[i + 1].date.slice(0, 4)); } } @@ -140,20 +140,17 @@ borderRadius: 4, formatter: function () { // Format the x value to display time in a custom format - let tooltipContent = `${new Date( + let tooltipContent = `Year ${new Date( this?.x, ).toLocaleDateString("en-US", { year: "numeric", - month: "short", - day: "numeric", })}
`; // Loop through each point in the shared tooltip this.points.forEach((point) => { tooltipContent += ` - ${point.series.name}: - ${abbreviateNumber(point.y)}
`; + ${point?.y?.toLocaleString("en-US")}
`; }); return tooltipContent; @@ -161,7 +158,7 @@ }, series: [ { - name: sortBy, + name: "Employees", data: valueList, color: $mode === "light" ? "#2C6288" : "#fff", animation: false, @@ -169,7 +166,7 @@ ], plotOptions: { column: { - borderRadius: 2, + borderRadius: 1, }, }, legend: { @@ -193,7 +190,7 @@ // Add data rows historyList.forEach((item, index) => { - const date = new Date(item.filingDate).toLocaleString("en-US", { + const date = new Date(item.date).toLocaleString("en-US", { month: "short", day: "numeric", year: "numeric", @@ -244,8 +241,8 @@ function generateEmployeeInfoHTML() { if (employeeHistory?.length !== 0 && !dateDistance) { const formattedEmployees = new Intl.NumberFormat("en").format(employees); - const latestFilingDate = new Date( - employeeHistory[employeeHistory.length - 1]["filingDate"], + const latestdate = new Date( + employeeHistory[employeeHistory.length - 1]["date"], ).toLocaleString("en-US", { month: "short", day: "numeric", @@ -263,7 +260,7 @@ return ` - ${$displayCompanyName} had ${formattedEmployees} employees on ${latestFilingDate}. The number of employees ${changeDirection} + ${$displayCompanyName} had ${formattedEmployees} employees on ${latestdate}. The number of employees ${changeDirection} by ${formattedChangeRate} or ${growthRate}% @@ -273,8 +270,8 @@ `; } else if (employeeHistory?.length !== 0 && dateDistance) { const abbreviatedEmployees = abbreviateNumber(employees); - const latestFilingDate = new Date( - employeeHistory[employeeHistory.length - 1]["filingDate"], + const latestdate = new Date( + employeeHistory[employeeHistory.length - 1]["date"], ).toLocaleString("en-US", { month: "short", day: "numeric", @@ -283,7 +280,7 @@ return ` - ${$displayCompanyName} had ${abbreviatedEmployees} employees on ${latestFilingDate}. Since then, the company has not submitted any additional employee data for more than a year. + ${$displayCompanyName} had ${abbreviatedEmployees} employees on ${latestdate}. Since then, the company has not submitted any additional employee data for more than a year. `; } else { @@ -305,7 +302,7 @@ changeRate = employees - employeeHistory?.at(-2)?.employeeCount; dateDistance = - new Date(employeeHistory[employeeHistory?.length - 1]["filingDate"]) < + new Date(employeeHistory[employeeHistory?.length - 1]["date"]) < new Date(new Date().setFullYear(new Date().getFullYear() - 1)) ? true : false; @@ -331,7 +328,7 @@ @@ -557,7 +554,7 @@ - {new Date(item?.filingDate)?.toLocaleString("en-US", { + {new Date(item?.date)?.toLocaleString("en-US", { month: "short", day: "numeric", year: "numeric",