提交 df0a815e 编写于 作者: O Ovilia

Merge branch 'master' of github.com:ecomfe/echarts

......@@ -90,6 +90,7 @@ function run() {
build(configs);
// Compatible with prevoius folder structure: `echarts/lib` exists in `node_modules`
// npm run prepublish: `rm -r lib; cp -r src lib`
fsExtra.removeSync(getPath('./lib'));
fsExtra.copySync(getPath('./src'), getPath('./lib'));
......
......@@ -47057,6 +47057,4 @@ exports.List = List;
exports.Model = Model;
exports.Axis = Axis;
Object.defineProperty(exports, '__esModule', { value: true });
})));
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -72481,7 +72481,5 @@ exports.List = List;
exports.Model = Model;
exports.Axis = Axis;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=echarts-en.js.map
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -33026,6 +33026,4 @@ exports.List = List;
exports.Model = Model;
exports.Axis = Axis;
Object.defineProperty(exports, '__esModule', { value: true });
})));
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -47057,6 +47057,4 @@ exports.List = List;
exports.Model = Model;
exports.Axis = Axis;
Object.defineProperty(exports, '__esModule', { value: true });
})));
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -33026,6 +33026,4 @@ exports.List = List;
exports.Model = Model;
exports.Axis = Axis;
Object.defineProperty(exports, '__esModule', { value: true });
})));
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -338,7 +338,5 @@ var version = '1.0.0';
exports.version = version;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=bmap.js.map
{"version":3,"file":"bmap.js","sources":["../../extension/bmap/BMapCoordSys.js","../../extension/bmap/BMapModel.js","../../extension/bmap/BMapView.js","../../extension/bmap/bmap.js"],"sourcesContent":["/* global BMap */\n\nimport {\n util as zrUtil,\n graphic,\n matrix\n} from 'echarts';\n\nfunction BMapCoordSys(bmap, api) {\n this._bmap = bmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n\n this._api = api;\n\n this._projection = new BMap.MercatorProjection();\n}\n\nBMapCoordSys.prototype.dimensions = ['lng', 'lat'];\n\nBMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\n\nBMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));\n};\n\nBMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\n\nBMapCoordSys.prototype.getBMap = function () {\n return this._bmap;\n};\n\nBMapCoordSys.prototype.dataToPoint = function (data) {\n var point = new BMap.Point(data[0], data[1]);\n // TODO mercator projection is toooooooo slow\n // var mercatorPoint = this._projection.lngLatToPoint(point);\n\n // var width = this._api.getZr().getWidth();\n // var height = this._api.getZr().getHeight();\n // var divider = Math.pow(2, 18 - 10);\n // return [\n // Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),\n // Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)\n // ];\n var px = this._bmap.pointToOverlayPixel(point);\n var mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\n\nBMapCoordSys.prototype.pointToData = function (pt) {\n var mapOffset = this._mapOffset;\n var pt = this._bmap.overlayPixelToPoint({\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1]\n });\n return [pt.lng, pt.lat];\n};\n\nBMapCoordSys.prototype.getViewRect = function () {\n var api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\n\nBMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\n\nBMapCoordSys.prototype.prepareCustoms = function (data) {\n var rect = this.getViewRect();\n return {\n coordSys: {\n // The name exposed to user is always 'cartesian2d' but not 'grid'.\n type: 'bmap',\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([0, 1], function (dimIdx) {\n var val = dataItem[dimIdx];\n var halfSize = dataSize[dimIdx] / 2;\n var p1 = [];\n var 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 }, this);\n}\n\nvar Overlay;\n\n// For deciding which dimensions to use when creating list data\nBMapCoordSys.dimensions = BMapCoordSys.prototype.dimensions;\n\nfunction createOverlayCtor() {\n function Overlay(root) {\n this._root = root;\n }\n\n Overlay.prototype = new BMap.Overlay();\n /**\n * 初始化\n *\n * @param {BMap.Map} map\n * @override\n */\n Overlay.prototype.initialize = function (map) {\n map.getPanes().labelPane.appendChild(this._root);\n return this._root;\n };\n /**\n * @override\n */\n Overlay.prototype.draw = function () {};\n\n return Overlay;\n}\n\nBMapCoordSys.create = function (ecModel, api) {\n var bmapCoordSys;\n var root = api.getDom();\n\n // TODO Dispose\n ecModel.eachComponent('bmap', function (bmapModel) {\n var painter = api.getZr().painter;\n var viewportRoot = painter.getViewportRoot();\n if (typeof BMap === 'undefined') {\n throw new Error('BMap api is not loaded');\n }\n Overlay = Overlay || createOverlayCtor();\n if (bmapCoordSys) {\n throw new Error('Only one bmap component can exist');\n }\n if (!bmapModel.__bmap) {\n // Not support IE8\n var bmapRoot = root.querySelector('.ec-extension-bmap');\n if (bmapRoot) {\n // Reset viewport left and top, which will be changed\n // in moving handler in BMapView\n viewportRoot.style.left = '0px';\n viewportRoot.style.top = '0px';\n root.removeChild(bmapRoot);\n }\n bmapRoot = document.createElement('div');\n bmapRoot.style.cssText = 'width:100%;height:100%';\n // Not support IE8\n bmapRoot.classList.add('ec-extension-bmap');\n root.appendChild(bmapRoot);\n var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);\n\n var overlay = new Overlay(viewportRoot);\n bmap.addOverlay(overlay);\n\n // Override\n painter.getViewportRootOffset = function () {\n return {offsetLeft: 0, offsetTop: 0};\n };\n }\n var bmap = bmapModel.__bmap;\n\n // Set bmap options\n // centerAndZoom before layout and render\n var center = bmapModel.get('center');\n var zoom = bmapModel.get('zoom');\n if (center && zoom) {\n var pt = new BMap.Point(center[0], center[1]);\n bmap.centerAndZoom(pt, zoom);\n }\n\n bmapCoordSys = new BMapCoordSys(bmap, api);\n bmapCoordSys.setMapOffset(bmapModel.__mapOffset || [0, 0]);\n bmapCoordSys.setZoom(zoom);\n bmapCoordSys.setCenter(center);\n\n bmapModel.coordinateSystem = bmapCoordSys;\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === 'bmap') {\n seriesModel.coordinateSystem = bmapCoordSys;\n }\n });\n};\n\nexport default BMapCoordSys;","import * as echarts from 'echarts';\n\nfunction v2Equal(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1];\n}\n\nexport default echarts.extendComponentModel({\n type: 'bmap',\n\n getBMap: function () {\n // __bmap is injected when creating BMapCoordSys\n return this.__bmap;\n },\n\n setCenterAndZoom: function (center, zoom) {\n this.option.center = center;\n this.option.zoom = zoom;\n },\n\n centerOrZoomChanged: function (center, zoom) {\n var option = this.option;\n return !(v2Equal(center, option.center) && zoom === option.zoom);\n },\n\n defaultOption: {\n\n center: [104.114129, 37.550339],\n\n zoom: 5,\n\n mapStyle: {},\n\n roam: false\n }\n});","import * as echarts from 'echarts';\n\nexport default echarts.extendComponentView({\n type: 'bmap',\n\n render: function (bMapModel, ecModel, api) {\n var rendering = true;\n\n var bmap = bMapModel.getBMap();\n var viewportRoot = api.getZr().painter.getViewportRoot();\n var coordSys = bMapModel.coordinateSystem;\n var moveHandler = function (type, target) {\n if (rendering) {\n return;\n }\n var offsetEl = viewportRoot.parentNode.parentNode.parentNode;\n var 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\n coordSys.setMapOffset(mapOffset);\n bMapModel.__mapOffset = mapOffset;\n\n api.dispatchAction({\n type: 'bmapRoam'\n });\n };\n\n function zoomEndHandler() {\n if (rendering) {\n return;\n }\n api.dispatchAction({\n type: 'bmapRoam'\n });\n }\n\n bmap.removeEventListener('moving', this._oldMoveHandler);\n // FIXME\n // Moveend may be triggered by centerAndZoom method when creating coordSys next time\n // bmap.removeEventListener('moveend', this._oldMoveHandler);\n bmap.removeEventListener('zoomend', this._oldZoomEndHandler);\n bmap.addEventListener('moving', moveHandler);\n // bmap.addEventListener('moveend', moveHandler);\n bmap.addEventListener('zoomend', zoomEndHandler);\n\n this._oldMoveHandler = moveHandler;\n this._oldZoomEndHandler = zoomEndHandler;\n\n var roam = bMapModel.get('roam');\n if (roam && roam !== 'scale') {\n bmap.enableDragging();\n }\n else {\n bmap.disableDragging();\n }\n if (roam && roam !== 'move') {\n bmap.enableScrollWheelZoom();\n bmap.enableDoubleClickZoom();\n bmap.enablePinchToZoom();\n }\n else {\n bmap.disableScrollWheelZoom();\n bmap.disableDoubleClickZoom();\n bmap.disablePinchToZoom();\n }\n\n var originalStyle = bMapModel.__mapStyle;\n\n var newMapStyle = bMapModel.get('mapStyle') || {};\n // FIXME, Not use JSON methods\n var mapStyleStr = JSON.stringify(newMapStyle);\n if (JSON.stringify(originalStyle) !== mapStyleStr) {\n // FIXME May have blank tile when dragging if setMapStyle\n if (Object.keys(newMapStyle).length) {\n bmap.setMapStyle(newMapStyle);\n }\n bMapModel.__mapStyle = JSON.parse(mapStyleStr);\n }\n\n rendering = false;\n }\n});","/**\n * BMap component extension\n */\n\nimport * as echarts from 'echarts';\nimport BMapCoordSys from './BMapCoordSys';\n\nimport './BMapModel';\nimport './BMapView';\n\necharts.registerCoordinateSystem('bmap', BMapCoordSys);\n\n// Action\necharts.registerAction({\n type: 'bmapRoam',\n event: 'bmapRoam',\n update: 'updateLayout'\n}, function (payload, ecModel) {\n ecModel.eachComponent('bmap', function (bMapModel) {\n var bmap = bMapModel.getBMap();\n var center = bmap.getCenter();\n bMapModel.setCenterAndZoom([center.lng, center.lat], bmap.getZoom());\n });\n});\n\nexport var version = '1.0.0';\n"],"names":["graphic","matrix","zrUtil","echarts.extendComponentModel","echarts.extendComponentView","echarts.registerCoordinateSystem","echarts.registerAction"],"mappings":";;;;;;AAAA;;AAEA,AAMA,SAAS,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE;IAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;;IAEzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;;IAEhB,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;CACpD;;AAED,YAAY,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;;AAEnD,YAAY,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,IAAI,EAAE;IAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;CACrB,CAAC;;AAEF,YAAY,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,MAAM,EAAE;IACjD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACvF,CAAC;;AAEF,YAAY,CAAC,SAAS,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;;;;;"}
\ No newline at end of file
{"version":3,"file":"bmap.js","sources":["../../extension/bmap/BMapCoordSys.js","../../extension/bmap/BMapModel.js","../../extension/bmap/BMapView.js","../../extension/bmap/bmap.js"],"sourcesContent":["/* global BMap */\n\nimport {\n util as zrUtil,\n graphic,\n matrix\n} from 'echarts';\n\nfunction BMapCoordSys(bmap, api) {\n this._bmap = bmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n\n this._api = api;\n\n this._projection = new BMap.MercatorProjection();\n}\n\nBMapCoordSys.prototype.dimensions = ['lng', 'lat'];\n\nBMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\n\nBMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));\n};\n\nBMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\n\nBMapCoordSys.prototype.getBMap = function () {\n return this._bmap;\n};\n\nBMapCoordSys.prototype.dataToPoint = function (data) {\n var point = new BMap.Point(data[0], data[1]);\n // TODO mercator projection is toooooooo slow\n // var mercatorPoint = this._projection.lngLatToPoint(point);\n\n // var width = this._api.getZr().getWidth();\n // var height = this._api.getZr().getHeight();\n // var divider = Math.pow(2, 18 - 10);\n // return [\n // Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),\n // Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)\n // ];\n var px = this._bmap.pointToOverlayPixel(point);\n var mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\n\nBMapCoordSys.prototype.pointToData = function (pt) {\n var mapOffset = this._mapOffset;\n var pt = this._bmap.overlayPixelToPoint({\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1]\n });\n return [pt.lng, pt.lat];\n};\n\nBMapCoordSys.prototype.getViewRect = function () {\n var api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\n\nBMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\n\nBMapCoordSys.prototype.prepareCustoms = function (data) {\n var rect = this.getViewRect();\n return {\n coordSys: {\n // The name exposed to user is always 'cartesian2d' but not 'grid'.\n type: 'bmap',\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([0, 1], function (dimIdx) {\n var val = dataItem[dimIdx];\n var halfSize = dataSize[dimIdx] / 2;\n var p1 = [];\n var 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 }, this);\n}\n\nvar Overlay;\n\n// For deciding which dimensions to use when creating list data\nBMapCoordSys.dimensions = BMapCoordSys.prototype.dimensions;\n\nfunction createOverlayCtor() {\n function Overlay(root) {\n this._root = root;\n }\n\n Overlay.prototype = new BMap.Overlay();\n /**\n * 初始化\n *\n * @param {BMap.Map} map\n * @override\n */\n Overlay.prototype.initialize = function (map) {\n map.getPanes().labelPane.appendChild(this._root);\n return this._root;\n };\n /**\n * @override\n */\n Overlay.prototype.draw = function () {};\n\n return Overlay;\n}\n\nBMapCoordSys.create = function (ecModel, api) {\n var bmapCoordSys;\n var root = api.getDom();\n\n // TODO Dispose\n ecModel.eachComponent('bmap', function (bmapModel) {\n var painter = api.getZr().painter;\n var viewportRoot = painter.getViewportRoot();\n if (typeof BMap === 'undefined') {\n throw new Error('BMap api is not loaded');\n }\n Overlay = Overlay || createOverlayCtor();\n if (bmapCoordSys) {\n throw new Error('Only one bmap component can exist');\n }\n if (!bmapModel.__bmap) {\n // Not support IE8\n var bmapRoot = root.querySelector('.ec-extension-bmap');\n if (bmapRoot) {\n // Reset viewport left and top, which will be changed\n // in moving handler in BMapView\n viewportRoot.style.left = '0px';\n viewportRoot.style.top = '0px';\n root.removeChild(bmapRoot);\n }\n bmapRoot = document.createElement('div');\n bmapRoot.style.cssText = 'width:100%;height:100%';\n // Not support IE8\n bmapRoot.classList.add('ec-extension-bmap');\n root.appendChild(bmapRoot);\n var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);\n\n var overlay = new Overlay(viewportRoot);\n bmap.addOverlay(overlay);\n\n // Override\n painter.getViewportRootOffset = function () {\n return {offsetLeft: 0, offsetTop: 0};\n };\n }\n var bmap = bmapModel.__bmap;\n\n // Set bmap options\n // centerAndZoom before layout and render\n var center = bmapModel.get('center');\n var zoom = bmapModel.get('zoom');\n if (center && zoom) {\n var pt = new BMap.Point(center[0], center[1]);\n bmap.centerAndZoom(pt, zoom);\n }\n\n bmapCoordSys = new BMapCoordSys(bmap, api);\n bmapCoordSys.setMapOffset(bmapModel.__mapOffset || [0, 0]);\n bmapCoordSys.setZoom(zoom);\n bmapCoordSys.setCenter(center);\n\n bmapModel.coordinateSystem = bmapCoordSys;\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === 'bmap') {\n seriesModel.coordinateSystem = bmapCoordSys;\n }\n });\n};\n\nexport default BMapCoordSys;","import * as echarts from 'echarts';\n\nfunction v2Equal(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1];\n}\n\nexport default echarts.extendComponentModel({\n type: 'bmap',\n\n getBMap: function () {\n // __bmap is injected when creating BMapCoordSys\n return this.__bmap;\n },\n\n setCenterAndZoom: function (center, zoom) {\n this.option.center = center;\n this.option.zoom = zoom;\n },\n\n centerOrZoomChanged: function (center, zoom) {\n var option = this.option;\n return !(v2Equal(center, option.center) && zoom === option.zoom);\n },\n\n defaultOption: {\n\n center: [104.114129, 37.550339],\n\n zoom: 5,\n\n mapStyle: {},\n\n roam: false\n }\n});","import * as echarts from 'echarts';\n\nexport default echarts.extendComponentView({\n type: 'bmap',\n\n render: function (bMapModel, ecModel, api) {\n var rendering = true;\n\n var bmap = bMapModel.getBMap();\n var viewportRoot = api.getZr().painter.getViewportRoot();\n var coordSys = bMapModel.coordinateSystem;\n var moveHandler = function (type, target) {\n if (rendering) {\n return;\n }\n var offsetEl = viewportRoot.parentNode.parentNode.parentNode;\n var 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\n coordSys.setMapOffset(mapOffset);\n bMapModel.__mapOffset = mapOffset;\n\n api.dispatchAction({\n type: 'bmapRoam'\n });\n };\n\n function zoomEndHandler() {\n if (rendering) {\n return;\n }\n api.dispatchAction({\n type: 'bmapRoam'\n });\n }\n\n bmap.removeEventListener('moving', this._oldMoveHandler);\n // FIXME\n // Moveend may be triggered by centerAndZoom method when creating coordSys next time\n // bmap.removeEventListener('moveend', this._oldMoveHandler);\n bmap.removeEventListener('zoomend', this._oldZoomEndHandler);\n bmap.addEventListener('moving', moveHandler);\n // bmap.addEventListener('moveend', moveHandler);\n bmap.addEventListener('zoomend', zoomEndHandler);\n\n this._oldMoveHandler = moveHandler;\n this._oldZoomEndHandler = zoomEndHandler;\n\n var roam = bMapModel.get('roam');\n if (roam && roam !== 'scale') {\n bmap.enableDragging();\n }\n else {\n bmap.disableDragging();\n }\n if (roam && roam !== 'move') {\n bmap.enableScrollWheelZoom();\n bmap.enableDoubleClickZoom();\n bmap.enablePinchToZoom();\n }\n else {\n bmap.disableScrollWheelZoom();\n bmap.disableDoubleClickZoom();\n bmap.disablePinchToZoom();\n }\n\n var originalStyle = bMapModel.__mapStyle;\n\n var newMapStyle = bMapModel.get('mapStyle') || {};\n // FIXME, Not use JSON methods\n var mapStyleStr = JSON.stringify(newMapStyle);\n if (JSON.stringify(originalStyle) !== mapStyleStr) {\n // FIXME May have blank tile when dragging if setMapStyle\n if (Object.keys(newMapStyle).length) {\n bmap.setMapStyle(newMapStyle);\n }\n bMapModel.__mapStyle = JSON.parse(mapStyleStr);\n }\n\n rendering = false;\n }\n});","/**\n * BMap component extension\n */\n\nimport * as echarts from 'echarts';\nimport BMapCoordSys from './BMapCoordSys';\n\nimport './BMapModel';\nimport './BMapView';\n\necharts.registerCoordinateSystem('bmap', BMapCoordSys);\n\n// Action\necharts.registerAction({\n type: 'bmapRoam',\n event: 'bmapRoam',\n update: 'updateLayout'\n}, function (payload, ecModel) {\n ecModel.eachComponent('bmap', function (bMapModel) {\n var bmap = bMapModel.getBMap();\n var center = bmap.getCenter();\n bMapModel.setCenterAndZoom([center.lng, center.lat], bmap.getZoom());\n });\n});\n\nexport var version = '1.0.0';\n"],"names":["graphic","matrix","zrUtil","echarts.extendComponentModel","echarts.extendComponentView","echarts.registerCoordinateSystem","echarts.registerAction"],"mappings":";;;;;;AAAA;;AAEA,AAMA,SAAS,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE;IAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;;IAEzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;;IAEhB,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;CACpD;;AAED,YAAY,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;;AAEnD,YAAY,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,IAAI,EAAE;IAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;CACrB,CAAC;;AAEF,YAAY,CAAC,SAAS,CAAC,SAAS,GAAG,UAAU,MAAM,EAAE;IACjD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa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,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;KACxE,CAAC,CAAC;CACN,CAAC,CAAC;;AAEH,AAAO,IAAI,OAAO,GAAG,OAAO;;;;;;;;"}
\ No newline at end of file
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(t.bmap={},t.echarts)}(this,function(t,e){"use strict";function o(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(t,o){return o=o||[0,0],e.util.map([0,1],function(e){var n=o[e],i=t[e]/2,a=[],r=[];return a[e]=n-i,r[e]=n+i,a[1-e]=r[1-e]=o[1-e],Math.abs(this.dataToPoint(a)[e]-this.dataToPoint(r)[e])},this)}function i(){function t(t){this._root=t}return t.prototype=new BMap.Overlay,t.prototype.initialize=function(t){return t.getPanes().labelPane.appendChild(this._root),this._root},t.prototype.draw=function(){},t}function a(t,e){return t&&e&&t[0]===e[0]&&t[1]===e[1]}o.prototype.dimensions=["lng","lat"],o.prototype.setZoom=function(t){this._zoom=t},o.prototype.setCenter=function(t){this._center=this._projection.lngLatToPoint(new BMap.Point(t[0],t[1]))},o.prototype.setMapOffset=function(t){this._mapOffset=t},o.prototype.getBMap=function(){return this._bmap},o.prototype.dataToPoint=function(t){var e=new BMap.Point(t[0],t[1]),o=this._bmap.pointToOverlayPixel(e),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},o.prototype.pointToData=function(t){var e=this._mapOffset;return[(t=this._bmap.overlayPixelToPoint({x:t[0]+e[0],y:t[1]+e[1]})).lng,t.lat]},o.prototype.getViewRect=function(){var t=this._api;return new e.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},o.prototype.getRoamTransform=function(){return e.matrix.create()},o.prototype.prepareCustoms=function(t){var o=this.getViewRect();return{coordSys:{type:"bmap",x:o.x,y:o.y,width:o.width,height:o.height},api:{coord:e.util.bind(this.dataToPoint,this),size:e.util.bind(n,this)}}};var r;o.dimensions=o.prototype.dimensions,o.create=function(t,e){var n,a=e.getDom();t.eachComponent("bmap",function(t){var p=e.getZr().painter,s=p.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(r=r||i(),n)throw new Error("Only one bmap component can exist");if(!t.__bmap){var m=a.querySelector(".ec-extension-bmap");m&&(s.style.left="0px",s.style.top="0px",a.removeChild(m)),(m=document.createElement("div")).style.cssText="width:100%;height:100%",m.classList.add("ec-extension-bmap"),a.appendChild(m);var c=t.__bmap=new BMap.Map(m),d=new r(s);c.addOverlay(d),p.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var c=t.__bmap,f=t.get("center"),l=t.get("zoom");if(f&&l){var h=new BMap.Point(f[0],f[1]);c.centerAndZoom(h,l)}(n=new o(c,e)).setMapOffset(t.__mapOffset||[0,0]),n.setZoom(l),n.setCenter(f),t.coordinateSystem=n}),t.eachSeries(function(t){"bmap"===t.get("coordinateSystem")&&(t.coordinateSystem=n)})},e.extendComponentModel({type:"bmap",getBMap:function(){return this.__bmap},setCenterAndZoom:function(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged:function(t,e){var o=this.option;return!(a(t,o.center)&&e===o.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},roam:!1}}),e.extendComponentView({type:"bmap",render:function(t,e,o){function n(){i||o.dispatchAction({type:"bmapRoam"})}var i=!0,a=t.getBMap(),r=o.getZr().painter.getViewportRoot(),p=t.coordinateSystem,s=function(e,n){if(!i){var a=r.parentNode.parentNode.parentNode,s=[-parseInt(a.style.left,10)||0,-parseInt(a.style.top,10)||0];r.style.left=s[0]+"px",r.style.top=s[1]+"px",p.setMapOffset(s),t.__mapOffset=s,o.dispatchAction({type:"bmapRoam"})}};a.removeEventListener("moving",this._oldMoveHandler),a.removeEventListener("zoomend",this._oldZoomEndHandler),a.addEventListener("moving",s),a.addEventListener("zoomend",n),this._oldMoveHandler=s,this._oldZoomEndHandler=n;var m=t.get("roam");m&&"scale"!==m?a.enableDragging():a.disableDragging(),m&&"move"!==m?(a.enableScrollWheelZoom(),a.enableDoubleClickZoom(),a.enablePinchToZoom()):(a.disableScrollWheelZoom(),a.disableDoubleClickZoom(),a.disablePinchToZoom());var c=t.__mapStyle,d=t.get("mapStyle")||{},f=JSON.stringify(d);JSON.stringify(c)!==f&&(Object.keys(d).length&&a.setMapStyle(d),t.__mapStyle=JSON.parse(f)),i=!1}}),e.registerCoordinateSystem("bmap",o),e.registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(t,e){e.eachComponent("bmap",function(t){var e=t.getBMap(),o=e.getCenter();t.setCenterAndZoom([o.lng,o.lat],e.getZoom())})});t.version="1.0.0",Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(t.bmap={},t.echarts)}(this,function(t,e){"use strict";function o(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(t,o){return o=o||[0,0],e.util.map([0,1],function(e){var n=o[e],i=t[e]/2,a=[],r=[];return a[e]=n-i,r[e]=n+i,a[1-e]=r[1-e]=o[1-e],Math.abs(this.dataToPoint(a)[e]-this.dataToPoint(r)[e])},this)}function i(){function t(t){this._root=t}return t.prototype=new BMap.Overlay,t.prototype.initialize=function(t){return t.getPanes().labelPane.appendChild(this._root),this._root},t.prototype.draw=function(){},t}function a(t,e){return t&&e&&t[0]===e[0]&&t[1]===e[1]}o.prototype.dimensions=["lng","lat"],o.prototype.setZoom=function(t){this._zoom=t},o.prototype.setCenter=function(t){this._center=this._projection.lngLatToPoint(new BMap.Point(t[0],t[1]))},o.prototype.setMapOffset=function(t){this._mapOffset=t},o.prototype.getBMap=function(){return this._bmap},o.prototype.dataToPoint=function(t){var e=new BMap.Point(t[0],t[1]),o=this._bmap.pointToOverlayPixel(e),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},o.prototype.pointToData=function(t){var e=this._mapOffset;return[(t=this._bmap.overlayPixelToPoint({x:t[0]+e[0],y:t[1]+e[1]})).lng,t.lat]},o.prototype.getViewRect=function(){var t=this._api;return new e.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},o.prototype.getRoamTransform=function(){return e.matrix.create()},o.prototype.prepareCustoms=function(t){var o=this.getViewRect();return{coordSys:{type:"bmap",x:o.x,y:o.y,width:o.width,height:o.height},api:{coord:e.util.bind(this.dataToPoint,this),size:e.util.bind(n,this)}}};var r;o.dimensions=o.prototype.dimensions,o.create=function(t,e){var n,a=e.getDom();t.eachComponent("bmap",function(t){var p=e.getZr().painter,s=p.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(r=r||i(),n)throw new Error("Only one bmap component can exist");if(!t.__bmap){var m=a.querySelector(".ec-extension-bmap");m&&(s.style.left="0px",s.style.top="0px",a.removeChild(m)),(m=document.createElement("div")).style.cssText="width:100%;height:100%",m.classList.add("ec-extension-bmap"),a.appendChild(m);var c=t.__bmap=new BMap.Map(m),d=new r(s);c.addOverlay(d),p.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}var c=t.__bmap,f=t.get("center"),l=t.get("zoom");if(f&&l){var h=new BMap.Point(f[0],f[1]);c.centerAndZoom(h,l)}(n=new o(c,e)).setMapOffset(t.__mapOffset||[0,0]),n.setZoom(l),n.setCenter(f),t.coordinateSystem=n}),t.eachSeries(function(t){"bmap"===t.get("coordinateSystem")&&(t.coordinateSystem=n)})},e.extendComponentModel({type:"bmap",getBMap:function(){return this.__bmap},setCenterAndZoom:function(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged:function(t,e){var o=this.option;return!(a(t,o.center)&&e===o.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},roam:!1}}),e.extendComponentView({type:"bmap",render:function(t,e,o){function n(){i||o.dispatchAction({type:"bmapRoam"})}var i=!0,a=t.getBMap(),r=o.getZr().painter.getViewportRoot(),p=t.coordinateSystem,s=function(e,n){if(!i){var a=r.parentNode.parentNode.parentNode,s=[-parseInt(a.style.left,10)||0,-parseInt(a.style.top,10)||0];r.style.left=s[0]+"px",r.style.top=s[1]+"px",p.setMapOffset(s),t.__mapOffset=s,o.dispatchAction({type:"bmapRoam"})}};a.removeEventListener("moving",this._oldMoveHandler),a.removeEventListener("zoomend",this._oldZoomEndHandler),a.addEventListener("moving",s),a.addEventListener("zoomend",n),this._oldMoveHandler=s,this._oldZoomEndHandler=n;var m=t.get("roam");m&&"scale"!==m?a.enableDragging():a.disableDragging(),m&&"move"!==m?(a.enableScrollWheelZoom(),a.enableDoubleClickZoom(),a.enablePinchToZoom()):(a.disableScrollWheelZoom(),a.disableDoubleClickZoom(),a.disablePinchToZoom());var c=t.__mapStyle,d=t.get("mapStyle")||{},f=JSON.stringify(d);JSON.stringify(c)!==f&&(Object.keys(d).length&&a.setMapStyle(d),t.__mapStyle=JSON.parse(f)),i=!1}}),e.registerCoordinateSystem("bmap",o),e.registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(t,e){e.eachComponent("bmap",function(t){var e=t.getBMap(),o=e.getCenter();t.setCenterAndZoom([o.lng,o.lat],e.getZoom())})});t.version="1.0.0"});
......@@ -324,7 +324,5 @@ exports.version = version;
exports.gexf = gexf;
exports.prepareBoxplotData = prepareBoxplotData;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=dataTool.js.map
{"version":3,"file":"dataTool.js","sources":["../../extension/dataTool/gexf.js","../../extension/dataTool/quantile.js","../../extension/dataTool/prepareBoxplotData.js","../../extension/dataTool/index.js"],"sourcesContent":["// GEXF File Parser\n// http://gexf.net/1.2draft/gexf-12draft-primer.pdf\n\nimport {util as zrUtil} from 'echarts';\n\nexport function parse(xml) {\n var doc;\n if (typeof xml === 'string') {\n var parser = new DOMParser();\n doc = parser.parseFromString(xml, 'text/xml');\n }\n else {\n doc = xml;\n }\n if (!doc || doc.getElementsByTagName('parsererror').length) {\n return null;\n }\n\n var gexfRoot = getChildByTagName(doc, 'gexf');\n\n if (!gexfRoot) {\n return null;\n }\n\n var graphRoot = getChildByTagName(gexfRoot, 'graph');\n\n var attributes = parseAttributes(getChildByTagName(graphRoot, 'attributes'));\n var attributesMap = {};\n for (var i = 0; i < attributes.length; i++) {\n attributesMap[attributes[i].id] = attributes[i];\n }\n\n return {\n nodes: parseNodes(getChildByTagName(graphRoot, 'nodes'), attributesMap),\n links: parseEdges(getChildByTagName(graphRoot, 'edges'))\n };\n}\n\nfunction parseAttributes(parent) {\n return parent ? zrUtil.map(getChildrenByTagName(parent, 'attribute'), function (attribDom) {\n return {\n id: getAttr(attribDom, 'id'),\n title: getAttr(attribDom, 'title'),\n type: getAttr(attribDom, 'type')\n };\n }) : [];\n}\n\nfunction parseNodes(parent, attributesMap) {\n return parent ? zrUtil.map(getChildrenByTagName(parent, 'node'), function (nodeDom) {\n\n var id = getAttr(nodeDom, 'id');\n var label = getAttr(nodeDom, 'label');\n\n var node = {\n id: id,\n name: label,\n itemStyle: {\n normal: {}\n }\n };\n\n var vizSizeDom = getChildByTagName(nodeDom, 'viz:size');\n var vizPosDom = getChildByTagName(nodeDom, 'viz:position');\n var vizColorDom = getChildByTagName(nodeDom, 'viz:color');\n // var vizShapeDom = getChildByTagName(nodeDom, 'viz:shape');\n\n var attvaluesDom = getChildByTagName(nodeDom, 'attvalues');\n\n if (vizSizeDom) {\n node.symbolSize = parseFloat(getAttr(vizSizeDom, 'value'));\n }\n if (vizPosDom) {\n node.x = parseFloat(getAttr(vizPosDom, 'x'));\n node.y = parseFloat(getAttr(vizPosDom, 'y'));\n // z\n }\n if (vizColorDom) {\n node.itemStyle.normal.color = 'rgb(' +[\n getAttr(vizColorDom, 'r') | 0,\n getAttr(vizColorDom, 'g') | 0,\n getAttr(vizColorDom, 'b') | 0\n ].join(',') + ')';\n }\n // if (vizShapeDom) {\n // node.shape = getAttr(vizShapeDom, 'shape');\n // }\n if (attvaluesDom) {\n var attvalueDomList = getChildrenByTagName(attvaluesDom, 'attvalue');\n\n node.attributes = {};\n\n for (var j = 0; j < attvalueDomList.length; j++) {\n var attvalueDom = attvalueDomList[j];\n var attId = getAttr(attvalueDom, 'for');\n var attValue = getAttr(attvalueDom, 'value');\n var attribute = attributesMap[attId];\n\n if (attribute) {\n switch (attribute.type) {\n case 'integer':\n case 'long':\n attValue = parseInt(attValue, 10);\n break;\n case 'float':\n case 'double':\n attValue = parseFloat(attValue);\n break;\n case 'boolean':\n attValue = attValue.toLowerCase() == 'true';\n break;\n default:\n }\n node.attributes[attId] = attValue;\n }\n }\n }\n\n return node;\n }) : [];\n}\n\nfunction parseEdges(parent) {\n return parent ? zrUtil.map(getChildrenByTagName(parent, 'edge'), function (edgeDom) {\n var id = getAttr(edgeDom, 'id');\n var label = getAttr(edgeDom, 'label');\n\n var sourceId = getAttr(edgeDom, 'source');\n var targetId = getAttr(edgeDom, 'target');\n\n var edge = {\n id: id,\n name: label,\n source: sourceId,\n target: targetId,\n lineStyle: {\n normal: {}\n }\n };\n\n var lineStyle = edge.lineStyle.normal;\n\n var vizThicknessDom = getChildByTagName(edgeDom, 'viz:thickness');\n var vizColorDom = getChildByTagName(edgeDom, 'viz:color');\n // var vizShapeDom = getChildByTagName(edgeDom, 'viz:shape');\n\n if (vizThicknessDom) {\n lineStyle.width = parseFloat(vizThicknessDom.getAttribute('value'));\n }\n if (vizColorDom) {\n lineStyle.color = 'rgb(' + [\n getAttr(vizColorDom, 'r') | 0,\n getAttr(vizColorDom, 'g') | 0,\n getAttr(vizColorDom, 'b') | 0\n ].join(',') + ')';\n }\n // if (vizShapeDom) {\n // edge.shape = vizShapeDom.getAttribute('shape');\n // }\n\n return edge;\n }) : [];\n}\n\nfunction getAttr(el, attrName) {\n return el.getAttribute(attrName);\n}\n\nfunction getChildByTagName (parent, tagName) {\n var node = parent.firstChild;\n\n while (node) {\n if (\n node.nodeType != 1 ||\n node.nodeName.toLowerCase() != tagName.toLowerCase()\n ) {\n node = node.nextSibling;\n } else {\n return node;\n }\n }\n\n return null;\n}\n\nfunction getChildrenByTagName (parent, tagName) {\n var node = parent.firstChild;\n var children = [];\n while (node) {\n if (node.nodeName.toLowerCase() == tagName.toLowerCase()) {\n children.push(node);\n }\n node = node.nextSibling;\n }\n\n return children;\n}\n","/**\n * Copyright (c) 2010-2015, Michael Bostock\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * * The name Michael Bostock may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @see <https://github.com/mbostock/d3/blob/master/src/arrays/quantile.js>\n * @see <http://en.wikipedia.org/wiki/Quantile>\n * @param {Array.<number>} ascArr\n */\nexport default function(ascArr, p) {\n var H = (ascArr.length - 1) * p + 1,\n h = Math.floor(H),\n v = +ascArr[h - 1],\n e = H - h;\n return e ? v + e * (ascArr[h] - v) : v;\n}\n","import quantile from './quantile';\nimport {number as numberUtil} from 'echarts';\n\n/**\n * See:\n * <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>\n * <http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html>\n *\n * Helper method for preparing data.\n *\n * @param {Array.<number>} rawData like\n * [\n * [12,232,443], (raw data set for the first box)\n * [3843,5545,1232], (raw datat set for the second box)\n * ...\n * ]\n * @param {Object} [opt]\n *\n * @param {(number|string)} [opt.boundIQR=1.5] Data less than min bound is outlier.\n * default 1.5, means Q1 - 1.5 * (Q3 - Q1).\n * If 'none'/0 passed, min bound will not be used.\n * @param {(number|string)} [opt.layout='horizontal']\n * Box plot layout, can be 'horizontal' or 'vertical'\n * @return {Object} {\n * boxData: Array.<Array.<number>>\n * outliers: Array.<Array.<number>>\n * axisData: Array.<string>\n * }\n */\nexport default function (rawData, opt) {\n opt = opt || [];\n var boxData = [];\n var outliers = [];\n var axisData = [];\n var boundIQR = opt.boundIQR;\n var useExtreme = boundIQR === 'none' || boundIQR === 0;\n\n for (var i = 0; i < rawData.length; i++) {\n axisData.push(i + '');\n var ascList = numberUtil.asc(rawData[i].slice());\n\n var Q1 = quantile(ascList, 0.25);\n var Q2 = quantile(ascList, 0.5);\n var Q3 = quantile(ascList, 0.75);\n var min = ascList[0];\n var max = ascList[ascList.length - 1];\n\n var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);\n\n var low = useExtreme\n ? min\n : Math.max(min, Q1 - bound);\n var high = useExtreme\n ? max\n : Math.min(max, Q3 + bound);\n\n boxData.push([low, Q1, Q2, Q3, high]);\n\n for (var j = 0; j < ascList.length; j++) {\n var dataItem = ascList[j];\n if (dataItem < low || dataItem > high) {\n var outlier = [i, dataItem];\n opt.layout === 'vertical' && outlier.reverse();\n outliers.push(outlier);\n }\n }\n }\n return {\n boxData: boxData,\n outliers: outliers,\n axisData: axisData\n };\n}\n","import * as gexf from './gexf';\nimport prepareBoxplotData from './prepareBoxplotData';\n\nexport var version = '1.0.0';\n\nexport {gexf};\n\nexport {prepareBoxplotData};\n"],"names":["zrUtil","numberUtil"],"mappings":";;;;;;AAAA;;;AAGA,AAEO,SAAS,KAAK,CAAC,GAAG,EAAE;IACvB,IAAI,GAAG,CAAC;IACR,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QACzB,IAAI,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC7B,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;KACjD;SACI;QACD,GAAG,GAAG,GAAG,CAAC;KACb;IACD,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE;QACxD,OAAO,IAAI,CAAC;KACf;;IAED,IAAI,QAAQ,GAAG,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;;IAE9C,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO,IAAI,CAAC;KACf;;IAED,IAAI,SAAS,GAAG,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;;IAErD,IAAI,UAAU,GAAG,eAAe,CAAC,iBAAiB,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;IAC7E,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;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AO,EAAE,OAAO;QAChB,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,QAAQ;KACrB,CAAC;CACL;;ACrEM,IAAI,OAAO,GAAG,OAAO;;;;;;;;;;;;;;"}
\ No newline at end of file
{"version":3,"file":"dataTool.js","sources":["../../extension/dataTool/gexf.js","../../extension/dataTool/quantile.js","../../extension/dataTool/prepareBoxplotData.js","../../extension/dataTool/index.js"],"sourcesContent":["// GEXF File Parser\n// http://gexf.net/1.2draft/gexf-12draft-primer.pdf\n\nimport {util as zrUtil} from 'echarts';\n\nexport function parse(xml) {\n var doc;\n if (typeof xml === 'string') {\n var parser = new DOMParser();\n doc = parser.parseFromString(xml, 'text/xml');\n }\n else {\n doc = xml;\n }\n if (!doc || doc.getElementsByTagName('parsererror').length) {\n return null;\n }\n\n var gexfRoot = getChildByTagName(doc, 'gexf');\n\n if (!gexfRoot) {\n return null;\n }\n\n var graphRoot = getChildByTagName(gexfRoot, 'graph');\n\n var attributes = parseAttributes(getChildByTagName(graphRoot, 'attributes'));\n var attributesMap = {};\n for (var i = 0; i < attributes.length; i++) {\n attributesMap[attributes[i].id] = attributes[i];\n }\n\n return {\n nodes: parseNodes(getChildByTagName(graphRoot, 'nodes'), attributesMap),\n links: parseEdges(getChildByTagName(graphRoot, 'edges'))\n };\n}\n\nfunction parseAttributes(parent) {\n return parent ? zrUtil.map(getChildrenByTagName(parent, 'attribute'), function (attribDom) {\n return {\n id: getAttr(attribDom, 'id'),\n title: getAttr(attribDom, 'title'),\n type: getAttr(attribDom, 'type')\n };\n }) : [];\n}\n\nfunction parseNodes(parent, attributesMap) {\n return parent ? zrUtil.map(getChildrenByTagName(parent, 'node'), function (nodeDom) {\n\n var id = getAttr(nodeDom, 'id');\n var label = getAttr(nodeDom, 'label');\n\n var node = {\n id: id,\n name: label,\n itemStyle: {\n normal: {}\n }\n };\n\n var vizSizeDom = getChildByTagName(nodeDom, 'viz:size');\n var vizPosDom = getChildByTagName(nodeDom, 'viz:position');\n var vizColorDom = getChildByTagName(nodeDom, 'viz:color');\n // var vizShapeDom = getChildByTagName(nodeDom, 'viz:shape');\n\n var attvaluesDom = getChildByTagName(nodeDom, 'attvalues');\n\n if (vizSizeDom) {\n node.symbolSize = parseFloat(getAttr(vizSizeDom, 'value'));\n }\n if (vizPosDom) {\n node.x = parseFloat(getAttr(vizPosDom, 'x'));\n node.y = parseFloat(getAttr(vizPosDom, 'y'));\n // z\n }\n if (vizColorDom) {\n node.itemStyle.normal.color = 'rgb(' +[\n getAttr(vizColorDom, 'r') | 0,\n getAttr(vizColorDom, 'g') | 0,\n getAttr(vizColorDom, 'b') | 0\n ].join(',') + ')';\n }\n // if (vizShapeDom) {\n // node.shape = getAttr(vizShapeDom, 'shape');\n // }\n if (attvaluesDom) {\n var attvalueDomList = getChildrenByTagName(attvaluesDom, 'attvalue');\n\n node.attributes = {};\n\n for (var j = 0; j < attvalueDomList.length; j++) {\n var attvalueDom = attvalueDomList[j];\n var attId = getAttr(attvalueDom, 'for');\n var attValue = getAttr(attvalueDom, 'value');\n var attribute = attributesMap[attId];\n\n if (attribute) {\n switch (attribute.type) {\n case 'integer':\n case 'long':\n attValue = parseInt(attValue, 10);\n break;\n case 'float':\n case 'double':\n attValue = parseFloat(attValue);\n break;\n case 'boolean':\n attValue = attValue.toLowerCase() == 'true';\n break;\n default:\n }\n node.attributes[attId] = attValue;\n }\n }\n }\n\n return node;\n }) : [];\n}\n\nfunction parseEdges(parent) {\n return parent ? zrUtil.map(getChildrenByTagName(parent, 'edge'), function (edgeDom) {\n var id = getAttr(edgeDom, 'id');\n var label = getAttr(edgeDom, 'label');\n\n var sourceId = getAttr(edgeDom, 'source');\n var targetId = getAttr(edgeDom, 'target');\n\n var edge = {\n id: id,\n name: label,\n source: sourceId,\n target: targetId,\n lineStyle: {\n normal: {}\n }\n };\n\n var lineStyle = edge.lineStyle.normal;\n\n var vizThicknessDom = getChildByTagName(edgeDom, 'viz:thickness');\n var vizColorDom = getChildByTagName(edgeDom, 'viz:color');\n // var vizShapeDom = getChildByTagName(edgeDom, 'viz:shape');\n\n if (vizThicknessDom) {\n lineStyle.width = parseFloat(vizThicknessDom.getAttribute('value'));\n }\n if (vizColorDom) {\n lineStyle.color = 'rgb(' + [\n getAttr(vizColorDom, 'r') | 0,\n getAttr(vizColorDom, 'g') | 0,\n getAttr(vizColorDom, 'b') | 0\n ].join(',') + ')';\n }\n // if (vizShapeDom) {\n // edge.shape = vizShapeDom.getAttribute('shape');\n // }\n\n return edge;\n }) : [];\n}\n\nfunction getAttr(el, attrName) {\n return el.getAttribute(attrName);\n}\n\nfunction getChildByTagName (parent, tagName) {\n var node = parent.firstChild;\n\n while (node) {\n if (\n node.nodeType != 1 ||\n node.nodeName.toLowerCase() != tagName.toLowerCase()\n ) {\n node = node.nextSibling;\n } else {\n return node;\n }\n }\n\n return null;\n}\n\nfunction getChildrenByTagName (parent, tagName) {\n var node = parent.firstChild;\n var children = [];\n while (node) {\n if (node.nodeName.toLowerCase() == tagName.toLowerCase()) {\n children.push(node);\n }\n node = node.nextSibling;\n }\n\n return children;\n}\n","/**\n * Copyright (c) 2010-2015, Michael Bostock\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * * The name Michael Bostock may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,\n * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,\n * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/**\n * @see <https://github.com/mbostock/d3/blob/master/src/arrays/quantile.js>\n * @see <http://en.wikipedia.org/wiki/Quantile>\n * @param {Array.<number>} ascArr\n */\nexport default function(ascArr, p) {\n var H = (ascArr.length - 1) * p + 1,\n h = Math.floor(H),\n v = +ascArr[h - 1],\n e = H - h;\n return e ? v + e * (ascArr[h] - v) : v;\n}\n","import quantile from './quantile';\nimport {number as numberUtil} from 'echarts';\n\n/**\n * See:\n * <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>\n * <http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html>\n *\n * Helper method for preparing data.\n *\n * @param {Array.<number>} rawData like\n * [\n * [12,232,443], (raw data set for the first box)\n * [3843,5545,1232], (raw datat set for the second box)\n * ...\n * ]\n * @param {Object} [opt]\n *\n * @param {(number|string)} [opt.boundIQR=1.5] Data less than min bound is outlier.\n * default 1.5, means Q1 - 1.5 * (Q3 - Q1).\n * If 'none'/0 passed, min bound will not be used.\n * @param {(number|string)} [opt.layout='horizontal']\n * Box plot layout, can be 'horizontal' or 'vertical'\n * @return {Object} {\n * boxData: Array.<Array.<number>>\n * outliers: Array.<Array.<number>>\n * axisData: Array.<string>\n * }\n */\nexport default function (rawData, opt) {\n opt = opt || [];\n var boxData = [];\n var outliers = [];\n var axisData = [];\n var boundIQR = opt.boundIQR;\n var useExtreme = boundIQR === 'none' || boundIQR === 0;\n\n for (var i = 0; i < rawData.length; i++) {\n axisData.push(i + '');\n var ascList = numberUtil.asc(rawData[i].slice());\n\n var Q1 = quantile(ascList, 0.25);\n var Q2 = quantile(ascList, 0.5);\n var Q3 = quantile(ascList, 0.75);\n var min = ascList[0];\n var max = ascList[ascList.length - 1];\n\n var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);\n\n var low = useExtreme\n ? min\n : Math.max(min, Q1 - bound);\n var high = useExtreme\n ? max\n : Math.min(max, Q3 + bound);\n\n boxData.push([low, Q1, Q2, Q3, high]);\n\n for (var j = 0; j < ascList.length; j++) {\n var dataItem = ascList[j];\n if (dataItem < low || dataItem > high) {\n var outlier = [i, dataItem];\n opt.layout === 'vertical' && outlier.reverse();\n outliers.push(outlier);\n }\n }\n }\n return {\n boxData: boxData,\n outliers: outliers,\n axisData: axisData\n };\n}\n","import * as gexf from './gexf';\nimport prepareBoxplotData from './prepareBoxplotData';\n\nexport var version = '1.0.0';\n\nexport {gexf};\n\nexport {prepareBoxplotData};\n"],"names":["zrUtil","numberUtil"],"mappings":";;;;;;AAAA;;;AAGA,AAEO,SAAS,KAAK,CAAC,GAAG,EAAE;IACvB,IAAI,GAAG,CAAC;IACR,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QACzB,IAAI,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC7B,GAAG,GAAG,MAAM,CAAC,eAAe,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;KACjD;SACI;QACD,GAAG,GAAG,GAAG,CAAC;KACb;IACD,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE;QACxD,OAAO,IAAI,CAAC;KACf;;IAED,IAAI,QAAQ,GAAG,iBAAiB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;;IAE9C,IAAI,CAAC,QAAQ,EAAE;QACX,OAAO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EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACrC,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,QAAQ,GAAG,GAAG,IAAI,QAAQ,GAAG,IAAI,EAAE;gBACnC,IAAI,OAAO,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;gBAC5B,GAAG,CAAC,MAAM,KAAK,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC/C,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;aAC1B;SACJ;KACJ;IACD,OAAO;QACH,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,QAAQ;QAClB,QAAQ,EAAE,QAAQ;KACrB,CAAC;CACL;;ACrEM,IAAI,OAAO,GAAG,OAAO;;;;;;;;;;"}
\ No newline at end of file
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],t):t(e.dataTool={},e.echarts)}(this,function(e,t){"use strict";function r(e){return e?t.util.map(l(e,"attribute"),function(e){return{id:o(e,"id"),title:o(e,"title"),type:o(e,"type")}}):[]}function n(e,r){return e?t.util.map(l(e,"node"),function(e){var t={id:o(e,"id"),name:o(e,"label"),itemStyle:{normal:{}}},n=i(e,"viz:size"),a=i(e,"viz:position"),u=i(e,"viz:color"),s=i(e,"attvalues");if(n&&(t.symbolSize=parseFloat(o(n,"value"))),a&&(t.x=parseFloat(o(a,"x")),t.y=parseFloat(o(a,"y"))),u&&(t.itemStyle.normal.color="rgb("+[0|o(u,"r"),0|o(u,"g"),0|o(u,"b")].join(",")+")"),s){var f=l(s,"attvalue");t.attributes={};for(var c=0;c<f.length;c++){var p=f[c],v=o(p,"for"),d=o(p,"value"),g=r[v];if(g){switch(g.type){case"integer":case"long":d=parseInt(d,10);break;case"float":case"double":d=parseFloat(d);break;case"boolean":d="true"==d.toLowerCase()}t.attributes[v]=d}}}return t}):[]}function a(e){return e?t.util.map(l(e,"edge"),function(e){var t={id:o(e,"id"),name:o(e,"label"),source:o(e,"source"),target:o(e,"target"),lineStyle:{normal:{}}},r=t.lineStyle.normal,n=i(e,"viz:thickness"),a=i(e,"viz:color");return n&&(r.width=parseFloat(n.getAttribute("value"))),a&&(r.color="rgb("+[0|o(a,"r"),0|o(a,"g"),0|o(a,"b")].join(",")+")"),t}):[]}function o(e,t){return e.getAttribute(t)}function i(e,t){for(var r=e.firstChild;r;){if(1==r.nodeType&&r.nodeName.toLowerCase()==t.toLowerCase())return r;r=r.nextSibling}return null}function l(e,t){for(var r=e.firstChild,n=[];r;)r.nodeName.toLowerCase()==t.toLowerCase()&&n.push(r),r=r.nextSibling;return n}var u=(Object.freeze||Object)({parse:function(e){var t;if(!(t="string"==typeof e?(new DOMParser).parseFromString(e,"text/xml"):e)||t.getElementsByTagName("parsererror").length)return null;var o=i(t,"gexf");if(!o)return null;for(var l=i(o,"graph"),u=r(i(l,"attributes")),s={},f=0;f<u.length;f++)s[u[f].id]=u[f];return{nodes:n(i(l,"nodes"),s),links:a(i(l,"edges"))}}}),s=function(e,t){var r=(e.length-1)*t+1,n=Math.floor(r),a=+e[n-1],o=r-n;return o?a+o*(e[n]-a):a};e.version="1.0.0",e.gexf=u,e.prepareBoxplotData=function(e,r){for(var n=[],a=[],o=[],i=(r=r||[]).boundIQR,l="none"===i||0===i,u=0;u<e.length;u++){o.push(u+"");var f=t.number.asc(e[u].slice()),c=s(f,.25),p=s(f,.5),v=s(f,.75),d=f[0],g=f[f.length-1],b=(null==i?1.5:i)*(v-c),h=l?d:Math.max(d,c-b),m=l?g:Math.min(g,v+b);n.push([h,c,p,v,m]);for(var y=0;y<f.length;y++){var x=f[y];if(x<h||x>m){var w=[u,x];"vertical"===r.layout&&w.reverse(),a.push(w)}}}return{boxData:n,outliers:a,axisData:o}},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.dataTool={},e.echarts)}(this,function(e,t){"use strict";function r(e){return e?t.util.map(l(e,"attribute"),function(e){return{id:o(e,"id"),title:o(e,"title"),type:o(e,"type")}}):[]}function n(e,r){return e?t.util.map(l(e,"node"),function(e){var t={id:o(e,"id"),name:o(e,"label"),itemStyle:{normal:{}}},n=i(e,"viz:size"),a=i(e,"viz:position"),u=i(e,"viz:color"),s=i(e,"attvalues");if(n&&(t.symbolSize=parseFloat(o(n,"value"))),a&&(t.x=parseFloat(o(a,"x")),t.y=parseFloat(o(a,"y"))),u&&(t.itemStyle.normal.color="rgb("+[0|o(u,"r"),0|o(u,"g"),0|o(u,"b")].join(",")+")"),s){var f=l(s,"attvalue");t.attributes={};for(var c=0;c<f.length;c++){var p=f[c],v=o(p,"for"),d=o(p,"value"),g=r[v];if(g){switch(g.type){case"integer":case"long":d=parseInt(d,10);break;case"float":case"double":d=parseFloat(d);break;case"boolean":d="true"==d.toLowerCase()}t.attributes[v]=d}}}return t}):[]}function a(e){return e?t.util.map(l(e,"edge"),function(e){var t={id:o(e,"id"),name:o(e,"label"),source:o(e,"source"),target:o(e,"target"),lineStyle:{normal:{}}},r=t.lineStyle.normal,n=i(e,"viz:thickness"),a=i(e,"viz:color");return n&&(r.width=parseFloat(n.getAttribute("value"))),a&&(r.color="rgb("+[0|o(a,"r"),0|o(a,"g"),0|o(a,"b")].join(",")+")"),t}):[]}function o(e,t){return e.getAttribute(t)}function i(e,t){for(var r=e.firstChild;r;){if(1==r.nodeType&&r.nodeName.toLowerCase()==t.toLowerCase())return r;r=r.nextSibling}return null}function l(e,t){for(var r=e.firstChild,n=[];r;)r.nodeName.toLowerCase()==t.toLowerCase()&&n.push(r),r=r.nextSibling;return n}var u=(Object.freeze||Object)({parse:function(e){var t;if(!(t="string"==typeof e?(new DOMParser).parseFromString(e,"text/xml"):e)||t.getElementsByTagName("parsererror").length)return null;var o=i(t,"gexf");if(!o)return null;for(var l=i(o,"graph"),u=r(i(l,"attributes")),s={},f=0;f<u.length;f++)s[u[f].id]=u[f];return{nodes:n(i(l,"nodes"),s),links:a(i(l,"edges"))}}}),s=function(e,t){var r=(e.length-1)*t+1,n=Math.floor(r),a=+e[n-1],o=r-n;return o?a+o*(e[n]-a):a};e.version="1.0.0",e.gexf=u,e.prepareBoxplotData=function(e,r){for(var n=[],a=[],o=[],i=(r=r||[]).boundIQR,l="none"===i||0===i,u=0;u<e.length;u++){o.push(u+"");var f=t.number.asc(e[u].slice()),c=s(f,.25),p=s(f,.5),v=s(f,.75),d=f[0],g=f[f.length-1],b=(null==i?1.5:i)*(v-c),h=l?d:Math.max(d,c-b),m=l?g:Math.min(g,v+b);n.push([h,c,p,v,m]);for(var y=0;y<f.length;y++){var x=f[y];if(x<h||x>m){var w=[u,x];"vertical"===r.layout&&w.reverse(),a.push(w)}}}return{boxData:n,outliers:a,axisData:o}}});
import './src/config';
export * from './src/echarts';
export * from './src/export';
import './src/chart/line';
import './src/chart/bar';
......
import './src/config';
export * from './src/echarts';
export * from './src/export';
// Import all charts and components
import './src/chart/line';
......@@ -50,3 +51,4 @@ import './src/component/timeline';
import './src/component/toolbox';
import 'zrender/src/vml/vml';
import 'zrender/src/svg/svg';
......@@ -30,7 +30,7 @@ var ThemeRiverSeries = SeriesModel.extend({
init: function (option) {
ThemeRiverSeries.superApply(this, 'init', arguments);
// Put this function here is for the sake of consistency of code
// Put this function here is for the sake of consistency of code style.
// Enable legend selection for each data item
// Use a function instead of direct access because data reference may changed
this.legendDataProvider = function () {
......
......@@ -6,7 +6,7 @@
import * as echarts from '../../echarts';
import {Polygon} from '../line/poly';
import * as graphic from '../../util/graphic';
import * as zrUtil from 'zrender/src/core/util';
import {bind, extend} from 'zrender/src/core/util';
import DataDiffer from '../../data/DataDiffer';
export default echarts.extendChartView({
......@@ -19,11 +19,6 @@ export default echarts.extendChartView({
render: function (seriesModel, ecModel, api) {
var data = seriesModel.getData();
var rawData = seriesModel.getRawData();
if (!data.count()) {
return;
}
var group = this.group;
......@@ -45,9 +40,10 @@ export default echarts.extendChartView({
var newLayersGroups = {};
dataDiffer.add(zrUtil.bind(zrUtil.curry(process, 'add'), this))
.update(zrUtil.bind(zrUtil.curry(process, 'update'), this))
.remove(zrUtil.bind(zrUtil.curry(process, 'remove'), this))
dataDiffer
.add(bind(process, this, 'add'))
.update(bind(process, this, 'update'))
.remove(bind(process, this, 'remove'))
.execute();
function process(status, idx, oldIdx) {
......@@ -69,7 +65,7 @@ export default echarts.extendChartView({
points0.push([x, y0]);
points1.push([x, y0 + y]);
color = rawData.getItemVisual(indices[j], 'color');
color = data.getItemVisual(indices[j], 'color');
}
var polygon;
......@@ -138,7 +134,7 @@ export default echarts.extendChartView({
textVerticalAlign: 'middle'
});
polygon.setStyle(zrUtil.extend({
polygon.setStyle(extend({
fill: color
}, itemStyleModel.getItemStyle(['color'])));
......
......@@ -3,16 +3,30 @@
* @author Deqing Li(annong035@gmail.com)
*/
import {createHashMap} from 'zrender/src/core/util';
export default function (ecModel) {
ecModel.eachSeriesByType('themeRiver', function (seriesModel) {
var data = seriesModel.getData();
var rawData = seriesModel.getRawData();
var colorList = seriesModel.get('color');
var idxMap = createHashMap();
data.each(function (idx) {
idxMap.set(data.getRawIndex(idx), idx);
});
data.each(function (index) {
var name = data.getName(index);
rawData.each(function (rawIndex) {
var name = rawData.getName(rawIndex);
var color = colorList[(seriesModel.nameMap.get(name) - 1) % colorList.length];
rawData.setItemVisual(index, 'color', color);
rawData.setItemVisual(rawIndex, 'color', color);
var idx = idxMap.get(rawIndex);
if (idx != null) {
data.setItemVisual(idx, 'color', color);
}
});
});
}
\ No newline at end of file
......@@ -15,21 +15,22 @@ var selector = {
lineY: getLineSelectors(1),
rect: {
point: function (itemLayout, selectors, area) {
return area.boundingRect.contain(itemLayout[0], itemLayout[1]);
return itemLayout && area.boundingRect.contain(itemLayout[0], itemLayout[1]);
},
rect: function (itemLayout, selectors, area) {
return area.boundingRect.intersect(itemLayout);
return itemLayout && area.boundingRect.intersect(itemLayout);
}
},
polygon: {
point: function (itemLayout, selectors, area) {
return area.boundingRect.contain(itemLayout[0], itemLayout[1])
return itemLayout
&& area.boundingRect.contain(itemLayout[0], itemLayout[1])
&& polygonContain.contain(area.range, itemLayout[0], itemLayout[1]);
},
rect: function (itemLayout, selectors, area) {
var points = area.range;
if (points.length <= 1) {
if (!itemLayout || points.length <= 1) {
return false;
}
......@@ -61,21 +62,25 @@ function getLineSelectors(xyIndex) {
return {
point: function (itemLayout, selectors, area) {
var range = area.range;
var p = itemLayout[xyIndex];
return inLineRange(p, range);
if (itemLayout) {
var range = area.range;
var p = itemLayout[xyIndex];
return inLineRange(p, range);
}
},
rect: function (itemLayout, selectors, area) {
var range = area.range;
var layoutRange = [
itemLayout[xy[xyIndex]],
itemLayout[xy[xyIndex]] + itemLayout[wh[xyIndex]]
];
layoutRange[1] < layoutRange[0] && layoutRange.reverse();
return inLineRange(layoutRange[0], range)
|| inLineRange(layoutRange[1], range)
|| inLineRange(range[0], layoutRange)
|| inLineRange(range[1], layoutRange);
if (itemLayout) {
var range = area.range;
var layoutRange = [
itemLayout[xy[xyIndex]],
itemLayout[xy[xyIndex]] + itemLayout[wh[xyIndex]]
];
layoutRange[1] < layoutRange[0] && layoutRange.reverse();
return inLineRange(layoutRange[0], range)
|| inLineRange(layoutRange[1], range)
|| inLineRange(range[0], layoutRange)
|| inLineRange(range[1], layoutRange);
}
}
};
}
......
......@@ -433,12 +433,8 @@ var DataZoomModel = echarts.extendComponentModel({
* @param {boolean} [ignoreUpdateRangeUsg=false]
*/
setRawRange: function (opt, ignoreUpdateRangeUsg) {
each(['start', 'end', 'startValue', 'endValue'], function (name) {
// If any of those prop is null/undefined, we should alos set
// them, because only one pair between start/end and
// startValue/endValue can work.
this.option[name] = opt[name];
}, this);
setOneSide(opt, this.option, 'start');
setOneSide(opt, this.option, 'end');
!ignoreUpdateRangeUsg && updateRangeUse(this, opt);
},
......@@ -514,6 +510,24 @@ var DataZoomModel = echarts.extendComponentModel({
});
// percentName: 'start' or 'end', valueName: 'startValue' or 'endValue'
function setOneSide(inputParams, option, percentName) {
var names = [percentName, percentName + 'Value'];
var hasValueIdx;
each(names, function (name, index) {
if (inputParams[name] != null) {
option[name] = inputParams[name];
hasValueIdx = index;
}
});
// If only 'start' or 'startValue' is set in inputParams and then assigned
// to option, the other one should be cleared in option. because only one
// pair between start/end and startValue/endValue can work.
if (hasValueIdx != null) {
option[names[1 - hasValueIdx]] = null;
}
}
function retrieveRaw(option) {
var ret = {};
each(
......
......@@ -12,8 +12,6 @@
import * as zrender from 'zrender/src/zrender';
import * as zrUtil from 'zrender/src/core/util';
import * as colorTool from 'zrender/src/tool/color';
import * as matrix from 'zrender/src/core/matrix';
import * as vector from 'zrender/src/core/vector';
import env from 'zrender/src/core/env';
import timsort from 'zrender/src/core/timsort';
import Eventful from 'zrender/src/mixin/Eventful';
......@@ -28,12 +26,9 @@ import ComponentView from './view/Component';
import ChartView from './view/Chart';
import * as graphic from './util/graphic';
import * as modelUtil from './util/model';
import * as numberUtil from './util/number';
import * as formatUtil from './util/format';
import {throttle} from './util/throttle';
import seriesColor from './visual/seriesColor';
import loadingDefault from './loading/default';
import * as ecHelper from './helper';
var each = zrUtil.each;
var parseClassType = ComponentModel.parseClassType;
......@@ -1981,31 +1976,6 @@ registerAction({
// Exports
// --------
export {zrender};
export {default as List} from './data/List';
export {default as Model} from './model/Model';
export {default as Axis} from './coord/Axis';
export {graphic};
export {numberUtil as number};
export {formatUtil as format};
export {throttle};
export {ecHelper as helper};
export {matrix};
export {vector};
export {colorTool as color};
var ecUtil = {};
each([
'map', 'each', 'filter', 'indexOf', 'inherits', 'reduce', 'filter',
'bind', 'curry', 'isArray', 'isString', 'isObject', 'isFunction',
'extend', 'defaults', 'clone', 'merge'
],
function (name) {
ecUtil[name] = zrUtil[name];
}
);
export {ecUtil as util};
export var registerMap;
export var getMap;
export var parseGeoJSON;
......
/**
* Do not mount those modules on 'src/echarts' for better tree shaking.
*/
import * as zrender from 'zrender/src/zrender';
import * as matrix from 'zrender/src/core/matrix';
import * as vector from 'zrender/src/core/vector';
import * as zrUtil from 'zrender/src/core/util';
import * as colorTool from 'zrender/src/tool/color';
import * as graphic from './util/graphic';
import * as numberUtil from './util/number';
import * as formatUtil from './util/format';
import {throttle} from './util/throttle';
import * as ecHelper from './helper';
export {zrender};
export {default as List} from './data/List';
export {default as Model} from './model/Model';
export {default as Axis} from './coord/Axis';
export {graphic};
export {numberUtil as number};
export {formatUtil as format};
export {throttle};
export {ecHelper as helper};
export {matrix};
export {vector};
export {colorTool as color};
var ecUtil = {};
zrUtil.each([
'map', 'each', 'filter', 'indexOf', 'inherits', 'reduce', 'filter',
'bind', 'curry', 'isArray', 'isString', 'isObject', 'isFunction',
'extend', 'defaults', 'clone', 'merge'
],
function (name) {
ecUtil[name] = zrUtil[name];
}
);
export {ecUtil as util};
......@@ -903,7 +903,14 @@
for (var i = 0; i < 10; i++) {
xAxisData.push('Class' + i);
data1.push((Math.random() * 2).toFixed(2));
if (i === 1) {
data1.push(null);
}
else {
data1.push((Math.random() * 2).toFixed(2));
}
data2.push(-Math.random().toFixed(2));
data3.push((Math.random() * 5).toFixed(2));
data4.push((Math.random() + 0.3).toFixed(2));
......
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="../dist/echarts.js"></script>
<script src="lib/facePrint.js"></script>
<script src="lib/jquery.min.js"></script>
<link rel="stylesheet" href="reset.css" />
</head>
<body>
<style>
h1 {
line-height: 60px;
background: #360;
text-align: center;
font-weight: bold;
color: #eee;
font-size: 14px;
margin: 0;
}
.chart {
height: 450px;
}
.by-dispatch-action {
padding: 5px;
}
</style>
<div class="by-dispatch-action">
by dispatchAction:
<button id="change-start-value">Change Start Value</button>
<button id="change-end-value">Change Start Value</button>
<button id="first-focus">First Focus</button>
</div>
<div id="main">
<div class="chart" id="chart"></div>
</div>
<script>
$.getJSON('./data/ec-star.json', function (data) {
$('#first-focus').on('click', firstFocus);
$('#change-start-value').on('click', changeStartValue);
$('#change-end-value').on('click', changeEndValue);
var myChart = echarts.init(document.getElementById('chart'));
var minStartValue = '2013-06-06';
var maxEndValue = '2017-10-17';
var currStartValue = '2017-01-01';
var currEndValue = maxEndValue;
var option = {
animationDurationUpdate: 3000,
tooltip: {
trigger: 'axis'
},
xAxis: [{
type: 'time',
boundaryGap: false,
axisLabel:{
textStyle:{
fontSize:14
}
},
splitLine: {
show: false,
lineStyle:{
color:'#f7f7f7'
}
}
}],
yAxis: [{
type: 'value',
name: 'Github Star',
nameGap: 30,
nameTextStyle: {
fontSize: 20
},
axisLabel: {
fontSize: 15
},
splitLine: {
show: true,
lineStyle:{
color:'#f7f7f7'
}
}
}],
grid: {
top: 120,
left: 30,
right: 30,
bottom: 50,
containLabel: true
},
dataZoom: [{
id: 'dz',
type: 'inside',
xAxisIndex: 0,
startValue: currStartValue,
endValue: currEndValue,
minValueSpan: 3600 * 24 * 1000 * 10
}, {
type: 'slider',
xAxisIndex: 0,
startValue: currStartValue,
endValue: currEndValue,
height: 20,
handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
handleSize: '90%',
minSpanValue: 3600 * 24 * 1000 * 10
}],
visualMap: {
show: false,
type: 'continuous',
seriesIndex: 0,
min: 0,
max: 23000
},
series: [{
type: 'line',
name: 'Star',
lineStyle: {
normal: {
width: 4
}
},
itemStyle: {
normal: {
borderColor: '#fff',
borderWidth: 2
}
},
showSymbol: false,
symbol: 'circle',
hoverAnimation: false,
symbolSize: 15,
sampling: 'average',
// smooth: true,
// symbol: 'none',
data: data
}]
};
myChart.setOption(option);
$(window).resize(function() {
myChart.resize();
})
// Control -------------------------
function changeStartValue(phase) {
currStartValue = '2014-09-01';
myChart.dispatchAction({
type: 'dataZoom',
id: 'dz',
startValue: currStartValue
});
}
function changeEndValue(phase) {
currEndValue = '2017-02-05';
myChart.dispatchAction({
type: 'dataZoom',
id: 'dz',
endValue: currEndValue
});
}
function firstFocus(phase) {
currStartValue = minStartValue;
currEndValue = '2013-11-06';
myChart.dispatchAction({
type: 'dataZoom',
id: 'dz',
startValue: currStartValue,
endValue: currEndValue
});
}
});
</script>
</body>
</html>
\ No newline at end of file
(function () {
var baseUrl = window.AMD_BASE_URL || '../';
var sourceMap = window.AMD_ENABLE_SOURCE_MAP;
// `true` by default for debugging.
sourceMap == null && (sourceMap = true);
if (typeof require !== 'undefined') {
require.config({
baseUrl: baseUrl,
paths: {
'echarts': 'dist/echarts',
'zrender': '../zrender/dist/zrender',
'zrender': 'node_modules/zrender/dist/zrender',
'geoJson': '../geoData/geoJson',
'theme': 'theme',
'data': 'test/data',
'map': 'map',
'extension': 'dist/extension'
},
urlArgs: '_v_=' + (+new Date())
}
// urlArgs will prevent break point on init in debug tool.
// urlArgs: '_v_=' + (+new Date())
});
}
......@@ -23,14 +27,15 @@
baseUrl: baseUrl,
paths: {
'echarts': './',
'zrender': '../zrender',
'zrender': 'node_modules/zrender',
'geoJson': 'geoData/geoJson',
'theme': 'theme',
'data': 'test/data',
'map': 'map',
'extension': 'extension'
},
urlArgs: '_v_=' + (+new Date())
// urlArgs: '_v_=' + (+new Date()),
sourceMap: sourceMap
});
}
......
......@@ -13,7 +13,8 @@
* packages: [
* {...}, ...
* ],
* urlArgs: +new Date()
* urlArgs: +new Date(),
* sourceMap: true // Enable sourceMap for debugging. `false` by default.
* });
*
* requireES([
......@@ -25,13 +26,11 @@
*
* [Caution]:
*
* 1) Modules are not shared between different
* calling of `simpleModuleLoader.load()`.
* 1) Modules are not shared between different calling of `requireES(...)`.
*
* 2) Whether import `*` or `default` is determined
* by module itself. That is, if the module only
* export `default` (like `xxx/SomeClz`), we import
* `default`, otherwise import `*` (like `xxx/util`).
* 2) Whether import `*` or `default` is determined by the module itself.
* That is, if the module (like `xxx/SomeClz`) only export `default` , it
* imports `default`, otherwise (like `xxx/util`) it imports `*`.
*/
/* global define, ActiveXObject */
......@@ -56,7 +55,10 @@
*
* @param {Object} cfg {
* @param {string} [cfg.baseUrl='.']
* @param {Object} [cfg.paths]
* @param {Object} [cfg.paths={}]
* @param {Array.<Object>} [cfg.packages=[]]
* @param {string} [cfg.urlArgs='']
* @param {boolean} [cfg.sourceMap=false]
*/
function amdConfig(cfg) {
if (cfg.baseUrl != null) {
......@@ -74,6 +76,9 @@
if (cfg.urlArgs != null) {
amdCfg.urlArgs = cfg.urlArgs;
}
if (cfg.sourceMap != null) {
amdCfg.sourceMap = cfg.sourceMap;
}
}
/**
......@@ -121,12 +126,21 @@
return bundle.generate({
format: 'iife',
legacy: true,
// But only bundle.write support generating inline source map.
sourcemap: 'inline',
name: TOP_MODULE_NAME
});
}).then(function (result) {
var code = result.code;
if (amdCfg.sourceMap) {
code = addSourceMap(code, result.map);
}
var modules = (new Function(
'var __DEV__ = true; '
+ result.code
+ code
+ '\n return ' + TOP_MODULE_NAME
))();
......@@ -296,6 +310,20 @@
return res;
}
function addSourceMap(code, map) {
// Use unescape(encodeURIComponent) to avoid the error on Chrome:
// Uncaught (in promise) DOMException: Failed to execute 'btoa' on 'Window':
// The string to be encoded contains characters outside of the Latin1 range
var dataURI = btoa(unescape(encodeURIComponent(map.toString()))); // jshint ignore:line
dataURI = 'data:application/json;charset=utf-8;base64,' + dataURI;
// Split the string to prevent sourcemap tooling from mistaking
// this for an actual sourceMappingURL.
code += '//# ' + 'sourceMa' + 'ppingURL' + '=' + dataURI + '\n';
return code;
}
function cwd() {
// Only support that works in browser.
return dir(location.pathname);
......
......@@ -2,6 +2,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- <script src="lib/esl.js"></script> -->
<script src="lib/esl.js"></script>
<script src="lib/config.js"></script>
<script src="lib/jquery.min.js"></script>
......@@ -19,10 +20,11 @@
require([
'echarts'
// 'echarts/chart/themeRiver',
// 'echarts/component/legend',
// 'echarts/component/singleAxis',
// 'echarts/component/tooltip',
// 'echarts/src/echarts',
// 'echarts/src/chart/themeRiver',
// 'echarts/src/component/legend',
// 'echarts/src/component/singleAxis',
// 'echarts/src/component/tooltip',
], function (echarts) {
var chart = echarts.init(document.getElementById('main'));
......
......@@ -14,6 +14,7 @@
<script src="../lib/requireES.js"></script>
<script>
window.AMD_BASE_URL = '../../';
window.AMD_ENABLE_SOURCE_MAP = false;
</script>
<script src="../lib/config.js"></script>
</head>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册