UNPKG

6.47 kBTypeScriptView Raw
1/**
2 * Axis break module
3 */
4/**
5 * ============================================================================
6 * IMPORTS
7 * ============================================================================
8 * @hidden
9 */
10import { Container, IContainerProperties, IContainerAdapters, IContainerEvents } from "../../core/Container";
11import { Axis, AxisDataItem } from "./Axis";
12import { MutableValueDisposer } from "../../core/utils/Disposer";
13import { IWavedShape } from "../../core/defs/IWavedShape";
14import { List } from "../../core/utils/List";
15import { IPoint } from "../../core/defs/IPoint";
16/**
17 * ============================================================================
18 * REQUISITES
19 * ============================================================================
20 * @hidden
21 */
22/**
23 * Defines properties for [[AxisBreak]].
24 */
25export interface IAxisBreakProperties extends IContainerProperties {
26 /**
27 * A size of the break relative to the actual size of the scope break spans.
28 *
29 * For example, if `breakSize = 0.1` and unbroken scope of values it spans
30 * would be 100 pixels, the break would be 10 pixels wide.
31 *
32 * 0 means the break will completely collapse and hide the values.
33 * 1 means break would be not collapse at all, which would make it
34 * effectively useless.
35 *
36 * @default 0.01
37 */
38 breakSize?: number;
39 /**
40 * Starting value.
41 */
42 startValue?: number;
43 /**
44 * End value.
45 */
46 endValue?: number;
47}
48/**
49 * Defines events for [[AxisBreak]].
50 */
51export interface IAxisBreakEvents extends IContainerEvents {
52}
53/**
54 * Defines [[AxisBreak]] adapters.
55 *
56 * @see {@link Adapter}
57 */
58export interface IAxisBreakAdapters extends IContainerAdapters, IAxisBreakProperties {
59}
60/**
61 * ============================================================================
62 * MAIN CLASS
63 * ============================================================================
64 * @hidden
65 */
66/**
67 * Base class to define "breaks" on axes.
68 *
69 * @see {@link IAxisBreakEvents} for a list of available events
70 * @see {@link IAxisBreakAdapters} for a list of available Adapters
71 * @important
72 */
73export declare class AxisBreak extends Container {
74 /**
75 * Defines available properties.
76 */
77 _properties: IAxisBreakProperties;
78 /**
79 * Defines available adapters.
80 */
81 _adapter: IAxisBreakAdapters;
82 /**
83 * Defines available events.
84 */
85 _events: IAxisBreakEvents;
86 /**
87 * Defines the type of the Axis this break is used for.
88 */
89 _axisType: Axis;
90 /**
91 * Reference to parent Axis.
92 */
93 protected _axis: MutableValueDisposer<this["_axisType"]>;
94 /**
95 * A reference to starting line element.
96 */
97 protected _startLine: IWavedShape;
98 /**
99 * A reference to ending line element.
100 */
101 protected _endLine: IWavedShape;
102 /**
103 * A reference to fill shape.
104 */
105 protected _fillShape: IWavedShape;
106 /**
107 * A list of axis data items which fall within this break.
108 */
109 dataItems: List<AxisDataItem>;
110 /**
111 * Adjusted start value.
112 *
113 * Start and end values need to be adjusted so that they do not overlap with
114 * adjacent breaks.
115 */
116 adjustedStartValue: number;
117 /**
118 * Adjusted end value.
119 *
120 * Start and end values need to be adjusted so that they do not overlap with
121 * adjacent breaks.
122 */
123 adjustedEndValue: number;
124 /**
125 * Constructor
126 */
127 constructor();
128 dispose(): void;
129 /**
130 * An element used for the starting line of the break.
131 *
132 * @param sprite Element
133 */
134 /**
135 * @return Element
136 */
137 startLine: IWavedShape;
138 /**
139 * An element used for the end line of the break.
140 *
141 * @param sprite Element
142 */
143 /**
144 * @return Element
145 */
146 endLine: IWavedShape;
147 /**
148 * An element used for fill of the break.
149 *
150 * @param sprite Element
151 */
152 /**
153 * @return Element
154 */
155 fillShape: IWavedShape;
156 /**
157 * Adds a break element (e.g. lines, fill) to the break, which is
158 * [[Container]].
159 *
160 * @ignore Exclude from docs
161 * @param sprite Element to add
162 */
163 addBreakSprite(sprite: IWavedShape): void;
164 /**
165 * An Axis this Break is associated with.
166 *
167 * @param axis Axis
168 */
169 /**
170 * @return Axis
171 */
172 axis: this["_axisType"];
173 /**
174 * A size of the break relative to the actual size of the scope break spans.
175 *
176 * For example, if `breakSize = 0.1` and unbroken scope of values it spans
177 * would be 100 pixels, the break would be 10 pixels wide.
178 *
179 * 0 means the break will completely collapse and hide the values.
180 * 1 means break would be not collapse at all, which would make it
181 * effectively useless.
182 *
183 * @default 0.01
184 * @param value Relative axis break
185 */
186 /**
187 * @return Relative axis break
188 */
189 breakSize: number;
190 /**
191 * Returns pixel coordinates of axis break's start.
192 *
193 * @return Start point
194 */
195 readonly startPoint: IPoint;
196 /**
197 * Returns pixel coordinates of axis break's end.
198 *
199 * @return End point
200 */
201 readonly endPoint: IPoint;
202 /**
203 * Returns a relative position at which axis break starts.
204 *
205 * This is a calculated position, meaning it shows relative position of the
206 * break after break is applied.
207 *
208 * @return Start position
209 */
210 readonly startPosition: number;
211 /**
212 * Returns a relative position at which axis break ends.
213 *
214 * This is a calculated position, meaning it shows relative position of the
215 * break after break is applied.
216 *
217 * @return End position
218 */
219 readonly endPosition: number;
220 /**
221 * Draws the axis break.
222 *
223 * @ignore Exclude from docs
224 */
225 draw(): void;
226 /**
227 * A starting value for the break.
228 *
229 * @param value Starting value
230 */
231 /**
232 * @return Starting value
233 */
234 startValue: number;
235 /**
236 * An end value for the break.
237 *
238 * @param value End value
239 */
240 /**
241 * @return End value
242 */
243 endValue: number;
244}