@naivemap/mapbox-gl-echarts-layer 0.1.4 → 0.3.2

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 CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Naive Map
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Naive Map
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,17 +1,52 @@
1
- # mapbox-gl-echarts-layer
2
-
3
- [全国主要城市空气质量 - 百度地图](https://huanglii.github.io/mapbox-gl-js-cookbook/example/echarts-scatter.html)
4
-
5
- ```bash
6
- npm i @naivemap/mapbox-gl-echarts-layer
7
- ```
8
-
9
- ```js
10
- import EchartsLayer from '@naivemap/mapbox-gl-echarts-layer'
11
-
12
- // echart option
13
- const option = {...}
14
- const layer = new EchartsLayer('layer-id', option)
15
-
16
- map.addLayer(layer)
17
- ```
1
+ ## EChartsLayer class
2
+
3
+ ```bash
4
+ npm i @naivemap/mapbox-gl-echarts-layer echarts
5
+ ```
6
+
7
+ <b>Signature:</b>
8
+
9
+ ```typescript
10
+ export default class EChartsLayer implements mapboxgl.CustomLayerInterface
11
+ ```
12
+
13
+ <b>Implements:</b> mapboxgl.CustomLayerInterface
14
+
15
+ ## Constructors
16
+
17
+ | Constructor | Description |
18
+ | --- | --- |
19
+ | (constructor)(`id`: `string`, `option`: `ECOption`) | Constructs a new instance of the <code>EChartsLayer</code> class |
20
+
21
+ ### Parameters
22
+
23
+ **id** `(string)` The ID of the layer.
24
+
25
+ **option** `(ECOption)` The option of the [Lines graph](https://echarts.apache.org/zh/option.html#series-lines) and [Scatter (bubble) chart](https://echarts.apache.org/zh/option.html#series-scatter).
26
+
27
+ ```ts
28
+ export type ECOption = echarts.ComposeOption<
29
+ | TitleComponentOption
30
+ | TooltipComponentOption
31
+ | LegendComponentOption
32
+ | LinesSeriesOption
33
+ | ScatterSeriesOption
34
+ | EffectScatterSeriesOption
35
+ >
36
+ ```
37
+
38
+ ### Methods
39
+
40
+ | Method | Description |
41
+ | ---------------------------------- | ------------------------------------------------------- |
42
+ | **setOption** `(option: ECOption)` | Call `echartsInstance.setOption()` to update the chart. |
43
+
44
+ ## Example
45
+
46
+ ```ts
47
+ // echart option
48
+ const option = {...}
49
+ const layer = new EChartsLayer('layer-id', option)
50
+
51
+ map.addLayer(layer)
52
+ ```
@@ -0,0 +1,104 @@
1
+ import { init, registerCoordinateSystem, } from 'echarts';
2
+ var COORDINATE_SYSTEM_NAME = 'mapboxgl-echarts';
3
+ var CoordinateSystem = /** @class */ (function () {
4
+ function CoordinateSystem(map) {
5
+ this.dimensions = ['x', 'y'];
6
+ this._mapOffset = [0, 0];
7
+ this.map = map;
8
+ }
9
+ CoordinateSystem.prototype.create = function (ecModel) {
10
+ var _this = this;
11
+ ecModel.eachSeries(function (seriesModel) {
12
+ if (seriesModel.get('coordinateSystem') === COORDINATE_SYSTEM_NAME) {
13
+ seriesModel.coordinateSystem = new CoordinateSystem(_this.map);
14
+ }
15
+ });
16
+ };
17
+ CoordinateSystem.prototype.dataToPoint = function (data) {
18
+ var px = this.map.project(data);
19
+ var mapOffset = this._mapOffset;
20
+ return [px.x - mapOffset[0], px.y - mapOffset[1]];
21
+ };
22
+ CoordinateSystem.prototype.pointToData = function (pt) {
23
+ var mapOffset = this._mapOffset;
24
+ var data = this.map.unproject([pt[0] + mapOffset[0], pt[1] + mapOffset[1]]);
25
+ return [data.lng, data.lat];
26
+ };
27
+ return CoordinateSystem;
28
+ }());
29
+ var EChartsLayer = /** @class */ (function () {
30
+ function EChartsLayer(id, ecOption) {
31
+ this._registered = false;
32
+ this.id = id;
33
+ this.type = 'custom';
34
+ this.renderingMode = '2d';
35
+ this._coordSystemName = COORDINATE_SYSTEM_NAME;
36
+ this._ecOption = ecOption;
37
+ }
38
+ EChartsLayer.prototype.onAdd = function (map) {
39
+ this._map = map;
40
+ this._createLayerContainer();
41
+ };
42
+ EChartsLayer.prototype.onRemove = function () {
43
+ var _a;
44
+ (_a = this._ec) === null || _a === void 0 ? void 0 : _a.dispose();
45
+ this._removeLayerContainer();
46
+ };
47
+ EChartsLayer.prototype.setOption = function (option) {
48
+ var _a;
49
+ (_a = this._ec) === null || _a === void 0 ? void 0 : _a.setOption(option);
50
+ };
51
+ EChartsLayer.prototype.render = function () {
52
+ if (!this._container) {
53
+ this._createLayerContainer();
54
+ }
55
+ if (!this._ec) {
56
+ this._ec = init(this._container);
57
+ this._prepareECharts();
58
+ this._ec.setOption(this._ecOption);
59
+ }
60
+ else {
61
+ if (this._map.isMoving()) {
62
+ this._ec.clear();
63
+ }
64
+ else {
65
+ this._ec.resize({
66
+ width: this._map.getCanvas().width,
67
+ height: this._map.getCanvas().height,
68
+ });
69
+ this._ec.setOption(this._ecOption);
70
+ }
71
+ }
72
+ };
73
+ EChartsLayer.prototype._prepareECharts = function () {
74
+ if (!this._registered) {
75
+ var coordinateSystem = new CoordinateSystem(this._map);
76
+ registerCoordinateSystem(this._coordSystemName, coordinateSystem);
77
+ this._registered = true;
78
+ }
79
+ var series = this._ecOption.series;
80
+ if (series) {
81
+ for (var i = series.length - 1; i >= 0; i--) {
82
+ // change coordinateSystem to mapboxgl-echarts
83
+ series[i]['coordinateSystem'] = this._coordSystemName;
84
+ // disable update animations
85
+ // series[i]['animation'] = false
86
+ }
87
+ }
88
+ };
89
+ EChartsLayer.prototype._createLayerContainer = function () {
90
+ var mapContainer = this._map.getCanvasContainer();
91
+ this._container = document.createElement('div');
92
+ this._container.style.width = this._map.getCanvas().style.width;
93
+ this._container.style.height = this._map.getCanvas().style.height;
94
+ mapContainer.appendChild(this._container);
95
+ };
96
+ EChartsLayer.prototype._removeLayerContainer = function () {
97
+ var _a;
98
+ if (this._container) {
99
+ (_a = this._container.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this._container);
100
+ }
101
+ };
102
+ return EChartsLayer;
103
+ }());
104
+ export default EChartsLayer;
@@ -0,0 +1,22 @@
1
+ /// <reference types="mapbox-gl" />
2
+ import { ComposeOption, EffectScatterSeriesOption, LegendComponentOption, LinesSeriesOption, ScatterSeriesOption, TitleComponentOption, TooltipComponentOption } from 'echarts';
3
+ export declare type ECOption = ComposeOption<TitleComponentOption | TooltipComponentOption | LegendComponentOption | LinesSeriesOption | ScatterSeriesOption | EffectScatterSeriesOption>;
4
+ export default class EChartsLayer implements mapboxgl.CustomLayerInterface {
5
+ id: string;
6
+ type: 'custom';
7
+ renderingMode?: '2d' | '3d' | undefined;
8
+ private _container;
9
+ private _map;
10
+ private _ec;
11
+ private _coordSystemName;
12
+ private _registered;
13
+ private _ecOption;
14
+ constructor(id: string, ecOption: ECOption);
15
+ onAdd(map: mapboxgl.Map): void;
16
+ onRemove(): void;
17
+ setOption(option: ECOption): void;
18
+ render(): void;
19
+ private _prepareECharts;
20
+ private _createLayerContainer;
21
+ private _removeLayerContainer;
22
+ }
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var echarts_1 = require("echarts");
4
+ var COORDINATE_SYSTEM_NAME = 'mapboxgl-echarts';
5
+ var CoordinateSystem = /** @class */ (function () {
6
+ function CoordinateSystem(map) {
7
+ this.dimensions = ['x', 'y'];
8
+ this._mapOffset = [0, 0];
9
+ this.map = map;
10
+ }
11
+ CoordinateSystem.prototype.create = function (ecModel) {
12
+ var _this = this;
13
+ ecModel.eachSeries(function (seriesModel) {
14
+ if (seriesModel.get('coordinateSystem') === COORDINATE_SYSTEM_NAME) {
15
+ seriesModel.coordinateSystem = new CoordinateSystem(_this.map);
16
+ }
17
+ });
18
+ };
19
+ CoordinateSystem.prototype.dataToPoint = function (data) {
20
+ var px = this.map.project(data);
21
+ var mapOffset = this._mapOffset;
22
+ return [px.x - mapOffset[0], px.y - mapOffset[1]];
23
+ };
24
+ CoordinateSystem.prototype.pointToData = function (pt) {
25
+ var mapOffset = this._mapOffset;
26
+ var data = this.map.unproject([pt[0] + mapOffset[0], pt[1] + mapOffset[1]]);
27
+ return [data.lng, data.lat];
28
+ };
29
+ return CoordinateSystem;
30
+ }());
31
+ var EChartsLayer = /** @class */ (function () {
32
+ function EChartsLayer(id, ecOption) {
33
+ this._registered = false;
34
+ this.id = id;
35
+ this.type = 'custom';
36
+ this.renderingMode = '2d';
37
+ this._coordSystemName = COORDINATE_SYSTEM_NAME;
38
+ this._ecOption = ecOption;
39
+ }
40
+ EChartsLayer.prototype.onAdd = function (map) {
41
+ this._map = map;
42
+ this._createLayerContainer();
43
+ };
44
+ EChartsLayer.prototype.onRemove = function () {
45
+ var _a;
46
+ (_a = this._ec) === null || _a === void 0 ? void 0 : _a.dispose();
47
+ this._removeLayerContainer();
48
+ };
49
+ EChartsLayer.prototype.setOption = function (option) {
50
+ var _a;
51
+ (_a = this._ec) === null || _a === void 0 ? void 0 : _a.setOption(option);
52
+ };
53
+ EChartsLayer.prototype.render = function () {
54
+ if (!this._container) {
55
+ this._createLayerContainer();
56
+ }
57
+ if (!this._ec) {
58
+ this._ec = (0, echarts_1.init)(this._container);
59
+ this._prepareECharts();
60
+ this._ec.setOption(this._ecOption);
61
+ }
62
+ else {
63
+ if (this._map.isMoving()) {
64
+ this._ec.clear();
65
+ }
66
+ else {
67
+ this._ec.resize({
68
+ width: this._map.getCanvas().width,
69
+ height: this._map.getCanvas().height,
70
+ });
71
+ this._ec.setOption(this._ecOption);
72
+ }
73
+ }
74
+ };
75
+ EChartsLayer.prototype._prepareECharts = function () {
76
+ if (!this._registered) {
77
+ var coordinateSystem = new CoordinateSystem(this._map);
78
+ (0, echarts_1.registerCoordinateSystem)(this._coordSystemName, coordinateSystem);
79
+ this._registered = true;
80
+ }
81
+ var series = this._ecOption.series;
82
+ if (series) {
83
+ for (var i = series.length - 1; i >= 0; i--) {
84
+ // change coordinateSystem to mapboxgl-echarts
85
+ series[i]['coordinateSystem'] = this._coordSystemName;
86
+ // disable update animations
87
+ // series[i]['animation'] = false
88
+ }
89
+ }
90
+ };
91
+ EChartsLayer.prototype._createLayerContainer = function () {
92
+ var mapContainer = this._map.getCanvasContainer();
93
+ this._container = document.createElement('div');
94
+ this._container.style.width = this._map.getCanvas().style.width;
95
+ this._container.style.height = this._map.getCanvas().style.height;
96
+ mapContainer.appendChild(this._container);
97
+ };
98
+ EChartsLayer.prototype._removeLayerContainer = function () {
99
+ var _a;
100
+ if (this._container) {
101
+ (_a = this._container.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this._container);
102
+ }
103
+ };
104
+ return EChartsLayer;
105
+ }());
106
+ exports.default = EChartsLayer;
package/package.json CHANGED
@@ -1,46 +1,55 @@
1
1
  {
2
2
  "name": "@naivemap/mapbox-gl-echarts-layer",
3
- "version": "0.1.4",
4
- "description": "mapbox-gl-echarts-layer",
5
- "files": [
6
- "dist",
7
- "types"
8
- ],
9
- "types": "./types/index.d.ts",
10
- "main": "./dist/mapbox-gl-echarts-layer.umd.js",
11
- "module": "./dist/mapbox-gl-echarts-layer.es.js",
3
+ "version": "0.3.2",
4
+ "description": "Integrate the Lines graph and Scatter (bubble) chart of Apache ECharts.",
5
+ "author": "huanglii <li.huangli@qq.com>",
6
+ "homepage": "https://github.com/naivemap/mapbox-gl-layers#readme",
7
+ "license": "MIT",
8
+ "main": "dist/js/index.js",
9
+ "module": "dist/es/index.js",
12
10
  "exports": {
11
+ "./package.json": "./package.json",
13
12
  ".": {
14
- "import": "./dist/mapbox-gl-echarts-layer.es.js",
15
- "require": "./dist/mapbox-gl-echarts-layer.umd.js"
13
+ "import": "./dist/es/index.js",
14
+ "require": "./dist/js/index.js"
16
15
  }
17
16
  },
18
- "scripts": {
19
- "dev": "vite",
20
- "lint": "eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx",
21
- "prettier": "prettier --write .",
22
- "build": "vite build"
23
- },
24
- "repository": "https://github.com/naivemap/mapbox-gl-echarts-layer",
17
+ "types": "dist/js/index.d.ts",
18
+ "sideEffects": false,
19
+ "files": [
20
+ "dist"
21
+ ],
25
22
  "keywords": [
26
23
  "mapbox-gl",
27
- "echarts"
24
+ "echarts",
25
+ "scatter",
26
+ "lines"
28
27
  ],
29
- "license": "MIT",
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/naivemap/mapbox-gl-layers.git"
34
+ },
35
+ "scripts": {
36
+ "test": "echo \"Error: run tests from root\" && exit 1",
37
+ "build": "npm-run-all build:*",
38
+ "build:es": "tsc --outDir dist/es --module esnext --declaration false",
39
+ "build:js": "tsc",
40
+ "prepublishOnly": "npm-run-all build:*"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/naivemap/mapbox-gl-layers/issues"
44
+ },
30
45
  "peerDependencies": {
31
46
  "echarts": "^5.3.0"
32
47
  },
33
48
  "devDependencies": {
34
- "@types/mapbox-gl": "^2.6.1",
35
- "@types/node": "^17.0.15",
36
- "@typescript-eslint/eslint-plugin": "^5.10.2",
37
- "@typescript-eslint/parser": "^5.10.2",
38
- "echarts": "^5.3.0",
39
- "eslint": "^8.8.0",
40
- "eslint-config-prettier": "^8.3.0",
41
- "eslint-plugin-prettier": "^4.0.0",
42
- "prettier": "^2.5.1",
43
- "typescript": "^4.5.5",
44
- "vite": "^2.7.13"
45
- }
49
+ "@types/mapbox-gl": "^2.7.2",
50
+ "@types/node": "^17.0.36",
51
+ "echarts": "^5.3.2",
52
+ "npm-run-all": "^4.1.5"
53
+ },
54
+ "gitHead": "0d34a954e38a0366112328e2cceaafebece75e3e"
46
55
  }
