Lovelace: mini graph card

How to change graph’s color dynamically:

There is a method to colorize a graph dependingly on a value using “color_thresholds” value.
But if someone needs a way to color the WHOLE graph dynamically - here is a brute-force method:

code
type: vertical-stack
cards:
  - type: entities
    entities:
      - entity: input_boolean.test_boolean
  - type: custom:mini-graph-card
    entities:
      - entity: sensor.processor_use
    show:
      points: true
    card_mod:
      style: |
        .line--rect,
        .fill--rect,
        .line--points {
          {% if is_state('input_boolean.test_boolean','on') %}
            {% set COLOR = 'cyan' %}
          {% else %}
            {% set COLOR = 'green' %}
          {% endif %}
          fill: {{COLOR}};
          stroke: {{COLOR}};
        }

This is an answer to this FR.

1 Like