forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
heatmap.d.ts
139 lines (115 loc) · 3.08 KB
/
heatmap.d.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
// Type definitions for heatmap.js v2.0
// Project: https://github.com/pa7/heatmap.js/
// Definitions by: Yang Guan <https://github.com/lookuptable>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../leaflet/leaflet.d.ts" />
/*
* Configuration object of a heatmap
*/
interface HeatmapConfiguration {
/*
* A background color string in form of hexcode, color name, or rgb(a)
*/
backgroundColor?: string;
/*
* The blur factor that will be applied to all datapoints. The higher the
* blur factor is, the smoother the gradients will be
* Default value: 0.85
*/
blur?: number;
/*
* An object that represents the gradient
*/
gradient?: any;
/*
* The property name of your latitude coordinate in a datapoint
* Default value: 'x'
*/
latField?: string;
/*
* The property name of your longitude coordinate in a datapoint
* Default value: 'y'
*/
lngField?: string;
/*
* The maximal opacity the highest value in the heatmap will have. (will be
* overridden if opacity set)
* Default value: 0.6
*/
maxOpacity?: number;
/*
* The minimum opacity the lowest value in the heatmap will have (will be
* overridden if opacity set)
*/
minOpacity?: number;
/*
* A global opacity for the whole heatmap. This overrides maxOpacity and
* minOpacity if set
*/
opacity?: number;
/*
* The radius each datapoint will have (if not specified on the datapoint
* itself)
*/
radius?: number;
/**
* Scales the radius based on map zoom.
*/
scaleRadius?: boolean;
/*
* Indicate whether the heatmap should use a global extrema or a local
* extrema (the maximum and minimum of the currently displayed viewport)
*/
useLocalExtrema?: boolean;
/*
* The property name of the value/weight in a datapoint
*/
valueField: string;
}
/*
* A single data point on a heatmap. The keys are specified by
* HeatmapConfig.latField, HeatmapConfig.lngField and HeatmapConfig.valueField
*/
interface HeatmapDataPoint {
[index: string]: number;
}
/*
* An object representing the set of data points on a heatmap
*/
interface HeatmapData {
/*
* An array of HeatmapDataPoints
*/
data: HeatmapDataPoint[];
/*
* Max value of the valueField
*/
max?: number;
/*
* Min value of the valueField
*/
min?: number;
}
/*
* The overlay layer to be added onto leaflet map
*/
declare class HeatmapOverlay {
/*
* Initialization function
*/
constructor(configuration: HeatmapConfiguration)
/*
* Create DOM elements for an overlay, adding them to map panes and puts
* listeners on relevant map events
*/
onAdd(map: L.Map): void;
/*
* Remove the overlay's elements from the DOM and remove listeners
* previously added by onAdd()
*/
onRemove(map: L.Map): void;
/*
* Initialize a heatmap instance with the given dataset
*/
setData(data: HeatmapData): void;
}