@@ -1,96 +0,0 @@
1
- import * as echarts from "echarts";
2
- const COORDINATE_SYSTEM_NAME = "mapboxgl-echarts";
3
- class CoordinateSystem {
4
- constructor(map) {
5
- this.dimensions = ["x", "y"];
6
- this._mapOffset = [0, 0];
7
- this.map = map;
8
- }
9
- create(ecModel) {
10
- ecModel.eachSeries((seriesModel) => {
11
- if (seriesModel.get("coordinateSystem") === COORDINATE_SYSTEM_NAME) {
12
- seriesModel.coordinateSystem = new CoordinateSystem(this.map);
13
- }
14
- });
15
- }
16
- dataToPoint(data) {
17
- const px = this.map.project(data);
18
- const mapOffset = this._mapOffset;
19
- return [px.x - mapOffset[0], px.y - mapOffset[1]];
20
- }
21
- pointToData(pt) {
22
- const mapOffset = this._mapOffset;
23
- const data = this.map.unproject([pt[0] + mapOffset[0], pt[1] + mapOffset[1]]);
24
- return [data.lng, data.lat];
25
- }
26
- }
27
- class EchartsLayer {
28
- constructor(id, ecOption) {
29
- this._registered = false;
30
- this.id = id;
31
- this.type = "custom";
32
- this.renderingMode = "2d";
33
- this._coordSystemName = COORDINATE_SYSTEM_NAME;
34
- this._ecOption = ecOption;
35
- }
36
- onAdd(map) {
37
- this._map = map;
38
- this._createLayerContainer();
39
- }
40
- onRemove() {
41
- this._ec.dispose();
42
- this._removeLayerContainer();
43
- }
44
- setOption(option) {
45
- if (this._ec) {
46
- this._ec.setOption(option);
47
- }
48
- }
49
- render() {
50
- if (!this._container) {
51
- this._createLayerContainer();
52
- }
53
- if (!this._ec) {
54
- this._ec = echarts.init(this._container);
55
- this._prepareECharts();
56
- this._ec.setOption(this._ecOption);
57
- } else {
58
- if (this._map.isMoving()) {
59
- this._ec.clear();
60
- } else {
61
- this._ec.resize({
62
- width: this._map.getCanvas().width,
63
- height: this._map.getCanvas().height
64
- });
65
- this._ec.setOption(this._ecOption);
66
- }
67
- }
68
- }
69
- _prepareECharts() {
70
- if (!this._registered) {
71
- const coordinateSystem = new CoordinateSystem(this._map);
72
- echarts.registerCoordinateSystem(this._coordSystemName, coordinateSystem);
73
- this._registered = true;
74
- }
75
- const series = this._ecOption.series;
76
- if (series) {
77
- for (let i = series.length - 1; i >= 0; i--) {
78
- series[i]["coordinateSystem"] = this._coordSystemName;
79
- }
80
- }
81
- }
82
- _createLayerContainer() {
83
- const mapContainer = this._map.getCanvasContainer();
84
- this._container = document.createElement("div");
85
- this._container.style.width = this._map.getCanvas().style.width;
86
- this._container.style.height = this._map.getCanvas().style.height;
87
- mapContainer.appendChild(this._container);
88
- }
89
- _removeLayerContainer() {
90
- var _a;
91
- if (this._container) {
92
- (_a = this._container.parentNode) == null ? void 0 : _a.removeChild(this._container);
93
- }
94
- }
95
- }
96
- export { EchartsLayer as default };
@@ -1 +0,0 @@
1
- (function(n,r){typeof exports=="object"&&typeof module!="undefined"?module.exports=r(require("echarts")):typeof define=="function"&&define.amd?define(["echarts"],r):(n=typeof globalThis!="undefined"?globalThis:n||self,n.EchartsLayer=r(n.echarts))})(this,function(n){"use strict";function r(i){if(i&&i.__esModule)return i;var e={__proto__:null,[Symbol.toStringTag]:"Module"};return i&&Object.keys(i).forEach(function(t){if(t!=="default"){var s=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:function(){return i[t]}})}}),e.default=i,Object.freeze(e)}var o=r(n);const h="mapboxgl-echarts";class a{constructor(e){this.dimensions=["x","y"],this._mapOffset=[0,0],this.map=e}create(e){e.eachSeries(t=>{t.get("coordinateSystem")===h&&(t.coordinateSystem=new a(this.map))})}dataToPoint(e){const t=this.map.project(e),s=this._mapOffset;return[t.x-s[0],t.y-s[1]]}pointToData(e){const t=this._mapOffset,s=this.map.unproject([e[0]+t[0],e[1]+t[1]]);return[s.lng,s.lat]}}class c{constructor(e,t){this._registered=!1,this.id=e,this.type="custom",this.renderingMode="2d",this._coordSystemName=h,this._ecOption=t}onAdd(e){this._map=e,this._createLayerContainer()}onRemove(){this._ec.dispose(),this._removeLayerContainer()}setOption(e){this._ec&&this._ec.setOption(e)}render(){this._container||this._createLayerContainer(),this._ec?this._map.isMoving()?this._ec.clear():(this._ec.resize({width:this._map.getCanvas().width,height:this._map.getCanvas().height}),this._ec.setOption(this._ecOption)):(this._ec=o.init(this._container),this._prepareECharts(),this._ec.setOption(this._ecOption))}_prepareECharts(){if(!this._registered){const t=new a(this._map);o.registerCoordinateSystem(this._coordSystemName,t),this._registered=!0}const e=this._ecOption.series;if(e)for(let t=e.length-1;t>=0;t--)e[t].coordinateSystem=this._coordSystemName}_createLayerContainer(){const e=this._map.getCanvasContainer();this._container=document.createElement("div"),this._container.style.width=this._map.getCanvas().style.width,this._container.style.height=this._map.getCanvas().style.height,e.appendChild(this._container)}_removeLayerContainer(){var e;this._container&&((e=this._container.parentNode)==null||e.removeChild(this._container))}}return c});
package/types/index.d.ts DELETED
@@ -1,37 +0,0 @@
1
- /// <reference types="mapbox-gl" />
2
- import * as echarts from 'echarts'
3
- import {
4
- EffectScatterSeriesOption,
5
- LegendComponentOption,
6
- LinesSeriesOption,
7
- ScatterSeriesOption,
8
- TitleComponentOption,
9
- TooltipComponentOption,
10
- } from 'echarts'
11
- export declare type ECOption = echarts.ComposeOption<
12
- | TitleComponentOption
13
- | TooltipComponentOption
14
- | LegendComponentOption
15
- | LinesSeriesOption
16
- | ScatterSeriesOption
17
- | EffectScatterSeriesOption
18
- >
19
- export default class EchartsLayer implements mapboxgl.CustomLayerInterface {
20
- id: string
21
- type: 'custom'
22
- renderingMode: '2d'
23
- private _container
24
- private _map
25
- private _ec
26
- private _coordSystemName
27
- private _registered
28
- private _ecOption
29
- constructor(id: string, ecOption: ECOption)
30
- onAdd(map: mapboxgl.Map): void
31
- onRemove(): void
32
- setOption(option: ECOption): void
33
- render(): void
34
- private _prepareECharts
35
- private _createLayerContainer
36
- private _removeLayerContainer
37
- }