Skip to content

Commit a2a97da

Browse files
authored
Update README.md
1 parent b429be3 commit a2a97da

1 file changed

Lines changed: 85 additions & 17 deletions

File tree

README.md

Lines changed: 85 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ An awesome feature-rich custom card for [Home Assistant](https://www.home-assist
6464
| 📈 | Line, step, and bar charts with smooth Bezier curves |
6565
| 📅 | **Built-in Date Picker** — navigate Day, Week, Month, Year views with arrow buttons, calendar popup, and preset ranges (Last 7/30 Days, Last 12 Months). Sync multiple cards with `date_picker_group` — even cards without a visible picker can follow the group. Customize visible modes with `date_picker_modes` — lock to a single mode for a minimal nav bar |
6666
| 🔢 | Live state rows with current value, MDI icons, and configurable font sizes |
67-
| 🎯 | **Nine chart modes** — Timeline, Scatter, Pie (donut), Ranking (horizontal bar), Radial Bar (concentric arcs), Polar Area (variable-radius pie), Radar (spider polygon), Heatmap (days × hours), Calendar (weekly grid) — selectable from a single dropdown |
67+
| 🎯 | **Ten chart modes** Timeline, State Timeline, Scatter, Pie (donut), Ranking (horizontal bar), Radial Bar (concentric arcs), Polar Area (variable-radius pie), Radar (spider polygon), Heatmap (days × hours), Calendar (weekly grid) — selectable from a single dropdown |
6868
| 🎛️ | **Gauge display** — replace the state row with a half-circle gauge showing current value against min/max bounds |
6969
|| **Sparkline mode** — ultra-compact inline graphs with no chrome, ideal for dashboard overview tiles |
7070
| 📊 | **Rise/Fall colorization** — graph segments automatically change color as values climb or drop, with independent colors for rising, falling, and stable periods |
@@ -73,7 +73,7 @@ An awesome feature-rich custom card for [Home Assistant](https://www.home-assist
7373
| 🏷️ | **Custom unit per entity** — override auto-detected units with `unit: kWh` on any entity. Essential for attributes and unitless sensors |
7474
| 🔡 | **Axis label customization** — adjust font size and opacity of Y-axis and X-axis labels independently for a clean, tailored look |
7575
| 📌 | **Axis tick marks** — optional small tick lines at each label position, controllable independently for X and Y axes |
76-
| 🕐 | **Graph Start Hour**pin the X-axis to a fixed start hour (e.g. 06:00) to cut out irrelevant nighttime data on solar dashboards |
76+
| 🕐 | **Dynamic Graph Hours**filter data to specific hours each day with `graph_start_hour` and `graph_end_hour`. Accepts fixed numbers or sensor entities (e.g. `sensor.sunrise_hour`) for sunrise-to-sunset views that adapt throughout the year |
7777
| 🛠️ | **Full visual editor** — every option is configurable through the Lovelace UI without touching YAML; entities can be reordered by drag-and-drop. The editor adapts dynamically: irrelevant options hide based on the selected chart mode |
7878
| ↕️ | Dual Y-axis support (primary + secondary) with per-axis bounds and configurable tick count |
7979
| ↕️ | **Independent Y2 axis toggle** — show or hide the secondary (right) Y axis labels without affecting the primary axis |
@@ -269,9 +269,11 @@ These options apply to the whole card.
269269
| `show_x_axis` | boolean | `true` | Show X axis labels (time in Timeline, values in Scatter). Available in Timeline and Scatter modes. |
270270
| `show_x_ticks` | boolean | `false` | Draw small tick marks at each X-axis label position. |
271271
| `show_y_ticks` | boolean | `false` | Draw small tick marks at each Y-axis label position. |
272-
| `graph_start_hour` | number | `null` | Anchors the X-axis to a fixed hour of the day (0–23). For example, `6` starts the chart at 06:00 — ideal for solar panels. Ignored when the interval picker is active. |
272+
| `graph_start_hour` | number / entity | `null` | Daily start hour filter. Points before this hour each day are hidden, creating natural line breaks between days. Accepts a fixed number (`6` = 06:00, `6.5` = 06:30) or a sensor entity ID (`sensor.sunrise_hour`) for dynamic values. Works with Date Picker: in Day mode trims the X-axis, in Week/Month/Year modes filters per day. See [Dynamic Graph Hours](#-dynamic-graph-hours). |
273+
| `graph_end_hour` | number / entity | `null` | Daily end hour filter. Points after this hour each day are hidden. Same format as `graph_start_hour`. Use with `sensor.sunset_hour` for sunrise-to-sunset views. |
273274
| `graph_start` | string | `null` | Snaps the graph start to a calendar boundary: `tomorrow` (tomorrow 00:00 — ideal for next-day spot prices via `data_attribute`), `week` (Monday 00:00), `month` (1st of month), `year` (Jan 1st). When set to `tomorrow`, the window automatically extends to cover the full next day even without `show_full_period`. Ignored when the interval picker is active. See [Long-Range Views](#-long-range-views). |
274275
| `show_full_period` | boolean | `false` | Extends the X-axis to cover the full calendar period instead of stopping at "now". A dashed vertical line marks the current time. Works with `graph_start` (week/month/year) and `energy_date_sync`. Not required for `graph_start: tomorrow` — that extends automatically. See [Show Full Period](#-show-full-period). |
276+
| `card_background_color` | color | `null` | Custom background color for the card. Accepts any CSS color (hex, rgba, name). Replaces `card_mod` workarounds — this value persists across re-renders. |
275277
| `show_legend` | boolean | `false` | Show a compact color-coded entity name key below the graph. Click any item to temporarily toggle that entity's visibility on the graph. For per-entity stats, use the entity-level Legend toggle. |
276278
| `legend_position` | string | `"center"` | Position of the compact legend: `left` / `center` / `right`. The legend flows inline at the chosen alignment. |
277279
| `logarithmic` | boolean | `false` | Logarithmic Y axis scale. Timeline mode only. |
@@ -590,24 +592,44 @@ entities:
590592

591593
Requires at least 3 entities. Each entity's value is normalized to its `lower_bound` / `upper_bound` range. Polygon grid rings provide reference levels. Colored dots at each vertex show the exact position, with value labels nearby. Supports color thresholds for per-dot colors.
592594

595+
### State Timeline
596+
597+
```yaml
598+
type: custom:statistics-graph-chart-card
599+
chart_mode: state_timeline
600+
hours_to_show: 24
601+
entities:
602+
- entity: binary_sensor.window_living_room
603+
name: Living Room
604+
state_map:
605+
- value: "off"
606+
label: "Closed"
607+
color: "#e74c3c"
608+
- value: "on"
609+
label: "Open"
610+
color: "#5dade2"
611+
```
612+
613+
Displays horizontal colored bars showing state changes over time — one row per entity. Entity names appear on the left, state labels inside each segment when wide enough. Hover for a tooltip showing state name, duration, and time range. Works with `binary_sensor`, `input_boolean`, `input_select`, and any entity with a `state_map`.
614+
593615
### Chart Mode Compatibility
594616

595617
Not all card options apply to every mode. The visual editor hides irrelevant options automatically.
596618

597-
| Feature | Timeline | Scatter | Pie | Ranking | Radial Bar | Polar Area | Radar | Heatmap | Calendar |
598-
|---------|----------|---------|-----|---------|------------|------------|-------|---------|----------|
599-
| Y / X axes | ✅ | ✅ | — | — | — | — | — | Own axes | Own axes |
600-
| Grid | ✅ | ✅ | — | — | — | Grid circles | Polygon grid | — | — |
601-
| Stacked | ✅ | — | — | — | — | — | — | — | — |
602-
| Offset | ✅ | — | — | — | — | — | — | — | — |
603-
| Annotations | ✅ | — | — | — | — | — | — | — | — |
604-
| Zoom brush | ✅ | — | — | — | — | — | — | — | — |
605-
| Scroll | ✅ | — | — | — | — | — | — | — | — |
606-
| Sparkline | ✅ | — | — | — | — | — | — | — | — |
607-
| Range Band | ✅ | — | — | — | — | — | — | — | — |
608-
| Entity limit | ∞ | 2 | ∞ | ∞ | ∞ | ∞ | 3+ | 1 | 1 |
609-
| Entity graph_type | line/step/bar | — | — | — | — | — | — | — | — |
610-
| lower/upper_bound | Y axis range | — | — | — | 0–100% range | — | Normalization | Color scale | Color scale |
619+
| Feature | Timeline | State Timeline | Scatter | Pie | Ranking | Radial Bar | Polar Area | Radar | Heatmap | Calendar |
620+
|---------|----------|----------------|---------|-----|---------|------------|------------|-------|---------|----------|
621+
| Y / X axes | ✅ | X only | ✅ | — | — | — | — | — | Own axes | Own axes |
622+
| Grid | ✅ | — | ✅ | — | — | — | Grid circles | Polygon grid | — | — |
623+
| Stacked | ✅ | — | — | — | — | — | — | — | — | — |
624+
| Offset | ✅ | — | — | — | — | — | — | — | — | — |
625+
| Annotations | ✅ | — | — | — | — | — | — | — | — | — |
626+
| Zoom brush | ✅ | — | — | — | — | — | — | — | — | — |
627+
| Scroll | ✅ | — | — | — | — | — | — | — | — | — |
628+
| Sparkline | ✅ | — | — | — | — | — | — | — | — | — |
629+
| Range Band | ✅ | — | — | — | — | — | — | — | — | — |
630+
| Entity limit | ∞ | ∞ | 2 | ∞ | ∞ | ∞ | ∞ | 3+ | 1 | 1 |
631+
| Entity graph_type | line/step/bar | — | — | — | — | — | — | — | — | — |
632+
| lower/upper_bound | Y axis range | — | — | — | — | 0–100% range | — | Normalization | Color scale | Color scale |
611633

612634
</details>
613635

@@ -2171,10 +2193,56 @@ entities:
21712193
service: switch.toggle
21722194
service_data:
21732195
entity_id: switch.pump
2196+
2197+
# Fire DOM event (browser_mod popup, YAML only)
2198+
- entity: sensor.power
2199+
tap_action:
2200+
action: fire-dom-event
2201+
browser_mod:
2202+
service: browser_mod.popup
2203+
data:
2204+
content:
2205+
type: custom:mini-graph-card
2206+
entity: sensor.power
21742207
```
21752208

21762209
---
21772210

2211+
### 🌅 Dynamic Graph Hours
2212+
2213+
Filter data to specific hours each day using sensor values. Ideal for solar panels (sunrise to sunset) or business hours.
2214+
2215+
```yaml
2216+
type: custom:statistics-graph-chart-card
2217+
graph_start_hour: sensor.sunrise_hour
2218+
graph_end_hour: sensor.sunset_hour
2219+
hours_to_show: 168
2220+
show_date_picker: true
2221+
entities:
2222+
- entity: sensor.solar_power
2223+
```
2224+
2225+
Create template sensors that output fractional hours:
2226+
2227+
```yaml
2228+
template:
2229+
- sensor:
2230+
- name: "Sunrise Hour"
2231+
unique_id: sunrise_hour
2232+
state: >
2233+
{% set dt = state_attr('sun.sun', 'next_rising') | as_datetime | as_local %}
2234+
{{ dt.hour + dt.minute / 60 }}
2235+
- name: "Sunset Hour"
2236+
unique_id: sunset_hour
2237+
state: >
2238+
{% set dt = state_attr('sun.sun', 'next_setting') | as_datetime | as_local %}
2239+
{{ dt.hour + dt.minute / 60 }}
2240+
```
2241+
2242+
When viewing multiple days, data outside the specified hours is hidden and lines break naturally between days. Both `graph_start_hour` and `graph_end_hour` accept fixed numbers (`6`, `22`, `6.5` for 06:30) or entity IDs.
2243+
2244+
---
2245+
21782246
### ⏩ Sparse Data with Points Per Hour
21792247

21802248
For sensors that update infrequently (e.g. weather), use a higher `points_per_hour` with forward-fill. Empty buckets inherit the last known value, producing a clean step-line instead of scattered dots.

0 commit comments

Comments
 (0)