You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/07/27 13:31:35 UTC
[incubator-echarts] branch next-npm-env updated: chore: update
extension prepublish
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch next-npm-env
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/next-npm-env by this push:
new ad561df chore: update extension prepublish
ad561df is described below
commit ad561dfe5c4191fc80e854c873571ce528e7fb6e
Author: pissang <bm...@gmail.com>
AuthorDate: Mon Jul 27 21:30:55 2020 +0800
chore: update extension prepublish
---
.eslintignore | 6 +-
README.md | 2 +-
{extension => extension-src}/bmap/README.md | 0
extension-src/dataTool/prepareBoxplotData.ts | 23 ++-
extension/bmap/BMapCoordSys.js | 245 ---------------------------
extension/bmap/BMapModel.js | 68 --------
extension/bmap/BMapView.js | 143 ----------------
extension/bmap/bmap.js | 65 -------
extension/dataTool/gexf.js | 230 -------------------------
extension/dataTool/index.js | 61 -------
extension/dataTool/prepareBoxplotData.js | 107 ------------
extension/echarts.js | 20 ---
extension/webpack.config.js | 36 ----
13 files changed, 24 insertions(+), 982 deletions(-)
diff --git a/.eslintignore b/.eslintignore
index 6274b8a..8da5fc2 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,3 +1,7 @@
/dist
/node_modules
-/build
\ No newline at end of file
+/build
+/extension-esm
+/extension
+/lib
+/esm
\ No newline at end of file
diff --git a/README.md b/README.md
index b22abb4..ee6daca 100644
--- a/README.md
+++ b/README.md
@@ -94,7 +94,7 @@ If you wish to debug locally or make pull requests, please refer to [contributin
+ [Wordcloud 字符云](https://github.com/ecomfe/echarts-wordcloud)
-+ [Extension for Baidu Map 百度地图扩展](https://github.com/apache/incubator-echarts/tree/master/extension/bmap) An extension provides a wrapper of Baidu Map Service SDK.
++ [Extension for Baidu Map 百度地图扩展](https://github.com/apache/incubator-echarts/tree/master/extension-src/bmap) An extension provides a wrapper of Baidu Map Service SDK.
+ [vue-echarts](https://github.com/ecomfe/vue-echarts) ECharts component for Vue.js
diff --git a/extension/bmap/README.md b/extension-src/bmap/README.md
similarity index 100%
rename from extension/bmap/README.md
rename to extension-src/bmap/README.md
diff --git a/extension-src/dataTool/prepareBoxplotData.ts b/extension-src/dataTool/prepareBoxplotData.ts
index ac59a8e..b57575a 100644
--- a/extension-src/dataTool/prepareBoxplotData.ts
+++ b/extension-src/dataTool/prepareBoxplotData.ts
@@ -18,8 +18,21 @@
*/
// @ts-nocheck
-import * as numberUtil from '../../src/util/number';
+function asc<T extends number[]>(arr: T): T {
+ arr.sort(function (a, b) {
+ return a - b;
+ });
+ return arr;
+}
+
+function quantile(ascArr: number[], p: number): number {
+ const H = (ascArr.length - 1) * p + 1;
+ const h = Math.floor(H);
+ const v = +ascArr[h - 1];
+ const e = H - h;
+ return e ? v + e * (ascArr[h] - v) : v;
+}
/**
* See:
* <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>
@@ -56,11 +69,11 @@ export default function (rawData, opt) {
for (let i = 0; i < rawData.length; i++) {
axisData.push(i + '');
- const ascList = numberUtil.asc(rawData[i].slice());
+ const ascList = asc(rawData[i].slice());
- const Q1 = numberUtil.quantile(ascList, 0.25);
- const Q2 = numberUtil.quantile(ascList, 0.5);
- const Q3 = numberUtil.quantile(ascList, 0.75);
+ const Q1 = quantile(ascList, 0.25);
+ const Q2 = quantile(ascList, 0.5);
+ const Q3 = quantile(ascList, 0.75);
const min = ascList[0];
const max = ascList[ascList.length - 1];
diff --git a/extension/bmap/BMapCoordSys.js b/extension/bmap/BMapCoordSys.js
deleted file mode 100644
index 59378e1..0000000
--- a/extension/bmap/BMapCoordSys.js
+++ /dev/null
@@ -1,245 +0,0 @@
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-var _echarts = require("echarts");
-
-var zrUtil = _echarts.util;
-var graphic = _echarts.graphic;
-var matrix = _echarts.matrix;
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-/* global BMap */
-function BMapCoordSys(bmap, api) {
- this._bmap = bmap;
- this.dimensions = ['lng', 'lat'];
- this._mapOffset = [0, 0];
- this._api = api;
- this._projection = new BMap.MercatorProjection();
-}
-
-BMapCoordSys.prototype.dimensions = ['lng', 'lat'];
-
-BMapCoordSys.prototype.setZoom = function (zoom) {
- this._zoom = zoom;
-};
-
-BMapCoordSys.prototype.setCenter = function (center) {
- this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));
-};
-
-BMapCoordSys.prototype.setMapOffset = function (mapOffset) {
- this._mapOffset = mapOffset;
-};
-
-BMapCoordSys.prototype.getBMap = function () {
- return this._bmap;
-};
-
-BMapCoordSys.prototype.dataToPoint = function (data) {
- var point = new BMap.Point(data[0], data[1]); // TODO mercator projection is toooooooo slow
- // var mercatorPoint = this._projection.lngLatToPoint(point);
- // var width = this._api.getZr().getWidth();
- // var height = this._api.getZr().getHeight();
- // var divider = Math.pow(2, 18 - 10);
- // return [
- // Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),
- // Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)
- // ];
-
- var px = this._bmap.pointToOverlayPixel(point);
-
- var mapOffset = this._mapOffset;
- return [px.x - mapOffset[0], px.y - mapOffset[1]];
-};
-
-BMapCoordSys.prototype.pointToData = function (pt) {
- var mapOffset = this._mapOffset;
-
- var pt = this._bmap.overlayPixelToPoint({
- x: pt[0] + mapOffset[0],
- y: pt[1] + mapOffset[1]
- });
-
- return [pt.lng, pt.lat];
-};
-
-BMapCoordSys.prototype.getViewRect = function () {
- var api = this._api;
- return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());
-};
-
-BMapCoordSys.prototype.getRoamTransform = function () {
- return matrix.create();
-};
-
-BMapCoordSys.prototype.prepareCustoms = function (data) {
- var rect = this.getViewRect();
- return {
- coordSys: {
- // The name exposed to user is always 'cartesian2d' but not 'grid'.
- type: 'bmap',
- x: rect.x,
- y: rect.y,
- width: rect.width,
- height: rect.height
- },
- api: {
- coord: zrUtil.bind(this.dataToPoint, this),
- size: zrUtil.bind(dataToCoordSize, this)
- }
- };
-};
-
-function dataToCoordSize(dataSize, dataItem) {
- dataItem = dataItem || [0, 0];
- return zrUtil.map([0, 1], function (dimIdx) {
- var val = dataItem[dimIdx];
- var halfSize = dataSize[dimIdx] / 2;
- var p1 = [];
- var p2 = [];
- p1[dimIdx] = val - halfSize;
- p2[dimIdx] = val + halfSize;
- p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
- return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
- }, this);
-}
-
-var Overlay; // For deciding which dimensions to use when creating list data
-
-BMapCoordSys.dimensions = BMapCoordSys.prototype.dimensions;
-
-function createOverlayCtor() {
- function Overlay(root) {
- this._root = root;
- }
-
- Overlay.prototype = new BMap.Overlay();
- /**
- * 初始化
- *
- * @param {BMap.Map} map
- * @override
- */
-
- Overlay.prototype.initialize = function (map) {
- map.getPanes().labelPane.appendChild(this._root);
- return this._root;
- };
- /**
- * @override
- */
-
-
- Overlay.prototype.draw = function () {};
-
- return Overlay;
-}
-
-BMapCoordSys.create = function (ecModel, api) {
- var bmapCoordSys;
- var root = api.getDom(); // TODO Dispose
-
- ecModel.eachComponent('bmap', function (bmapModel) {
- var painter = api.getZr().painter;
- var viewportRoot = painter.getViewportRoot();
-
- if (typeof BMap === 'undefined') {
- throw new Error('BMap api is not loaded');
- }
-
- Overlay = Overlay || createOverlayCtor();
-
- if (bmapCoordSys) {
- throw new Error('Only one bmap component can exist');
- }
-
- if (!bmapModel.__bmap) {
- // Not support IE8
- var bmapRoot = root.querySelector('.ec-extension-bmap');
-
- if (bmapRoot) {
- // Reset viewport left and top, which will be changed
- // in moving handler in BMapView
- viewportRoot.style.left = '0px';
- viewportRoot.style.top = '0px';
- root.removeChild(bmapRoot);
- }
-
- bmapRoot = document.createElement('div');
- bmapRoot.style.cssText = 'width:100%;height:100%'; // Not support IE8
-
- bmapRoot.classList.add('ec-extension-bmap');
- root.appendChild(bmapRoot);
- var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);
- var overlay = new Overlay(viewportRoot);
- bmap.addOverlay(overlay); // Override
-
- painter.getViewportRootOffset = function () {
- return {
- offsetLeft: 0,
- offsetTop: 0
- };
- };
- }
-
- var bmap = bmapModel.__bmap; // Set bmap options
- // centerAndZoom before layout and render
-
- var center = bmapModel.get('center');
- var zoom = bmapModel.get('zoom');
-
- if (center && zoom) {
- var pt = new BMap.Point(center[0], center[1]);
- bmap.centerAndZoom(pt, zoom);
- }
-
- bmapCoordSys = new BMapCoordSys(bmap, api);
- bmapCoordSys.setMapOffset(bmapModel.__mapOffset || [0, 0]);
- bmapCoordSys.setZoom(zoom);
- bmapCoordSys.setCenter(center);
- bmapModel.coordinateSystem = bmapCoordSys;
- });
- ecModel.eachSeries(function (seriesModel) {
- if (seriesModel.get('coordinateSystem') === 'bmap') {
- seriesModel.coordinateSystem = bmapCoordSys;
- }
- });
-};
-
-var _default = BMapCoordSys;
-module.exports = _default;
\ No newline at end of file
diff --git a/extension/bmap/BMapModel.js b/extension/bmap/BMapModel.js
deleted file mode 100644
index e0cdf1b..0000000
--- a/extension/bmap/BMapModel.js
+++ /dev/null
@@ -1,68 +0,0 @@
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-var echarts = require("echarts");
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-function v2Equal(a, b) {
- return a && b && a[0] === b[0] && a[1] === b[1];
-}
-
-var _default = echarts.extendComponentModel({
- type: 'bmap',
- getBMap: function () {
- // __bmap is injected when creating BMapCoordSys
- return this.__bmap;
- },
- setCenterAndZoom: function (center, zoom) {
- this.option.center = center;
- this.option.zoom = zoom;
- },
- centerOrZoomChanged: function (center, zoom) {
- var option = this.option;
- return !(v2Equal(center, option.center) && zoom === option.zoom);
- },
- defaultOption: {
- center: [104.114129, 37.550339],
- zoom: 5,
- mapStyle: {},
- mapStyleV2: {},
- roam: false
- }
-});
-
-module.exports = _default;
\ No newline at end of file
diff --git a/extension/bmap/BMapView.js b/extension/bmap/BMapView.js
deleted file mode 100644
index 0ea19d8..0000000
--- a/extension/bmap/BMapView.js
+++ /dev/null
@@ -1,143 +0,0 @@
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-var echarts = require("echarts");
-
-var _util = require("zrender/lib/core/util");
-
-var clone = _util.clone;
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-var _default = echarts.extendComponentView({
- type: 'bmap',
- render: function (bMapModel, ecModel, api) {
- var rendering = true;
- var bmap = bMapModel.getBMap();
- var viewportRoot = api.getZr().painter.getViewportRoot();
- var coordSys = bMapModel.coordinateSystem;
-
- var moveHandler = function (type, target) {
- if (rendering) {
- return;
- }
-
- var offsetEl = viewportRoot.parentNode.parentNode.parentNode;
- var mapOffset = [-parseInt(offsetEl.style.left, 10) || 0, -parseInt(offsetEl.style.top, 10) || 0];
- viewportRoot.style.left = mapOffset[0] + 'px';
- viewportRoot.style.top = mapOffset[1] + 'px';
- coordSys.setMapOffset(mapOffset);
- bMapModel.__mapOffset = mapOffset;
- api.dispatchAction({
- type: 'bmapRoam'
- });
- };
-
- function zoomEndHandler() {
- if (rendering) {
- return;
- }
-
- api.dispatchAction({
- type: 'bmapRoam'
- });
- }
-
- bmap.removeEventListener('moving', this._oldMoveHandler); // FIXME
- // Moveend may be triggered by centerAndZoom method when creating coordSys next time
- // bmap.removeEventListener('moveend', this._oldMoveHandler);
-
- bmap.removeEventListener('zoomend', this._oldZoomEndHandler);
- bmap.addEventListener('moving', moveHandler); // bmap.addEventListener('moveend', moveHandler);
-
- bmap.addEventListener('zoomend', zoomEndHandler);
- this._oldMoveHandler = moveHandler;
- this._oldZoomEndHandler = zoomEndHandler;
- var roam = bMapModel.get('roam');
-
- if (roam && roam !== 'scale') {
- bmap.enableDragging();
- } else {
- bmap.disableDragging();
- }
-
- if (roam && roam !== 'move') {
- bmap.enableScrollWheelZoom();
- bmap.enableDoubleClickZoom();
- bmap.enablePinchToZoom();
- } else {
- bmap.disableScrollWheelZoom();
- bmap.disableDoubleClickZoom();
- bmap.disablePinchToZoom();
- }
- /* map 2.0 */
-
-
- var originalStyle = bMapModel.__mapStyle;
- var newMapStyle = bMapModel.get('mapStyle') || {}; // FIXME, Not use JSON methods
-
- var mapStyleStr = JSON.stringify(newMapStyle);
-
- if (JSON.stringify(originalStyle) !== mapStyleStr) {
- // FIXME May have blank tile when dragging if setMapStyle
- if (Object.keys(newMapStyle).length) {
- bmap.setMapStyle(clone(newMapStyle));
- }
-
- bMapModel.__mapStyle = JSON.parse(mapStyleStr);
- }
- /* map 3.0 */
-
-
- var originalStyle2 = bMapModel.__mapStyle2;
- var newMapStyle2 = bMapModel.get('mapStyleV2') || {}; // FIXME, Not use JSON methods
-
- var mapStyleStr2 = JSON.stringify(newMapStyle2);
-
- if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
- // FIXME May have blank tile when dragging if setMapStyle
- if (Object.keys(newMapStyle2).length) {
- bmap.setMapStyleV2(clone(newMapStyle2));
- }
-
- bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
- }
-
- rendering = false;
- }
-});
-
-module.exports = _default;
\ No newline at end of file
diff --git a/extension/bmap/bmap.js b/extension/bmap/bmap.js
deleted file mode 100644
index e727893..0000000
--- a/extension/bmap/bmap.js
+++ /dev/null
@@ -1,65 +0,0 @@
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-var echarts = require("echarts");
-
-var BMapCoordSys = require("./BMapCoordSys");
-
-require("./BMapModel");
-
-require("./BMapView");
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-/**
- * BMap component extension
- */
-echarts.registerCoordinateSystem('bmap', BMapCoordSys); // Action
-
-echarts.registerAction({
- type: 'bmapRoam',
- event: 'bmapRoam',
- update: 'updateLayout'
-}, function (payload, ecModel) {
- ecModel.eachComponent('bmap', function (bMapModel) {
- var bmap = bMapModel.getBMap();
- var center = bmap.getCenter();
- bMapModel.setCenterAndZoom([center.lng, center.lat], bmap.getZoom());
- });
-});
-var version = '1.0.0';
-exports.version = version;
\ No newline at end of file
diff --git a/extension/dataTool/gexf.js b/extension/dataTool/gexf.js
deleted file mode 100644
index 307362e..0000000
--- a/extension/dataTool/gexf.js
+++ /dev/null
@@ -1,230 +0,0 @@
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-var zrUtil = require("zrender/lib/core/util");
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-/**
- * This is a parse of GEXF.
- *
- * The spec of GEXF:
- * https://gephi.org/gexf/1.2draft/gexf-12draft-primer.pdf
- */
-function parse(xml) {
- var doc;
-
- if (typeof xml === 'string') {
- var parser = new DOMParser();
- doc = parser.parseFromString(xml, 'text/xml');
- } else {
- doc = xml;
- }
-
- if (!doc || doc.getElementsByTagName('parsererror').length) {
- return null;
- }
-
- var gexfRoot = getChildByTagName(doc, 'gexf');
-
- if (!gexfRoot) {
- return null;
- }
-
- var graphRoot = getChildByTagName(gexfRoot, 'graph');
- var attributes = parseAttributes(getChildByTagName(graphRoot, 'attributes'));
- var attributesMap = {};
-
- for (var i = 0; i < attributes.length; i++) {
- attributesMap[attributes[i].id] = attributes[i];
- }
-
- return {
- nodes: parseNodes(getChildByTagName(graphRoot, 'nodes'), attributesMap),
- links: parseEdges(getChildByTagName(graphRoot, 'edges'))
- };
-}
-
-function parseAttributes(parent) {
- return parent ? zrUtil.map(getChildrenByTagName(parent, 'attribute'), function (attribDom) {
- return {
- id: getAttr(attribDom, 'id'),
- title: getAttr(attribDom, 'title'),
- type: getAttr(attribDom, 'type')
- };
- }) : [];
-}
-
-function parseNodes(parent, attributesMap) {
- return parent ? zrUtil.map(getChildrenByTagName(parent, 'node'), function (nodeDom) {
- var id = getAttr(nodeDom, 'id');
- var label = getAttr(nodeDom, 'label');
- var node = {
- id: id,
- name: label,
- itemStyle: {
- normal: {}
- }
- };
- var vizSizeDom = getChildByTagName(nodeDom, 'viz:size');
- var vizPosDom = getChildByTagName(nodeDom, 'viz:position');
- var vizColorDom = getChildByTagName(nodeDom, 'viz:color'); // var vizShapeDom = getChildByTagName(nodeDom, 'viz:shape');
-
- var attvaluesDom = getChildByTagName(nodeDom, 'attvalues');
-
- if (vizSizeDom) {
- node.symbolSize = parseFloat(getAttr(vizSizeDom, 'value'));
- }
-
- if (vizPosDom) {
- node.x = parseFloat(getAttr(vizPosDom, 'x'));
- node.y = parseFloat(getAttr(vizPosDom, 'y')); // z
- }
-
- if (vizColorDom) {
- node.itemStyle.normal.color = 'rgb(' + [getAttr(vizColorDom, 'r') | 0, getAttr(vizColorDom, 'g') | 0, getAttr(vizColorDom, 'b') | 0].join(',') + ')';
- } // if (vizShapeDom) {
- // node.shape = getAttr(vizShapeDom, 'shape');
- // }
-
-
- if (attvaluesDom) {
- var attvalueDomList = getChildrenByTagName(attvaluesDom, 'attvalue');
- node.attributes = {};
-
- for (var j = 0; j < attvalueDomList.length; j++) {
- var attvalueDom = attvalueDomList[j];
- var attId = getAttr(attvalueDom, 'for');
- var attValue = getAttr(attvalueDom, 'value');
- var attribute = attributesMap[attId];
-
- if (attribute) {
- switch (attribute.type) {
- case 'integer':
- case 'long':
- attValue = parseInt(attValue, 10);
- break;
-
- case 'float':
- case 'double':
- attValue = parseFloat(attValue);
- break;
-
- case 'boolean':
- attValue = attValue.toLowerCase() === 'true';
- break;
-
- default:
- }
-
- node.attributes[attId] = attValue;
- }
- }
- }
-
- return node;
- }) : [];
-}
-
-function parseEdges(parent) {
- return parent ? zrUtil.map(getChildrenByTagName(parent, 'edge'), function (edgeDom) {
- var id = getAttr(edgeDom, 'id');
- var label = getAttr(edgeDom, 'label');
- var sourceId = getAttr(edgeDom, 'source');
- var targetId = getAttr(edgeDom, 'target');
- var edge = {
- id: id,
- name: label,
- source: sourceId,
- target: targetId,
- lineStyle: {
- normal: {}
- }
- };
- var lineStyle = edge.lineStyle.normal;
- var vizThicknessDom = getChildByTagName(edgeDom, 'viz:thickness');
- var vizColorDom = getChildByTagName(edgeDom, 'viz:color'); // var vizShapeDom = getChildByTagName(edgeDom, 'viz:shape');
-
- if (vizThicknessDom) {
- lineStyle.width = parseFloat(vizThicknessDom.getAttribute('value'));
- }
-
- if (vizColorDom) {
- lineStyle.color = 'rgb(' + [getAttr(vizColorDom, 'r') | 0, getAttr(vizColorDom, 'g') | 0, getAttr(vizColorDom, 'b') | 0].join(',') + ')';
- } // if (vizShapeDom) {
- // edge.shape = vizShapeDom.getAttribute('shape');
- // }
-
-
- return edge;
- }) : [];
-}
-
-function getAttr(el, attrName) {
- return el.getAttribute(attrName);
-}
-
-function getChildByTagName(parent, tagName) {
- var node = parent.firstChild;
-
- while (node) {
- if (node.nodeType !== 1 || node.nodeName.toLowerCase() !== tagName.toLowerCase()) {
- node = node.nextSibling;
- } else {
- return node;
- }
- }
-
- return null;
-}
-
-function getChildrenByTagName(parent, tagName) {
- var node = parent.firstChild;
- var children = [];
-
- while (node) {
- if (node.nodeName.toLowerCase() === tagName.toLowerCase()) {
- children.push(node);
- }
-
- node = node.nextSibling;
- }
-
- return children;
-}
-
-exports.parse = parse;
\ No newline at end of file
diff --git a/extension/dataTool/index.js b/extension/dataTool/index.js
deleted file mode 100644
index 61e38e5..0000000
--- a/extension/dataTool/index.js
+++ /dev/null
@@ -1,61 +0,0 @@
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-var echarts = require("echarts");
-
-var gexf = require("./gexf");
-
-exports.gexf = gexf;
-
-var prepareBoxplotData = require("./prepareBoxplotData");
-
-exports.prepareBoxplotData = prepareBoxplotData;
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-var version = '1.0.0';
-
-// For backward compatibility, where the namespace `dataTool` will
-// be mounted on `echarts` is the extension `dataTool` is imported.
-// But the old version of echarts do not have `dataTool` namespace,
-// so check it before mounting.
-if (echarts.dataTool) {
- echarts.dataTool.version = version;
- echarts.dataTool.gexf = gexf;
- echarts.dataTool.prepareBoxplotData = prepareBoxplotData;
-}
-
-exports.version = version;
\ No newline at end of file
diff --git a/extension/dataTool/prepareBoxplotData.js b/extension/dataTool/prepareBoxplotData.js
deleted file mode 100644
index 1dc4f7a..0000000
--- a/extension/dataTool/prepareBoxplotData.js
+++ /dev/null
@@ -1,107 +0,0 @@
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-var numberUtil = require("../../lib/util/number");
-
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-/**
- * See:
- * <https://en.wikipedia.org/wiki/Box_plot#cite_note-frigge_hoaglin_iglewicz-2>
- * <http://stat.ethz.ch/R-manual/R-devel/library/grDevices/html/boxplot.stats.html>
- *
- * Helper method for preparing data.
- *
- * @param {Array.<number>} rawData like
- * [
- * [12,232,443], (raw data set for the first box)
- * [3843,5545,1232], (raw datat set for the second box)
- * ...
- * ]
- * @param {Object} [opt]
- *
- * @param {(number|string)} [opt.boundIQR=1.5] Data less than min bound is outlier.
- * default 1.5, means Q1 - 1.5 * (Q3 - Q1).
- * If 'none'/0 passed, min bound will not be used.
- * @param {(number|string)} [opt.layout='horizontal']
- * Box plot layout, can be 'horizontal' or 'vertical'
- * @return {Object} {
- * boxData: Array.<Array.<number>>
- * outliers: Array.<Array.<number>>
- * axisData: Array.<string>
- * }
- */
-function _default(rawData, opt) {
- opt = opt || [];
- var boxData = [];
- var outliers = [];
- var axisData = [];
- var boundIQR = opt.boundIQR;
- var useExtreme = boundIQR === 'none' || boundIQR === 0;
-
- for (var i = 0; i < rawData.length; i++) {
- axisData.push(i + '');
- var ascList = numberUtil.asc(rawData[i].slice());
- var Q1 = numberUtil.quantile(ascList, 0.25);
- var Q2 = numberUtil.quantile(ascList, 0.5);
- var Q3 = numberUtil.quantile(ascList, 0.75);
- var min = ascList[0];
- var max = ascList[ascList.length - 1];
- var bound = (boundIQR == null ? 1.5 : boundIQR) * (Q3 - Q1);
- var low = useExtreme ? min : Math.max(min, Q1 - bound);
- var high = useExtreme ? max : Math.min(max, Q3 + bound);
- boxData.push([low, Q1, Q2, Q3, high]);
-
- for (var j = 0; j < ascList.length; j++) {
- var dataItem = ascList[j];
-
- if (dataItem < low || dataItem > high) {
- var outlier = [i, dataItem];
- opt.layout === 'vertical' && outlier.reverse();
- outliers.push(outlier);
- }
- }
- }
-
- return {
- boxData: boxData,
- outliers: outliers,
- axisData: axisData
- };
-}
-
-module.exports = _default;
\ No newline at end of file
diff --git a/extension/echarts.js b/extension/echarts.js
deleted file mode 100644
index 47e27e6..0000000
--- a/extension/echarts.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-define('echarts', [], function () {return echarts;});
\ No newline at end of file
diff --git a/extension/webpack.config.js b/extension/webpack.config.js
deleted file mode 100644
index af875ed..0000000
--- a/extension/webpack.config.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-var PROD = process.argv.indexOf('-p') >= 0;
-
-module.exports = {
- entry: {
- 'bmap': __dirname + '/../extension/bmap/bmap.js',
- 'dataTool': __dirname + '/../extension/dataTool'
- },
- output: {
- libraryTarget: 'umd',
- library: ['echarts', '[name]'],
- path: __dirname + '/../dist/extension',
- filename: PROD ? '[name].min.js' : '[name].js'
- },
- externals: {
- 'echarts': 'echarts'
- }
-};
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org