UNPKG

5.75 kBTypeScriptView Raw
1/**
2 * [[Chart]] class provides base functionality for all chart types to inherit.
3 */
4import { Component, IComponentProperties, IComponentDataFields, IComponentEvents, IComponentAdapters } from "../core/Component";
5import { MutableValueDisposer } from "../core/utils/Disposer";
6import { ListTemplate, IListEvents } from "../core/utils/List";
7import { Container } from "../core/Container";
8import { Label } from "../core/elements/Label";
9import { Grip } from "../core/elements/Grip";
10import { Legend } from "../charts/Legend";
11import { DataItem } from "../core/DataItem";
12import * as $type from "../core/utils/Type";
13/**
14 * ============================================================================
15 * DATA ITEM
16 * ============================================================================
17 * @hidden
18 */
19/**
20 * Defines a [[DataItem]] for [[Chart]].
21 *
22 * @see {@link DataItem}
23 */
24export declare class ChartDataItem extends DataItem {
25 /**
26 * Defines a type of [[Component]] this data item is used for.
27 */
28 _component: Chart;
29 /**
30 * Constructor
31 */
32 constructor();
33}
34/**
35 * ============================================================================
36 * REQUISITES
37 * ============================================================================
38 * @hidden
39 */
40/**
41 * Defines data fields for [[Chart]].
42 */
43export interface IChartDataFields extends IComponentDataFields {
44}
45/**
46 * Defines properties for [[Chart]].
47 */
48export interface IChartProperties extends IComponentProperties {
49}
50/**
51 * Defines events for [[Chart]].
52 */
53export interface IChartEvents extends IComponentEvents {
54}
55/**
56 * Defines adapters for [[Chart]].
57 *
58 * @see {@link Adapter}
59 */
60export interface IChartAdapters extends IComponentAdapters, IChartProperties {
61}
62/**
63 * ============================================================================
64 * MAIN CLASS
65 * ============================================================================
66 * @hidden
67 */
68/**
69 * A base class for all Charts.
70 *
71 * @see {@link IChartEvents} for a list of available Events
72 * @see {@link IChartAdapters} for a list of available Adapters
73 */
74export declare class Chart extends Component {
75 /**
76 * Available data fields.
77 */
78 _dataFields: IChartDataFields;
79 /**
80 * Defines available properties.
81 */
82 _properties: IChartProperties;
83 /**
84 * Defines available adapters.
85 */
86 _adapter: IChartAdapters;
87 /**
88 * Defines available events.
89 */
90 _events: IChartEvents;
91 /**
92 * A List of chart titles.
93 */
94 titles: ListTemplate<Label>;
95 /**
96 * Container that holds the chart itself.
97 */
98 chartContainer: Container;
99 /**
100 * A reference to a container that holds both the chart and the legend.
101 */
102 chartAndLegendContainer: Container;
103 /**
104 * A reference to chart's [[Legend]].
105 * @ignore
106 */
107 protected _legend: MutableValueDisposer<Legend>;
108 /**
109 * Instance of the grip element.
110 */
111 protected _dragGrip: $type.Optional<Grip>;
112 /**
113 * Constructor
114 */
115 constructor();
116 /**
117 * Sets defaults that instantiate some objects that rely on parent, so they
118 * cannot be set in constructor.
119 */
120 protected applyInternalDefaults(): void;
121 /**
122 * Initiates drawing of the chart.
123 *
124 * @ignore Exclude from docs
125 */
126 draw(): void;
127 /**
128 * Updates legend's hierarchy based on the position.
129 */
130 protected fixLayout(): void;
131 /**
132 * Setups the legend to use the chart's data.
133 */
134 protected feedLegend(): void;
135 /**
136 * Adds a new title to the chart when it is inserted into chart's titles
137 * list.
138 * @param event An event object which is triggered when inserting into titles list
139 * @return Label object
140 */
141 protected processTitle(event: IListEvents<Label>["inserted"]): Label;
142 /**
143 * Checks if chart has any title elements. If it does, we will use them in an
144 * `aria-labelledby` attribute so that screen readers can use them to properly
145 * describe the chart when it is focused or hovered.
146 *
147 * @ignore Exclude from docs
148 */
149 updateReaderTitleReferences(): void;
150 /**
151 * Holds the instance of chart's [[Leged]].
152 *
153 * @see {@link https://www.amcharts.com/docs/v4/concepts/legend/} for more information about legends
154 * @param Legend
155 */
156 /**
157 * @return Legend
158 */
159 legend: Legend;
160 /**
161 * Prepares the legend instance for use in this chart.
162 *
163 * @param legend Legend
164 */
165 protected setLegend(legend: Legend): void;
166 /**
167 * Destroys this object and all related data.
168 */
169 dispose(): void;
170 /**
171 * Processes JSON-based config before it is applied to the object.
172 *
173 * @ignore Exclude from docs
174 * @param config Config
175 */
176 processConfig(config?: {
177 [index: string]: any;
178 }): void;
179 /**
180 * Copies all properties from another instance of [[Series]].
181 *
182 * @param source Source series
183 */
184 copyFrom(source: this): void;
185 /**
186 * An instance of [[Grip]] which serves as a grip point which appears on
187 * touch and allows scrolling whole page even if chart is occupying the
188 * whole of the screen and would otherwise prevent scrolling.
189 *
190 * @since 4.4.0
191 * @see {@link https://www.amcharts.com/docs/v4/concepts/touch/} For more information.
192 * @param value Grip
193 */
194 /**
195 * @return Grip
196 */
197 dragGrip: Grip;
198 focusable: boolean;
199}