diff --git a/ui/src/shared/annotations/styles.js b/ui/src/shared/annotations/styles.js index 3b504852c8..198ddbc878 100644 --- a/ui/src/shared/annotations/styles.js +++ b/ui/src/shared/annotations/styles.js @@ -154,22 +154,10 @@ export const tooltipFormStyle = { export const tooltipInputButton = {marginLeft: '2px'} export const tooltipInput = {flex: '1 0 0'} -export const annotationStyle = ( - {startTime}, - dygraph, - isMouseOver, - isDragging -) => { +export const annotationStyle = (time, dygraph, isMouseOver, isDragging) => { // TODO: export and test this function - const [startX, endX] = dygraph.xAxisRange() - let visibility = 'visible' - - if (startTime < startX || startTime > endX) { - visibility = 'hidden' - } - const containerLeftPadding = 16 - const left = `${dygraph.toDomXCoord(startTime) + containerLeftPadding}px` + const left = `${dygraph.toDomXCoord(time) + containerLeftPadding}px` const width = 2 return { @@ -183,7 +171,7 @@ export const annotationStyle = ( width: `${width}px`, transition: 'background-color 0.25s ease', transform: `translateX(-${width / 2}px)`, // translate should always be half with width to horizontally center the annotation pole - visibility, + visibility: 'visible', zIndex: isDragging || isMouseOver ? zIndexAnnotationActive : zIndexAnnotation, } diff --git a/ui/src/shared/components/Annotation.js b/ui/src/shared/components/Annotation.js index 62b5dca12e..4263e85c83 100644 --- a/ui/src/shared/components/Annotation.js +++ b/ui/src/shared/components/Annotation.js @@ -85,45 +85,180 @@ class Annotation extends Component { e.stopPropagation() } + renderPoint( + annotation, + dygraph, + isMouseOver, + isDragging, + humanTime, + isEditing + ) { + return ( +