Closed simonwood0609 closed 4 years ago
Hey, You're most likely not loading the latest version of the card. If you've installed through HACS, please see this https://github.com/kalkih/mini-graph-card/issues/169. If you've installed the card manually, try clearing the browser cache.
Sorry for the late reply - thanks, that fixed it! Just deleted the plugin & re-installed via HACS since I'd previously added it manually.
By the way, any way to easily remove the timestamp from the data when mouse-over?
Not without changing the source code, but yes, we should probably skip the timestamp if grouped by date.
I'm pretty new to GitHub, where can I leave feature requests?
I'm also wondering if the bar graph can/does support negative values, as some days I produce more power than I consume so the net/total is negative. Would be nice to have that coloured differently too.
You can just open another issue and state that it's a feature request.
The bar graph does support negative value, the y-axis will change dynamically based on min/max data points.
Sure, you could use color thresholds to render negative bars red and positive bars green for example:
- type: custom:mini-graph-card
entities:
- sensor.energy
show:
graph: bar
icon_adaptive_color: true
color_thresholds:
- value: -50
color: '#e74c3c' # red
- value: 0 # above 0 render as this color
color: '#27ae60' *# green
An example of a server load bar graph with color thresholds
Thanks again for your time @kalkih .
I now understand how your graph visualises negative data - at first I thought the y-axis responsive scale must have been wrong (why is 1.17 so close to 6.84?)
Then I realised that is because the zero-line is somewhere here:
This is what I was hoping to acheive:
Is that possible currently?
Also how would I add data-labels to the bar graph to show each bar's value?
Here's my current code:
entities:
- entity: sensor.energyeasy_yesterday_usage
group_by: date
hours_to_show: 336
name: Energy Usage
show:
graph: bar
type: 'custom:mini-graph-card'
icon_adaptive_color: true
color_thresholds:
- color: green
value: -50
- color: yellow
value: 0
- color: orange
value: 5
- color: red
value: 10
Is that possible currently?
Also how would I add data-labels to the bar graph to show each bar's value?
No, that graph type is not supported. If you want a challenge you could potentially play around with template sensors and some custom css to achieve it though. Here's an example of what you can achieve pretty easily (line graph though).
As for the bar values hover/touch is the only way to see the value atm.
Thanks so much for sharing this card @kalkih !
I can't for the life of me figure out why the group_by flag isn't working - I copied your exact template from the guide and changed the sensor only.
Each day has multiple bar-points (the last two "trends" are two days).