Skip to content

Commit 143e402

Browse files
author
Kathryn Dale
committed
Make watermark scale
1 parent e368d39 commit 143e402

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

metrics/interfaces/charts/common/chart_output.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from metrics.interfaces.data_classification.access import DataClassification
88

99
HEX_COLOUR_BLACK = "#0b0c0c"
10-
WATERMARK_FONT_SIZE = 40
1110
WATERMARK_FONT_COLOUR = "rgba(0, 0, 0, 0.25)"
1211
WATERMARK_OPACITY = 0.58
1312

@@ -34,7 +33,7 @@ def __post_init__(self) -> None:
3433

3534
def _apply_watermark(self) -> None:
3635
"""
37-
Adds a diagonal watermark to the Plotly figure.
36+
Adds a horizontal watermark to the Plotly figure.
3837
3938
The watermark is added directly to the figure as a layout
4039
annotation using paper coordinates, so it is consistently
@@ -43,17 +42,21 @@ def _apply_watermark(self) -> None:
4342
"""
4443

4544
watermark_text = DataClassification[self.data_classification].value
46-
wrapped_watermark_text = wrap_text(watermark_text, 16)
45+
46+
width = self.figure.layout.width or 800
47+
48+
WATERMARK_FONT_SIZE = max(20, int(width * 0.07))
49+
4750

4851
self.figure.add_annotation(
49-
text=wrapped_watermark_text,
52+
text=watermark_text,
5053
xref="paper",
5154
yref="paper",
5255
x=0.5,
5356
y=0.5,
5457
showarrow=False,
5558
font={"size": WATERMARK_FONT_SIZE, "color": WATERMARK_FONT_COLOUR},
56-
textangle=-30,
59+
textangle=0,
5760
opacity=WATERMARK_OPACITY,
5861
)
5962

0 commit comments

Comments
 (0)