diff --git a/dist/echarts-extension-bingmaps.cjs.js b/dist/echarts-extension-bingmaps.cjs.js index 5e091de..28ec0d7 100644 --- a/dist/echarts-extension-bingmaps.cjs.js +++ b/dist/echarts-extension-bingmaps.cjs.js @@ -1,6 +1,6 @@ /*! * echarts-extension-bingmaps - * @version 1.0.4 + * @version 2.0.1 * @author andybuibui * * MIT License @@ -259,7 +259,7 @@ BingMapCoordSys.create = function (ecModel, api) { }; var name = "echarts-extension-bingmaps"; -var version = "1.0.4"; +var version = "2.0.1"; /** * BingMap extension installer @@ -273,7 +273,7 @@ function install(registers) { var coordSys = seriesModel.coordinateSystem; var data = seriesModel.getData(); var valueDim = data.mapDimension('value'); - if (coordSys && coordSys.type === COMPONENT_TYPE) { + if (coordSys && coordSys._type === COMPONENT_TYPE) { var center = seriesModel.get('center'); var point = coordSys.dataToPoint(center); var cx = point[0]; diff --git a/dist/echarts-extension-bingmaps.esm.js b/dist/echarts-extension-bingmaps.esm.js index 7525441..397a2a4 100644 --- a/dist/echarts-extension-bingmaps.esm.js +++ b/dist/echarts-extension-bingmaps.esm.js @@ -1,6 +1,6 @@ /*! * echarts-extension-bingmaps - * @version 1.0.4 + * @version 2.0.1 * @author andybuibui * * MIT License @@ -258,7 +258,7 @@ BingMapCoordSys.create = function (ecModel, api) { }; var name = "echarts-extension-bingmaps"; -var version = "1.0.4"; +var version = "2.0.1"; /** * BingMap extension installer @@ -272,7 +272,7 @@ function install(registers) { var coordSys = seriesModel.coordinateSystem; var data = seriesModel.getData(); var valueDim = data.mapDimension('value'); - if (coordSys && coordSys.type === COMPONENT_TYPE) { + if (coordSys && coordSys._type === COMPONENT_TYPE) { var center = seriesModel.get('center'); var point = coordSys.dataToPoint(center); var cx = point[0]; diff --git a/dist/echarts-extension-bingmaps.js b/dist/echarts-extension-bingmaps.js index 903bc21..994fb26 100644 --- a/dist/echarts-extension-bingmaps.js +++ b/dist/echarts-extension-bingmaps.js @@ -1,6 +1,6 @@ /*! * echarts-extension-bingmaps - * @version 1.0.4 + * @version 2.0.1 * @author andybuibui * * MIT License @@ -261,7 +261,7 @@ }; var name = "echarts-extension-bingmaps"; - var version = "1.0.4"; + var version = "2.0.1"; /** * BingMap extension installer @@ -275,7 +275,7 @@ var coordSys = seriesModel.coordinateSystem; var data = seriesModel.getData(); var valueDim = data.mapDimension('value'); - if (coordSys && coordSys.type === COMPONENT_TYPE) { + if (coordSys && coordSys._type === COMPONENT_TYPE) { var center = seriesModel.get('center'); var point = coordSys.dataToPoint(center); var cx = point[0]; diff --git a/dist/echarts-extension-bingmaps.js.map b/dist/echarts-extension-bingmaps.js.map index 4d48d8b..00a509d 100644 --- a/dist/echarts-extension-bingmaps.js.map +++ b/dist/echarts-extension-bingmaps.js.map @@ -1 +1 @@ -{"version":3,"file":"echarts-extension-bingmaps.js","sources":["../lib/util.js","../lib/BingMapModel.js","../lib/BingMapView.js","../lib/BingMapCoordSys.js","../lib/index.js","../index.js"],"sourcesContent":["import { version } from 'echarts'\n\nexport const ecVer = version.split('.')\n\nexport const isNewEC = ecVer[0] > 4\n\nexport const COMPONENT_TYPE = 'bingmap'\n\nexport function v2Equal(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1]\n}\n","import { ComponentModel } from 'echarts'\n\nimport { v2Equal, isNewEC, COMPONENT_TYPE } from './util';\n\nconst BingMapModel = {\n type: COMPONENT_TYPE,\n setBingMap: function (bingmap) {\n this.__bingmap = bingmap;\n },\n getBingMap: function () {\n return this.__bingmap;\n },\n setEChartsLayer: function (layer) {\n this.__echartsLayer = layer;\n },\n\n getEChartsLayer: function () {\n return this.__echartsLayer;\n },\n setCenterAndZoom: function (center, zoom) {\n this.option.viewOption.center = center;\n this.option.viewOption.zoom = zoom;\n },\n centerOrZoomChanged: function (center, zoom) {\n let option = this.option.viewOption;\n return !(v2Equal(center, option.center) && zoom === option.zoom);\n },\n defaultOption: {\n viewOption: {\n center: [113.493471, 23.169598],\n zoom: 5,\n },\n mapOption: {\n customMapStyle: {},\n },\n },\n}\n\nexport default isNewEC\n ? ComponentModel.extend(BingMapModel)\n : BingMapModel\n","import { ComponentView } from 'echarts'\nimport { COMPONENT_TYPE, isNewEC } from './util'\n\nconst BingMapView = {\n type: COMPONENT_TYPE,\n init() {\n this._isFirstRender = true\n },\n\n render: function (bingMapModel, ecModel, api) {\n let rendering = true;\n let bingmap = bingMapModel.getBingMap();\n let viewportRoot = api.getZr().painter.getViewportRoot();\n let coordSys = bingMapModel.coordinateSystem;\n\n let viewChangeHandler = function (arg) {\n if (rendering) {\n return;\n }\n\n let offsetEl = viewportRoot.parentNode.parentNode.parentNode;\n let mapOffset = [\n -parseInt(offsetEl.style.left, 10) || 0,\n -parseInt(offsetEl.style.top, 10) || 0,\n ];\n viewportRoot.style.left = mapOffset[0] + 'px';\n viewportRoot.style.top = mapOffset[1] + 'px';\n coordSys.setMapOffset(mapOffset);\n bingMapModel.__mapOffset = mapOffset;\n api.dispatchAction({\n type: 'bingmapRoam',\n });\n };\n Microsoft.Maps.Events.removeHandler(this._oldViewChangeHandler);\n this._oldViewChangeHandler = Microsoft.Maps.Events.addHandler(\n bingmap,\n 'viewchangeend',\n viewChangeHandler,\n );\n Microsoft.Maps.Events.removeHandler(this._oldmapresize);\n this._oldmapresize = Microsoft.Maps.Events.addHandler(bingmap, 'mapresize', viewChangeHandler);\n this._isFirstRender = rendering = false;\n this.__viewChangeHandler = viewChangeHandler;\n },\n dispose() {\n const component = this.__model\n if (component) {\n component.getBingMap().dispose()\n component.setBingMap(null)\n component.setEChartsLayer(null)\n if (component.coordinateSystem) {\n component.coordinateSystem.setBingMap(null)\n component.coordinateSystem = null\n }\n }\n delete this.__viewChangeHandler\n }\n}\n\nexport default isNewEC\n ? ComponentView.extend(BingMapView)\n : BingMapView\n","import { util as zrUtil, graphic, matrix } from 'echarts';\nimport { COMPONENT_TYPE } from './util';\n\nfunction BingMapCoordSys(bingmap, api) {\n this._bingmap = bingmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n this._api = api;\n this._type = COMPONENT_TYPE;\n}\n\nBingMapCoordSys.prototype.dimensions = ['lng', 'lat'];\n\nBingMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\n\nBingMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._bingmap.tryLocationToPixel(\n new Microsoft.Maps.Location(center[1], center[0]),\n );\n};\n\nBingMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\n\nBingMapCoordSys.prototype.getBingMap = function () {\n return this._bingmap;\n};\n\nBingMapCoordSys.prototype.dataToPoint = function (data) {\n let lnglat = new Microsoft.Maps.Location(data[1], data[0]);\n let px = this._bingmap.tryLocationToPixel(lnglat, Microsoft.Maps.PixelReference.control);\n let mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\n\nBingMapCoordSys.prototype.pointToData = function (pt) {\n let mapOffset = this._mapOffset;\n const ptN = this._bingmap.tryPixelToLocation(\n {\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1],\n },\n Microsoft.Maps.PixelReference.control,\n );\n\n return [ptN.longitude, ptN.latitude];\n};\n\nBingMapCoordSys.prototype.getViewRect = function () {\n let api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\n\nBingMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\n\nBingMapCoordSys.prototype.prepareCustoms = function () {\n let rect = this.getViewRect();\n return {\n coordSys: {\n type: COMPONENT_TYPE,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height,\n },\n api: {\n coord: zrUtil.bind(this.dataToPoint, this),\n size: zrUtil.bind(dataToCoordSize, this),\n },\n };\n};\n\nfunction dataToCoordSize(dataSize, dataItem) {\n dataItem = dataItem || [0, 0];\n return zrUtil.map(\n [0, 1],\n function (dimIdx) {\n let val = dataItem[dimIdx];\n let halfSize = dataSize[dimIdx] / 2;\n let p1 = [];\n let p2 = [];\n p1[dimIdx] = val - halfSize;\n p2[dimIdx] = val + halfSize;\n p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];\n return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);\n },\n this,\n );\n}\n\nBingMapCoordSys.dimensions = BingMapCoordSys.prototype.dimensions;\n\nBingMapCoordSys.create = function (ecModel, api) {\n let bingmapCoordSys;\n let root = api.getDom();\n\n ecModel.eachComponent(COMPONENT_TYPE, function (bingmapModel) {\n let painter = api.getZr().painter;\n let viewportRoot = painter.getViewportRoot();\n\n if (\n typeof Microsoft === 'undefined' ||\n typeof Microsoft.Maps === 'undefined' ||\n typeof Microsoft.Maps.Map === 'undefined'\n ) {\n throw new Error('It seems that Bing Map API has not been loaded completely yet.');\n }\n\n if (bingmapCoordSys) {\n throw new Error('Only one bingmap component can exist');\n }\n\n if (!bingmapModel.__bingmap) {\n let bingmapRoot = root.querySelector('.ec-extension-bing-map');\n viewportRoot.className = 'ms-composite';\n viewportRoot.style.visibility = 'hidden';\n if (bingmapRoot) {\n viewportRoot.style.left = '0px';\n viewportRoot.style.top = '0px';\n viewportRoot.style.width = '100%';\n viewportRoot.style.height = '100%';\n viewportRoot.style.position = 'absolute';\n root.removeChild(bingmapRoot);\n }\n bingmapRoot = document.createElement('div');\n bingmapRoot.style.cssText = 'position:absolute;top:0;left:0;right:0;bottom:0;';\n bingmapRoot.className = 'ec-extension-bing-map';\n root.appendChild(bingmapRoot);\n const bingmap = (bingmapModel.__bingmap = new Microsoft.Maps.Map(bingmapRoot));\n let mapOption = bingmapModel.get('mapOption') || {};\n bingmap.setOptions(mapOption);\n bingmapRoot.querySelector('.MicrosoftMap').appendChild(viewportRoot);\n viewportRoot.style.visibility = '';\n painter.getViewportRootOffset = function () {\n return {\n offsetLeft: 0,\n offsetTop: 0,\n };\n };\n }\n\n const bingmap = bingmapModel.__bingmap;\n let viewOption = bingmapModel.get('viewOption');\n let { center, zoom } = viewOption;\n let normalizedCenter = [\n center.lng !== undefined ? center.lng : center[0],\n center.lat !== undefined ? center.lat : center[1],\n ];\n\n if (center && zoom) {\n let bingmapCenter = bingmap.getCenter();\n let bingmapZoom = bingmap.getZoom();\n let centerOrZoomChanged = bingmapModel.centerOrZoomChanged(\n [bingmapCenter.longitude, bingmapCenter.latitude],\n bingmapZoom,\n );\n if (centerOrZoomChanged) {\n let pt = new Microsoft.Maps.Location(normalizedCenter[1], normalizedCenter[0]);\n bingmap.setView({\n center: pt,\n zoom: zoom,\n });\n }\n }\n\n bingmapCoordSys = new BingMapCoordSys(bingmap, api);\n bingmapCoordSys.setMapOffset(bingmapModel.__mapOffset || [0, 0]);\n bingmapCoordSys.setZoom(zoom);\n bingmapCoordSys.setCenter(center);\n bingmapModel.coordinateSystem = bingmapCoordSys;\n });\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === COMPONENT_TYPE) {\n seriesModel.coordinateSystem = bingmapCoordSys;\n }\n });\n};\n\nexport default BingMapCoordSys;\n","import BingMapModel from './BingMapModel';\nimport BingMapView from './BingMapView';\nimport BingMapCoordSys from './BingMapCoordSys';\nimport { isNewEC, ecVer, COMPONENT_TYPE } from './util';\n\nexport { version, name } from '../package.json';\n\n/**\n * BingMap extension installer\n * @param {EChartsExtensionRegisters} registers\n */\nexport function install(registers) {\n // add coordinate system support for pie series for ECharts < 5.4.0\n if (!isNewEC || (ecVer[0] == 5 && ecVer[1] < 4)) {\n registers.registerLayout(function (ecModel) {\n ecModel.eachSeriesByType('pie', function (seriesModel) {\n const coordSys = seriesModel.coordinateSystem;\n const data = seriesModel.getData();\n const valueDim = data.mapDimension('value');\n if (coordSys && coordSys.type === COMPONENT_TYPE) {\n const center = seriesModel.get('center');\n const point = coordSys.dataToPoint(center);\n const cx = point[0];\n const cy = point[1];\n data.each(valueDim, function (value, idx) {\n const layout = data.getItemLayout(idx);\n layout.cx = cx;\n layout.cy = cy;\n });\n }\n });\n });\n }\n // Model\n isNewEC\n ? registers.registerComponentModel(BingMapModel)\n : registers.extendComponentModel(BingMapModel);\n // View\n isNewEC\n ? registers.registerComponentView(BingMapView)\n : registers.extendComponentView(BingMapView);\n // Coordinate System\n registers.registerCoordinateSystem(COMPONENT_TYPE, BingMapCoordSys);\n // Action\n registers.registerAction(\n {\n type: COMPONENT_TYPE + 'Roam',\n event: COMPONENT_TYPE + 'Roam',\n update: 'updateLayout',\n },\n function (payload, ecModel) {\n ecModel.eachComponent('bingmap', function (bingMapModel) {\n const bingmap = bingMapModel.getBingMap();\n const center = bingmap.getCenter();\n bingMapModel.setCenterAndZoom([center.longitude, center.latitude], bingmap.getZoom());\n });\n },\n );\n}\n","import * as echarts from 'echarts'\nimport { install } from './lib/index'\nimport { isNewEC } from './lib/util'\n\nisNewEC ? echarts.use(install) : install(echarts)\n\nexport { name, version } from './lib/index'\n"],"names":["ecVer","version","split","isNewEC","COMPONENT_TYPE","v2Equal","a","b","BingMapModel","type","setBingMap","bingmap","__bingmap","getBingMap","setEChartsLayer","layer","__echartsLayer","getEChartsLayer","setCenterAndZoom","center","zoom","option","viewOption","centerOrZoomChanged","defaultOption","mapOption","customMapStyle","ComponentModel","extend","BingMapView","init","_isFirstRender","render","bingMapModel","ecModel","api","rendering","viewportRoot","getZr","painter","getViewportRoot","coordSys","coordinateSystem","viewChangeHandler","arg","offsetEl","parentNode","mapOffset","parseInt","style","left","top","setMapOffset","__mapOffset","dispatchAction","Microsoft","Maps","Events","removeHandler","_oldViewChangeHandler","addHandler","_oldmapresize","__viewChangeHandler","dispose","component","__model","ComponentView","BingMapCoordSys","_bingmap","dimensions","_mapOffset","_api","_type","prototype","setZoom","_zoom","setCenter","_center","tryLocationToPixel","Location","dataToPoint","data","lnglat","px","PixelReference","control","x","y","pointToData","pt","ptN","tryPixelToLocation","longitude","latitude","getViewRect","graphic","BoundingRect","getWidth","getHeight","getRoamTransform","matrix","create","prepareCustoms","rect","width","height","coord","zrUtil","bind","size","dataToCoordSize","dataSize","dataItem","map","dimIdx","val","halfSize","p1","p2","Math","abs","bingmapCoordSys","root","getDom","eachComponent","bingmapModel","Map","Error","bingmapRoot","querySelector","className","visibility","position","removeChild","document","createElement","cssText","appendChild","get","setOptions","getViewportRootOffset","offsetLeft","offsetTop","normalizedCenter","lng","undefined","lat","bingmapCenter","getCenter","bingmapZoom","getZoom","setView","eachSeries","seriesModel","install","registers","registerLayout","eachSeriesByType","getData","valueDim","mapDimension","point","cx","cy","each","value","idx","layout","getItemLayout","registerComponentModel","extendComponentModel","registerComponentView","extendComponentView","registerCoordinateSystem","registerAction","event","update","payload","echarts","use"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEO,IAAMA,KAAK,GAAGC,eAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAAA;EAEhC,IAAMC,OAAO,GAAGH,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;EAE5B,IAAMI,cAAc,GAAG,SAAS,CAAA;EAEhC,SAASC,OAAOA,CAACC,CAAC,EAAEC,CAAC,EAAE;IAC5B,OAAOD,CAAC,IAAIC,CAAC,IAAID,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,IAAID,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,CAAA;EACjD;;ECNA,IAAMC,YAAY,GAAG;EACnBC,EAAAA,IAAI,EAAEL,cAAc;EACpBM,EAAAA,UAAU,EAAE,SAAAA,UAAUC,CAAAA,OAAO,EAAE;MAC7B,IAAI,CAACC,SAAS,GAAGD,OAAO,CAAA;KACzB;IACDE,UAAU,EAAE,SAAAA,UAAAA,GAAY;MACtB,OAAO,IAAI,CAACD,SAAS,CAAA;KACtB;EACDE,EAAAA,eAAe,EAAE,SAAAA,eAAUC,CAAAA,KAAK,EAAE;MAChC,IAAI,CAACC,cAAc,GAAGD,KAAK,CAAA;KAC5B;IAEDE,eAAe,EAAE,SAAAA,eAAAA,GAAY;MAC3B,OAAO,IAAI,CAACD,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CAAC2I,OAAO,EAAE,CAAC,CAAA;EACvF,KAAC,CAAC,CAAA;EACJ,GACF,CAAC,CAAA;EACH;;ECtDAnJ,OAAO,GAAG+K,OAAO,CAACC,GAAG,CAACzB,OAAO,CAAC,GAAGA,OAAO,CAACwB,OAAO,CAAC;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"echarts-extension-bingmaps.js","sources":["../lib/util.js","../lib/BingMapModel.js","../lib/BingMapView.js","../lib/BingMapCoordSys.js","../lib/index.js","../index.js"],"sourcesContent":["import { version } from 'echarts'\n\nexport const ecVer = version.split('.')\n\nexport const isNewEC = ecVer[0] > 4\n\nexport const COMPONENT_TYPE = 'bingmap'\n\nexport function v2Equal(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1]\n}\n","import { ComponentModel } from 'echarts'\n\nimport { v2Equal, isNewEC, COMPONENT_TYPE } from './util';\n\nconst BingMapModel = {\n type: COMPONENT_TYPE,\n setBingMap: function (bingmap) {\n this.__bingmap = bingmap;\n },\n getBingMap: function () {\n return this.__bingmap;\n },\n setEChartsLayer: function (layer) {\n this.__echartsLayer = layer;\n },\n\n getEChartsLayer: function () {\n return this.__echartsLayer;\n },\n setCenterAndZoom: function (center, zoom) {\n this.option.viewOption.center = center;\n this.option.viewOption.zoom = zoom;\n },\n centerOrZoomChanged: function (center, zoom) {\n let option = this.option.viewOption;\n return !(v2Equal(center, option.center) && zoom === option.zoom);\n },\n defaultOption: {\n viewOption: {\n center: [113.493471, 23.169598],\n zoom: 5,\n },\n mapOption: {\n customMapStyle: {},\n },\n },\n}\n\nexport default isNewEC\n ? ComponentModel.extend(BingMapModel)\n : BingMapModel\n","import { ComponentView } from 'echarts'\nimport { COMPONENT_TYPE, isNewEC } from './util'\n\nconst BingMapView = {\n type: COMPONENT_TYPE,\n init() {\n this._isFirstRender = true\n },\n\n render: function (bingMapModel, ecModel, api) {\n let rendering = true;\n let bingmap = bingMapModel.getBingMap();\n let viewportRoot = api.getZr().painter.getViewportRoot();\n let coordSys = bingMapModel.coordinateSystem;\n\n let viewChangeHandler = function (arg) {\n if (rendering) {\n return;\n }\n\n let offsetEl = viewportRoot.parentNode.parentNode.parentNode;\n let mapOffset = [\n -parseInt(offsetEl.style.left, 10) || 0,\n -parseInt(offsetEl.style.top, 10) || 0,\n ];\n viewportRoot.style.left = mapOffset[0] + 'px';\n viewportRoot.style.top = mapOffset[1] + 'px';\n coordSys.setMapOffset(mapOffset);\n bingMapModel.__mapOffset = mapOffset;\n api.dispatchAction({\n type: 'bingmapRoam',\n });\n };\n Microsoft.Maps.Events.removeHandler(this._oldViewChangeHandler);\n this._oldViewChangeHandler = Microsoft.Maps.Events.addHandler(\n bingmap,\n 'viewchangeend',\n viewChangeHandler,\n );\n Microsoft.Maps.Events.removeHandler(this._oldmapresize);\n this._oldmapresize = Microsoft.Maps.Events.addHandler(bingmap, 'mapresize', viewChangeHandler);\n this._isFirstRender = rendering = false;\n this.__viewChangeHandler = viewChangeHandler;\n },\n dispose() {\n const component = this.__model\n if (component) {\n component.getBingMap().dispose()\n component.setBingMap(null)\n component.setEChartsLayer(null)\n if (component.coordinateSystem) {\n component.coordinateSystem.setBingMap(null)\n component.coordinateSystem = null\n }\n }\n delete this.__viewChangeHandler\n }\n}\n\nexport default isNewEC\n ? ComponentView.extend(BingMapView)\n : BingMapView\n","import { util as zrUtil, graphic, matrix } from 'echarts';\nimport { COMPONENT_TYPE } from './util';\n\nfunction BingMapCoordSys(bingmap, api) {\n this._bingmap = bingmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n this._api = api;\n this._type = COMPONENT_TYPE;\n}\n\nBingMapCoordSys.prototype.dimensions = ['lng', 'lat'];\n\nBingMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\n\nBingMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._bingmap.tryLocationToPixel(\n new Microsoft.Maps.Location(center[1], center[0]),\n );\n};\n\nBingMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\n\nBingMapCoordSys.prototype.getBingMap = function () {\n return this._bingmap;\n};\n\nBingMapCoordSys.prototype.dataToPoint = function (data) {\n let lnglat = new Microsoft.Maps.Location(data[1], data[0]);\n let px = this._bingmap.tryLocationToPixel(lnglat, Microsoft.Maps.PixelReference.control);\n let mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\n\nBingMapCoordSys.prototype.pointToData = function (pt) {\n let mapOffset = this._mapOffset;\n const ptN = this._bingmap.tryPixelToLocation(\n {\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1],\n },\n Microsoft.Maps.PixelReference.control,\n );\n\n return [ptN.longitude, ptN.latitude];\n};\n\nBingMapCoordSys.prototype.getViewRect = function () {\n let api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\n\nBingMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\n\nBingMapCoordSys.prototype.prepareCustoms = function () {\n let rect = this.getViewRect();\n return {\n coordSys: {\n type: COMPONENT_TYPE,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height,\n },\n api: {\n coord: zrUtil.bind(this.dataToPoint, this),\n size: zrUtil.bind(dataToCoordSize, this),\n },\n };\n};\n\nfunction dataToCoordSize(dataSize, dataItem) {\n dataItem = dataItem || [0, 0];\n return zrUtil.map(\n [0, 1],\n function (dimIdx) {\n let val = dataItem[dimIdx];\n let halfSize = dataSize[dimIdx] / 2;\n let p1 = [];\n let p2 = [];\n p1[dimIdx] = val - halfSize;\n p2[dimIdx] = val + halfSize;\n p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];\n return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);\n },\n this,\n );\n}\n\nBingMapCoordSys.dimensions = BingMapCoordSys.prototype.dimensions;\n\nBingMapCoordSys.create = function (ecModel, api) {\n let bingmapCoordSys;\n let root = api.getDom();\n\n ecModel.eachComponent(COMPONENT_TYPE, function (bingmapModel) {\n let painter = api.getZr().painter;\n let viewportRoot = painter.getViewportRoot();\n\n if (\n typeof Microsoft === 'undefined' ||\n typeof Microsoft.Maps === 'undefined' ||\n typeof Microsoft.Maps.Map === 'undefined'\n ) {\n throw new Error('It seems that Bing Map API has not been loaded completely yet.');\n }\n\n if (bingmapCoordSys) {\n throw new Error('Only one bingmap component can exist');\n }\n\n if (!bingmapModel.__bingmap) {\n let bingmapRoot = root.querySelector('.ec-extension-bing-map');\n viewportRoot.className = 'ms-composite';\n viewportRoot.style.visibility = 'hidden';\n if (bingmapRoot) {\n viewportRoot.style.left = '0px';\n viewportRoot.style.top = '0px';\n viewportRoot.style.width = '100%';\n viewportRoot.style.height = '100%';\n viewportRoot.style.position = 'absolute';\n root.removeChild(bingmapRoot);\n }\n bingmapRoot = document.createElement('div');\n bingmapRoot.style.cssText = 'position:absolute;top:0;left:0;right:0;bottom:0;';\n bingmapRoot.className = 'ec-extension-bing-map';\n root.appendChild(bingmapRoot);\n const bingmap = (bingmapModel.__bingmap = new Microsoft.Maps.Map(bingmapRoot));\n let mapOption = bingmapModel.get('mapOption') || {};\n bingmap.setOptions(mapOption);\n bingmapRoot.querySelector('.MicrosoftMap').appendChild(viewportRoot);\n viewportRoot.style.visibility = '';\n painter.getViewportRootOffset = function () {\n return {\n offsetLeft: 0,\n offsetTop: 0,\n };\n };\n }\n\n const bingmap = bingmapModel.__bingmap;\n let viewOption = bingmapModel.get('viewOption');\n let { center, zoom } = viewOption;\n let normalizedCenter = [\n center.lng !== undefined ? center.lng : center[0],\n center.lat !== undefined ? center.lat : center[1],\n ];\n\n if (center && zoom) {\n let bingmapCenter = bingmap.getCenter();\n let bingmapZoom = bingmap.getZoom();\n let centerOrZoomChanged = bingmapModel.centerOrZoomChanged(\n [bingmapCenter.longitude, bingmapCenter.latitude],\n bingmapZoom,\n );\n if (centerOrZoomChanged) {\n let pt = new Microsoft.Maps.Location(normalizedCenter[1], normalizedCenter[0]);\n bingmap.setView({\n center: pt,\n zoom: zoom,\n });\n }\n }\n\n bingmapCoordSys = new BingMapCoordSys(bingmap, api);\n bingmapCoordSys.setMapOffset(bingmapModel.__mapOffset || [0, 0]);\n bingmapCoordSys.setZoom(zoom);\n bingmapCoordSys.setCenter(center);\n bingmapModel.coordinateSystem = bingmapCoordSys;\n });\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === COMPONENT_TYPE) {\n seriesModel.coordinateSystem = bingmapCoordSys;\n }\n });\n};\n\nexport default BingMapCoordSys;\n","import BingMapModel from './BingMapModel';\nimport BingMapView from './BingMapView';\nimport BingMapCoordSys from './BingMapCoordSys';\nimport { isNewEC, ecVer, COMPONENT_TYPE } from './util';\n\nexport { version, name } from '../package.json';\n\n/**\n * BingMap extension installer\n * @param {EChartsExtensionRegisters} registers\n */\nexport function install(registers) {\n // add coordinate system support for pie series for ECharts < 5.4.0\n if (!isNewEC || (ecVer[0] == 5 && ecVer[1] < 4)) {\n registers.registerLayout(function (ecModel) {\n ecModel.eachSeriesByType('pie', function (seriesModel) {\n const coordSys = seriesModel.coordinateSystem;\n const data = seriesModel.getData();\n const valueDim = data.mapDimension('value');\n if (coordSys && coordSys._type === COMPONENT_TYPE) {\n const center = seriesModel.get('center');\n const point = coordSys.dataToPoint(center);\n const cx = point[0];\n const cy = point[1];\n data.each(valueDim, function (value, idx) {\n const layout = data.getItemLayout(idx);\n layout.cx = cx;\n layout.cy = cy;\n });\n }\n });\n });\n }\n // Model\n isNewEC\n ? registers.registerComponentModel(BingMapModel)\n : registers.extendComponentModel(BingMapModel);\n // View\n isNewEC\n ? registers.registerComponentView(BingMapView)\n : registers.extendComponentView(BingMapView);\n // Coordinate System\n registers.registerCoordinateSystem(COMPONENT_TYPE, BingMapCoordSys);\n // Action\n registers.registerAction(\n {\n type: COMPONENT_TYPE + 'Roam',\n event: COMPONENT_TYPE + 'Roam',\n update: 'updateLayout',\n },\n function (payload, ecModel) {\n ecModel.eachComponent('bingmap', function (bingMapModel) {\n const bingmap = bingMapModel.getBingMap();\n const center = bingmap.getCenter();\n bingMapModel.setCenterAndZoom([center.longitude, center.latitude], bingmap.getZoom());\n });\n },\n );\n}\n","import * as echarts from 'echarts'\nimport { install } from './lib/index'\nimport { isNewEC } from './lib/util'\n\nisNewEC ? echarts.use(install) : install(echarts)\n\nexport { name, version } from './lib/index'\n"],"names":["ecVer","version","split","isNewEC","COMPONENT_TYPE","v2Equal","a","b","BingMapModel","type","setBingMap","bingmap","__bingmap","getBingMap","setEChartsLayer","layer","__echartsLayer","getEChartsLayer","setCenterAndZoom","center","zoom","option","viewOption","centerOrZoomChanged","defaultOption","mapOption","customMapStyle","ComponentModel","extend","BingMapView","init","_isFirstRender","render","bingMapModel","ecModel","api","rendering","viewportRoot","getZr","painter","getViewportRoot","coordSys","coordinateSystem","viewChangeHandler","arg","offsetEl","parentNode","mapOffset","parseInt","style","left","top","setMapOffset","__mapOffset","dispatchAction","Microsoft","Maps","Events","removeHandler","_oldViewChangeHandler","addHandler","_oldmapresize","__viewChangeHandler","dispose","component","__model","ComponentView","BingMapCoordSys","_bingmap","dimensions","_mapOffset","_api","_type","prototype","setZoom","_zoom","setCenter","_center","tryLocationToPixel","Location","dataToPoint","data","lnglat","px","PixelReference","control","x","y","pointToData","pt","ptN","tryPixelToLocation","longitude","latitude","getViewRect","graphic","BoundingRect","getWidth","getHeight","getRoamTransform","matrix","create","prepareCustoms","rect","width","height","coord","zrUtil","bind","size","dataToCoordSize","dataSize","dataItem","map","dimIdx","val","halfSize","p1","p2","Math","abs","bingmapCoordSys","root","getDom","eachComponent","bingmapModel","Map","Error","bingmapRoot","querySelector","className","visibility","position","removeChild","document","createElement","cssText","appendChild","get","setOptions","getViewportRootOffset","offsetLeft","offsetTop","normalizedCenter","lng","undefined","lat","bingmapCenter","getCenter","bingmapZoom","getZoom","setView","eachSeries","seriesModel","install","registers","registerLayout","eachSeriesByType","getData","valueDim","mapDimension","point","cx","cy","each","value","idx","layout","getItemLayout","registerComponentModel","extendComponentModel","registerComponentView","extendComponentView","registerCoordinateSystem","registerAction","event","update","payload","echarts","use"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEO,IAAMA,KAAK,GAAGC,eAAO,CAACC,KAAK,CAAC,GAAG,CAAC,CAAA;EAEhC,IAAMC,OAAO,GAAGH,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;EAE5B,IAAMI,cAAc,GAAG,SAAS,CAAA;EAEhC,SAASC,OAAOA,CAACC,CAAC,EAAEC,CAAC,EAAE;IAC5B,OAAOD,CAAC,IAAIC,CAAC,IAAID,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,IAAID,CAAC,CAAC,CAAC,CAAC,KAAKC,CAAC,CAAC,CAAC,CAAC,CAAA;EACjD;;ECNA,IAAMC,YAAY,GAAG;EACnBC,EAAAA,IAAI,EAAEL,cAAc;EACpBM,EAAAA,UAAU,EAAE,SAAAA,UAAUC,CAAAA,OAAO,EAAE;MAC7B,IAAI,CAACC,SAAS,GAAGD,OAAO,CAAA;KACzB;IACDE,UAAU,EAAE,SAAAA,UAAAA,GAAY;MACtB,OAAO,IAAI,CAACD,SAAS,CAAA;KACtB;EACDE,EAAAA,eAAe,EAAE,SAAAA,eAAUC,CAAAA,KAAK,EAAE;MAChC,IAAI,CAACC,cAAc,GAAGD,KAAK,CAAA;KAC5B;IAEDE,eAAe,EAAE,SAAAA,eAAAA,GAAY;MAC3B,OAAO,IAAI,CAACD,cAAc,CAAA;KAC3B;EACDE,EAAAA,gBAAgB,EAAE,SAAAA,gBAAAA,CAAUC,MAAM,EAAEC,IAAI,EAAE;EACxC,IAAA,IAAI,CAACC,MAAM,CAACC,UAAU,CAACH,MAAM,GAAGA,MAAM,CAAA;EACtC,IAAA,IAAI,CAACE,MAAM,CAACC,UAAU,CAACF,IAAI,GAAGA,IAAI,CAAA;KACnC;EACDG,EAAAA,mBA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AAA;EAChB,WAAC,CAAC,CAAA;EACJ,SAAA;EACF,OAAC,CAAC,CAAA;EACJ,KAAC,CAAC,CAAA;EACJ,GAAA;EACA;EACAhK,EAAAA,OAAO,GACHwJ,SAAS,CAACc,sBAAsB,CAACjK,cAAY,CAAC,GAC9CmJ,SAAS,CAACe,oBAAoB,CAAClK,cAAY,CAAC,CAAA;EAChD;EACAL,EAAAA,OAAO,GACHwJ,SAAS,CAACgB,qBAAqB,CAAC9I,aAAW,CAAC,GAC5C8H,SAAS,CAACiB,mBAAmB,CAAC/I,aAAW,CAAC,CAAA;EAC9C;EACA8H,EAAAA,SAAS,CAACkB,wBAAwB,CAACzK,cAAc,EAAE+D,eAAe,CAAC,CAAA;EACnE;IACAwF,SAAS,CAACmB,cAAc,CACtB;MACErK,IAAI,EAAEL,cAAc,GAAG,MAAM;MAC7B2K,KAAK,EAAE3K,cAAc,GAAG,MAAM;EAC9B4K,IAAAA,MAAM,EAAE,cAAA;EACV,GAAC,EACD,UAAUC,OAAO,EAAE/I,OAAO,EAAE;EAC1BA,IAAAA,OAAO,CAAC0F,aAAa,CAAC,SAAS,EAAE,UAAU3F,YAAY,EAAE;EACvD,MAAA,IAAMtB,OAAO,GAAGsB,YAAY,CAACpB,UAAU,EAAE,CAAA;EACzC,MAAA,IAAMM,MAAM,GAAGR,OAAO,CAACyI,SAAS,EAAE,CAAA;EAClCnH,MAAAA,YAAY,CAACf,gBAAgB,CAAC,CAACC,MAAM,CAACyE,SAAS,EAAEzE,MAAM,CAAC0E,QAAQ,CAAC,EAAElF,OAAO,CAAC2I,OAAO,EAAE,CAAC,CAAA;EACvF,KAAC,CAAC,CAAA;EACJ,GACF,CAAC,CAAA;EACH;;ECtDAnJ,OAAO,GAAG+K,OAAO,CAACC,GAAG,CAACzB,OAAO,CAAC,GAAGA,OAAO,CAACwB,OAAO,CAAC;;;;;;;;;"} \ No newline at end of file diff --git a/dist/echarts-extension-bingmaps.min.js b/dist/echarts-extension-bingmaps.min.js index 83a79ef..b69a860 100644 --- a/dist/echarts-extension-bingmaps.min.js +++ b/dist/echarts-extension-bingmaps.min.js @@ -1,6 +1,6 @@ /*! * echarts-extension-bingmaps - * @version 1.0.4 + * @version 2.0.1 * @author andybuibui * * MIT License @@ -25,5 +25,5 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).echarts=t.echarts||{},t.echarts.bingmap={}),t.echarts)}(this,(function(t,e){"use strict";var o=e.version.split("."),n=o[0]>4,i="bingmap";var a={type:i,setBingMap:function(t){this.__bingmap=t},getBingMap:function(){return this.__bingmap},setEChartsLayer:function(t){this.__echartsLayer=t},getEChartsLayer:function(){return this.__echartsLayer},setCenterAndZoom:function(t,e){this.option.viewOption.center=t,this.option.viewOption.zoom=e},centerOrZoomChanged:function(t,e){var o,n,i=this.option.viewOption;return n=i.center,!((o=t)&&n&&o[0]===n[0]&&o[1]===n[1]&&e===i.zoom)},defaultOption:{viewOption:{center:[113.493471,23.169598],zoom:5},mapOption:{customMapStyle:{}}}},s=n?e.ComponentModel.extend(a):a,r={type:i,init:function(){this._isFirstRender=!0},render:function(t,e,o){var n=!0,i=t.getBingMap(),a=o.getZr().painter.getViewportRoot(),s=t.coordinateSystem,r=function(e){if(!n){var i=a.parentNode.parentNode.parentNode,r=[-parseInt(i.style.left,10)||0,-parseInt(i.style.top,10)||0];a.style.left=r[0]+"px",a.style.top=r[1]+"px",s.setMapOffset(r),t.__mapOffset=r,o.dispatchAction({type:"bingmapRoam"})}};Microsoft.Maps.Events.removeHandler(this._oldViewChangeHandler),this._oldViewChangeHandler=Microsoft.Maps.Events.addHandler(i,"viewchangeend",r),Microsoft.Maps.Events.removeHandler(this._oldmapresize),this._oldmapresize=Microsoft.Maps.Events.addHandler(i,"mapresize",r),this._isFirstRender=n=!1,this.__viewChangeHandler=r},dispose:function(){var t=this.__model;t&&(t.getBingMap().dispose(),t.setBingMap(null),t.setEChartsLayer(null),t.coordinateSystem&&(t.coordinateSystem.setBingMap(null),t.coordinateSystem=null)),delete this.__viewChangeHandler}},p=n?e.ComponentView.extend(r):r;function c(t,e){this._bingmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._type=i}function d(t,o){return o=o||[0,0],e.util.map([0,1],(function(e){var n=o[e],i=t[e]/2,a=[],s=[];return a[e]=n-i,s[e]=n+i,a[1-e]=s[1-e]=o[1-e],Math.abs(this.dataToPoint(a)[e]-this.dataToPoint(s)[e])}),this)}c.prototype.dimensions=["lng","lat"],c.prototype.setZoom=function(t){this._zoom=t},c.prototype.setCenter=function(t){this._center=this._bingmap.tryLocationToPixel(new Microsoft.Maps.Location(t[1],t[0]))},c.prototype.setMapOffset=function(t){this._mapOffset=t},c.prototype.getBingMap=function(){return this._bingmap},c.prototype.dataToPoint=function(t){var e=new Microsoft.Maps.Location(t[1],t[0]),o=this._bingmap.tryLocationToPixel(e,Microsoft.Maps.PixelReference.control),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},c.prototype.pointToData=function(t){var e=this._mapOffset,o=this._bingmap.tryPixelToLocation({x:t[0]+e[0],y:t[1]+e[1]},Microsoft.Maps.PixelReference.control);return[o.longitude,o.latitude]},c.prototype.getViewRect=function(){var t=this._api;return new e.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},c.prototype.getRoamTransform=function(){return e.matrix.create()},c.prototype.prepareCustoms=function(){var t=this.getViewRect();return{coordSys:{type:i,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:e.util.bind(this.dataToPoint,this),size:e.util.bind(d,this)}}},c.dimensions=c.prototype.dimensions,c.create=function(t,e){var o,n=e.getDom();t.eachComponent(i,(function(t){var i=e.getZr().painter,a=i.getViewportRoot();if("undefined"==typeof Microsoft||void 0===Microsoft.Maps||void 0===Microsoft.Maps.Map)throw new Error("It seems that Bing Map API has not been loaded completely yet.");if(o)throw new Error("Only one bingmap component can exist");if(!t.__bingmap){var s=n.querySelector(".ec-extension-bing-map");a.className="ms-composite",a.style.visibility="hidden",s&&(a.style.left="0px",a.style.top="0px",a.style.width="100%",a.style.height="100%",a.style.position="absolute",n.removeChild(s)),(s=document.createElement("div")).style.cssText="position:absolute;top:0;left:0;right:0;bottom:0;",s.className="ec-extension-bing-map",n.appendChild(s);var r=t.__bingmap=new Microsoft.Maps.Map(s),p=t.get("mapOption")||{};r.setOptions(p),s.querySelector(".MicrosoftMap").appendChild(a),a.style.visibility="",i.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var d=t.__bingmap,f=t.get("viewOption"),m=f.center,l=f.zoom,h=[void 0!==m.lng?m.lng:m[0],void 0!==m.lat?m.lat:m[1]];if(m&&l){var g=d.getCenter(),u=d.getZoom();if(t.centerOrZoomChanged([g.longitude,g.latitude],u)){var y=new Microsoft.Maps.Location(h[1],h[0]);d.setView({center:y,zoom:l})}}(o=new c(d,e)).setMapOffset(t.__mapOffset||[0,0]),o.setZoom(l),o.setCenter(m),t.coordinateSystem=o})),t.eachSeries((function(t){t.get("coordinateSystem")===i&&(t.coordinateSystem=o)}))};function f(t){(!n||5==o[0]&&o[1]<4)&&t.registerLayout((function(t){t.eachSeriesByType("pie",(function(t){var e=t.coordinateSystem,o=t.getData(),n=o.mapDimension("value");if(e&&e.type===i){var a=t.get("center"),s=e.dataToPoint(a),r=s[0],p=s[1];o.each(n,(function(t,e){var n=o.getItemLayout(e);n.cx=r,n.cy=p}))}}))})),n?t.registerComponentModel(s):t.extendComponentModel(s),n?t.registerComponentView(p):t.extendComponentView(p),t.registerCoordinateSystem(i,c),t.registerAction({type:i+"Roam",event:i+"Roam",update:"updateLayout"},(function(t,e){e.eachComponent("bingmap",(function(t){var e=t.getBingMap(),o=e.getCenter();t.setCenterAndZoom([o.longitude,o.latitude],e.getZoom())}))}))}n?e.use(f):f(e),t.name="echarts-extension-bingmaps",t.version="1.0.4"})); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).echarts=t.echarts||{},t.echarts.bingmap={}),t.echarts)}(this,(function(t,e){"use strict";var o=e.version.split("."),n=o[0]>4,i="bingmap";var a={type:i,setBingMap:function(t){this.__bingmap=t},getBingMap:function(){return this.__bingmap},setEChartsLayer:function(t){this.__echartsLayer=t},getEChartsLayer:function(){return this.__echartsLayer},setCenterAndZoom:function(t,e){this.option.viewOption.center=t,this.option.viewOption.zoom=e},centerOrZoomChanged:function(t,e){var o,n,i=this.option.viewOption;return n=i.center,!((o=t)&&n&&o[0]===n[0]&&o[1]===n[1]&&e===i.zoom)},defaultOption:{viewOption:{center:[113.493471,23.169598],zoom:5},mapOption:{customMapStyle:{}}}},s=n?e.ComponentModel.extend(a):a,r={type:i,init:function(){this._isFirstRender=!0},render:function(t,e,o){var n=!0,i=t.getBingMap(),a=o.getZr().painter.getViewportRoot(),s=t.coordinateSystem,r=function(e){if(!n){var i=a.parentNode.parentNode.parentNode,r=[-parseInt(i.style.left,10)||0,-parseInt(i.style.top,10)||0];a.style.left=r[0]+"px",a.style.top=r[1]+"px",s.setMapOffset(r),t.__mapOffset=r,o.dispatchAction({type:"bingmapRoam"})}};Microsoft.Maps.Events.removeHandler(this._oldViewChangeHandler),this._oldViewChangeHandler=Microsoft.Maps.Events.addHandler(i,"viewchangeend",r),Microsoft.Maps.Events.removeHandler(this._oldmapresize),this._oldmapresize=Microsoft.Maps.Events.addHandler(i,"mapresize",r),this._isFirstRender=n=!1,this.__viewChangeHandler=r},dispose:function(){var t=this.__model;t&&(t.getBingMap().dispose(),t.setBingMap(null),t.setEChartsLayer(null),t.coordinateSystem&&(t.coordinateSystem.setBingMap(null),t.coordinateSystem=null)),delete this.__viewChangeHandler}},p=n?e.ComponentView.extend(r):r;function c(t,e){this._bingmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._type=i}function d(t,o){return o=o||[0,0],e.util.map([0,1],(function(e){var n=o[e],i=t[e]/2,a=[],s=[];return a[e]=n-i,s[e]=n+i,a[1-e]=s[1-e]=o[1-e],Math.abs(this.dataToPoint(a)[e]-this.dataToPoint(s)[e])}),this)}c.prototype.dimensions=["lng","lat"],c.prototype.setZoom=function(t){this._zoom=t},c.prototype.setCenter=function(t){this._center=this._bingmap.tryLocationToPixel(new Microsoft.Maps.Location(t[1],t[0]))},c.prototype.setMapOffset=function(t){this._mapOffset=t},c.prototype.getBingMap=function(){return this._bingmap},c.prototype.dataToPoint=function(t){var e=new Microsoft.Maps.Location(t[1],t[0]),o=this._bingmap.tryLocationToPixel(e,Microsoft.Maps.PixelReference.control),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},c.prototype.pointToData=function(t){var e=this._mapOffset,o=this._bingmap.tryPixelToLocation({x:t[0]+e[0],y:t[1]+e[1]},Microsoft.Maps.PixelReference.control);return[o.longitude,o.latitude]},c.prototype.getViewRect=function(){var t=this._api;return new e.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},c.prototype.getRoamTransform=function(){return e.matrix.create()},c.prototype.prepareCustoms=function(){var t=this.getViewRect();return{coordSys:{type:i,x:t.x,y:t.y,width:t.width,height:t.height},api:{coord:e.util.bind(this.dataToPoint,this),size:e.util.bind(d,this)}}},c.dimensions=c.prototype.dimensions,c.create=function(t,e){var o,n=e.getDom();t.eachComponent(i,(function(t){var i=e.getZr().painter,a=i.getViewportRoot();if("undefined"==typeof Microsoft||void 0===Microsoft.Maps||void 0===Microsoft.Maps.Map)throw new Error("It seems that Bing Map API has not been loaded completely yet.");if(o)throw new Error("Only one bingmap component can exist");if(!t.__bingmap){var s=n.querySelector(".ec-extension-bing-map");a.className="ms-composite",a.style.visibility="hidden",s&&(a.style.left="0px",a.style.top="0px",a.style.width="100%",a.style.height="100%",a.style.position="absolute",n.removeChild(s)),(s=document.createElement("div")).style.cssText="position:absolute;top:0;left:0;right:0;bottom:0;",s.className="ec-extension-bing-map",n.appendChild(s);var r=t.__bingmap=new Microsoft.Maps.Map(s),p=t.get("mapOption")||{};r.setOptions(p),s.querySelector(".MicrosoftMap").appendChild(a),a.style.visibility="",i.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var d=t.__bingmap,f=t.get("viewOption"),m=f.center,l=f.zoom,h=[void 0!==m.lng?m.lng:m[0],void 0!==m.lat?m.lat:m[1]];if(m&&l){var g=d.getCenter(),u=d.getZoom();if(t.centerOrZoomChanged([g.longitude,g.latitude],u)){var y=new Microsoft.Maps.Location(h[1],h[0]);d.setView({center:y,zoom:l})}}(o=new c(d,e)).setMapOffset(t.__mapOffset||[0,0]),o.setZoom(l),o.setCenter(m),t.coordinateSystem=o})),t.eachSeries((function(t){t.get("coordinateSystem")===i&&(t.coordinateSystem=o)}))};function f(t){(!n||5==o[0]&&o[1]<4)&&t.registerLayout((function(t){t.eachSeriesByType("pie",(function(t){var e=t.coordinateSystem,o=t.getData(),n=o.mapDimension("value");if(e&&e._type===i){var a=t.get("center"),s=e.dataToPoint(a),r=s[0],p=s[1];o.each(n,(function(t,e){var n=o.getItemLayout(e);n.cx=r,n.cy=p}))}}))})),n?t.registerComponentModel(s):t.extendComponentModel(s),n?t.registerComponentView(p):t.extendComponentView(p),t.registerCoordinateSystem(i,c),t.registerAction({type:i+"Roam",event:i+"Roam",update:"updateLayout"},(function(t,e){e.eachComponent("bingmap",(function(t){var e=t.getBingMap(),o=e.getCenter();t.setCenterAndZoom([o.longitude,o.latitude],e.getZoom())}))}))}n?e.use(f):f(e),t.name="echarts-extension-bingmaps",t.version="2.0.1"})); //# sourceMappingURL=echarts-extension-bingmaps.min.js.map diff --git a/dist/echarts-extension-bingmaps.min.js.map b/dist/echarts-extension-bingmaps.min.js.map index 8400a5a..76068ac 100644 --- a/dist/echarts-extension-bingmaps.min.js.map +++ b/dist/echarts-extension-bingmaps.min.js.map @@ -1 +1 @@ -{"version":3,"file":"echarts-extension-bingmaps.min.js","sources":["../lib/util.js","../lib/BingMapModel.js","../lib/BingMapView.js","../lib/BingMapCoordSys.js","../lib/index.js","../index.js"],"sourcesContent":["import { version } from 'echarts'\n\nexport const ecVer = version.split('.')\n\nexport const isNewEC = ecVer[0] > 4\n\nexport const COMPONENT_TYPE = 'bingmap'\n\nexport function v2Equal(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1]\n}\n","import { ComponentModel } from 'echarts'\n\nimport { v2Equal, isNewEC, COMPONENT_TYPE } from './util';\n\nconst BingMapModel = {\n type: COMPONENT_TYPE,\n setBingMap: function (bingmap) {\n this.__bingmap = bingmap;\n },\n getBingMap: function () {\n return this.__bingmap;\n },\n setEChartsLayer: function (layer) {\n this.__echartsLayer = layer;\n },\n\n getEChartsLayer: function () {\n return this.__echartsLayer;\n },\n setCenterAndZoom: function (center, zoom) {\n this.option.viewOption.center = center;\n this.option.viewOption.zoom = zoom;\n },\n centerOrZoomChanged: function (center, zoom) {\n let option = this.option.viewOption;\n return !(v2Equal(center, option.center) && zoom === option.zoom);\n },\n defaultOption: {\n viewOption: {\n center: [113.493471, 23.169598],\n zoom: 5,\n },\n mapOption: {\n customMapStyle: {},\n },\n },\n}\n\nexport default isNewEC\n ? ComponentModel.extend(BingMapModel)\n : BingMapModel\n","import { ComponentView } from 'echarts'\nimport { COMPONENT_TYPE, isNewEC } from './util'\n\nconst BingMapView = {\n type: COMPONENT_TYPE,\n init() {\n this._isFirstRender = true\n },\n\n render: function (bingMapModel, ecModel, api) {\n let rendering = true;\n let bingmap = bingMapModel.getBingMap();\n let viewportRoot = api.getZr().painter.getViewportRoot();\n let coordSys = bingMapModel.coordinateSystem;\n\n let viewChangeHandler = function (arg) {\n if (rendering) {\n return;\n }\n\n let offsetEl = viewportRoot.parentNode.parentNode.parentNode;\n let mapOffset = [\n -parseInt(offsetEl.style.left, 10) || 0,\n -parseInt(offsetEl.style.top, 10) || 0,\n ];\n viewportRoot.style.left = mapOffset[0] + 'px';\n viewportRoot.style.top = mapOffset[1] + 'px';\n coordSys.setMapOffset(mapOffset);\n bingMapModel.__mapOffset = mapOffset;\n api.dispatchAction({\n type: 'bingmapRoam',\n });\n };\n Microsoft.Maps.Events.removeHandler(this._oldViewChangeHandler);\n this._oldViewChangeHandler = Microsoft.Maps.Events.addHandler(\n bingmap,\n 'viewchangeend',\n viewChangeHandler,\n );\n Microsoft.Maps.Events.removeHandler(this._oldmapresize);\n this._oldmapresize = Microsoft.Maps.Events.addHandler(bingmap, 'mapresize', viewChangeHandler);\n this._isFirstRender = rendering = false;\n this.__viewChangeHandler = viewChangeHandler;\n },\n dispose() {\n const component = this.__model\n if (component) {\n component.getBingMap().dispose()\n component.setBingMap(null)\n component.setEChartsLayer(null)\n if (component.coordinateSystem) {\n component.coordinateSystem.setBingMap(null)\n component.coordinateSystem = null\n }\n }\n delete this.__viewChangeHandler\n }\n}\n\nexport default isNewEC\n ? ComponentView.extend(BingMapView)\n : BingMapView\n","import { util as zrUtil, graphic, matrix } from 'echarts';\nimport { COMPONENT_TYPE } from './util';\n\nfunction BingMapCoordSys(bingmap, api) {\n this._bingmap = bingmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n this._api = api;\n this._type = COMPONENT_TYPE;\n}\n\nBingMapCoordSys.prototype.dimensions = ['lng', 'lat'];\n\nBingMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\n\nBingMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._bingmap.tryLocationToPixel(\n new Microsoft.Maps.Location(center[1], center[0]),\n );\n};\n\nBingMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\n\nBingMapCoordSys.prototype.getBingMap = function () {\n return this._bingmap;\n};\n\nBingMapCoordSys.prototype.dataToPoint = function (data) {\n let lnglat = new Microsoft.Maps.Location(data[1], data[0]);\n let px = this._bingmap.tryLocationToPixel(lnglat, Microsoft.Maps.PixelReference.control);\n let mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\n\nBingMapCoordSys.prototype.pointToData = function (pt) {\n let mapOffset = this._mapOffset;\n const ptN = this._bingmap.tryPixelToLocation(\n {\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1],\n },\n Microsoft.Maps.PixelReference.control,\n );\n\n return [ptN.longitude, ptN.latitude];\n};\n\nBingMapCoordSys.prototype.getViewRect = function () {\n let api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\n\nBingMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\n\nBingMapCoordSys.prototype.prepareCustoms = function () {\n let rect = this.getViewRect();\n return {\n coordSys: {\n type: COMPONENT_TYPE,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height,\n },\n api: {\n coord: zrUtil.bind(this.dataToPoint, this),\n size: zrUtil.bind(dataToCoordSize, this),\n },\n };\n};\n\nfunction dataToCoordSize(dataSize, dataItem) {\n dataItem = dataItem || [0, 0];\n return zrUtil.map(\n [0, 1],\n function (dimIdx) {\n let val = dataItem[dimIdx];\n let halfSize = dataSize[dimIdx] / 2;\n let p1 = [];\n let p2 = [];\n p1[dimIdx] = val - halfSize;\n p2[dimIdx] = val + halfSize;\n p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];\n return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);\n },\n this,\n );\n}\n\nBingMapCoordSys.dimensions = BingMapCoordSys.prototype.dimensions;\n\nBingMapCoordSys.create = function (ecModel, api) {\n let bingmapCoordSys;\n let root = api.getDom();\n\n ecModel.eachComponent(COMPONENT_TYPE, function (bingmapModel) {\n let painter = api.getZr().painter;\n let viewportRoot = painter.getViewportRoot();\n\n if (\n typeof Microsoft === 'undefined' ||\n typeof Microsoft.Maps === 'undefined' ||\n typeof Microsoft.Maps.Map === 'undefined'\n ) {\n throw new Error('It seems that Bing Map API has not been loaded completely yet.');\n }\n\n if (bingmapCoordSys) {\n throw new Error('Only one bingmap component can exist');\n }\n\n if (!bingmapModel.__bingmap) {\n let bingmapRoot = root.querySelector('.ec-extension-bing-map');\n viewportRoot.className = 'ms-composite';\n viewportRoot.style.visibility = 'hidden';\n if (bingmapRoot) {\n viewportRoot.style.left = '0px';\n viewportRoot.style.top = '0px';\n viewportRoot.style.width = '100%';\n viewportRoot.style.height = '100%';\n viewportRoot.style.position = 'absolute';\n root.removeChild(bingmapRoot);\n }\n bingmapRoot = document.createElement('div');\n bingmapRoot.style.cssText = 'position:absolute;top:0;left:0;right:0;bottom:0;';\n bingmapRoot.className = 'ec-extension-bing-map';\n root.appendChild(bingmapRoot);\n const bingmap = (bingmapModel.__bingmap = new Microsoft.Maps.Map(bingmapRoot));\n let mapOption = bingmapModel.get('mapOption') || {};\n bingmap.setOptions(mapOption);\n bingmapRoot.querySelector('.MicrosoftMap').appendChild(viewportRoot);\n viewportRoot.style.visibility = '';\n painter.getViewportRootOffset = function () {\n return {\n offsetLeft: 0,\n offsetTop: 0,\n };\n };\n }\n\n const bingmap = bingmapModel.__bingmap;\n let viewOption = bingmapModel.get('viewOption');\n let { center, zoom } = viewOption;\n let normalizedCenter = [\n center.lng !== undefined ? center.lng : center[0],\n center.lat !== undefined ? center.lat : center[1],\n ];\n\n if (center && zoom) {\n let bingmapCenter = bingmap.getCenter();\n let bingmapZoom = bingmap.getZoom();\n let centerOrZoomChanged = bingmapModel.centerOrZoomChanged(\n [bingmapCenter.longitude, bingmapCenter.latitude],\n bingmapZoom,\n );\n if (centerOrZoomChanged) {\n let pt = new Microsoft.Maps.Location(normalizedCenter[1], normalizedCenter[0]);\n bingmap.setView({\n center: pt,\n zoom: zoom,\n });\n }\n }\n\n bingmapCoordSys = new BingMapCoordSys(bingmap, api);\n bingmapCoordSys.setMapOffset(bingmapModel.__mapOffset || [0, 0]);\n bingmapCoordSys.setZoom(zoom);\n bingmapCoordSys.setCenter(center);\n bingmapModel.coordinateSystem = bingmapCoordSys;\n });\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === COMPONENT_TYPE) {\n seriesModel.coordinateSystem = bingmapCoordSys;\n }\n });\n};\n\nexport default BingMapCoordSys;\n","import BingMapModel from './BingMapModel';\nimport BingMapView from './BingMapView';\nimport BingMapCoordSys from './BingMapCoordSys';\nimport { isNewEC, ecVer, COMPONENT_TYPE } from './util';\n\nexport { version, name } from '../package.json';\n\n/**\n * BingMap extension installer\n * @param {EChartsExtensionRegisters} registers\n */\nexport function install(registers) {\n // add coordinate system support for pie series for ECharts < 5.4.0\n if (!isNewEC || (ecVer[0] == 5 && ecVer[1] < 4)) {\n registers.registerLayout(function (ecModel) {\n ecModel.eachSeriesByType('pie', function (seriesModel) {\n const coordSys = seriesModel.coordinateSystem;\n const data = seriesModel.getData();\n const valueDim = data.mapDimension('value');\n if (coordSys && coordSys.type === COMPONENT_TYPE) {\n const center = seriesModel.get('center');\n const point = coordSys.dataToPoint(center);\n const cx = point[0];\n const cy = point[1];\n data.each(valueDim, function (value, idx) {\n const layout = data.getItemLayout(idx);\n layout.cx = cx;\n layout.cy = cy;\n });\n }\n });\n });\n }\n // Model\n isNewEC\n ? registers.registerComponentModel(BingMapModel)\n : registers.extendComponentModel(BingMapModel);\n // View\n isNewEC\n ? registers.registerComponentView(BingMapView)\n : registers.extendComponentView(BingMapView);\n // Coordinate System\n registers.registerCoordinateSystem(COMPONENT_TYPE, BingMapCoordSys);\n // Action\n registers.registerAction(\n {\n type: COMPONENT_TYPE + 'Roam',\n event: COMPONENT_TYPE + 'Roam',\n update: 'updateLayout',\n },\n function (payload, ecModel) {\n ecModel.eachComponent('bingmap', function (bingMapModel) {\n const bingmap = bingMapModel.getBingMap();\n const center = bingmap.getCenter();\n bingMapModel.setCenterAndZoom([center.longitude, center.latitude], bingmap.getZoom());\n });\n },\n );\n}\n","import * as echarts from 'echarts'\nimport { install } from './lib/index'\nimport { isNewEC } from './lib/util'\n\nisNewEC ? echarts.use(install) : install(echarts)\n\nexport { name, version } from './lib/index'\n"],"names":["ecVer","version","split","isNewEC","COMPONENT_TYPE","BingMapModel","type","setBingMap","bingmap","this","__bingmap","getBingMap","setEChartsLayer","layer","__echartsLayer","getEChartsLayer","setCenterAndZoom","center","zoom","option","viewOption","centerOrZoomChanged","a","b","defaultOption","mapOption","customMapStyle","ComponentModel","extend","BingMapView","init","_isFirstRender","render","bingMapModel","ecModel","api","rendering","viewportRoot","getZr","painter","getViewportRoot","coordSys","coordinateSystem","viewChangeHandler","arg","offsetEl","parentNode","mapOffset","parseInt","style","left","top","setMapOffset","__mapOffset","dispatchAction","Microsoft","Maps","Events","removeHandler","_oldViewChangeHandler","addHandler","_oldmapresize","__viewChangeHandler","dispose","component","__model","ComponentView","BingMapCoordSys","_bingmap","dimensions","_mapOffset","_api","_type","dataToCoordSize","dataSize","dataItem","zrUtil","map","dimIdx","val","halfSize","p1","p2","Math","abs","dataToPoint","prototype","setZoom","_zoom","setCenter","_center","tryLocationToPixel","Location","data","lnglat","px","PixelReference","control","x","y","pointToData","pt","ptN","tryPixelToLocation","longitude","latitude","getViewRect","graphic","BoundingRect","getWidth","getHeight","getRoamTransform","matrix","create","prepareCustoms","rect","width","height","coord","bind","size","util","bingmapCoordSys","root","getDom","eachComponent","bingmapModel","Map","Error","bingmapRoot","querySelector","className","visibility","position","removeChild","document","createElement","cssText","appendChild","get","setOptions","getViewportRootOffset","offsetLeft","offsetTop","normalizedCenter","undefined","lng","lat","bingmapCenter","getCenter","bingmapZoom","getZoom","setView","eachSeries","seriesModel","install","registers","registerLayout","eachSeriesByType","getData","valueDim","mapDimension","point","cx","cy","each","value","idx","layout","getItemLayout","registerComponentModel","extendComponentModel","registerComponentView","extendComponentView","registerCoordinateSystem","registerAction","event","update","payload","echarts","use"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;0TAEO,IAAMA,EAAQC,EAAOA,QAACC,MAAM,KA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AAM,GACjBrE,EAAKwE,KAAKL,GAAU,SAAUM,EAAOC,GACnC,IAAMC,EAAS3E,EAAK4E,cAAcF,GAClCC,EAAOL,GAAKA,EACZK,EAAOJ,GAAKA,CACd,GACF,CACF,GACF,IAGFjK,EACIyJ,EAAUc,uBAAuBrK,GACjCuJ,EAAUe,qBAAqBtK,GAEnCF,EACIyJ,EAAUgB,sBAAsB/I,GAChC+H,EAAUiB,oBAAoBhJ,GAElC+H,EAAUkB,yBAAyB1K,EAAgB+D,GAEnDyF,EAAUmB,eACR,CACEzK,KAAMF,EAAiB,OACvB4K,MAAO5K,EAAiB,OACxB6K,OAAQ,iBAEV,SAAUC,EAAShJ,GACjBA,EAAQ2F,cAAc,WAAW,SAAU5F,GACzC,IAAMzB,EAAUyB,EAAatB,aACvBM,EAAST,EAAQ6I,YACvBpH,EAAajB,iBAAiB,CAACC,EAAOuF,UAAWvF,EAAOwF,UAAWjG,EAAQ+I,UAC7E,GACF,GAEJ,CCtDApJ,EAAUgL,EAAQC,IAAIzB,GAAWA,EAAQwB"} \ No newline at end of file +{"version":3,"file":"echarts-extension-bingmaps.min.js","sources":["../lib/util.js","../lib/BingMapModel.js","../lib/BingMapView.js","../lib/BingMapCoordSys.js","../lib/index.js","../index.js"],"sourcesContent":["import { version } from 'echarts'\n\nexport const ecVer = version.split('.')\n\nexport const isNewEC = ecVer[0] > 4\n\nexport const COMPONENT_TYPE = 'bingmap'\n\nexport function v2Equal(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1]\n}\n","import { ComponentModel } from 'echarts'\n\nimport { v2Equal, isNewEC, COMPONENT_TYPE } from './util';\n\nconst BingMapModel = {\n type: COMPONENT_TYPE,\n setBingMap: function (bingmap) {\n this.__bingmap = bingmap;\n },\n getBingMap: function () {\n return this.__bingmap;\n },\n setEChartsLayer: function (layer) {\n this.__echartsLayer = layer;\n },\n\n getEChartsLayer: function () {\n return this.__echartsLayer;\n },\n setCenterAndZoom: function (center, zoom) {\n this.option.viewOption.center = center;\n this.option.viewOption.zoom = zoom;\n },\n centerOrZoomChanged: function (center, zoom) {\n let option = this.option.viewOption;\n return !(v2Equal(center, option.center) && zoom === option.zoom);\n },\n defaultOption: {\n viewOption: {\n center: [113.493471, 23.169598],\n zoom: 5,\n },\n mapOption: {\n customMapStyle: {},\n },\n },\n}\n\nexport default isNewEC\n ? ComponentModel.extend(BingMapModel)\n : BingMapModel\n","import { ComponentView } from 'echarts'\nimport { COMPONENT_TYPE, isNewEC } from './util'\n\nconst BingMapView = {\n type: COMPONENT_TYPE,\n init() {\n this._isFirstRender = true\n },\n\n render: function (bingMapModel, ecModel, api) {\n let rendering = true;\n let bingmap = bingMapModel.getBingMap();\n let viewportRoot = api.getZr().painter.getViewportRoot();\n let coordSys = bingMapModel.coordinateSystem;\n\n let viewChangeHandler = function (arg) {\n if (rendering) {\n return;\n }\n\n let offsetEl = viewportRoot.parentNode.parentNode.parentNode;\n let mapOffset = [\n -parseInt(offsetEl.style.left, 10) || 0,\n -parseInt(offsetEl.style.top, 10) || 0,\n ];\n viewportRoot.style.left = mapOffset[0] + 'px';\n viewportRoot.style.top = mapOffset[1] + 'px';\n coordSys.setMapOffset(mapOffset);\n bingMapModel.__mapOffset = mapOffset;\n api.dispatchAction({\n type: 'bingmapRoam',\n });\n };\n Microsoft.Maps.Events.removeHandler(this._oldViewChangeHandler);\n this._oldViewChangeHandler = Microsoft.Maps.Events.addHandler(\n bingmap,\n 'viewchangeend',\n viewChangeHandler,\n );\n Microsoft.Maps.Events.removeHandler(this._oldmapresize);\n this._oldmapresize = Microsoft.Maps.Events.addHandler(bingmap, 'mapresize', viewChangeHandler);\n this._isFirstRender = rendering = false;\n this.__viewChangeHandler = viewChangeHandler;\n },\n dispose() {\n const component = this.__model\n if (component) {\n component.getBingMap().dispose()\n component.setBingMap(null)\n component.setEChartsLayer(null)\n if (component.coordinateSystem) {\n component.coordinateSystem.setBingMap(null)\n component.coordinateSystem = null\n }\n }\n delete this.__viewChangeHandler\n }\n}\n\nexport default isNewEC\n ? ComponentView.extend(BingMapView)\n : BingMapView\n","import { util as zrUtil, graphic, matrix } from 'echarts';\nimport { COMPONENT_TYPE } from './util';\n\nfunction BingMapCoordSys(bingmap, api) {\n this._bingmap = bingmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n this._api = api;\n this._type = COMPONENT_TYPE;\n}\n\nBingMapCoordSys.prototype.dimensions = ['lng', 'lat'];\n\nBingMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\n\nBingMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._bingmap.tryLocationToPixel(\n new Microsoft.Maps.Location(center[1], center[0]),\n );\n};\n\nBingMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\n\nBingMapCoordSys.prototype.getBingMap = function () {\n return this._bingmap;\n};\n\nBingMapCoordSys.prototype.dataToPoint = function (data) {\n let lnglat = new Microsoft.Maps.Location(data[1], data[0]);\n let px = this._bingmap.tryLocationToPixel(lnglat, Microsoft.Maps.PixelReference.control);\n let mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\n\nBingMapCoordSys.prototype.pointToData = function (pt) {\n let mapOffset = this._mapOffset;\n const ptN = this._bingmap.tryPixelToLocation(\n {\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1],\n },\n Microsoft.Maps.PixelReference.control,\n );\n\n return [ptN.longitude, ptN.latitude];\n};\n\nBingMapCoordSys.prototype.getViewRect = function () {\n let api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\n\nBingMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\n\nBingMapCoordSys.prototype.prepareCustoms = function () {\n let rect = this.getViewRect();\n return {\n coordSys: {\n type: COMPONENT_TYPE,\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height,\n },\n api: {\n coord: zrUtil.bind(this.dataToPoint, this),\n size: zrUtil.bind(dataToCoordSize, this),\n },\n };\n};\n\nfunction dataToCoordSize(dataSize, dataItem) {\n dataItem = dataItem || [0, 0];\n return zrUtil.map(\n [0, 1],\n function (dimIdx) {\n let val = dataItem[dimIdx];\n let halfSize = dataSize[dimIdx] / 2;\n let p1 = [];\n let p2 = [];\n p1[dimIdx] = val - halfSize;\n p2[dimIdx] = val + halfSize;\n p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];\n return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);\n },\n this,\n );\n}\n\nBingMapCoordSys.dimensions = BingMapCoordSys.prototype.dimensions;\n\nBingMapCoordSys.create = function (ecModel, api) {\n let bingmapCoordSys;\n let root = api.getDom();\n\n ecModel.eachComponent(COMPONENT_TYPE, function (bingmapModel) {\n let painter = api.getZr().painter;\n let viewportRoot = painter.getViewportRoot();\n\n if (\n typeof Microsoft === 'undefined' ||\n typeof Microsoft.Maps === 'undefined' ||\n typeof Microsoft.Maps.Map === 'undefined'\n ) {\n throw new Error('It seems that Bing Map API has not been loaded completely yet.');\n }\n\n if (bingmapCoordSys) {\n throw new Error('Only one bingmap component can exist');\n }\n\n if (!bingmapModel.__bingmap) {\n let bingmapRoot = root.querySelector('.ec-extension-bing-map');\n viewportRoot.className = 'ms-composite';\n viewportRoot.style.visibility = 'hidden';\n if (bingmapRoot) {\n viewportRoot.style.left = '0px';\n viewportRoot.style.top = '0px';\n viewportRoot.style.width = '100%';\n viewportRoot.style.height = '100%';\n viewportRoot.style.position = 'absolute';\n root.removeChild(bingmapRoot);\n }\n bingmapRoot = document.createElement('div');\n bingmapRoot.style.cssText = 'position:absolute;top:0;left:0;right:0;bottom:0;';\n bingmapRoot.className = 'ec-extension-bing-map';\n root.appendChild(bingmapRoot);\n const bingmap = (bingmapModel.__bingmap = new Microsoft.Maps.Map(bingmapRoot));\n let mapOption = bingmapModel.get('mapOption') || {};\n bingmap.setOptions(mapOption);\n bingmapRoot.querySelector('.MicrosoftMap').appendChild(viewportRoot);\n viewportRoot.style.visibility = '';\n painter.getViewportRootOffset = function () {\n return {\n offsetLeft: 0,\n offsetTop: 0,\n };\n };\n }\n\n const bingmap = bingmapModel.__bingmap;\n let viewOption = bingmapModel.get('viewOption');\n let { center, zoom } = viewOption;\n let normalizedCenter = [\n center.lng !== undefined ? center.lng : center[0],\n center.lat !== undefined ? center.lat : center[1],\n ];\n\n if (center && zoom) {\n let bingmapCenter = bingmap.getCenter();\n let bingmapZoom = bingmap.getZoom();\n let centerOrZoomChanged = bingmapModel.centerOrZoomChanged(\n [bingmapCenter.longitude, bingmapCenter.latitude],\n bingmapZoom,\n );\n if (centerOrZoomChanged) {\n let pt = new Microsoft.Maps.Location(normalizedCenter[1], normalizedCenter[0]);\n bingmap.setView({\n center: pt,\n zoom: zoom,\n });\n }\n }\n\n bingmapCoordSys = new BingMapCoordSys(bingmap, api);\n bingmapCoordSys.setMapOffset(bingmapModel.__mapOffset || [0, 0]);\n bingmapCoordSys.setZoom(zoom);\n bingmapCoordSys.setCenter(center);\n bingmapModel.coordinateSystem = bingmapCoordSys;\n });\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === COMPONENT_TYPE) {\n seriesModel.coordinateSystem = bingmapCoordSys;\n }\n });\n};\n\nexport default BingMapCoordSys;\n","import BingMapModel from './BingMapModel';\nimport BingMapView from './BingMapView';\nimport BingMapCoordSys from './BingMapCoordSys';\nimport { isNewEC, ecVer, COMPONENT_TYPE } from './util';\n\nexport { version, name } from '../package.json';\n\n/**\n * BingMap extension installer\n * @param {EChartsExtensionRegisters} registers\n */\nexport function install(registers) {\n // add coordinate system support for pie series for ECharts < 5.4.0\n if (!isNewEC || (ecVer[0] == 5 && ecVer[1] < 4)) {\n registers.registerLayout(function (ecModel) {\n ecModel.eachSeriesByType('pie', function (seriesModel) {\n const coordSys = seriesModel.coordinateSystem;\n const data = seriesModel.getData();\n const valueDim = data.mapDimension('value');\n if (coordSys && coordSys._type === COMPONENT_TYPE) {\n const center = seriesModel.get('center');\n const point = coordSys.dataToPoint(center);\n const cx = point[0];\n const cy = point[1];\n data.each(valueDim, function (value, idx) {\n const layout = data.getItemLayout(idx);\n layout.cx = cx;\n layout.cy = cy;\n });\n }\n });\n });\n }\n // Model\n isNewEC\n ? registers.registerComponentModel(BingMapModel)\n : registers.extendComponentModel(BingMapModel);\n // View\n isNewEC\n ? registers.registerComponentView(BingMapView)\n : registers.extendComponentView(BingMapView);\n // Coordinate System\n registers.registerCoordinateSystem(COMPONENT_TYPE, BingMapCoordSys);\n // Action\n registers.registerAction(\n {\n type: COMPONENT_TYPE + 'Roam',\n event: COMPONENT_TYPE + 'Roam',\n update: 'updateLayout',\n },\n function (payload, ecModel) {\n ecModel.eachComponent('bingmap', function (bingMapModel) {\n const bingmap = bingMapModel.getBingMap();\n const center = bingmap.getCenter();\n bingMapModel.setCenterAndZoom([center.longitude, center.latitude], bingmap.getZoom());\n });\n },\n );\n}\n","import * as echarts from 'echarts'\nimport { install } from './lib/index'\nimport { isNewEC } from './lib/util'\n\nisNewEC ? echarts.use(install) : install(echarts)\n\nexport { name, version } from './lib/index'\n"],"names":["ecVer","version","split","isNewEC","COMPONENT_TYPE","BingMapModel","type","setBingMap","bingmap","this","__bingmap","getBingMap","setEChartsLayer","layer","__echartsLayer","getEChartsLayer","setCenterAndZoom","center","zoom","option","viewOption","centerOrZoomChanged","a","b","defaultOption","mapOption","customMapStyle","ComponentModel","extend","BingMapView","init","_isFirstRender","render","bingMapModel","ecModel","api","rendering","viewportRoot","getZr","painter","getViewportRoot","coordSys","coordinateSystem","viewChangeHandler","arg","offsetEl","parentNode","mapOffset","parseInt","style","left","top","setMapOffset","__mapOffset","dispatchAction","Microsoft","Maps","Events","removeHandler","_oldViewChangeHandler","addHandler","_oldmapresize","__viewChangeHandler","dispose","component","__model","ComponentView","BingMapCoordSys","_bingmap","dimensions","_mapOffset","_api","_type","dataToCoordSize","dataSize","dataItem","zrUtil","map","dimIdx","val","halfSize","p1","p2","Math","abs","dataToPoint","prototype","setZoom","_zoom","setCenter","_center","tryLocationToPixel","Location","data","lnglat","px","PixelReference","control","x","y","pointToData","pt","ptN","tryPixelToLocation","longitude","latitude","getViewRect","graphic","BoundingRect","getWidth","getHeight","getRoamTransform","matrix","create","prepareCustoms","rect","width","height","coord","bind","size","util","bingmapCoordSys","root","getDom","eachComponent","bingmapModel","Map","Error","bingmapRoot","querySelector","className","visibility","position","removeChild","document","createElement","cssText","appendChild","get","setOptions","getViewportRootOffset","offsetLeft","offsetTop","normalizedCenter","undefined","lng","lat","bingmapCenter","getCenter","bingmapZoom","getZoom","setView","eachSeries","seriesModel","install","registers","registerLayout","eachSeriesByType","getData","valueDim","mapDimension","point","cx","cy","each","value","idx","layout","getItemLayout","registerComponentModel","extendComponentModel","registerComponentView","extendComponentView","registerCoordinateSystem","registerAction","event","update","payload","echarts","use"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;0TAEO,IAAMA,EAAQC,EAAOA,QAACC,MAAM,KAEtBC,EAAUH,EAAM,GAAK,EAErBI,EAAiB,UCF9B,IAAMC,EAAe,CACnBC,KAAMF,EACNG,WAAY,SAAUC,GACpBC,KAAKC,UAAYF,CAClB,EACDG,WAAY,WACV,OAAOF,KAAKC,SACb,EACDE,gBAAiB,SAAUC,GACzBJ,KAAKK,eAAiBD,CACvB,EAEDE,gBAAiB,WACf,OAAON,KAAKK,cACb,EACDE,iBAAkB,SAAUC,EAAQC,GAClCT,KAAKU,OAAOC,WAAWH,OAASA,EAChCR,KAAKU,OAAOC,WAAWF,KAAOA,CAC/B,EACDG,oBAAqB,SAAUJ,EAAQC,GACrC,IDhBoBI,EAAGC,ECgBnBJ,EAASV,KAAKU,OAAOC,WACzB,ODjBuBG,ECiBEJ,EAAOF,UDjBZK,ECiBHL,IDhBPM,GAAKD,EAAE,KAAOC,EAAE,IAAMD,EAAE,KAAOC,EAAE,ICgBAL,IAASC,EAAOD,KAC5D,EACDM,cAAe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AC7E,GACF,GAEJ,CCtDApJ,EAAUgL,EAAQC,IAAIzB,GAAWA,EAAQwB"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index e0934d2..d527bc4 100644 --- a/lib/index.js +++ b/lib/index.js @@ -17,7 +17,7 @@ export function install(registers) { const coordSys = seriesModel.coordinateSystem; const data = seriesModel.getData(); const valueDim = data.mapDimension('value'); - if (coordSys && coordSys.type === COMPONENT_TYPE) { + if (coordSys && coordSys._type === COMPONENT_TYPE) { const center = seriesModel.get('center'); const point = coordSys.dataToPoint(center); const cx = point[0]; diff --git a/package-lock.json b/package-lock.json index 30b163a..c2b5f1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "echarts-extension-bingmaps", - "version": "1.0.2", + "version": "2.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "echarts-extension-bingmaps", - "version": "1.0.2", + "version": "2.0.1", "license": "MIT", "devDependencies": { "@babel/core": "^7.24.5", diff --git a/package.json b/package.json index 2039e39..b608c2d 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,14 @@ "name": "echarts-extension-bingmaps", "description": "bingmap for Apache ECharts (https://github.com/apache/echarts)", "private": false, - "version": "2.0.0", + "version": "2.0.1", "author": "andybuibui", "license": "MIT", "files": [ "dist", "index.d.ts" ], - "main": ".dist/echarts-extension-bingmaps.min.js", + "main": "dist/echarts-extension-bingmaps.min.js", "module": "dist/echarts-extension-bingmaps.esm.js", "types": "index.d.ts", "scripts": {