Thanks for taking the time to assist. Correct, the card size is ok. I would leave it bigger if it adjusted the font clipping but that doesnāt seem to help.
Here is what it looks like when I adjust the card height.
Hey guys. Iām stumped on this.
Is there a (probably simple) way to make the padding change consistent, when the mini media player entity changes to āāinactiveā the code ceases to work.
Many Thanks
---- Edit ----
I found the answer. ā!importantā. Damn i feel dumb
Hi
I feel like I have tried everything: I want to change the color of the bars i plot in a mini-graph-card with an if-statement based on which hour it is to highlight which bar represents the current electricity price. I thought card-mod is the best way to go but I canāt find out even how to change the color with card-mod. I have tried place the card-mod code in different places but I donāt really know what iām doing. I can change the color with the ācolor entryā when i add the entitiy to the graph but not with card-mod to include the if-statement. Any suggestions how to proceed here? Perhaps there is another smarter way than if-statement based on the current hour?
The image should show what Iām after, The code I have right now is belowā¦ i have removed some entity entries just to make the code a bit more readable.
This works for a āshow 1 graphā case.
In your case a code contains 3 graphs (one with āshow_graph: falseā) - so adapt this style for your case.
To select some bar you need to use smth like ānth-child(17)ā.
Each bar corresponds to some hour. If you need to select the current hour - this will be the LAST bar.
Goto 1st post ā link at the bottom ā styles for mini-graph-card ā How to set a color for the last bar.
If you need to select SOME PARTICULAR bar - then use this:
card_mod:
style: |
{% set INDEX = ................ -%}
.graph__container__svg svg g.bars .bar:nth-child({{INDEX}}) {
fill: grey;
}
where you need to specify a formula for the āINDEXā value.
first I set it to the ha-card, but that was moot, since I use these picture-element cards to navigate to my roomsā¦ only looked for a way to have the bottom-section icons be non-responsive.
this seems to work as hoped for, posting here for others to help, and if something could be optimized, please do (as always the challenge is in combining several styling aspects, in the case the border on the card. the [[]] originate the decluttering template I use for these Navigating cards):
since I dont use titles for the picture-glance cards, the div is 1ā¦ it opens up the right section for interaction.
I also tried to set cursor: none in that section, but suppose I need another property to attach that to, because it cant be dine generically in that div
the hover popups are a bit slow (in button-card I always use
@Ildar_Gabdullin Thanks for taking time to explain for a beginner
Your example colors the whole graph if I select nth-child(1) since I only show 1 hour per entity. My entities are energy prices for one hour that is why I have this set up.
I donāt see how to tweak it to select the right entity to color When i check the inspector the bars seem to have individual numbers so I donāt really understand
Do you have any additional suggestion?
Thanks for helping out!
Not sure I understand you.
In my example there is a graph with N bars for some time span (hours_to_show). By card-mod you may colorize some bar(s) - the first, the last, the 7th etc.
Probably your initial goal is not clear then. Post a graph and explain which bar you want to colorize.
more configurability is available using apexcharts btw, making indicating the current price even easier, injecting a secondary graph, and the Now indicator:
Hi, Yes sorry Iām probably not being clear.
Iāll take it from beginning maybe it will be more clear:
I have sensor data for energy price for each hour. So sensor.nordpool_today_hr_00_01 (energy cost during 00:00 - 01:00), sensor.nordpool_today_hr_01_02 ( energy cost during 01:00 - 02:00) I have 24 bars that are plotted with individal entity and I only show 1 hour.
group_by: hour
hours_to_show: 1
But since i put
entities:
- entity: sensor.nordpool_today_hr_00_01
name: Today hour 1
show_legend: false
- entity: sensor.nordpool_today_hr_01_02
name: Today hour 2
show_legend: false
... and so on until ...
- entity: sensor.nordpool_today_hr_23_24
name: Today hour 24
show_legend: false
If i put in your card_mod code addressing the 2nth bar in the end of my card:
I color the whole graph (all 24 bars get color grey) because each entity has is represented by 1 bar and iām now coloring 1st bar of every entity. Do you see my problem ?
I donāt understand the how to translate the DOM to CSS/YAML for card-mod but what Iām after (i know it is not correct but):
Your figure with Processor use where you are colring the 5th bar is exaclty what Iām after and the generic code to set the id of the bar is perfect for my purpose but it seems like the card_mod style is not specifying which entity it is refering to modify the fill for which in my case seems to be needed.
I hope that makes sence THanks again for helping out, It is much appreciated!
this wont work, because for 24 hours, you show 24 entities.
that is a completely different config from a single entity shown for 24 hours.
sadly there is no option in the mini-graph-card card to add a ānowā label. if you d need the now indicator, maybe some nifty vertical-stack option could work showing the 2 on top of each other.
ofc, the easiest way out here would be the apexcharts, which has the option builtin:
Hello
I have been following your discussions and thoughts regarding the apexcharts card with great interest. I have a different thought than the ones Iāve seen you discuss so far, but it still applies to the sensor for the energy price. My desire is to be able to color the different bars depending on whether they are above or below, say, the average for the day. If it were possible to use the value of a sensor or some kind of template to specify the value of a color_threshold, that would solve my problem. I have made a few attempts without success. Is there any solution to this./Peter