Permalink
Browse files

Fix #3450

  • Loading branch information...
1 parent 5941aa4 commit b87fcd05b297a0942efcbb96bb983ade2e69ad72 @pissang pissang committed Jun 19, 2016
View
Oops, something went wrong.
Oops, something went wrong.
View
Oops, something went wrong.
View
Oops, something went wrong.
View
Oops, something went wrong.
Oops, something went wrong.
@@ -258,9 +258,10 @@ return /******/ (function(modules) { // webpackBootstrap
},
defaultOption: {
- center: null,
- zoom: 1,
+ center: [104.114129, 37.550339],
+
+ zoom: 5,
mapStyle: {},
@@ -349,7 +350,10 @@ return /******/ (function(modules) { // webpackBootstrap
// FIXME, Not use JSON methods
var mapStyleStr = JSON.stringify(newMapStyle);
if (JSON.stringify(originalStyle) !== mapStyleStr) {
- bmap.setMapStyle(newMapStyle);
+ // FIXME May have blank tile when dragging if setMapStyle
+ if (Object.keys(newMapStyle).length) {
+ bmap.setMapStyle(newMapStyle);
+ }
bMapModel.__mapStyle = JSON.parse(mapStyleStr);
}
@@ -1 +1 @@
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],t):"object"==typeof exports?exports.bmap=t(require("echarts")):(e.echarts=e.echarts||{},e.echarts.bmap=t(e.echarts))}(this,function(e){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){var n;n=function(e){return o(1).registerCoordinateSystem("bmap",o(2)),o(3),o(4),o(1).registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(e,t){t.eachComponent("bmap",function(e){var t=e.getBMap(),o=t.getCenter();e.setCenterAndZoom([o.lng,o.lat],t.getZoom())})}),{version:"1.0.0"}}.call(t,o,t,e),!(void 0!==n&&(e.exports=n))},function(t,o){t.exports=e},function(e,t,o){var n;n=function(e){function t(e,t){this._bmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}function n(){function e(e){this._root=e}return e.prototype=new BMap.Overlay,e.prototype.initialize=function(e){return e.getPanes().labelPane.appendChild(this._root),this._root},e.prototype.draw=function(){},e}var r=o(1);t.prototype.dimensions=["lng","lat"],t.prototype.setMapOffset=function(e){this._mapOffset=e},t.prototype.getBMap=function(){return this._bmap},t.prototype.dataToPoint=function(e){var t=new BMap.Point(e[0],e[1]),o=this._bmap.pointToOverlayPixel(t),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},t.prototype.pointToData=function(e){var t=this._mapOffset,e=this._bmap.overlayPixelToPoint({x:e[0]+t[0],y:e[1]+t[1]});return[e.lng,e.lat]},t.prototype.getViewRect=function(){var e=this._api;return new r.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},t.prototype.getRoamTransform=function(){return r.matrix.create()};var a;return t.dimensions=t.prototype.dimensions,t.create=function(e,o){var r,i=o.getDom();e.eachComponent("bmap",function(e){var p=o.getZr().painter.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(a=a||n(),r)throw new Error("Only one bmap component can exist");if(!e.__bmap){var s=i.querySelector(".ec-extension-bmap");s&&(p.style.left="0px",p.style.top="0px",i.removeChild(s)),s=document.createElement("div"),s.style.cssText="width:100%;height:100%",s.classList.add("ec-extension-bmap"),i.appendChild(s);var c=e.__bmap=new BMap.Map(s),m=new a(p);c.addOverlay(m)}var c=e.__bmap,l=e.get("center"),d=e.get("zoom");if(l&&d){var f=new BMap.Point(l[0],l[1]);c.centerAndZoom(f,d)}r=new t(c,o),r.setMapOffset(e.__mapOffset||[0,0]),e.coordinateSystem=r}),e.eachSeries(function(e){"bmap"===e.get("coordinateSystem")&&(e.coordinateSystem=r)})},t}.call(t,o,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,o){var n;n=function(e){function t(e,t){return e&&t&&e[0]===t[0]&&e[1]===t[1]}return o(1).extendComponentModel({type:"bmap",getBMap:function(){return this.__bmap},setCenterAndZoom:function(e,t){this.option.center=e,this.option.zoom=t},centerOrZoomChanged:function(e,o){var n=this.option;return!(t(e,n.center)&&o===n.zoom)},defaultOption:{center:null,zoom:1,mapStyle:{},roam:!1}})}.call(t,o,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,o){var n;n=function(e){return o(1).extendComponentView({type:"bmap",render:function(e,t,o){function n(){r||o.dispatchAction({type:"bmapRoam"})}var r=!0,a=e.getBMap(),i=o.getZr().painter.getViewportRoot(),p=e.coordinateSystem,s=function(t,n){if(!r){var a=i.parentNode.parentNode.parentNode,s=[-parseInt(a.style.left,10)||0,-parseInt(a.style.top,10)||0];i.style.left=s[0]+"px",i.style.top=s[1]+"px",p.setMapOffset(s),e.__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 c=e.get("roam");c&&"scale"!==c?a.enableDragging():a.disableDragging(),c&&"move"!==c?(a.enableScrollWheelZoom(),a.enableDoubleClickZoom(),a.enablePinchToZoom()):(a.disableScrollWheelZoom(),a.disableDoubleClickZoom(),a.disablePinchToZoom());var m=e.__mapStyle,l=e.get("mapStyle")||{},d=JSON.stringify(l);JSON.stringify(m)!==d&&(a.setMapStyle(l),e.__mapStyle=JSON.parse(d)),r=!1}})}.call(t,o,t,e),!(void 0!==n&&(e.exports=n))}])});
+!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("echarts")):"function"==typeof define&&define.amd?define(["echarts"],t):"object"==typeof exports?exports.bmap=t(require("echarts")):(e.echarts=e.echarts||{},e.echarts.bmap=t(e.echarts))}(this,function(e){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var o={};return t.m=e,t.c=o,t.p="",t(0)}([function(e,t,o){var n;n=function(e){return o(1).registerCoordinateSystem("bmap",o(2)),o(3),o(4),o(1).registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(e,t){t.eachComponent("bmap",function(e){var t=e.getBMap(),o=t.getCenter();e.setCenterAndZoom([o.lng,o.lat],t.getZoom())})}),{version:"1.0.0"}}.call(t,o,t,e),!(void 0!==n&&(e.exports=n))},function(t,o){t.exports=e},function(e,t,o){var n;n=function(e){function t(e,t){this._bmap=e,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=t}function n(){function e(e){this._root=e}return e.prototype=new BMap.Overlay,e.prototype.initialize=function(e){return e.getPanes().labelPane.appendChild(this._root),this._root},e.prototype.draw=function(){},e}var r=o(1);t.prototype.dimensions=["lng","lat"],t.prototype.setMapOffset=function(e){this._mapOffset=e},t.prototype.getBMap=function(){return this._bmap},t.prototype.dataToPoint=function(e){var t=new BMap.Point(e[0],e[1]),o=this._bmap.pointToOverlayPixel(t),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},t.prototype.pointToData=function(e){var t=this._mapOffset,e=this._bmap.overlayPixelToPoint({x:e[0]+t[0],y:e[1]+t[1]});return[e.lng,e.lat]},t.prototype.getViewRect=function(){var e=this._api;return new r.graphic.BoundingRect(0,0,e.getWidth(),e.getHeight())},t.prototype.getRoamTransform=function(){return r.matrix.create()};var a;return t.dimensions=t.prototype.dimensions,t.create=function(e,o){var r,i=o.getDom();e.eachComponent("bmap",function(e){var p=o.getZr().painter.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(a=a||n(),r)throw new Error("Only one bmap component can exist");if(!e.__bmap){var s=i.querySelector(".ec-extension-bmap");s&&(p.style.left="0px",p.style.top="0px",i.removeChild(s)),s=document.createElement("div"),s.style.cssText="width:100%;height:100%",s.classList.add("ec-extension-bmap"),i.appendChild(s);var c=e.__bmap=new BMap.Map(s),m=new a(p);c.addOverlay(m)}var c=e.__bmap,l=e.get("center"),d=e.get("zoom");if(l&&d){var f=new BMap.Point(l[0],l[1]);c.centerAndZoom(f,d)}r=new t(c,o),r.setMapOffset(e.__mapOffset||[0,0]),e.coordinateSystem=r}),e.eachSeries(function(e){"bmap"===e.get("coordinateSystem")&&(e.coordinateSystem=r)})},t}.call(t,o,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,o){var n;n=function(e){function t(e,t){return e&&t&&e[0]===t[0]&&e[1]===t[1]}return o(1).extendComponentModel({type:"bmap",getBMap:function(){return this.__bmap},setCenterAndZoom:function(e,t){this.option.center=e,this.option.zoom=t},centerOrZoomChanged:function(e,o){var n=this.option;return!(t(e,n.center)&&o===n.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},roam:!1}})}.call(t,o,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,o){var n;n=function(e){return o(1).extendComponentView({type:"bmap",render:function(e,t,o){function n(){r||o.dispatchAction({type:"bmapRoam"})}var r=!0,a=e.getBMap(),i=o.getZr().painter.getViewportRoot(),p=e.coordinateSystem,s=function(t,n){if(!r){var a=i.parentNode.parentNode.parentNode,s=[-parseInt(a.style.left,10)||0,-parseInt(a.style.top,10)||0];i.style.left=s[0]+"px",i.style.top=s[1]+"px",p.setMapOffset(s),e.__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 c=e.get("roam");c&&"scale"!==c?a.enableDragging():a.disableDragging(),c&&"move"!==c?(a.enableScrollWheelZoom(),a.enableDoubleClickZoom(),a.enablePinchToZoom()):(a.disableScrollWheelZoom(),a.disableDoubleClickZoom(),a.disablePinchToZoom());var m=e.__mapStyle,l=e.get("mapStyle")||{},d=JSON.stringify(l);JSON.stringify(m)!==d&&(Object.keys(l).length&&a.setMapStyle(l),e.__mapStyle=JSON.parse(d)),r=!1}})}.call(t,o,t,e),!(void 0!==n&&(e.exports=n))}])});
View
@@ -38,12 +38,13 @@
"zrender": "^3.1.0"
},
"devDependencies": {
- "zrender": "^3.1.0",
+ "coordtransform": "^2.0.2",
"escodegen": "^1.8.0",
"esprima": "^2.7.2",
"estraverse": "^4.1.1",
"fs-extra": "^0.26.5",
"glob": "^7.0.0",
- "webpack": "^1.12.13"
+ "webpack": "^1.12.13",
+ "zrender": "^3.1.0"
}
}
@@ -65,13 +65,17 @@ define(function (require) {
}
var color = effectModel.get('color') || lineData.getItemVisual(idx, 'color');
var symbol = this.childAt(1);
+
var period = effectModel.get('period') * 1000;
var loop = effectModel.get('loop');
if (
this._symbolType !== symbolType
|| period !== this._period
|| loop !== this._loop
) {
+ // Remove previous
+ this.remove(symbol);
+
symbol = symbolUtil.createSymbol(
symbolType, -0.5, -0.5, 1, 1, color
);
@@ -98,6 +102,11 @@ define(function (require) {
}
animator.start();
}
+ // Symbol may be removed if loop is false
+ if (!symbol) {
+ return;
+ }
+
// Shadow color is same with color in default
symbol.setStyle('shadowColor', color);
symbol.setStyle(effectModel.getItemStyle(['color']));
View
@@ -219,6 +219,7 @@ define(function(require) {
? NaN : +value; // If string (like '-'), using '+' parse to NaN
};
+ // PENDING A little ugly
modelUtil.dataFormatMixin = {
/**
* Get params for formatter
@@ -12,27 +12,28 @@ define(function (require) {
return a - b;
}
- function swapElement(list, idx0, idx1) {
- var tmp = list[idx0];
- list[idx0] = list[idx1];
- list[idx1] = tmp;
+ function swapElement(arr, idx0, idx1) {
+ var tmp = arr[idx0];
+ arr[idx0] = arr[idx1];
+ arr[idx1] = tmp;
}
- function select(list, left, right, nth, compareFunc) {
+ function select(arr, left, right, nth, compareFunc) {
var pivotIdx = left;
+ var pivotValue;
while (right > left) {
pivotIdx = Math.round((right + left) / 2);
- var pivotValue = list[pivotIdx];
+ pivotValue = arr[pivotIdx];
// Swap pivot to the end
- swapElement(list, pivotIdx, right);
+ swapElement(arr, pivotIdx, right);
pivotIdx = left;
for (var i = left; i <= right - 1; i++) {
- if (compareFunc(pivotValue, list[i]) >= 0) {
- swapElement(list, i, pivotIdx);
+ if (compareFunc(pivotValue, arr[i]) >= 0) {
+ swapElement(arr, i, pivotIdx);
pivotIdx++;
}
}
- swapElement(list, right, pivotIdx);
+ swapElement(arr, right, pivotIdx);
if (pivotIdx === nth) {
return pivotIdx;
@@ -50,20 +51,20 @@ define(function (require) {
/**
* @alias module:echarts/core/quickSelect
- * @param {Array} list
+ * @param {Array} arr
* @param {number} [left]
* @param {number} [right]
* @param {number} nth
* @param {Function} [compareFunc]
* @example
* var quickSelect = require('echarts/core/quickSelect');
- * var list = [5, 2, 1, 4, 3]
- * quickSelect(list, 3);
- * quickSelect(list, 0, 3, 1, function (a, b) {return a - b});
+ * var arr = [5, 2, 1, 4, 3]
+ * quickSelect(arr, 3);
+ * quickSelect(arr, 0, 3, 1, function (a, b) {return a - b});
*
* @return {number}
*/
- function quickSelect(list, left, right, nth, compareFunc) {
+ function quickSelect(arr, left, right, nth, compareFunc) {
if (arguments.length <= 3) {
nth = left;
if (arguments.length == 2) {
@@ -73,9 +74,9 @@ define(function (require) {
compareFunc = right;
}
left = 0;
- right = list.length - 1;
+ right = arr.length - 1;
}
- return select(list, left, right, nth, compareFunc);
+ return select(arr, left, right, nth, compareFunc);
}
return quickSelect;
View
@@ -1,7 +1,7 @@
<html>
<head>
<meta charset="utf-8">
- <script src="esl.js"></script>
+ <script src="http://requirejs.org/docs/release/2.2.0/minified/require.js"></script>
<script src="config.js"></script>
<meta name="viewport" content="user-scalable=no,width=device-width,height=device-height">
</head>
@@ -87,6 +87,9 @@
},
tooltip: {
trigger: 'axis',
+ position: function (point) {
+ return [point[0], '10%'];
+ },
axisPointer: {
type: 'line'
}
View
@@ -48,6 +48,7 @@
var itemStyle = {
normal: {
+ barBorderRadius: 5,
label: {
show: true,
position: 'outside'
@@ -68,6 +69,7 @@
chart.setOption({
backgroundColor: '#eee',
legend: {
+ inactiveColor: '#abc',
borderWidth: 1,
data: [{
name: 'bar'
Oops, something went wrong.

0 comments on commit b87fcd0

Please sign in to comment.