Skip to content

Commit

Permalink
feat(annotations): set zIndex per spec
Browse files Browse the repository at this point in the history
  • Loading branch information
emmacunningham committed May 3, 2019
1 parent 921468f commit d9aa483
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/lib/series/specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ export type LineAnnotationSpec = BaseAnnotationSpec & {
};
/** Annotation lines are hidden */
hideLines?: boolean;
/** z-index of the annotation relative to other elements in the chart
* @default 1
*/
zIndex?: number;
};

export interface RectAnnotationDatum {
Expand All @@ -238,6 +242,10 @@ export type RectAnnotationSpec = BaseAnnotationSpec & {
dataValues: RectAnnotationDatum[];
/** Custom annotation style */
style?: Partial<RectAnnotationStyle>;
/** z-index of the annotation relative to other elements in the chart
* @default -1
*/
zIndex?: number;
};

export interface BaseAnnotationSpec {
Expand All @@ -256,7 +264,7 @@ export interface BaseAnnotationSpec {
/** Toggles tooltip annotation visibility */
hideTooltips?: boolean;
/** z-index of the annotation relative to other elements in the chart
* @default 0
* Default specified per specific annotation spec.
*/
zIndex?: number;
}
Expand Down
2 changes: 1 addition & 1 deletion src/specs/line_annotation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class LineAnnotationSpecComponent extends PureComponent<LineAnnotationPro
style: DEFAULT_ANNOTATION_LINE_STYLE,
hideLines: false,
hideTooltips: false,
zIndex: 0,
zIndex: 1,
};

private markerRef = createRef<HTMLDivElement>();
Expand Down
2 changes: 1 addition & 1 deletion src/specs/rect_annotation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class RectAnnotationSpecComponent extends PureComponent<RectAnnotationPro
static defaultProps: Partial<RectAnnotationProps> = {
groupId: getGroupId('__global__'),
annotationType: 'rectangle',
zIndex: 0,
zIndex: -1,
};

componentDidMount() {
Expand Down

0 comments on commit d9aa483

Please sign in to comment.