Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fill color problem when line is flat #1080

Open
jhemak opened this issue Feb 15, 2024 · 3 comments
Open

Fill color problem when line is flat #1080

jhemak opened this issue Feb 15, 2024 · 3 comments

Comments

@jhemak
Copy link

jhemak commented Feb 15, 2024

Hello! Thanks for creating such a great card! I am seeing a problem similar to #652.

When the line is flat, the line is the wrong color (even though the icon is the correct color).

type: custom:mini-graph-card
name: Battery Charge
entities:
  - entity: sensor.apc_battery_charge
hours_to_show: 6
points_per_hour: 1
decimals: 0
color_thresholds_transition: hard
color_thresholds:
  - value: 20
    color: '#ff0000'
  - value: 50
    color: '#ffa500'
  - value: 80
    color: '#008000'
show:
  labels: false
  points: false
  icon_adaptive_color: true

1

When I add the lower_bound, the line turns the correct color but the fill is strange.

type: custom:mini-graph-card
name: Battery Charge
entities:
  - entity: sensor.apc_battery_charge
hours_to_show: 6
points_per_hour: 1
decimals: 0
lower_bound: ~0
color_thresholds_transition: hard
color_thresholds:
  - value: 20
    color: '#ff0000'
  - value: 50
    color: '#ffa500'
  - value: 80
    color: '#008000'
show:
  labels: false
  points: false
  icon_adaptive_color: true

2

Would be great if you can take a look at it when you have time. Thank you!

@jhemak
Copy link
Author

jhemak commented Feb 15, 2024

Oops - sorry about that. Thanks for making me aware.

@ildar170975
Copy link
Collaborator

Well,

  1. As it was already suggested in the similar post - use labels: true to make the picture clear.
  2. As it was described in readme - the value in color_threasholds stands for "starting from this point - apply this color". I.e. it should be value: 0.
  3. There are already registered issues related to thresholds - which in most cases may be fixed by defining lower_bound.

@jhemak
Copy link
Author

jhemak commented Feb 15, 2024

Thanks for the suggestions - and for caching my typo on point 2. Add'l tests suggests the behavior remains the same.

type: custom:mini-graph-card
name: Battery Charge
entities:
  - entity: sensor.apc_battery_charge
hours_to_show: 12
points_per_hour: 1
decimals: 0
color_thresholds_transition: hard
color_thresholds:
  - value: 0
    color: '#ff0000'
  - value: 20
    color: '#ffa500'
  - value: 80
    color: '#008000'
show:
  labels: true
  points: false
  icon_adaptive_color: true

1

type: custom:mini-graph-card
name: Battery Charge
entities:
  - entity: sensor.apc_battery_charge
hours_to_show: 12
points_per_hour: 1
decimals: 0
lower_bound: ~0
color_thresholds_transition: hard
color_thresholds:
  - value: 0
    color: '#ff0000'
  - value: 20
    color: '#ffa500'
  - value: 80
    color: '#008000'
show:
  labels: true
  points: false
  icon_adaptive_color: true

2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants