kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
3.05k stars 237 forks source link

Header, Icon & State: wrong adaptive color when "color_thresholds" defined #621

Open typxxi opened 3 years ago

typxxi commented 3 years ago

Yes, the colour does change, but the icon's and title's color does NOT REFLECT THE LASTEST state but the lowest state in my case. Look at this weight curve and you can see that the orange belongs to the past with the lowest weight and not to the latest weight which would mean a lot more red instead of orange. Here is the code.

type: 'custom:mini-graph-card'
entities:
  - entity: sensor.ble_weight_mi_scale2
show:
  labels: 'true'
  state: 'false'
  name: 'false'
  icon: 'true'
  name_adaptive_color: 'true'
  icon_adaptive_color: 'true'
color_thresholds:
  - value: 102
    color: '#f39c12'
  - value: '104'
    color: '#d35400'
  - value: '105'
    color: '#c0392b'

image

If I change the thesholds I get this darke red and it looks like this, but again : icon and header represent a minimum and not the latest state which in this case would mean orange and not red.

image

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this is still an active issue, please let us know!

ildar170975 commented 2 years ago

Surely there is some problems here.

These options work if color_thresholds NOT specified:

type: custom:mini-graph-card
entities:
  - entity: sensor.cleargrass_1_co2
    color: red
    state_adaptive_color: true
hours_to_show: 6
points_per_hour: 60
show:
  fill: true
  name_adaptive_color: true
  icon_adaptive_color: true

image

When the color_thresholds are specified:

type: custom:mini-graph-card
entities:
  - entity: sensor.cleargrass_1_co2
    state_adaptive_color: true
hours_to_show: 6
points_per_hour: 60
aggregate_func: last
smoothing: false
show:
  labels: false
  fill: true
  name_adaptive_color: true
  icon_adaptive_color: true
color_thresholds_transition: hard
line_width: 3
height: 500
color_thresholds:
  - value: 700
    color: cyan
  - value: 740
    color: orange
  - value: 800
    color: violet
  - value: 850
    color: blue
  - value: 900
    color: brown

The icon & name are colored only when the MAX points are selected - but it should be colored always dependingly on the selected point's color: image

The state is colored always by the LATEST value's color - but it should be colored always dependingly on the selected point's color: image

stale[bot] commented 2 years ago

Still an active issue, got it! Removing stale label.

ildar170975 commented 2 years ago

Additional info here: https://github.com/kalkih/mini-graph-card/issues/688

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If this is still an active issue, please let us know!