Socket
Socket
Sign inDemoInstall

echarts-extension-gmap

Package Overview
Dependencies
1
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.1 to 1.3.0

54

build/build.js

@@ -0,1 +1,2 @@

const fs = require('fs');
const path = require('path');

@@ -6,3 +7,3 @@ const fsExtra = require('fs-extra');

const config = require('./config');
const { name } = require('../package.json');
const { name, version } = require('../package.json');

@@ -66,2 +67,3 @@ function run() {

build(configs).then(function () {
generateExamples();
console.log(

@@ -86,2 +88,52 @@ color('fgGreen', 'dim')('\nBuild completely')

function generateExamples() {
const exampleDir = path.resolve(__dirname, '../examples');
const libVersionMap = {};
[['', version], ['echarts', 'latest']].forEach(function (lib) {
const libName = lib[0];
const libVersion = lib[1];
const formattedLibName = ((libName ? libName + '_' : '') + 'version').toUpperCase();
libVersionMap[formattedLibName] = (
libName
? fs.readFileSync(
exampleDir + '/' + libName + '.version',
{ encoding: 'utf-8' }
) || lib[1]
: libVersion
).trim();
});
[['en', false], ['zh_CN']].forEach(function (lang) {
const fileName = `index${lang[1] === false ? '' : '_' + lang[0]}.html`;
const dest = path.resolve(exampleDir, './', fileName);
console.log(
color('fgCyan', 'dim')('\nGenerating example'),
color('fgCyan')(fileName),
color('fgCyan', 'dim')('=>'),
color('fgCyan')(dest),
color('fgCyan', 'dim')(' ...')
);
const tpl = fs.readFileSync(
dest + '.tpl',
{ encoding: 'utf-8' }
);
let example = tpl;
Object.keys(libVersionMap).forEach(function (libVer) {
example = example.replace(
new RegExp(`{${libVer}}`, 'g'),
libVersionMap[libVer].trim()
)
});
fs.writeFileSync(
dest,
example,
{ encoding: 'utf-8' }
);
console.log(
color('fgGreen', 'dim')('\nGenerated '),
color('fgGreen')(dest),
color('fgGreen', 'dim')(' successfully.')
);
});
}
function build(configs) {

@@ -88,0 +140,0 @@ return new Promise(function (resolve, reject) {

3

build/config.js

@@ -7,2 +7,3 @@ const path = require('path');

const { getLicense } = require('./header');
const { name } = require('../package.json');

@@ -30,3 +31,3 @@ function getPlugins({ min, addBundleVersion }) {

module.exports = function (opt/*{ min, addBundleVersion }*/) {
const outputFileName = 'echarts-extension-gmap' + (opt.min ? '.min.js' : '.js');
const outputFileName = name + (opt.min ? '.min.js' : '.js');
return {

@@ -33,0 +34,0 @@ plugins: getPlugins(opt),

/*!
* echarts-extension-gmap
* @version 1.2.1
* @version 1.3.0
* @author plainheart

@@ -36,3 +36,3 @@ *

var name = "echarts-extension-gmap";
var version = "1.2.1";
var version = "1.3.0";

@@ -86,2 +86,3 @@ /* global google */

}
return [];
};

@@ -178,5 +179,4 @@

gmapRoot = document.createElement('div');
gmapRoot.className = 'ec-extension-google-map';
gmapRoot.style.cssText = 'width:100%;height:100%';
// Not support IE8
gmapRoot.classList.add('ec-extension-google-map');
root.appendChild(gmapRoot);

@@ -805,18 +805,27 @@

var component = ecModel.getComponent('gmap');
if (!component) {
return;
}
var gmapInstance = component.getGoogleMap();
// remove injected projection
delete gmapInstance.__overlayProjection;
if (gmapInstance) {
// remove injected projection
delete gmapInstance.__overlayProjection;
// clear all listeners of map instance
google.maps.event.clearInstanceListeners(gmapInstance);
// clear all listeners of map instance
google.maps.event.clearInstanceListeners(gmapInstance);
// remove DOM of map instance
var mapDiv = gmapInstance.getDiv();
mapDiv.parentNode.removeChild(mapDiv);
// remove DOM of map instance
var mapDiv = gmapInstance.getDiv();
mapDiv.parentNode && mapDiv.parentNode.removeChild(mapDiv);
}
component.setGoogleMap(null);
component.setEChartsLayer(null);
component.coordinateSystem.setGoogleMap(null);
component.coordinateSystem = null;
if (component.coordinateSystem) {
component.coordinateSystem.setGoogleMap(null);
component.coordinateSystem = null;
}
}

@@ -823,0 +832,0 @@ });

/*!
* echarts-extension-gmap
* @version 1.2.1
* @version 1.3.0
* @author plainheart

@@ -29,2 +29,2 @@ *

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).echarts=e.echarts||{},e.echarts.gmap={}),e.echarts)}(this,(function(e,t){"use strict";function n(e,t){this._gmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}var o,r=n.prototype,i=["echartsLayerZIndex","renderOnMoving"];function a(e,n){return n=n||[0,0],t.util.map([0,1],(function(t){var o=n[t],r=e[t]/2,i=[],a=[];return i[t]=o-r,a[t]=o+r,i[1-t]=a[1-t]=n[1-t],Math.abs(this.dataToPoint(i)[t]-this.dataToPoint(a)[t])}),this)}function s(e,t){var n=t.__overlayProjection;if(n)return n.fromLatLngToContainerPixel(e)}r.dimensions=["lng","lat"],r.setZoom=function(e){this._zoom=e},r.setCenter=function(e){var t=new google.maps.LatLng(e[1],e[0]);this._center=s(t,this._gmap)},r.setMapOffset=function(e){this._mapOffset=e},r.setGoogleMap=function(e){this._gmap=e},r.getGoogleMap=function(){return this._gmap},r.dataToPoint=function(e){var t=s(new google.maps.LatLng(e[1],e[0]),this._gmap);if(t){var n=this._mapOffset;return[t.x-n[0],t.y-n[1]]}},r.pointToData=function(e){var t=this._mapOffset,n=function(e,t){var n=t.__overlayProjection;if(!n)return;return n.fromContainerPixelToLatLng(e)}(new google.maps.Point(e[0]+t[0],e[1]+t[1]),this._gmap);return[n.lng(),n.lat()]},r.getViewRect=function(){var e=this._api;return new t.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},r.getRoamTransform=function(){return t.matrix.create()},r.prepareCustoms=function(e){var n=this.getViewRect();return{coordSys:{type:"gmap",x:n.x,y:n.y,width:n.width,height:n.height},api:{coord:t.util.bind(this.dataToPoint,this),size:t.util.bind(a,this)}}},n.dimensions=r.dimensions,n.create=function(e,r){var a,s=r.getDom();e.eachComponent("gmap",(function(e){var f=r.getZr().painter,l=f.getViewportRoot();if("undefined"==typeof google||"undefined"==typeof google.maps||"undefined"==typeof google.maps.Map)throw new Error("It seems that Google Map API has not been loaded completely yet.");if(o=o||function(){function e(e,t){this._root=e,this.setMap(t)}return e.prototype=new google.maps.OverlayView,e.prototype.onAdd=function(){var e=this.getMap();e.__overlayProjection=this.getProjection(),e.getDiv().querySelector(".gm-style > div").appendChild(this._root)},e.prototype.draw=function(){google.maps.event.trigger(this.getMap(),"gmaprender")},e.prototype.onRemove=function(){this._root.parentNode.removeChild(this._root),this._root=null},e.prototype.setZIndex=function(e){this._root.style.zIndex=e},e.prototype.getZIndex=function(){return this._root.style.zIndex},e}(),a)throw new Error("Only one google map component can exist");var p=e.getGoogleMap();if(!p){var u=s.querySelector(".ec-extension-google-map");u&&(l.style.left="0px",l.style.top="0px",l.style.width="100%",l.style.height="100%",s.removeChild(u)),(u=document.createElement("div")).style.cssText="width:100%;height:100%",u.classList.add("ec-extension-google-map"),s.appendChild(u);var c=t.util.clone(e.get()),g=c.echartsLayerZIndex;t.util.each(i,(function(e){delete c[e]}));var d=c.center;t.util.isArray(d)&&(c.center={lng:d[0],lat:d[1]}),p=new google.maps.Map(u,c),e.setGoogleMap(p),e.__projectionChangeListener&&e.__projectionChangeListener.remove(),e.__projectionChangeListener=google.maps.event.addListener(p,"projection_changed",(function(){var t=e.getEChartsLayer();t&&t.setMap(null);var n=new o(l,p);n.setZIndex(g),e.setEChartsLayer(n)})),f.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var m=[null!=(d=e.get("center")).lng?d.lng:d[0],null!=d.lat?d.lat:d[1]],h=e.get("zoom");if(d&&h){var y=p.getCenter(),v=p.getZoom();if(e.centerOrZoomChanged([y.lng(),y.lat()],v)){var _=new google.maps.LatLng(m[1],m[0]);p.setOptions({center:_,zoom:h})}}(a=new n(p,r)).setMapOffset(e.__mapOffset||[0,0]),a.setZoom(h),a.setCenter(m),e.coordinateSystem=a})),e.eachSeries((function(e){"gmap"===e.get("coordinateSystem")&&(e.coordinateSystem=a)}))},t.extendComponentModel({type:"gmap",setGoogleMap:function(e){this.__gmap=e},getGoogleMap:function(){return this.__gmap},setEChartsLayer:function(e){this.__echartsLayer=e},getEChartsLayer:function(){return this.__echartsLayer},setCenterAndZoom:function(e,t){this.option.center=e,this.option.zoom=t},centerOrZoomChanged:function(e,t){var n,o,r=this.option;return n=e,o=r.center,!(n&&o&&n[0]===o[0]&&n[1]===o[1]&&t===r.zoom)},defaultOption:{center:{lat:39.90923,lng:116.397428},zoom:5,echartsLayerZIndex:2e3,renderOnMoving:!0}});var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,g=parseInt,d="object"==typeof f&&f&&f.Object===Object&&f,m="object"==typeof self&&self&&self.Object===Object&&self,h=d||m||Function("return this")(),y=Object.prototype.toString,v=Math.max,_=Math.min,x=function(){return h.Date.now()};function w(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function C(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==y.call(e)}(e))return NaN;if(w(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=u.test(e);return n||c.test(e)?g(e.slice(2),n?2:8):p.test(e)?NaN:+e}var L=function(e,t,n){var o,r,i,a,s,f,l=0,p=!1,u=!1,c=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var n=o,i=r;return o=r=undefined,l=t,a=e.apply(i,n)}function d(e){return l=e,s=setTimeout(h,t),p?g(e):a}function m(e){var n=e-f;return f===undefined||n>=t||n<0||u&&e-l>=i}function h(){var e=x();if(m(e))return y(e);s=setTimeout(h,function(e){var n=t-(e-f);return u?_(n,i-(e-l)):n}(e))}function y(e){return s=undefined,c&&o?g(e):(o=r=undefined,a)}function L(){var e=x(),n=m(e);if(o=arguments,r=this,f=e,n){if(s===undefined)return d(f);if(u)return s=setTimeout(h,t),g(f)}return s===undefined&&(s=setTimeout(h,t)),a}return t=C(t)||0,w(n)&&(p=!!n.leading,i=(u="maxWait"in n)?v(C(n.maxWait)||0,t):i,c="trailing"in n?!!n.trailing:c),L.cancel=function(){s!==undefined&&clearTimeout(s),l=0,o=f=r=s=undefined},L.flush=function(){return s===undefined?a:y(x())},L};t.extendComponentView({type:"gmap",render:function(e,n,o){var r=!0,i=e.getGoogleMap(),a=o.getZr().painter.getViewportRoot(),s=e.coordinateSystem,f=i.getDiv(),l=e.get("renderOnMoving"),p=f.clientWidth,u=f.clientHeight,c=function(){if(!r){var t=f.clientWidth,n=f.clientHeight;if(t!==p||n!==u)return g.call(this);var i=[-parseInt(f.style.left,10)||0,-parseInt(f.style.top,10)||0];a.style.left=i[0]+"px",a.style.top=i[1]+"px",s.setMapOffset(i),e.__mapOffset=i,o.dispatchAction({type:"gmapRoam",animation:{duration:0}})}},g=function(){t.getInstanceByDom(o.getDom()).resize()};this._oldRenderHandler&&this._oldRenderHandler.remove(),l||(c=L(c,100),g=L(g,100)),this._oldRenderHandler=google.maps.event.addListener(i,"gmaprender",c),r=!1},dispose:function(e,t){this._oldRenderHandler&&this._oldRenderHandler.remove(),this._oldRenderHandler=null;var n=e.getComponent("gmap"),o=n.getGoogleMap();delete o.__overlayProjection,google.maps.event.clearInstanceListeners(o);var r=o.getDiv();r.parentNode.removeChild(r),n.setGoogleMap(null),n.setEChartsLayer(null),n.coordinateSystem.setGoogleMap(null),n.coordinateSystem=null}}),t.registerCoordinateSystem("gmap",n),t.registerAction({type:"gmapRoam",event:"gmapRoam",update:"updateLayout"},(function(e,t){t.eachComponent("gmap",(function(e){var t=e.getGoogleMap(),n=t.getCenter();e.setCenterAndZoom([n.lng(),n.lat()],t.getZoom())}))})),e.name="echarts-extension-gmap",e.version="1.2.1",Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).echarts=e.echarts||{},e.echarts.gmap={}),e.echarts)}(this,(function(e,t){"use strict";function n(e,t){this._gmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}var o,r=n.prototype,i=["echartsLayerZIndex","renderOnMoving"];function a(e,n){return n=n||[0,0],t.util.map([0,1],(function(t){var o=n[t],r=e[t]/2,i=[],a=[];return i[t]=o-r,a[t]=o+r,i[1-t]=a[1-t]=n[1-t],Math.abs(this.dataToPoint(i)[t]-this.dataToPoint(a)[t])}),this)}function s(e,t){var n=t.__overlayProjection;if(n)return n.fromLatLngToContainerPixel(e)}r.dimensions=["lng","lat"],r.setZoom=function(e){this._zoom=e},r.setCenter=function(e){var t=new google.maps.LatLng(e[1],e[0]);this._center=s(t,this._gmap)},r.setMapOffset=function(e){this._mapOffset=e},r.setGoogleMap=function(e){this._gmap=e},r.getGoogleMap=function(){return this._gmap},r.dataToPoint=function(e){var t=s(new google.maps.LatLng(e[1],e[0]),this._gmap);if(t){var n=this._mapOffset;return[t.x-n[0],t.y-n[1]]}return[]},r.pointToData=function(e){var t=this._mapOffset,n=function(e,t){var n=t.__overlayProjection;if(!n)return;return n.fromContainerPixelToLatLng(e)}(new google.maps.Point(e[0]+t[0],e[1]+t[1]),this._gmap);return[n.lng(),n.lat()]},r.getViewRect=function(){var e=this._api;return new t.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},r.getRoamTransform=function(){return t.matrix.create()},r.prepareCustoms=function(e){var n=this.getViewRect();return{coordSys:{type:"gmap",x:n.x,y:n.y,width:n.width,height:n.height},api:{coord:t.util.bind(this.dataToPoint,this),size:t.util.bind(a,this)}}},n.dimensions=r.dimensions,n.create=function(e,r){var a,s=r.getDom();e.eachComponent("gmap",(function(e){var f=r.getZr().painter,l=f.getViewportRoot();if("undefined"==typeof google||"undefined"==typeof google.maps||"undefined"==typeof google.maps.Map)throw new Error("It seems that Google Map API has not been loaded completely yet.");if(o=o||function(){function e(e,t){this._root=e,this.setMap(t)}return e.prototype=new google.maps.OverlayView,e.prototype.onAdd=function(){var e=this.getMap();e.__overlayProjection=this.getProjection(),e.getDiv().querySelector(".gm-style > div").appendChild(this._root)},e.prototype.draw=function(){google.maps.event.trigger(this.getMap(),"gmaprender")},e.prototype.onRemove=function(){this._root.parentNode.removeChild(this._root),this._root=null},e.prototype.setZIndex=function(e){this._root.style.zIndex=e},e.prototype.getZIndex=function(){return this._root.style.zIndex},e}(),a)throw new Error("Only one google map component can exist");var p=e.getGoogleMap();if(!p){var u=s.querySelector(".ec-extension-google-map");u&&(l.style.left="0px",l.style.top="0px",l.style.width="100%",l.style.height="100%",s.removeChild(u)),(u=document.createElement("div")).className="ec-extension-google-map",u.style.cssText="width:100%;height:100%",s.appendChild(u);var c=t.util.clone(e.get()),g=c.echartsLayerZIndex;t.util.each(i,(function(e){delete c[e]}));var d=c.center;t.util.isArray(d)&&(c.center={lng:d[0],lat:d[1]}),p=new google.maps.Map(u,c),e.setGoogleMap(p),e.__projectionChangeListener&&e.__projectionChangeListener.remove(),e.__projectionChangeListener=google.maps.event.addListener(p,"projection_changed",(function(){var t=e.getEChartsLayer();t&&t.setMap(null);var n=new o(l,p);n.setZIndex(g),e.setEChartsLayer(n)})),f.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var m=[null!=(d=e.get("center")).lng?d.lng:d[0],null!=d.lat?d.lat:d[1]],h=e.get("zoom");if(d&&h){var y=p.getCenter(),v=p.getZoom();if(e.centerOrZoomChanged([y.lng(),y.lat()],v)){var _=new google.maps.LatLng(m[1],m[0]);p.setOptions({center:_,zoom:h})}}(a=new n(p,r)).setMapOffset(e.__mapOffset||[0,0]),a.setZoom(h),a.setCenter(m),e.coordinateSystem=a})),e.eachSeries((function(e){"gmap"===e.get("coordinateSystem")&&(e.coordinateSystem=a)}))},t.extendComponentModel({type:"gmap",setGoogleMap:function(e){this.__gmap=e},getGoogleMap:function(){return this.__gmap},setEChartsLayer:function(e){this.__echartsLayer=e},getEChartsLayer:function(){return this.__echartsLayer},setCenterAndZoom:function(e,t){this.option.center=e,this.option.zoom=t},centerOrZoomChanged:function(e,t){var n,o,r=this.option;return n=e,o=r.center,!(n&&o&&n[0]===o[0]&&n[1]===o[1]&&t===r.zoom)},defaultOption:{center:{lat:39.90923,lng:116.397428},zoom:5,echartsLayerZIndex:2e3,renderOnMoving:!0}});var f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},l=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,g=parseInt,d="object"==typeof f&&f&&f.Object===Object&&f,m="object"==typeof self&&self&&self.Object===Object&&self,h=d||m||Function("return this")(),y=Object.prototype.toString,v=Math.max,_=Math.min,x=function(){return h.Date.now()};function w(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function C(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==y.call(e)}(e))return NaN;if(w(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=w(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=u.test(e);return n||c.test(e)?g(e.slice(2),n?2:8):p.test(e)?NaN:+e}var M=function(e,t,n){var o,r,i,a,s,f,l=0,p=!1,u=!1,c=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function g(t){var n=o,i=r;return o=r=undefined,l=t,a=e.apply(i,n)}function d(e){return l=e,s=setTimeout(h,t),p?g(e):a}function m(e){var n=e-f;return f===undefined||n>=t||n<0||u&&e-l>=i}function h(){var e=x();if(m(e))return y(e);s=setTimeout(h,function(e){var n=t-(e-f);return u?_(n,i-(e-l)):n}(e))}function y(e){return s=undefined,c&&o?g(e):(o=r=undefined,a)}function M(){var e=x(),n=m(e);if(o=arguments,r=this,f=e,n){if(s===undefined)return d(f);if(u)return s=setTimeout(h,t),g(f)}return s===undefined&&(s=setTimeout(h,t)),a}return t=C(t)||0,w(n)&&(p=!!n.leading,i=(u="maxWait"in n)?v(C(n.maxWait)||0,t):i,c="trailing"in n?!!n.trailing:c),M.cancel=function(){s!==undefined&&clearTimeout(s),l=0,o=f=r=s=undefined},M.flush=function(){return s===undefined?a:y(x())},M};t.extendComponentView({type:"gmap",render:function(e,n,o){var r=!0,i=e.getGoogleMap(),a=o.getZr().painter.getViewportRoot(),s=e.coordinateSystem,f=i.getDiv(),l=e.get("renderOnMoving"),p=f.clientWidth,u=f.clientHeight,c=function(){if(!r){var t=f.clientWidth,n=f.clientHeight;if(t!==p||n!==u)return g.call(this);var i=[-parseInt(f.style.left,10)||0,-parseInt(f.style.top,10)||0];a.style.left=i[0]+"px",a.style.top=i[1]+"px",s.setMapOffset(i),e.__mapOffset=i,o.dispatchAction({type:"gmapRoam",animation:{duration:0}})}},g=function(){t.getInstanceByDom(o.getDom()).resize()};this._oldRenderHandler&&this._oldRenderHandler.remove(),l||(c=M(c,100),g=M(g,100)),this._oldRenderHandler=google.maps.event.addListener(i,"gmaprender",c),r=!1},dispose:function(e,t){this._oldRenderHandler&&this._oldRenderHandler.remove(),this._oldRenderHandler=null;var n=e.getComponent("gmap");if(n){var o=n.getGoogleMap();if(o){delete o.__overlayProjection,google.maps.event.clearInstanceListeners(o);var r=o.getDiv();r.parentNode&&r.parentNode.removeChild(r)}n.setGoogleMap(null),n.setEChartsLayer(null),n.coordinateSystem&&(n.coordinateSystem.setGoogleMap(null),n.coordinateSystem=null)}}}),t.registerCoordinateSystem("gmap",n),t.registerAction({type:"gmapRoam",event:"gmapRoam",update:"updateLayout"},(function(e,t){t.eachComponent("gmap",(function(e){var t=e.getGoogleMap(),n=t.getCenter();e.setCenterAndZoom([n.lng(),n.lat()],t.getZoom())}))})),e.name="echarts-extension-gmap",e.version="1.3.0",Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "echarts-extension-gmap",
"version": "1.2.1",
"version": "1.3.0",
"description": "An Google Map(https://www.google.com/maps) extension for Apache ECharts (incubating) (https://github.com/apache/incubator-echarts)",

@@ -5,0 +5,0 @@ "main": "dist/echarts-extension-gmap.min.js",

[![NPM version](https://img.shields.io/npm/v/echarts-extension-gmap.svg?style=flat)](https://www.npmjs.org/package/echarts-extension-gmap)
[![Build Status](https://travis-ci.org/plainheart/echarts-extension-gmap.svg?branch=master)](https://travis-ci.org/plainheart/echarts-extension-gmap)
[![NPM Downloads](https://img.shields.io/npm/dm/echarts-extension-gmap.svg)](https://npmcharts.com/compare/echarts-extension-gmap?minimal=true)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/echarts-extension-gmap/badge)](https://www.jsdelivr.com/package/npm/echarts-extension-gmap)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/echarts-extension-gmap/badge?style=rounded)](https://www.jsdelivr.com/package/npm/echarts-extension-gmap)
[![License](https://img.shields.io/npm/l/echarts-extension-gmap.svg)](https://www.npmjs.com/package/echarts-extension-gmap)

@@ -13,3 +13,3 @@

This is a Google Map extension for [ECharts](https://echarts.apache.org/en/index.html) which is used to display visualizations such as [Scatter](https://echarts.apache.org/en/option.html#series-scatter), [Line](https://echarts.apache.org/en/option.html#series-line), [Heatmap](https://echarts.apache.org/en/option.html#series-heatmap).
This is a Google Map extension for [ECharts](https://echarts.apache.org/en/index.html) which is used to display visualizations such as [Scatter](https://echarts.apache.org/en/option.html#series-scatter), [Lines](https://echarts.apache.org/en/option.html#series-lines), [Heatmap](https://echarts.apache.org/en/option.html#series-heatmap).

@@ -24,3 +24,3 @@ ### Examples

```js
```shell
npm install echarts-extension-gmap --save

@@ -31,3 +31,3 @@ ```

Import packaged distribution file `echarts-extension-gmap.min.js` and add Google Map API script and echarts script.
Import packaged distribution file `echarts-extension-gmap.min.js` and add Google Map API script and ECharts script.

@@ -43,7 +43,7 @@ ```html

You can also import this extension by `require` if you are using `webpack`.
You can also import this extension by `require` or `import` if you are using `webpack`.
```js
require("echarts");
require("echarts-extension-gmap");
require('echarts');
require('echarts-extension-gmap');
```

@@ -53,6 +53,14 @@

[jsdelivr](https://www.jsdelivr.com/)
```html
<script src="https://cdn.jsdelivr.net/npm/echarts-extension-gmap@latest/dist/echarts-extension-gmap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts-extension-gmap/dist/echarts-extension-gmap.min.js"></script>
```
[unpkg](https://unpkg.com/)
```html
<script src="https://unpkg.com/echarts-extension-gmap/dist/echarts-extension-gmap.min.js"></script>
```
This extension will register itself as a component of `echarts` after it is imported.

@@ -85,5 +93,5 @@

{
type: "scatter",
type: 'scatter',
// use `gmap` as the coordinate system
coordinateSystem: "gmap",
coordinateSystem: 'gmap',
// data items [[lng, lat, value], [lng, lat, value], ...]

@@ -104,3 +112,3 @@ data: [[120, 30, 8], [120.1, 30.2, 20]],

.getModel()
.getComponent("gmap")
.getComponent('gmap')
.getGoogleMap();

@@ -107,0 +115,0 @@ // Add some markers to map

[![NPM version](https://img.shields.io/npm/v/echarts-extension-gmap.svg?style=flat)](https://www.npmjs.org/package/echarts-extension-gmap)
[![Build Status](https://travis-ci.org/plainheart/echarts-extension-gmap.svg?branch=master)](https://travis-ci.org/plainheart/echarts-extension-gmap)
[![NPM Downloads](https://img.shields.io/npm/dm/echarts-extension-gmap.svg)](https://npmcharts.com/compare/echarts-extension-gmap?minimal=true)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/echarts-extension-gmap/badge)](https://www.jsdelivr.com/package/npm/echarts-extension-gmap)
[![jsDelivr Downloads](https://data.jsdelivr.com/v1/package/npm/echarts-extension-gmap/badge?style=rounded)](https://www.jsdelivr.com/package/npm/echarts-extension-gmap)
[![License](https://img.shields.io/npm/l/echarts-extension-gmap.svg)](https://www.npmjs.com/package/echarts-extension-gmap)

@@ -13,3 +13,3 @@

[ECharts](https://echarts.apache.org/zh/index.html) 谷歌地图扩展,可以在高德地图上展现 [点图](https://echarts.apache.org/zh/option.html#series-scatter),[线图](https://echarts.apache.org/zh/option.html#series-line),[热力图](https://echarts.apache.org/zh/option.html#series-heatmap) 等可视化。
[ECharts](https://echarts.apache.org/zh/index.html) 谷歌地图扩展,可以在高德地图上展现 [点图](https://echarts.apache.org/zh/option.html#series-scatter),[线图](https://echarts.apache.org/zh/option.html#series-lines),[热力图](https://echarts.apache.org/zh/option.html#series-heatmap) 等可视化。

@@ -24,3 +24,3 @@ ### 示例

```js
```shell
npm install echarts-extension-gmap --save

@@ -42,7 +42,7 @@ ```

如果是 webpack 打包,也可以 require 引入
如果是 `webpack` 打包,也可以 `require` 或者 `import` 引入
```js
require("echarts");
require("echarts-extension-gmap");
require('echarts');
require('echarts-extension-gmap');
```

@@ -52,6 +52,14 @@

[jsdelivr](https://www.jsdelivr.com/)
```html
<script src="https://cdn.jsdelivr.net/npm/echarts-extension-gmap@latest/dist/echarts-extension-gmap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/echarts-extension-gmap/dist/echarts-extension-gmap.min.js"></script>
```
[unpkg](https://unpkg.com/)
```html
<script src="https://unpkg.com/echarts-extension-gmap/dist/echarts-extension-gmap.min.js"></script>
```
插件会自动注册相应的组件。

@@ -80,5 +88,5 @@

{
type: "scatter",
type: 'scatter',
// 使用高德地图坐标系
coordinateSystem: "gmap",
coordinateSystem: 'gmap',
// 数据格式跟在 geo 坐标系上一样,每一项都是 [经度,纬度,数值大小,其它维度...]

@@ -98,3 +106,3 @@ data: [[120, 30, 8], [120.1, 30.2, 20]],

.getModel()
.getComponent("gmap")
.getComponent('gmap')
.getGoogleMap();

@@ -101,0 +109,0 @@ // 添加一个Marker

@@ -50,2 +50,3 @@ /* global google */

}
return [];
};

@@ -142,5 +143,4 @@

gmapRoot = document.createElement('div');
gmapRoot.className = 'ec-extension-google-map';
gmapRoot.style.cssText = 'width:100%;height:100%';
// Not support IE8
gmapRoot.classList.add('ec-extension-google-map');
root.appendChild(gmapRoot);

@@ -147,0 +147,0 @@

@@ -74,19 +74,28 @@ /* global google */

var component = ecModel.getComponent('gmap');
if (!component) {
return;
}
var gmapInstance = component.getGoogleMap();
// remove injected projection
delete gmapInstance.__overlayProjection;
if (gmapInstance) {
// remove injected projection
delete gmapInstance.__overlayProjection;
// clear all listeners of map instance
google.maps.event.clearInstanceListeners(gmapInstance);
// clear all listeners of map instance
google.maps.event.clearInstanceListeners(gmapInstance);
// remove DOM of map instance
var mapDiv = gmapInstance.getDiv();
mapDiv.parentNode.removeChild(mapDiv);
// remove DOM of map instance
var mapDiv = gmapInstance.getDiv();
mapDiv.parentNode && mapDiv.parentNode.removeChild(mapDiv);
}
component.setGoogleMap(null);
component.setEChartsLayer(null);
component.coordinateSystem.setGoogleMap(null);
component.coordinateSystem = null;
if (component.coordinateSystem) {
component.coordinateSystem.setGoogleMap(null);
component.coordinateSystem = null;
}
}
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc