Skip to content

Commit e4d4432

Browse files
committed
Adds back the time slider box
1 parent 8fef8ba commit e4d4432

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

src/components/colorbar-plot/colorbar-plot.tsx

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,21 +147,29 @@ export const ColorbarPlot = observer(function ColorbarPlot() {
147147
// leave() {
148148
// stopAnnotationDragListener();
149149
// },
150-
annotations: selectedPinLabels.map((label) => {
151-
const xIndex = labels.indexOf(label); // Find the index of the selected pin label
152-
if (xIndex === -1) return null; // Skip if the label is not found
153-
return {
154-
type: "box",
155-
xMin: xIndex - 0.5, // Highlight the entire vertical bar
156-
xMax: xIndex + 0.5,
157-
yMin: 0, // Start from the bottom of the chart
158-
yMax: yLabels.length,
159-
backgroundColor: "rgba(255, 99, 132, 0.25)",
160-
borderColor: "rgba(255, 99, 132, 1)",
161-
borderWidth: 2,
162-
};
163-
}).filter(Boolean), // Remove null annotations
164-
},
150+
annotations: {
151+
box1: {
152+
type: "box" as const,
153+
yMin: yLabels.indexOf(selectedYMDDate!),
154+
yMax: yLabels.indexOf(selectedYMDDate!) + 1,
155+
backgroundColor: "rgba(255, 99, 132, 0.25)"
156+
},
157+
...selectedPinLabels.map((label) => {
158+
const xIndex = labels.indexOf(label); // Find the index of the selected pin label
159+
if (xIndex === -1) return null; // Skip if the label is not found
160+
return {
161+
type: "box",
162+
xMin: xIndex - 0.5, // Highlight the entire vertical bar
163+
xMax: xIndex + 0.5,
164+
yMin: 0, // Start from the bottom of the chart
165+
yMax: yLabels.length,
166+
backgroundColor: "rgba(255, 99, 132, 0.25)",
167+
borderColor: "rgba(255, 99, 132, 1)",
168+
borderWidth: 2,
169+
};
170+
}).filter(Boolean) // Remove null annotations
171+
}
172+
}
165173
},
166174
responsive: true,
167175
maintainAspectRatio: false,

0 commit comments

Comments
 (0)