-
Notifications
You must be signed in to change notification settings - Fork 121
/
constants.ts
145 lines (134 loc) · 3.64 KB
/
constants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import { $Values } from 'utility-types';
import { ChartTypes } from '../chart_types';
import { Position } from '../utils/common';
import { LIGHT_THEME } from '../utils/themes/light_theme';
import { SettingsSpec } from './settings';
export const SpecTypes = Object.freeze({
Series: 'series' as const,
Axis: 'axis' as const,
Annotation: 'annotation' as const,
Settings: 'settings' as const,
IndexOrder: 'index_order' as const,
SmallMultiples: 'small_multiples' as const,
});
/** @public */
export type SpecTypes = $Values<typeof SpecTypes>;
/**
* Type of bin aggregations
*/
export const BinAgg = Object.freeze({
/**
* Order by sum of values in bin
*/
Sum: 'sum' as const,
/**
* Order of values are used as is
*/
None: 'none' as const,
});
/** @public */
export type BinAgg = $Values<typeof BinAgg>;
/**
* Direction of sorting
*/
export const Direction = Object.freeze({
/**
* Least to greatest
*/
Ascending: 'ascending' as const,
/**
* Greatest to least
*/
Descending: 'descending' as const,
});
/** @public */
export type Direction = $Values<typeof Direction>;
export const PointerEventType = Object.freeze({
Over: 'Over' as const,
Out: 'Out' as const,
});
/** @public */
export type PointerEventType = $Values<typeof PointerEventType>;
/**
* This enums provides the available tooltip types
* @public
*/
export const TooltipType = Object.freeze({
/** Vertical cursor parallel to x axis */
VerticalCursor: 'vertical' as const,
/** Vertical and horizontal cursors */
Crosshairs: 'cross' as const,
/** Follow the mouse coordinates */
Follow: 'follow' as const,
/** Hide every tooltip */
None: 'none' as const,
});
/**
* The TooltipType
* @public
*/
export type TooltipType = $Values<typeof TooltipType>;
export const BrushAxis = Object.freeze({
X: 'x' as const,
Y: 'y' as const,
Both: 'both' as const,
});
/** @public */
export type BrushAxis = $Values<typeof BrushAxis>;
/**
* Default value for the tooltip type
* @defaultValue `vertical` {@link (TooltipType:type) | TooltipType.VerticalCursor}
* @public
*/
export const DEFAULT_TOOLTIP_TYPE = TooltipType.VerticalCursor;
/**
* Default value for the tooltip snap
* @defaultValue `true`
* @public
*/
export const DEFAULT_TOOLTIP_SNAP = true;
export const DEFAULT_SETTINGS_SPEC: SettingsSpec = {
id: '__global__settings___',
chartType: ChartTypes.Global,
specType: SpecTypes.Settings,
rendering: 'canvas' as const,
rotation: 0 as const,
animateData: true,
showLegend: false,
resizeDebounce: 10,
debug: false,
tooltip: {
type: DEFAULT_TOOLTIP_TYPE,
snap: DEFAULT_TOOLTIP_SNAP,
},
externalPointerEvents: {
tooltip: {
visible: false,
},
},
legendMaxDepth: Infinity,
legendPosition: Position.Right,
showLegendExtra: false,
hideDuplicateAxes: false,
baseTheme: LIGHT_THEME,
brushAxis: BrushAxis.X,
minBrushDelta: 2,
};