docs: Improved plot annotations sample

This commit is contained in:
Matthias
2025-05-03 08:02:09 +02:00
parent a3359b62d4
commit 74f601b352
5 changed files with 5 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

View File

@@ -1180,8 +1180,8 @@ Entries will be validated, and won't be passed to the UI if they don't correspon
### Plot annotations example ### Plot annotations example
![FreqUI - plot Annotations](assets/frequi-chart-annotations-dark.png#only-dark) ![FreqUI - plot Annotations](assets/freqUI-chart-annotations-dark.png#only-dark)
![FreqUI - plot Annotations](assets/frequi-chart-annotations-light.png#only-light) ![FreqUI - plot Annotations](assets/freqUI-chart-annotations-light.png#only-light)
??? Info "Code used for the plot above" ??? Info "Code used for the plot above"
This is an example code and should be treated as such. This is an example code and should be treated as such.
@@ -1207,14 +1207,15 @@ Entries will be validated, and won't be passed to the UI if they don't correspon
} }
) )
elif (start_dt.hour % 2) == 0: elif (start_dt.hour % 2) == 0:
price = dataframe.loc[dataframe["date"] == start_dt, ["close"]].mean()
mark_areas.append( mark_areas.append(
{ {
"type": "area", "type": "area",
"label": "2h", "label": "2h",
"start": start_dt, "start": start_dt,
"end": start_dt + timedelta(hours=1), "end": start_dt + timedelta(hours=1),
"y_end": 1830, "y_end": price * 1.01,
"y_start": 1860, "y_start": price * 0.99,
"color": "rgba(0, 255, 0, 0.4)", "color": "rgba(0, 255, 0, 0.4)",
} }
) )