Repository navigation
Expand file tree
/
Copy pathTimeLine.js
More file actions
336 lines (310 loc) · 7.66 KB
/
Copy pathTimeLine.js
File metadata and controls
336 lines (310 loc) · 7.66 KB
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
/*********************************************************************************
Copyright © SuperMap. All rights reserved.
Author: Wang zihao
E-mail: pridehao@gmail.com
Description:时间轴类
**********************************************************************************/
import {NativeModules} from 'react-native';
let TL = NativeModules.JSTimeLine;
import ChartView from './ChartView.js';
/**
* @class TimeLine
* @description 时间轴类,根据时间对数据进行展示的地图可视化图表
*/
export default class TimeLine {
/**
* 创建TimeLine对象
* @memberOf TimeLine
* @param {number} reactTag - 视图对应的reactTag值
* @returns {Promise.<TimeLine>}
*/
async createObj(reactTag){
var{_SMTimeLine} = TL.createObj(reactTag);
var timeLine = new TimeLine();
timeLine._SMTimeLine = _SMTimeLine;
return timeLine;
}
/**
* 设置滑块大小
* @memberOf TimeLine
* @param {number} size
* @returns {Promise.<void>}
*/
async setSliderSize(size){
try{
await TL.setSliderSize(this._SMTimeLine,size);
}catch(e){
console.error(e);
}
}
/**
* 获取滑块大小
* @memberOf TimeLine
* @returns {Promise.<number>}
*/
async getSliderSize(){
try{
var{size} = await TL.getSliderSize(this._SMTimeLine);
return size;
}catch(e){
console.error(e);
}
}
/**
* 设置滑块风格
* @memberOf TimeLine
* @param {string} url - 图片资源路径
* @returns {Promise.<void>}
*/
async setSliderImage(url){
try{
await TL.setSliderImage(this._SMTimeLine,url);
}catch(e){
console.error(e);
}
}
/**
* 获取滑块风格
* @memberOf TimeLine
* @returns {Promise.<object>}
*/
async getSliderImage(){
try{
var {image} = await TL.getSliderImage(this._SMTimeLine);
return image;
}catch(e){
console.error(e);
}
}
/**
* 设置滑块选中风格
* @memberOf TimeLine
* @param {string} url - 图片资源路径
* @returns {Promise.<void>}
*/
async setSliderSelectedImage(url){
try{
await TL.setSliderSelectedImage(this._SMTimeLine,url);
}catch(e){
console.error(e);
}
}
/**
* 获取滑块选中风格
* @memberOf TimeLine
* @returns {Promise.<object>}
*/
async getSliderSelectedImage(){
try{
var {image} = await TL.getSliderSelectedImage(this._SMTimeLine);
return image;
}catch(e){
console.error(e);
}
}
/**
* 设置滑块标签字体大小
* @memberOf TimeLine
* @param {number} size - 字体大小
* @returns {Promise.<void>}
*/
async setSliderLabelSize(size){
try{
await TL.setSliderLabelSize(this._SMTimeLine,size);
}catch(e){
console.error(e);
}
}
/**
* 获取滑块标签字体大小
* @memberOf TimeLine
* @returns {Promise.<number>}
*/
async getSliderLabelSize(){
try{
var {size} = await TL.getSliderLabelSize(this._SMTimeLine);
return size;
}catch(e){
console.error(e);
}
}
/**
* 设置滑块标签字体颜色
* @memberOf TimeLine
* @param {Arr} color - 字体颜色数组
* @returns {Promise.<void>}
*/
async setSliderLabelColor(color){
try{
await TL.setSliderLabelColor(this._SMTimeLine,color);
}catch(e){
console.error(e);
}
}
/**
* 获取滑块标签字体颜色
* @memberOf TimeLine
* @returns {Promise.<Arr>}
*/
async getSliderLabelColor(){
try{
var {color} = await TL.getSliderLabelColor(this._SMTimeLine);
return color;
}catch(e){
console.error(e);
}
}
/**
* 设置时间轴风格
* @memberOf TimeLine
* @param {Arr} color - 字体颜色数组
* @returns {Promise.<void>}
*/
async setTimeLineColor(color){
try{
await TL.setTimeLineColor(this._SMTimeLine,color);
}catch(e){
console.error(e);
}
}
/**
* 获取时间轴风格
* @memberOf TimeLine
* @returns {Promise.<Arr>}
*/
async getTimeLineColor(){
try{
var {color} = await TL.getTimeLineColor(this._SMTimeLine);
return color;
}catch(e){
console.error(e);
}
}
/**
* 设置播放按钮风格
* @memberOf TimeLine
* @param {string} url - 图片资源路径
* @returns {Promise.<void>}
*/
async setPlayImage(url){
try{
await TL.setPlayImage(this._SMTimeLine,url);
}catch(e){
console.error(e);
}
}
/**
* 获取播放按钮风格
* @memberOf TimeLine
* @returns {Promise.<object>}
*/
async getPlayImage(){
try{
var {image} = await TL.getPlayImage(this._SMTimeLine);
return image;
}catch(e){
console.error(e);
}
}
/**
* 设置停止按钮风格
* @memberOf TimeLine
* @param {string} url - 图片资源路径
* @returns {Promise.<void>}
*/
async setStopPlayImage(url){
try{
await TL.setStopPlayImage(this._SMTimeLine,url);
}catch(e){
console.error(e);
}
}
/**
* 获取停止按钮风格
* @memberOf TimeLine
* @returns {Promise.<object>}
*/
async getStopPlayImage(){
try{
var {image} = await TL.getStopPlayImage(this._SMTimeLine);
return image;
}catch(e){
console.error(e);
}
}
/**
* 设置时间轴是否水平放置
* @memberOf TimeLine
* @param {boolean} b
* @returns {Promise.<void>}
*/
async setHorizontal(b){
try{
await TL.setHorizontal(this._SMTimeLine,b);
}catch(e){
console.error(e);
}
}
/**
* 获取时间轴是否水平放置
* @memberOf TimeLine
* @returns {Promise.<object>}
*/
async isHorizontal(){
try{
var {bool} = await TL.isHorizontal(this._SMTimeLine);
return bool;
}catch(e){
console.error(e);
}
}
/**
* 添加关联图表
* @memberOf TimeLine
* @param {ChartView} chart - 关联图表
* @returns {Promise.<void>}
*/
async addChart(chart){
try{
await TL.addChart(this._SMTimeLine,chart.chartviewId);
}catch(e){
console.error(e);
}
}
/**
* 移除关联图表
* @memberOf TimeLine
* @returns {Promise.<object>}
*/
async removeChart(chart){
try{
await TL.removeChart(this._SMTimeLine,chart.chartviewId);
}catch(e){
console.error(e);
}
}
/**
* 清空所有关联图表
* @memberOf TimeLine
* @returns {Promise.<void>}
*/
async clearChart(){
try{
await TL.clearChart(this._SMTimeLine);
}catch(e){
console.error(e);
}
}
/**
* 加载时间轴
* @memberOf TimeLine
* @returns {Promise.<object>}
*/
async load(){
try{
await TL.load(this._SMTimeLine);
}catch(e){
console.error(e);
}
}
}