File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -394,16 +394,23 @@ entities:
394394 name: living temperature in Farenheit # Overrides the entity name
395395 unit_of_measurement: °F # Overrides the unit
396396 show_value: true # shows the last value as text
397+ customdata: |
398+ $fn ({states}) =>
399+ states.map( () => ({ extra_attr: "hello" }) )
400+ # customdata is array with the same number of values as x axis (states)
401+ # use statistics instead of states if entity is based on statistic
397402 texttemplate: >- # custom format for show_value
398- <b>%{y}</b>%{customdata.unit_of_measurement}<br>
399- %{customdata.name}
403+ <b>%{y}</b>%{customdata.extra_attr}<br>
400404 # to show only 2 decimals: "%{y:.2f}"
401- # see more here: https://plotly.com/javascript/reference/pie/#pie-texttemplate
402-
403- hovertemplate: >- # custom format for tooltip
404- <b>%{customdata.name}</b><br><i>%{x}</i><br>
405- %{y}%{customdata.unit_of_measurement}
406- <extra></extra>
405+ # see more here: https://plotly.com/javascript/hover-text-and-formatting/
406+ # only x, y, customdata are available as %{} template
407+
408+ hovertemplate: | # custom format for hover text using entity properites name and unit_of_measurement
409+ $fn ({ getFromConfig }) =>
410+ ` <b>${getFromConfig(".name")}</b><br>
411+ <i>%{x}</i><br>
412+ %{y}${getFromConfig(".unit_of_measurement")}
413+ <extra></extra>` # <extra></extra> removes text on the side of the tooltip (it otherwise defaults to the entity name)
407414```
408415
409416### Extend_to_present
You can’t perform that action at this time.
0 commit comments