From 9dd56f22e7e1981549b2b5d500167d9e77c4dba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B0=B8=E9=87=8E=20=E6=9C=97=E5=A4=AB?= Date: Thu, 4 Apr 2024 11:41:36 +0900 Subject: [PATCH] support fill color --- stanzas/barchart/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stanzas/barchart/index.ts b/stanzas/barchart/index.ts index e63e9c31..bdd21899 100644 --- a/stanzas/barchart/index.ts +++ b/stanzas/barchart/index.ts @@ -447,12 +447,15 @@ export default class Barchart extends MetaStanza { return `translate(${this.xAxisGen.axisGen.scale()(d.x0)},0)`} ); + const css = (key) => getComputedStyle(this.element).getPropertyValue(key); + const fill = css("--togostanza-theme-series_0_color"); + bar .append("rect") .attr("y", (d) => y(d.length)) .attr("width", x(bins[0].x1) - x(bins[0].x0) - 1) .attr("height", (d) => height - y(d.length)) - .attr("fill", "steelblue"); + .attr("fill", fill); } handleEvent(event) {