diff --git a/src/components/CandleChart.tsx b/src/components/CandleChart.tsx index 8f12c8e..c5689c9 100644 --- a/src/components/CandleChart.tsx +++ b/src/components/CandleChart.tsx @@ -157,13 +157,15 @@ const CandleChart = forwardRef( (a) => a.label_type === 'break_up' || a.label_type === 'break_down' ); - const markers = markerAnnotations.map((annotation) => ({ - time: annotation.timestamp as Time, - position: annotation.label_type === 'break_up' ? ('belowBar' as const) : ('aboveBar' as const), - color: annotation.label_type === 'break_up' ? '#22c55e' : '#ef4444', - shape: annotation.label_type === 'break_up' ? ('arrowUp' as const) : ('arrowDown' as const), - text: annotation.label_type === 'break_up' ? 'Break Up' : 'Break Down', - })); + const markers = markerAnnotations + .map((annotation) => ({ + time: annotation.timestamp as Time, + position: annotation.label_type === 'break_up' ? ('belowBar' as const) : ('aboveBar' as const), + color: annotation.label_type === 'break_up' ? '#22c55e' : '#ef4444', + shape: annotation.label_type === 'break_up' ? ('arrowUp' as const) : ('arrowDown' as const), + text: annotation.label_type === 'break_up' ? 'Break Up' : 'Break Down', + })) + .sort((a, b) => (a.time as number) - (b.time as number)); seriesRef.current.setMarkers(markers); }, [annotations]);