Component API

<price-history-chart>

Open live example

D3-powered SVG line chart for property price history.

Uses scaleTime (X) + scaleLinear (Y) from d3-scale and line/area path
generators from d3-shape. Adapts to container width via ResizeObserver.

Install

import "@f-ewald/components/price-history-chart.js";

Usage

<price-history-chart></price-history-chart>
<script type="module">
  document.querySelector("price-history-chart").history = [
    { date: "2023-01-01", price: 620000, eventType: "Listed" },
    { date: "2024-02-01", price: 680000, eventType: "Sold" },
  ];
</script>

Attributes / properties

PropertyAttributeTypeDefaultDescription
historyhistoryPricePoint[][]Array of price points (points with null price/date are skipped).
yLabelsy-labels"auto" | "always" | "never""auto""auto" (default) | "always" | "never"
maxXLabelsmax-x-labelsnumber3Max X-axis date ticks (default 3).

Events

None.

Slots

None.

CSS custom properties

Custom property
--ui-border
--ui-font
--ui-on-accent
--ui-primary
--ui-text-muted
--ui-tooltip