Skip to content

Commit

Permalink
feat(annotation): enable marker positioning on LineAnnotation
Browse files Browse the repository at this point in the history
This commit allows changing the marker position on a line annotation. The position is absolute on
the screen space and doesn't depend on the chart rotation

fix elastic#701
  • Loading branch information
markov00 committed Jul 3, 2020
1 parent d683322 commit ddec3f1
Show file tree
Hide file tree
Showing 16 changed files with 464 additions and 751 deletions.
219 changes: 0 additions & 219 deletions src/chart_types/xy_chart/annotations/annotation_marker.test.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import { MockSeriesSpec, MockAnnotationSpec, MockGlobalSpec } from '../../../../mocks/specs';
import { MockStore } from '../../../../mocks/store';
import { ScaleType } from '../../../../scales/constants';
import { Position } from '../../../../utils/commons';
import { computeAnnotationDimensionsSelector } from '../../state/selectors/compute_annotations';
import { AnnotationDomainTypes } from '../../utils/specs';

Expand Down Expand Up @@ -51,11 +50,10 @@ function expectAnnotationAtPosition(
const annotations = computeAnnotationDimensionsSelector(store.getState());
expect(annotations.get(annotation.id)).toEqual([
{
anchor: { left: expectedLinePosition, position: 'bottom', top: 100 },
details: { detailsText: undefined, headerText: `${indexPosition}` },
linePathPoints: {
start: { x1: expectedLinePosition, y1: 100 },
end: { x2: expectedLinePosition, y2: 0 },
start: { x1: expectedLinePosition, y1: 0 },
end: { x2: expectedLinePosition, y2: 100 },
},
marker: undefined,
},
Expand Down Expand Up @@ -145,14 +143,9 @@ describe('Render vertical line annotation within', () => {
const annotations = computeAnnotationDimensionsSelector(store.getState());
expect(annotations.get(annotation.id)).toEqual([
{
anchor: {
top: 100,
left: 95,
position: Position.Bottom,
},
linePathPoints: {
start: { x1: 95, y1: 100 },
end: { x2: 95, y2: 0 },
start: { x1: 95, y1: 0 },
end: { x2: 95, y2: 100 },
},
details: { detailsText: 'foo', headerText: '9.5' },
marker: undefined,
Expand Down
Loading

0 comments on commit ddec3f1

Please sign in to comment.