kalkih / mini-graph-card

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

[Feature request] Negative values #630

Open roybosch opened 3 years ago

roybosch commented 3 years ago

Hi!

First of all: great lovelace card. I'm using the mini-graph-card for all my graphs because it's by far the best out there.

Since a few weeks I'm also using it to monitor my energy usage compared to my solar yield. I made a template sensor which subtracts one from another, resulting in a positive value (I'm using more energy than my solar panels can deliver) or a negative value (the yield of my solar panels is more than I'm using). With the color_threshold attribute I'm making these two states red or green as shown below:

image

There could be a few improvements on this, which aren't possible so far:

  1. I'd like to draw an x-axis to show where the value goes negative. With the green and red color I can make this also visible, but showing a line would communicate better I think. Showing a small timeline on the x-axis would make it even better.

  2. If I change the graph to bars instead of line, the negative bars are drawn in positive direction. Only the color changes. I'd like to see them move down from the x-axis to state that these are negative values. Like this: image

  3. If I'm using the show_fill: true attribute on the graph shown above, it colors the area under the line. It would be nice if it colors the negative values above the line until the x-axis. Like so: image

Just some ideas which make your card even more powerfull in my opinion!

Kind regards,

Roy

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

This could be a very nice feature.

stale[bot] commented 2 years ago

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

trankillity commented 2 years ago

Example SVG implementation in my feature request from almost 2 years ago.

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!

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!

mareklab commented 2 years ago
image

Yes, this could be very useful to display above as bars instead of ugly lines. Home Assistant Energy page got it right:

image

just it cannot be reused outside of Energy :(

trankillity commented 2 years ago

For anyone following along who still wants this feature, I have moved to using ApexCharts Card as it has the flexibility to allow this (and a lot more).

mareklab commented 2 years ago

Apex Charts are nice, just pretty slow if compared to mini-graph. Also, bar charts there do not support colour thresholds yet.

rafalw1277 commented 1 year ago

Will this option ever be added ?

ildar170975 commented 1 year ago

@rafalw1277 Currently rectifying bugs & maintaining is the most prioritized task. Adding new non-critical features like this one is a future job. You are more than welcome to participate & add a necessary functionality.

chrwei commented 1 year ago

seems like negative values are working fine now. I wasn't sure at first and found this post, after watching it a couple days it seems perfect. card

ildar170975 commented 1 year ago

negative values are working fine now

Surely they are working.

The issue was mainly about features which are absent now: -- filling a space between an X-axis and a graph -- drawing an X-axis -- direction of bars with negative values.