diff --git a/src/components/Figure.tsx b/src/components/Figure.tsx
index 85036745..ae3b5791 100644
--- a/src/components/Figure.tsx
+++ b/src/components/Figure.tsx
@@ -150,9 +150,9 @@ export const FigureGraph = ({
"#722ed1",
],
legendFormatter: function (data) {
- if (data.x == null) {
- return "";
- }
+ // Without a hovered point (data.x == null) still list the series
+ // names and colors — an empty legend box reads as a bug.
+ const hovering = data.x != null;
let html = '
';
data.series.forEach(function (series) {
if (!series.isVisible) return;
@@ -161,7 +161,11 @@ export const FigureGraph = ({
'● ';
- html += series.labelHTML + ": " + series.yHTML + "
";
+ html += series.labelHTML;
+ if (hovering) {
+ html += ": " + series.yHTML;
+ }
+ html += "
";
});
html += "
";
return html;
diff --git a/src/index.css b/src/index.css
index 6f6dafc9..efdaec7f 100644
--- a/src/index.css
+++ b/src/index.css
@@ -425,14 +425,22 @@ body,
color: #fff !important;
border: 1px solid #333 !important;
border-radius: 4px !important;
- padding: 8px !important;
+ padding: 6px 8px !important;
+ /* The legend is always visible now: shrink to content (the library
+ default is a fixed 250px), cap its footprint on small charts, and
+ never intercept pointer events meant for the plot beneath it. */
+ width: auto !important;
+ max-width: 45% !important;
+ max-height: 45% !important;
+ overflow: hidden !important;
+ font-size: 11px !important;
+ line-height: 1.5 !important;
+ pointer-events: none !important;
}
.dygraph-custom-legend {
- background: rgba(0, 0, 0, 0.8);
- padding: 8px;
- border-radius: 4px;
color: #fff;
+ white-space: nowrap;
}
.dygraph-legend-dot {