diff --git a/app/javascript/controllers/time_series_chart_controller.js b/app/javascript/controllers/time_series_chart_controller.js
index c9d1df2f..6717110f 100644
--- a/app/javascript/controllers/time_series_chart_controller.js
+++ b/app/javascript/controllers/time_series_chart_controller.js
@@ -243,34 +243,32 @@ export default class extends Controller {
#tooltipTemplate(data) {
- if (data.currency) {
- return(`
-
- ${d3.timeFormat("%b %d, %Y")(data.date)}
-
-
-
- ${this.#currencyValue(data)} ${this.#currencyChange(data)} (${data.trend.percent}%)
-
- `)
- } else {
- return(`
-
- ${d3.timeFormat("%b %d, %Y")(data.date)}
-
-
-
- ${data.value} ${this.#decimalChange(data)} (${data.trend.percent}%)
-
- `)
- }
+ return(`
+
+ ${d3.timeFormat("%b %d, %Y")(data.date)}
+
+
+
+
+
+ ${this.#tooltipValue(data)}
+
+
+ ${this.#tooltipChange(data)} (${data.trend.percent}%)
+
+
+ `)
}
- #dataTrendColor(data) {
+ #tooltipTrendColor(data) {
return {
up: tailwindColors.success,
down: tailwindColors.error,
@@ -278,6 +276,22 @@ export default class extends Controller {
}[data.trend.direction]
}
+ #tooltipValue(data) {
+ if (data.currency) {
+ return this.#currencyValue(data)
+ } else {
+ return data.value
+ }
+ }
+
+ #tooltipChange(data) {
+ if (data.currency) {
+ return this.#currencyChange(data)
+ } else {
+ return this.#decimalChange(data)
+ }
+ }
+
#currencyValue(data) {
return Intl.NumberFormat(undefined, {
style: "currency",