@hpcc-js/map 3.5.2 → 3.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +43 -43
- package/README.md +88 -88
- package/TopoJSON/BR.json +122 -122
- package/TopoJSON/GB_idx.json +1 -1
- package/TopoJSON/IE_idx.json +1 -1
- package/TopoJSON/ND_idx.json +1 -1
- package/TopoJSON/countries.json +257 -257
- package/TopoJSON/us-counties.json +16550 -16550
- package/TopoJSON/us-states.json +458 -458
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +1 -1
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +9 -9
- package/src/CanvasPinLayer.ts +99 -99
- package/src/CanvasPins.ts +397 -397
- package/src/Choropleth.css +26 -26
- package/src/Choropleth.ts +203 -203
- package/src/ChoroplethContinents.ts +13 -13
- package/src/ChoroplethCounties.ts +111 -111
- package/src/ChoroplethCountries.ts +100 -100
- package/src/ChoroplethStates.ts +103 -103
- package/src/ChoroplethStatesHeat.ts +8 -8
- package/src/GMap.css +20 -20
- package/src/GMap.ts +880 -880
- package/src/GMapCounties.ts +93 -93
- package/src/GMapGraph.ts +61 -61
- package/src/GMapHeat.ts +27 -27
- package/src/GMapLayered.ts +94 -94
- package/src/GMapPin.ts +115 -115
- package/src/GMapPinLine.ts +138 -138
- package/src/GeoHash.css +14 -14
- package/src/GeoHash.ts +139 -139
- package/src/Graph.css +9 -9
- package/src/Graph.ts +98 -98
- package/src/Graticule.css +12 -12
- package/src/Graticule.ts +97 -97
- package/src/Heat.ts +87 -87
- package/src/IChoropleth.ts +8 -8
- package/src/Layer.ts +99 -99
- package/src/Layered.css +18 -18
- package/src/Layered.ts +206 -206
- package/src/Lines.css +8 -8
- package/src/Lines.ts +78 -78
- package/src/OpenStreet.css +15 -15
- package/src/OpenStreet.ts +126 -126
- package/src/Pins.css +17 -17
- package/src/Pins.ts +350 -350
- package/src/Projection.ts +42 -42
- package/src/TestHeatMap.ts +8 -8
- package/src/TopoJSONChoropleth.ts +125 -125
- package/src/Utility.ts +484 -484
- package/src/__package__.ts +3 -3
- package/src/index.ts +33 -33
- package/src/leaflet/AlbersPR.ts +48 -48
- package/src/leaflet/Blank.ts +9 -9
- package/src/leaflet/Circles.ts +139 -139
- package/src/leaflet/ClusterCircles.css +26 -26
- package/src/leaflet/ClusterCircles.ts +88 -88
- package/src/leaflet/Countries.ts +43 -43
- package/src/leaflet/DrawLayer.ts +167 -167
- package/src/leaflet/FeatureLayer.ts +138 -138
- package/src/leaflet/GMap.ts +44 -44
- package/src/leaflet/HeatLayer.ts +77 -77
- package/src/leaflet/Icons.ts +60 -60
- package/src/leaflet/Leaflet.css +3 -3
- package/src/leaflet/Leaflet.ts +239 -239
- package/src/leaflet/MapBox.ts +35 -35
- package/src/leaflet/Markers.ts +109 -109
- package/src/leaflet/OpenStreet.ts +27 -27
- package/src/leaflet/Path.ts +138 -138
- package/src/leaflet/Pins.ts +73 -73
- package/src/leaflet/Polygons.ts +113 -113
- package/src/leaflet/Region.ts +138 -138
- package/src/leaflet/Text.ts +99 -99
- package/src/leaflet/TileLayer.ts +81 -81
- package/src/leaflet/TopoJSON.ts +146 -146
- package/src/leaflet/US.ts +15 -15
- package/src/leaflet/USCounties.ts +43 -43
- package/src/leaflet/USStates.ts +41 -41
- package/src/leaflet/World.css +3 -3
- package/src/leaflet/World.ts +172 -172
- package/src/leaflet/index.ts +18 -18
- package/src/leaflet/leaflet-shim.ts +18 -18
- package/src/leaflet/plugins/BeautifyIcon.css +44 -44
- package/src/leaflet/plugins/BeautifyIcon.ts +190 -190
- package/src/leaflet/plugins/BeutifyIcon.licence +20 -20
- package/src/leaflet/plugins/D3SvgOverlay.css +2 -2
- package/src/leaflet/plugins/D3SvgOverlay.licence +20 -20
- package/src/leaflet/plugins/D3SvgOverlay.ts +175 -175
- package/src/leaflet/plugins/HeatLayer.license +21 -21
- package/src/leaflet/plugins/HeatLayer.ts +224 -224
- package/src/leaflet/plugins/Leaflet.GoogleMutant.ts +424 -424
- package/src/leaflet/plugins/lru_map.ts +352 -352
- package/src/test.ts +114 -114
- package/types/Layered.d.ts +1 -1
package/src/Choropleth.css
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
.map_Layered .checkerFill {
|
|
2
|
-
fill: red;
|
|
3
|
-
stroke: red;
|
|
4
|
-
opacity: 0.5;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.map_Layered .checkerNoFill {
|
|
8
|
-
fill: none;
|
|
9
|
-
stroke: none;
|
|
10
|
-
opacity: 0.5;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.map_Layered .mesh {
|
|
14
|
-
fill: none;
|
|
15
|
-
stroke: #6D6E71;
|
|
16
|
-
stroke-width: 0.25;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.map_Layered .data {
|
|
20
|
-
stroke: none;
|
|
21
|
-
stroke-width: 0.25;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.map_Layered .data .shape.selected {
|
|
25
|
-
stroke: red;
|
|
26
|
-
stroke-width: 1.25px;
|
|
1
|
+
.map_Layered .checkerFill {
|
|
2
|
+
fill: red;
|
|
3
|
+
stroke: red;
|
|
4
|
+
opacity: 0.5;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.map_Layered .checkerNoFill {
|
|
8
|
+
fill: none;
|
|
9
|
+
stroke: none;
|
|
10
|
+
opacity: 0.5;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.map_Layered .mesh {
|
|
14
|
+
fill: none;
|
|
15
|
+
stroke: #6D6E71;
|
|
16
|
+
stroke-width: 0.25;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.map_Layered .data {
|
|
20
|
+
stroke: none;
|
|
21
|
+
stroke-width: 0.25;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.map_Layered .data .shape.selected {
|
|
25
|
+
stroke: red;
|
|
26
|
+
stroke-width: 1.25px;
|
|
27
27
|
}
|
package/src/Choropleth.ts
CHANGED
|
@@ -1,203 +1,203 @@
|
|
|
1
|
-
import { Palette, Utility } from "@hpcc-js/common";
|
|
2
|
-
import { select as d3Select } from "d3-selection";
|
|
3
|
-
import * as topojson from "topojson-client";
|
|
4
|
-
import { Layer } from "./Layer.ts";
|
|
5
|
-
|
|
6
|
-
import "../src/Choropleth.css";
|
|
7
|
-
|
|
8
|
-
declare const window: any;
|
|
9
|
-
|
|
10
|
-
let _topoJsonFolder: string = window.__hpcc_topoJsonFolder || "./node_modules/@hpcc-js/map/TopoJSON";
|
|
11
|
-
export function topoJsonFolder(_?: string): string {
|
|
12
|
-
if (!arguments.length) return _topoJsonFolder;
|
|
13
|
-
const retVal = _topoJsonFolder;
|
|
14
|
-
_topoJsonFolder = _;
|
|
15
|
-
return retVal;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class Choropleth extends Layer {
|
|
19
|
-
_dataMap = {};
|
|
20
|
-
_path: any = d3Select(null);
|
|
21
|
-
|
|
22
|
-
_dataMinWeight;
|
|
23
|
-
_dataMaxWeight;
|
|
24
|
-
_choroplethData;
|
|
25
|
-
_choroplethTransform;
|
|
26
|
-
_choropleth;
|
|
27
|
-
_choroTopology;
|
|
28
|
-
_choroTopologyObjects;
|
|
29
|
-
_prevProjection;
|
|
30
|
-
_prevInternalOnly;
|
|
31
|
-
|
|
32
|
-
constructor() {
|
|
33
|
-
super();
|
|
34
|
-
Utility.SimpleSelectionMixin.call(this);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
data(_?) {
|
|
38
|
-
const retVal = Layer.prototype.data.apply(this, arguments);
|
|
39
|
-
if (arguments.length) {
|
|
40
|
-
this._dataMap = {};
|
|
41
|
-
this._dataMinWeight = null;
|
|
42
|
-
this._dataMaxWeight = null;
|
|
43
|
-
|
|
44
|
-
const context = this;
|
|
45
|
-
this.data().forEach(function (item) {
|
|
46
|
-
context._dataMap[item[0]] = item;
|
|
47
|
-
if (!context._dataMinWeight || item[1] < context._dataMinWeight) {
|
|
48
|
-
context._dataMinWeight = item[1];
|
|
49
|
-
}
|
|
50
|
-
if (!context._dataMaxWeight || item[1] > context._dataMaxWeight) {
|
|
51
|
-
context._dataMaxWeight = item[1];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
return retVal;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
getDataBounds() {
|
|
59
|
-
const bbox = this._choroplethData.node().getBBox();
|
|
60
|
-
const retVal = {
|
|
61
|
-
x: bbox.x,
|
|
62
|
-
y: bbox.y,
|
|
63
|
-
width: bbox.width,
|
|
64
|
-
height: bbox.height
|
|
65
|
-
};
|
|
66
|
-
/*
|
|
67
|
-
const scale = this._zoom.scale();
|
|
68
|
-
retVal.x *= scale;
|
|
69
|
-
retVal.y *= scale;
|
|
70
|
-
retVal.width *= scale;
|
|
71
|
-
retVal.height *= scale;
|
|
72
|
-
const translate = this._zoom.translate();
|
|
73
|
-
retVal.x += translate[0];
|
|
74
|
-
retVal.y += translate[1];
|
|
75
|
-
*/
|
|
76
|
-
return retVal;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
autoScale() {
|
|
80
|
-
switch (this.autoScaleMode()) {
|
|
81
|
-
case "none":
|
|
82
|
-
return;
|
|
83
|
-
case "mesh":
|
|
84
|
-
this.zoomToBBox(this.getBounds());
|
|
85
|
-
break;
|
|
86
|
-
case "data":
|
|
87
|
-
this.zoomToBBox(this.getDataBounds());
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
layerEnter(base, svgElement, domElement) {
|
|
93
|
-
Layer.prototype.layerEnter.apply(this, arguments);
|
|
94
|
-
this._choroplethTransform = svgElement;
|
|
95
|
-
this._choroplethData = this._choroplethTransform.append("g")
|
|
96
|
-
.attr("class", "data")
|
|
97
|
-
;
|
|
98
|
-
this._choropleth = this._choroplethTransform.append("path")
|
|
99
|
-
.attr("class", "mesh")
|
|
100
|
-
;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
layerUpdate(base, forcePath?) {
|
|
104
|
-
Layer.prototype.layerUpdate.apply(this, arguments);
|
|
105
|
-
|
|
106
|
-
this._palette = this._palette.switch(this.paletteID());
|
|
107
|
-
if (this.useClonedPalette()) {
|
|
108
|
-
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
this._choroplethTransform
|
|
112
|
-
.style("stroke", this.meshColor())
|
|
113
|
-
.style("opacity", this.opacity())
|
|
114
|
-
;
|
|
115
|
-
|
|
116
|
-
if (!this.visible() || !this.meshVisible()) {
|
|
117
|
-
this._choropleth.attr("d", "");
|
|
118
|
-
delete this._prevProjection;
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (forcePath || this._prevProjection !== base.projection() || this._prevInternalOnly !== this.internalOnly()) {
|
|
123
|
-
this._choropleth
|
|
124
|
-
.attr("d", base._d3GeoPath(topojson.mesh(this._choroTopology, this._choroTopologyObjects, this.internalOnly() ? function (a, b) { return a !== b; } : function (a, b) { return true; })))
|
|
125
|
-
;
|
|
126
|
-
this._prevProjection = base.projection();
|
|
127
|
-
this._prevInternalOnly = this.internalOnly();
|
|
128
|
-
}
|
|
129
|
-
this._choropleth
|
|
130
|
-
.style("stroke-width", this.meshStrokeWidth())
|
|
131
|
-
.style("stroke", this.meshColor())
|
|
132
|
-
;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
layerExit(base) {
|
|
136
|
-
delete this._prevProjection;
|
|
137
|
-
delete this._prevInternalOnly;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
layerZoomed(base) {
|
|
141
|
-
super.layerZoomed.apply(this, arguments);
|
|
142
|
-
this._choroplethData
|
|
143
|
-
.style("stroke-width", this.meshVisible() ? "0px" : `${0.5 / base.zoomScale()}px`)
|
|
144
|
-
;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// Events ---
|
|
148
|
-
click(row, column, selected) {
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
dblclick(row, column, selected) {
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
Choropleth.prototype._class += " map_Choropleth";
|
|
155
|
-
Choropleth.prototype.mixin(Utility.SimpleSelectionMixin);
|
|
156
|
-
|
|
157
|
-
Choropleth.prototype._palette = Palette.rainbow("default");
|
|
158
|
-
|
|
159
|
-
export interface Choropleth {
|
|
160
|
-
_palette;
|
|
161
|
-
|
|
162
|
-
// SimpleSelectionMixin ---
|
|
163
|
-
_selection;
|
|
164
|
-
|
|
165
|
-
// Properties ---
|
|
166
|
-
paletteID(): string;
|
|
167
|
-
paletteID(_: string): this;
|
|
168
|
-
paletteID_exists(): boolean;
|
|
169
|
-
useClonedPalette(): boolean;
|
|
170
|
-
useClonedPalette(_: boolean): this;
|
|
171
|
-
useClonedPalette_exists(): boolean;
|
|
172
|
-
|
|
173
|
-
opacity(): number;
|
|
174
|
-
opacity(_: number): this;
|
|
175
|
-
opacity_exists(): boolean;
|
|
176
|
-
|
|
177
|
-
meshVisible(): boolean;
|
|
178
|
-
meshVisible(_: boolean): this;
|
|
179
|
-
meshVisible_exists(): boolean;
|
|
180
|
-
meshColor(): string;
|
|
181
|
-
meshColor(_: string): this;
|
|
182
|
-
meshColor_exists(): boolean;
|
|
183
|
-
meshStrokeWidth(): number;
|
|
184
|
-
meshStrokeWidth(_: number): this;
|
|
185
|
-
meshStrokeWidth_exists(): boolean;
|
|
186
|
-
internalOnly(): boolean;
|
|
187
|
-
internalOnly(_: boolean): this;
|
|
188
|
-
internalOnly_exists(): boolean;
|
|
189
|
-
autoScaleMode(): string;
|
|
190
|
-
autoScaleMode(_: string): this;
|
|
191
|
-
autoScaleMode_exists(): boolean;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
Choropleth.prototype.publish("paletteID", "YlOrRd", "set", "Color palette for this widget", Choropleth.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
|
|
195
|
-
Choropleth.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
|
|
196
|
-
|
|
197
|
-
Choropleth.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
|
|
198
|
-
|
|
199
|
-
Choropleth.prototype.publish("meshVisible", true, "boolean", "Mesh Visibility");
|
|
200
|
-
Choropleth.prototype.publish("meshColor", null, "html-color", "Stroke Color", null, { optional: true });
|
|
201
|
-
Choropleth.prototype.publish("meshStrokeWidth", 0.25, "number", "Stroke Width");
|
|
202
|
-
Choropleth.prototype.publish("internalOnly", false, "boolean", "Internal mesh only");
|
|
203
|
-
Choropleth.prototype.publish("autoScaleMode", "mesh", "set", "Auto Scale", ["none", "mesh", "data"], { tags: ["Basic"], override: true });
|
|
1
|
+
import { Palette, Utility } from "@hpcc-js/common";
|
|
2
|
+
import { select as d3Select } from "d3-selection";
|
|
3
|
+
import * as topojson from "topojson-client";
|
|
4
|
+
import { Layer } from "./Layer.ts";
|
|
5
|
+
|
|
6
|
+
import "../src/Choropleth.css";
|
|
7
|
+
|
|
8
|
+
declare const window: any;
|
|
9
|
+
|
|
10
|
+
let _topoJsonFolder: string = window.__hpcc_topoJsonFolder || "./node_modules/@hpcc-js/map/TopoJSON";
|
|
11
|
+
export function topoJsonFolder(_?: string): string {
|
|
12
|
+
if (!arguments.length) return _topoJsonFolder;
|
|
13
|
+
const retVal = _topoJsonFolder;
|
|
14
|
+
_topoJsonFolder = _;
|
|
15
|
+
return retVal;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class Choropleth extends Layer {
|
|
19
|
+
_dataMap = {};
|
|
20
|
+
_path: any = d3Select(null);
|
|
21
|
+
|
|
22
|
+
_dataMinWeight;
|
|
23
|
+
_dataMaxWeight;
|
|
24
|
+
_choroplethData;
|
|
25
|
+
_choroplethTransform;
|
|
26
|
+
_choropleth;
|
|
27
|
+
_choroTopology;
|
|
28
|
+
_choroTopologyObjects;
|
|
29
|
+
_prevProjection;
|
|
30
|
+
_prevInternalOnly;
|
|
31
|
+
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
Utility.SimpleSelectionMixin.call(this);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
data(_?) {
|
|
38
|
+
const retVal = Layer.prototype.data.apply(this, arguments);
|
|
39
|
+
if (arguments.length) {
|
|
40
|
+
this._dataMap = {};
|
|
41
|
+
this._dataMinWeight = null;
|
|
42
|
+
this._dataMaxWeight = null;
|
|
43
|
+
|
|
44
|
+
const context = this;
|
|
45
|
+
this.data().forEach(function (item) {
|
|
46
|
+
context._dataMap[item[0]] = item;
|
|
47
|
+
if (!context._dataMinWeight || item[1] < context._dataMinWeight) {
|
|
48
|
+
context._dataMinWeight = item[1];
|
|
49
|
+
}
|
|
50
|
+
if (!context._dataMaxWeight || item[1] > context._dataMaxWeight) {
|
|
51
|
+
context._dataMaxWeight = item[1];
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return retVal;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
getDataBounds() {
|
|
59
|
+
const bbox = this._choroplethData.node().getBBox();
|
|
60
|
+
const retVal = {
|
|
61
|
+
x: bbox.x,
|
|
62
|
+
y: bbox.y,
|
|
63
|
+
width: bbox.width,
|
|
64
|
+
height: bbox.height
|
|
65
|
+
};
|
|
66
|
+
/*
|
|
67
|
+
const scale = this._zoom.scale();
|
|
68
|
+
retVal.x *= scale;
|
|
69
|
+
retVal.y *= scale;
|
|
70
|
+
retVal.width *= scale;
|
|
71
|
+
retVal.height *= scale;
|
|
72
|
+
const translate = this._zoom.translate();
|
|
73
|
+
retVal.x += translate[0];
|
|
74
|
+
retVal.y += translate[1];
|
|
75
|
+
*/
|
|
76
|
+
return retVal;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
autoScale() {
|
|
80
|
+
switch (this.autoScaleMode()) {
|
|
81
|
+
case "none":
|
|
82
|
+
return;
|
|
83
|
+
case "mesh":
|
|
84
|
+
this.zoomToBBox(this.getBounds());
|
|
85
|
+
break;
|
|
86
|
+
case "data":
|
|
87
|
+
this.zoomToBBox(this.getDataBounds());
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
layerEnter(base, svgElement, domElement) {
|
|
93
|
+
Layer.prototype.layerEnter.apply(this, arguments);
|
|
94
|
+
this._choroplethTransform = svgElement;
|
|
95
|
+
this._choroplethData = this._choroplethTransform.append("g")
|
|
96
|
+
.attr("class", "data")
|
|
97
|
+
;
|
|
98
|
+
this._choropleth = this._choroplethTransform.append("path")
|
|
99
|
+
.attr("class", "mesh")
|
|
100
|
+
;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
layerUpdate(base, forcePath?) {
|
|
104
|
+
Layer.prototype.layerUpdate.apply(this, arguments);
|
|
105
|
+
|
|
106
|
+
this._palette = this._palette.switch(this.paletteID());
|
|
107
|
+
if (this.useClonedPalette()) {
|
|
108
|
+
this._palette = this._palette.cloneNotExists(this.paletteID() + "_" + this.id());
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
this._choroplethTransform
|
|
112
|
+
.style("stroke", this.meshColor())
|
|
113
|
+
.style("opacity", this.opacity())
|
|
114
|
+
;
|
|
115
|
+
|
|
116
|
+
if (!this.visible() || !this.meshVisible()) {
|
|
117
|
+
this._choropleth.attr("d", "");
|
|
118
|
+
delete this._prevProjection;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (forcePath || this._prevProjection !== base.projection() || this._prevInternalOnly !== this.internalOnly()) {
|
|
123
|
+
this._choropleth
|
|
124
|
+
.attr("d", base._d3GeoPath(topojson.mesh(this._choroTopology, this._choroTopologyObjects, this.internalOnly() ? function (a, b) { return a !== b; } : function (a, b) { return true; })))
|
|
125
|
+
;
|
|
126
|
+
this._prevProjection = base.projection();
|
|
127
|
+
this._prevInternalOnly = this.internalOnly();
|
|
128
|
+
}
|
|
129
|
+
this._choropleth
|
|
130
|
+
.style("stroke-width", this.meshStrokeWidth())
|
|
131
|
+
.style("stroke", this.meshColor())
|
|
132
|
+
;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
layerExit(base) {
|
|
136
|
+
delete this._prevProjection;
|
|
137
|
+
delete this._prevInternalOnly;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
layerZoomed(base) {
|
|
141
|
+
super.layerZoomed.apply(this, arguments);
|
|
142
|
+
this._choroplethData
|
|
143
|
+
.style("stroke-width", this.meshVisible() ? "0px" : `${0.5 / base.zoomScale()}px`)
|
|
144
|
+
;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Events ---
|
|
148
|
+
click(row, column, selected) {
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
dblclick(row, column, selected) {
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
Choropleth.prototype._class += " map_Choropleth";
|
|
155
|
+
Choropleth.prototype.mixin(Utility.SimpleSelectionMixin);
|
|
156
|
+
|
|
157
|
+
Choropleth.prototype._palette = Palette.rainbow("default");
|
|
158
|
+
|
|
159
|
+
export interface Choropleth {
|
|
160
|
+
_palette;
|
|
161
|
+
|
|
162
|
+
// SimpleSelectionMixin ---
|
|
163
|
+
_selection;
|
|
164
|
+
|
|
165
|
+
// Properties ---
|
|
166
|
+
paletteID(): string;
|
|
167
|
+
paletteID(_: string): this;
|
|
168
|
+
paletteID_exists(): boolean;
|
|
169
|
+
useClonedPalette(): boolean;
|
|
170
|
+
useClonedPalette(_: boolean): this;
|
|
171
|
+
useClonedPalette_exists(): boolean;
|
|
172
|
+
|
|
173
|
+
opacity(): number;
|
|
174
|
+
opacity(_: number): this;
|
|
175
|
+
opacity_exists(): boolean;
|
|
176
|
+
|
|
177
|
+
meshVisible(): boolean;
|
|
178
|
+
meshVisible(_: boolean): this;
|
|
179
|
+
meshVisible_exists(): boolean;
|
|
180
|
+
meshColor(): string;
|
|
181
|
+
meshColor(_: string): this;
|
|
182
|
+
meshColor_exists(): boolean;
|
|
183
|
+
meshStrokeWidth(): number;
|
|
184
|
+
meshStrokeWidth(_: number): this;
|
|
185
|
+
meshStrokeWidth_exists(): boolean;
|
|
186
|
+
internalOnly(): boolean;
|
|
187
|
+
internalOnly(_: boolean): this;
|
|
188
|
+
internalOnly_exists(): boolean;
|
|
189
|
+
autoScaleMode(): string;
|
|
190
|
+
autoScaleMode(_: string): this;
|
|
191
|
+
autoScaleMode_exists(): boolean;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
Choropleth.prototype.publish("paletteID", "YlOrRd", "set", "Color palette for this widget", Choropleth.prototype._palette.switch(), { tags: ["Basic", "Shared"] });
|
|
195
|
+
Choropleth.prototype.publish("useClonedPalette", false, "boolean", "Enable or disable using a cloned palette", null, { tags: ["Intermediate", "Shared"] });
|
|
196
|
+
|
|
197
|
+
Choropleth.prototype.publish("opacity", 1.0, "number", "Opacity", null, { tags: ["Advanced"] });
|
|
198
|
+
|
|
199
|
+
Choropleth.prototype.publish("meshVisible", true, "boolean", "Mesh Visibility");
|
|
200
|
+
Choropleth.prototype.publish("meshColor", null, "html-color", "Stroke Color", null, { optional: true });
|
|
201
|
+
Choropleth.prototype.publish("meshStrokeWidth", 0.25, "number", "Stroke Width");
|
|
202
|
+
Choropleth.prototype.publish("internalOnly", false, "boolean", "Internal mesh only");
|
|
203
|
+
Choropleth.prototype.publish("autoScaleMode", "mesh", "set", "Auto Scale", ["none", "mesh", "data"], { tags: ["Basic"], override: true });
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ChoroplethCountries } from "./ChoroplethCountries.ts";
|
|
2
|
-
|
|
3
|
-
export class ChoroplethContinents extends ChoroplethCountries {
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
layerEnter(base, svgElement, domElement) {
|
|
9
|
-
ChoroplethCountries.prototype.layerEnter.apply(this, arguments);
|
|
10
|
-
this._choroTopologyObjects = this._choroTopologyObjectsLand;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
ChoroplethContinents.prototype._class += " map_ChoroplethContinents";
|
|
1
|
+
import { ChoroplethCountries } from "./ChoroplethCountries.ts";
|
|
2
|
+
|
|
3
|
+
export class ChoroplethContinents extends ChoroplethCountries {
|
|
4
|
+
constructor() {
|
|
5
|
+
super();
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
layerEnter(base, svgElement, domElement) {
|
|
9
|
+
ChoroplethCountries.prototype.layerEnter.apply(this, arguments);
|
|
10
|
+
this._choroTopologyObjects = this._choroTopologyObjectsLand;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
ChoroplethContinents.prototype._class += " map_ChoroplethContinents";
|