Skip to content

Fix readme formatting of preset examples #527

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

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -1072,24 +1072,31 @@ Below is an example YAML configuration that is split into several corresponding
<table>
<tr>
<th>YAML configuration</th>
<th>Preset configurations</th>
</tr>
<tr style="vertical-align:top">
<tr>
<td>

```yaml
hours_to_show: current_day
time_offset: -24h
defaults:
entity:
hovertemplate: "$fn ({ get }) => `%{y:,.1f} ${get('.unit_of_measurement')}<extra>${get('.name')}</extra>`"
hovertemplate: |
$fn ({ get }) => (
`%{y:,.1f} ${get('.unit_of_measurement')}<extra>${get('.name')}</extra>`
)
xaxes:
showspikes: true
spikemode: across
spikethickness: -2
```

</td>
</tr>
<tr>
<th>Preset configurations</th>
</tr>
<tr>
<td>

```js
Expand All @@ -1101,7 +1108,9 @@ window.PlotlyGraphCardPresets = {
simpleHover: { // Start of preset with name 'simpleHover'
defaults: {
entity: {
hovertemplate: ({get}) => `%{y:,.1f} ${get(".unit_of_measurement")}<extra>${get(".name")}</extra>`,
hovertemplate: ({get}) => (
`%{y:,.1f} ${get('.unit_of_measurement')}<extra>${get('.name')}</extra>`
),
},
},
},
Expand Down
Loading