提交 d7ed43ec 编写于 作者: O Ovilia

core: merge master

此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -264,6 +264,8 @@ echarts.extendComponentModel({
mapStyle: {},
mapStyleV2: {},
roam: false
}
});
......@@ -355,6 +357,7 @@ echarts.extendComponentView({
bmap.disablePinchToZoom();
}
/* map 2.0 */
var originalStyle = bMapModel.__mapStyle;
var newMapStyle = bMapModel.get('mapStyle') || {};
......@@ -368,6 +371,20 @@ echarts.extendComponentView({
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(newMapStyle2);
}
bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
}
rendering = false;
}
});
......
此差异已折叠。
......@@ -19,4 +19,4 @@
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(t.bmap={},t.echarts)}(this,function(t,o){"use strict";function f(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(a,r){return r=r||[0,0],o.util.map([0,1],function(t){var e=r[t],o=a[t]/2,n=[],i=[];return n[t]=e-o,i[t]=e+o,n[1-t]=i[1-t]=r[1-t],Math.abs(this.dataToPoint(n)[t]-this.dataToPoint(i)[t])},this)}var l;f.prototype.dimensions=["lng","lat"],f.prototype.setZoom=function(t){this._zoom=t},f.prototype.setCenter=function(t){this._center=this._projection.lngLatToPoint(new BMap.Point(t[0],t[1]))},f.prototype.setMapOffset=function(t){this._mapOffset=t},f.prototype.getBMap=function(){return this._bmap},f.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]]},f.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]},f.prototype.getViewRect=function(){var t=this._api;return new o.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},f.prototype.getRoamTransform=function(){return o.matrix.create()},f.prototype.prepareCustoms=function(t){var e=this.getViewRect();return{coordSys:{type:"bmap",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:o.util.bind(this.dataToPoint,this),size:o.util.bind(n,this)}}},f.dimensions=f.prototype.dimensions,f.create=function(t,m){var c,d=m.getDom();t.eachComponent("bmap",function(t){var e=m.getZr().painter,o=e.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(l=l||function(){function t(t){this._root=t}return(t.prototype=new BMap.Overlay).initialize=function(t){return t.getPanes().labelPane.appendChild(this._root),this._root},t.prototype.draw=function(){},t}(),c)throw new Error("Only one bmap component can exist");if(!t.__bmap){var n=d.querySelector(".ec-extension-bmap");n&&(o.style.left="0px",o.style.top="0px",d.removeChild(n)),(n=document.createElement("div")).style.cssText="width:100%;height:100%",n.classList.add("ec-extension-bmap"),d.appendChild(n);var i=t.__bmap=new BMap.Map(n),a=new l(o);i.addOverlay(a),e.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}i=t.__bmap;var r=t.get("center"),p=t.get("zoom");if(r&&p){var s=new BMap.Point(r[0],r[1]);i.centerAndZoom(s,p)}(c=new f(i,m)).setMapOffset(t.__mapOffset||[0,0]),c.setZoom(p),c.setCenter(r),t.coordinateSystem=c}),t.eachSeries(function(t){"bmap"===t.get("coordinateSystem")&&(t.coordinateSystem=c)})},o.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!(function(t,e){return t&&e&&t[0]===e[0]&&t[1]===e[1]}(t,o.center)&&e===o.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},roam:!1}}),o.extendComponentView({type:"bmap",render:function(i,t,a){function e(t,e){if(!r){var o=p.parentNode.parentNode.parentNode,n=[-parseInt(o.style.left,10)||0,-parseInt(o.style.top,10)||0];p.style.left=n[0]+"px",p.style.top=n[1]+"px",s.setMapOffset(n),i.__mapOffset=n,a.dispatchAction({type:"bmapRoam"})}}var r=!0,o=i.getBMap(),p=a.getZr().painter.getViewportRoot(),s=i.coordinateSystem;function n(){r||a.dispatchAction({type:"bmapRoam"})}o.removeEventListener("moving",this._oldMoveHandler),o.removeEventListener("zoomend",this._oldZoomEndHandler),o.addEventListener("moving",e),o.addEventListener("zoomend",n),this._oldMoveHandler=e,this._oldZoomEndHandler=n;var m=i.get("roam");m&&"scale"!==m?o.enableDragging():o.disableDragging(),m&&"move"!==m?(o.enableScrollWheelZoom(),o.enableDoubleClickZoom(),o.enablePinchToZoom()):(o.disableScrollWheelZoom(),o.disableDoubleClickZoom(),o.disablePinchToZoom());var c=i.__mapStyle,d=i.get("mapStyle")||{},f=JSON.stringify(d);JSON.stringify(c)!==f&&(Object.keys(d).length&&o.setMapStyle(d),i.__mapStyle=JSON.parse(f)),r=!1}}),o.registerCoordinateSystem("bmap",f),o.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"});
!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,o){"use strict";function l(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(a,r){return r=r||[0,0],o.util.map([0,1],function(t){var e=r[t],o=a[t]/2,n=[],i=[];return n[t]=e-o,i[t]=e+o,n[1-t]=i[1-t]=r[1-t],Math.abs(this.dataToPoint(n)[t]-this.dataToPoint(i)[t])},this)}var f;l.prototype.dimensions=["lng","lat"],l.prototype.setZoom=function(t){this._zoom=t},l.prototype.setCenter=function(t){this._center=this._projection.lngLatToPoint(new BMap.Point(t[0],t[1]))},l.prototype.setMapOffset=function(t){this._mapOffset=t},l.prototype.getBMap=function(){return this._bmap},l.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]]},l.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]},l.prototype.getViewRect=function(){var t=this._api;return new o.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},l.prototype.getRoamTransform=function(){return o.matrix.create()},l.prototype.prepareCustoms=function(t){var e=this.getViewRect();return{coordSys:{type:"bmap",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:o.util.bind(this.dataToPoint,this),size:o.util.bind(n,this)}}},l.dimensions=l.prototype.dimensions,l.create=function(t,m){var c,d=m.getDom();t.eachComponent("bmap",function(t){var e=m.getZr().painter,o=e.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(f=f||function(){function t(t){this._root=t}return(t.prototype=new BMap.Overlay).initialize=function(t){return t.getPanes().labelPane.appendChild(this._root),this._root},t.prototype.draw=function(){},t}(),c)throw new Error("Only one bmap component can exist");if(!t.__bmap){var n=d.querySelector(".ec-extension-bmap");n&&(o.style.left="0px",o.style.top="0px",d.removeChild(n)),(n=document.createElement("div")).style.cssText="width:100%;height:100%",n.classList.add("ec-extension-bmap"),d.appendChild(n);var i=t.__bmap=new BMap.Map(n),a=new f(o);i.addOverlay(a),e.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}i=t.__bmap;var r=t.get("center"),p=t.get("zoom");if(r&&p){var s=new BMap.Point(r[0],r[1]);i.centerAndZoom(s,p)}(c=new l(i,m)).setMapOffset(t.__mapOffset||[0,0]),c.setZoom(p),c.setCenter(r),t.coordinateSystem=c}),t.eachSeries(function(t){"bmap"===t.get("coordinateSystem")&&(t.coordinateSystem=c)})},o.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!(function(t,e){return t&&e&&t[0]===e[0]&&t[1]===e[1]}(t,o.center)&&e===o.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},mapStyleV2:{},roam:!1}}),o.extendComponentView({type:"bmap",render:function(i,t,a){function e(t,e){if(!r){var o=p.parentNode.parentNode.parentNode,n=[-parseInt(o.style.left,10)||0,-parseInt(o.style.top,10)||0];p.style.left=n[0]+"px",p.style.top=n[1]+"px",s.setMapOffset(n),i.__mapOffset=n,a.dispatchAction({type:"bmapRoam"})}}var r=!0,o=i.getBMap(),p=a.getZr().painter.getViewportRoot(),s=i.coordinateSystem;function n(){r||a.dispatchAction({type:"bmapRoam"})}o.removeEventListener("moving",this._oldMoveHandler),o.removeEventListener("zoomend",this._oldZoomEndHandler),o.addEventListener("moving",e),o.addEventListener("zoomend",n),this._oldMoveHandler=e,this._oldZoomEndHandler=n;var m=i.get("roam");m&&"scale"!==m?o.enableDragging():o.disableDragging(),m&&"move"!==m?(o.enableScrollWheelZoom(),o.enableDoubleClickZoom(),o.enablePinchToZoom()):(o.disableScrollWheelZoom(),o.disableDoubleClickZoom(),o.disablePinchToZoom());var c=i.__mapStyle,d=i.get("mapStyle")||{},l=JSON.stringify(d);JSON.stringify(c)!==l&&(Object.keys(d).length&&o.setMapStyle(d),i.__mapStyle=JSON.parse(l));var f=i.__mapStyle2,h=i.get("mapStyleV2")||{},u=JSON.stringify(h);JSON.stringify(f)!==u&&(Object.keys(h).length&&o.setMapStyleV2(h),i.__mapStyle2=JSON.parse(u)),r=!1}}),o.registerCoordinateSystem("bmap",l),o.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"});
......@@ -397,7 +397,7 @@ function parseNodes(parent, attributesMap) {
// z
}
if (vizColorDom) {
node.itemStyle.normal.color = 'rgb(' +[
node.itemStyle.normal.color = 'rgb(' + [
getAttr(vizColorDom, 'r') | 0,
getAttr(vizColorDom, 'g') | 0,
getAttr(vizColorDom, 'b') | 0
......@@ -428,7 +428,7 @@ function parseNodes(parent, attributesMap) {
attValue = parseFloat(attValue);
break;
case 'boolean':
attValue = attValue.toLowerCase() == 'true';
attValue = attValue.toLowerCase() === 'true';
break;
default:
}
......@@ -487,16 +487,17 @@ function getAttr(el, attrName) {
return el.getAttribute(attrName);
}
function getChildByTagName (parent, tagName) {
function getChildByTagName(parent, tagName) {
var node = parent.firstChild;
while (node) {
if (
node.nodeType != 1 ||
node.nodeName.toLowerCase() != tagName.toLowerCase()
node.nodeType !== 1
|| node.nodeName.toLowerCase() !== tagName.toLowerCase()
) {
node = node.nextSibling;
} else {
}
else {
return node;
}
}
......@@ -504,11 +505,11 @@ function getChildByTagName (parent, tagName) {
return null;
}
function getChildrenByTagName (parent, tagName) {
function getChildrenByTagName(parent, tagName) {
var node = parent.firstChild;
var children = [];
while (node) {
if (node.nodeName.toLowerCase() == tagName.toLowerCase()) {
if (node.nodeName.toLowerCase() === tagName.toLowerCase()) {
children.push(node);
}
node = node.nextSibling;
......
此差异已折叠。
......@@ -19,4 +19,4 @@
*/
!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";var i=Array.prototype.map;function l(e,t,r){if(e&&t){if(e.map&&e.map===i)return e.map(t,r);for(var a=[],o=0,n=e.length;o<n;o++)a.push(t.call(r,e[o],o,e));return a}}function v(e,t){return e.getAttribute(t)}function d(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 g(e,t){for(var r=e.firstChild,a=[];r;)r.nodeName.toLowerCase()==t.toLowerCase()&&a.push(r),r=r.nextSibling;return a}var r=(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 r=d(t,"gexf");if(!r)return null;for(var a=d(r,"graph"),o=function(e){return e?l(g(e,"attribute"),function(e){return{id:v(e,"id"),title:v(e,"title"),type:v(e,"type")}}):[]}(d(a,"attributes")),n={},i=0;i<o.length;i++)n[o[i].id]=o[i];return{nodes:function(e,p){return e?l(g(e,"node"),function(e){var t={id:v(e,"id"),name:v(e,"label"),itemStyle:{normal:{}}},r=d(e,"viz:size"),a=d(e,"viz:position"),o=d(e,"viz:color"),n=d(e,"attvalues");if(r&&(t.symbolSize=parseFloat(v(r,"value"))),a&&(t.x=parseFloat(v(a,"x")),t.y=parseFloat(v(a,"y"))),o&&(t.itemStyle.normal.color="rgb("+[0|v(o,"r"),0|v(o,"g"),0|v(o,"b")].join(",")+")"),n){var i=g(n,"attvalue");t.attributes={};for(var l=0;l<i.length;l++){var u=i[l],s=v(u,"for"),f=v(u,"value"),c=p[s];if(c){switch(c.type){case"integer":case"long":f=parseInt(f,10);break;case"float":case"double":f=parseFloat(f);break;case"boolean":f="true"==f.toLowerCase()}t.attributes[s]=f}}}return t}):[]}(d(a,"nodes"),n),links:function(e){return e?l(g(e,"edge"),function(e){var t={id:v(e,"id"),name:v(e,"label"),source:v(e,"source"),target:v(e,"target"),lineStyle:{normal:{}}},r=t.lineStyle.normal,a=d(e,"viz:thickness"),o=d(e,"viz:color");return a&&(r.width=parseFloat(a.getAttribute("value"))),o&&(r.color="rgb("+[0|v(o,"r"),0|v(o,"g"),0|v(o,"b")].join(",")+")"),t}):[]}(d(a,"edges"))}}});function w(e,t){var r=(e.length-1)*t+1,a=Math.floor(r),o=+e[a-1],n=r-a;return n?o+n*(e[a]-o):o}function a(e,t){for(var r,a=[],o=[],n=[],i=(t=t||[]).boundIQR,l="none"===i||0===i,u=0;u<e.length;u++){n.push(u+"");var s=((r=e[u].slice()).sort(function(e,t){return e-t}),r),f=w(s,.25),c=w(s,.5),p=w(s,.75),v=s[0],d=s[s.length-1],g=(null==i?1.5:i)*(p-f),h=l?v:Math.max(v,f-g),b=l?d:Math.min(d,p+g);a.push([h,f,c,p,b]);for(var m=0;m<s.length;m++){var y=s[m];if(y<h||b<y){var x=[u,y];"vertical"===t.layout&&x.reverse(),o.push(x)}}}return{boxData:a,outliers:o,axisData:n}}var o="1.0.0";t.dataTool&&(t.dataTool.version=o,t.dataTool.gexf=r,t.dataTool.prepareBoxplotData=a),e.version=o,e.gexf=r,e.prepareBoxplotData=a});
!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";var i=Array.prototype.map;function l(e,t,r){if(e&&t){if(e.map&&e.map===i)return e.map(t,r);for(var a=[],o=0,n=e.length;o<n;o++)a.push(t.call(r,e[o],o,e));return a}}function v(e,t){return e.getAttribute(t)}function d(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 g(e,t){for(var r=e.firstChild,a=[];r;)r.nodeName.toLowerCase()===t.toLowerCase()&&a.push(r),r=r.nextSibling;return a}var r=(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 r=d(t,"gexf");if(!r)return null;for(var a=d(r,"graph"),o=function(e){return e?l(g(e,"attribute"),function(e){return{id:v(e,"id"),title:v(e,"title"),type:v(e,"type")}}):[]}(d(a,"attributes")),n={},i=0;i<o.length;i++)n[o[i].id]=o[i];return{nodes:function(e,p){return e?l(g(e,"node"),function(e){var t={id:v(e,"id"),name:v(e,"label"),itemStyle:{normal:{}}},r=d(e,"viz:size"),a=d(e,"viz:position"),o=d(e,"viz:color"),n=d(e,"attvalues");if(r&&(t.symbolSize=parseFloat(v(r,"value"))),a&&(t.x=parseFloat(v(a,"x")),t.y=parseFloat(v(a,"y"))),o&&(t.itemStyle.normal.color="rgb("+[0|v(o,"r"),0|v(o,"g"),0|v(o,"b")].join(",")+")"),n){var i=g(n,"attvalue");t.attributes={};for(var l=0;l<i.length;l++){var u=i[l],s=v(u,"for"),f=v(u,"value"),c=p[s];if(c){switch(c.type){case"integer":case"long":f=parseInt(f,10);break;case"float":case"double":f=parseFloat(f);break;case"boolean":f="true"===f.toLowerCase()}t.attributes[s]=f}}}return t}):[]}(d(a,"nodes"),n),links:function(e){return e?l(g(e,"edge"),function(e){var t={id:v(e,"id"),name:v(e,"label"),source:v(e,"source"),target:v(e,"target"),lineStyle:{normal:{}}},r=t.lineStyle.normal,a=d(e,"viz:thickness"),o=d(e,"viz:color");return a&&(r.width=parseFloat(a.getAttribute("value"))),o&&(r.color="rgb("+[0|v(o,"r"),0|v(o,"g"),0|v(o,"b")].join(",")+")"),t}):[]}(d(a,"edges"))}}});function w(e,t){var r=(e.length-1)*t+1,a=Math.floor(r),o=+e[a-1],n=r-a;return n?o+n*(e[a]-o):o}function a(e,t){for(var r,a=[],o=[],n=[],i=(t=t||[]).boundIQR,l="none"===i||0===i,u=0;u<e.length;u++){n.push(u+"");var s=((r=e[u].slice()).sort(function(e,t){return e-t}),r),f=w(s,.25),c=w(s,.5),p=w(s,.75),v=s[0],d=s[s.length-1],g=(null==i?1.5:i)*(p-f),h=l?v:Math.max(v,f-g),b=l?d:Math.min(d,p+g);a.push([h,f,c,p,b]);for(var m=0;m<s.length;m++){var y=s[m];if(y<h||b<y){var x=[u,y];"vertical"===t.layout&&x.reverse(),o.push(x)}}}return{boxData:a,outliers:o,axisData:n}}var o="1.0.0";t.dataTool&&(t.dataTool.version=o,t.dataTool.gexf=r,t.dataTool.prepareBoxplotData=a),e.version=o,e.gexf=r,e.prepareBoxplotData=a});
......@@ -147,7 +147,7 @@ import './src/component/calendar';
// `grapchic` component, for example:
// `graphic` component, for example:
// chart.setOption({
// graphic: {...}
// });
......
......@@ -60,6 +60,7 @@ var _default = echarts.extendComponentModel({
center: [104.114129, 37.550339],
zoom: 5,
mapStyle: {},
mapStyleV2: {},
roam: false
}
});
......
......@@ -99,6 +99,8 @@ var _default = echarts.extendComponentView({
bmap.disableDoubleClickZoom();
bmap.disablePinchToZoom();
}
/* map 2.0 */
var originalStyle = bMapModel.__mapStyle;
var newMapStyle = bMapModel.get('mapStyle') || {}; // FIXME, Not use JSON methods
......@@ -113,6 +115,22 @@ var _default = echarts.extendComponentView({
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(newMapStyle2);
}
bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
}
rendering = false;
}
......
......@@ -145,7 +145,7 @@ function parseNodes(parent, attributesMap) {
break;
case 'boolean':
attValue = attValue.toLowerCase() == 'true';
attValue = attValue.toLowerCase() === 'true';
break;
default:
......@@ -202,7 +202,7 @@ function getChildByTagName(parent, tagName) {
var node = parent.firstChild;
while (node) {
if (node.nodeType != 1 || node.nodeName.toLowerCase() != tagName.toLowerCase()) {
if (node.nodeType !== 1 || node.nodeName.toLowerCase() !== tagName.toLowerCase()) {
node = node.nextSibling;
} else {
return node;
......@@ -217,7 +217,7 @@ function getChildrenByTagName(parent, tagName) {
var children = [];
while (node) {
if (node.nodeName.toLowerCase() == tagName.toLowerCase()) {
if (node.nodeName.toLowerCase() === tagName.toLowerCase()) {
children.push(node);
}
......
此差异已折叠。
{
"name": "echarts",
"version": "4.3.0",
"version": "4.4.0",
"description": "A powerful charting and visualization library for browser",
"license": "Apache-2.0",
"keywords": [
......@@ -26,7 +26,7 @@
"lint:dist": "echo 'It might take a while. Please wait ...' && ./node_modules/.bin/jshint --config .jshintrc-dist dist/echarts.js"
},
"dependencies": {
"zrender": "4.1.0"
"zrender": "4.1.1"
},
"devDependencies": {
"@babel/core": "7.3.4",
......
......@@ -35,6 +35,29 @@ var _eventPos = [0, 0];
// Just for compatible with ec2.
zrUtil.extend(Model.prototype, barItemStyle);
function getClipArea(coord, data) {
var coordSysClipArea = coord.getArea && coord.getArea();
if (coord.type === 'cartesian2d') {
var baseAxis = coord.getBaseAxis();
// When boundaryGap is false or using time axis. bar may exceed the grid.
// We should not clip this part.
// See test/bar2.html
if (baseAxis.type !== 'category' || !baseAxis.onBand) {
var expandWidth = data.getLayout('bandWidth');
if (baseAxis.isHorizontal()) {
coordSysClipArea.x -= expandWidth;
coordSysClipArea.width += expandWidth * 2;
}
else {
coordSysClipArea.y -= expandWidth;
coordSysClipArea.height += expandWidth * 2;
}
}
}
return coordSysClipArea;
}
export default echarts.extendChartView({
type: 'bar',
......@@ -94,16 +117,15 @@ export default echarts.extendChartView({
var animationModel = seriesModel.isAnimationEnabled() ? seriesModel : null;
var coordSysClipArea = coord.getArea && coord.getArea();
var needsClip = seriesModel.get('clip', true);
var roundCap = seriesModel.get('roundCap', true);
var coordSysClipArea = getClipArea(coord, data);
// If there is clipPath created in large mode. Remove it.
group.removeClipPath();
// We don't use clipPath in normal mode because we needs a perfect animation
// And don't want the label are clipped.
var roundCap = seriesModel.get('roundCap', true);
data.diff(oldData)
.add(function (dataIndex) {
if (!data.hasValue(dataIndex)) {
......
......@@ -107,6 +107,12 @@ export default echarts.extendComponentView({
areas: zrUtil.clone(areas),
$from: modelId
});
opt.isEnd && this.api.dispatchAction({
type: 'brushEnd',
brushId: modelId,
areas: zrUtil.clone(areas),
$from: modelId
});
}
});
......
......@@ -60,4 +60,9 @@ echarts.registerAction(
echarts.registerAction(
{type: 'brushSelect', event: 'brushSelected', update: 'none'},
function () {}
);
\ No newline at end of file
);
echarts.registerAction(
{type: 'brushEnd', event: 'brushEnd', update: 'none'},
function () {}
);
......@@ -249,23 +249,27 @@ MapDraw.prototype = {
if (geometry.type !== 'polygon') {
return;
}
var exterior = [];
var points = [];
for (var i = 0; i < geometry.exterior.length; ++i) {
exterior.push(transformPoint(geometry.exterior[i]));
points.push(transformPoint(geometry.exterior[i]));
}
compoundPath.shape.paths.push(new graphic.Polygon({
segmentIgnoreThreshold: 1,
shape: {
points: exterior
points: points
}
}));
for (var i = 0; i < (geometry.interiors ? geometry.interiors.length : 0); i++) {
var interiors = transformPoint(geometry.interiors[i]);
for (var i = 0; i < (geometry.interiors ? geometry.interiors.length : 0); ++i) {
var interior = geometry.interiors[i];
var points = [];
for (var j = 0; j < interior.length; ++j) {
points.push(transformPoint(interior[j]));
}
compoundPath.shape.paths.push(new graphic.Polygon({
segmentIgnoreThreshold: 1,
shape: {
points: interiors
points: points
}
}));
}
......
......@@ -23,16 +23,16 @@ import Model from '../../model/Model';
import {isNameSpecified} from '../../util/model';
import lang from '../../lang';
var langTitle = lang.legendSelector.title;
var langSelector = lang.legend.selector;
var defaultSelectorOption = {
all: {
type: 'all',
title: zrUtil.clone(langTitle.all)
title: zrUtil.clone(langSelector.all)
},
inverse: {
type: 'inverse',
title: zrUtil.clone(langTitle.inverse)
title: zrUtil.clone(langSelector.inverse)
}
};
......
......@@ -148,11 +148,11 @@ var GeoModel = ComponentModel.extend({
*/
getFormattedLabel: function (name, status) {
var regionModel = this.getRegionModel(name);
var formatter = regionModel.get('label'
+ (status === 'normal'
? '.'
: status + '.')
+ 'formatter');
var formatter = regionModel.get(
'label'
+ (status === 'normal' ? '.' : status + '.')
+ 'formatter'
);
var params = {
name: name
};
......
......@@ -51,10 +51,10 @@ var isFunction = zrUtil.isFunction;
var isObject = zrUtil.isObject;
var parseClassType = ComponentModel.parseClassType;
export var version = '4.3.0';
export var version = '4.4.0';
export var dependencies = {
zrender: '4.1.0'
zrender: '4.1.1'
};
var TEST_FRAME_REMAIN_TIME = 1;
......
......@@ -17,10 +17,13 @@
* under the License.
*/
/**
* Language: (Simplified) Chinese.
*/
export default {
legendSelector: {
title: {
legend: {
selector: {
all: '全选',
inverse: '反选'
}
......
......@@ -17,10 +17,13 @@
* under the License.
*/
/**
* Language: English.
*/
export default {
legendSelector: {
title: {
legend: {
selector: {
all: 'All',
inverse: 'Inv'
}
......
......@@ -17,8 +17,17 @@
* under the License.
*/
/**
* Language: Spanish
*/
export default {
legend: {
selector: {
all: 'Todas',
inverse: 'Inversa'
}
},
toolbox: {
brush: {
title: {
......
......@@ -17,8 +17,17 @@
* under the License.
*/
/**
* Language: Finnish
*/
export default {
legend: {
selector: {
all: 'Kaikki',
inverse: 'Käänteinen'
}
},
toolbox: {
brush: {
title: {
......
......@@ -17,7 +17,17 @@
* under the License.
*/
/**
* Language: Thai
*/
export default {
legend: {
selector: {
all: 'ทั้งหมด',
inverse: 'ผกผัน'
}
},
toolbox: {
brush: {
title: {
......
......@@ -223,6 +223,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
var offset = -widthSum / 2;
zrUtil.each(stacks, function (column, stackId) {
result[coordSysName][stackId] = result[coordSysName][stackId] || {
bandWidth: bandWidth,
offset: offset,
width: column.width
};
......@@ -280,6 +281,7 @@ export function layout(seriesType, ecModel) {
lastStackCoordsOrigin[stackId] = lastStackCoordsOrigin[stackId] || []; // Fix #4243
data.setLayout({
bandWidth: columnLayoutInfo.bandWidth,
offset: columnOffset,
size: columnWidth
});
......
......@@ -91,7 +91,8 @@ export function extendPath(pathData, opts) {
/**
* Register a user defined shape.
* The shape class can be fetched by `getShapeClass`
* This method will not overwrite the built-in shapes.
* This method will overwrite the registered shapes, including
* the registered built-in shapes, if using the same `name`.
* The shape can be used in `custom series` and
* `graphic component` by declaring `{type: name}`.
*
......@@ -337,13 +338,14 @@ function singleEnterEmphasis(el) {
}
var zr = el.__zr;
var useHoverLayer = el.useHoverLayer && zr && zr.painter.type === 'canvas';
el.__highlighted = useHoverLayer ? 'layer' : 'plain';
if (el.isGroup || (!zr && el.useHoverLayer)) {
return;
}
var useHoverLayer = el.useHoverLayer && zr.painter.type === 'canvas';
el.__highlighted = useHoverLayer ? 'layer' : 'plain';
var elTarget = el;
var targetStyle = el.style;
......
此差异已折叠。
......@@ -46,7 +46,6 @@ under the License.
}
</style>
<h1>No scroll, left not set (should be center)</h1>
<div class="chart" id="plain"></div>
<h1>No scroll, width 300, right: 10</h1>
<div class="chart" id="plain2"></div>
......@@ -153,6 +152,16 @@ under the License.
var option = {
legend: {
selector: true,
selectorLabel: {
color: 'yellow',
borderColor: 'green',
backgroundColor: 'blue'
},
emphasis: {
selectorLabel: {
backgroundColor: 'red'
}
},
data: seriesInfo.legendData,
// backgroundColor: 'rgba(0,100,50,0.2)'
},
......@@ -169,7 +178,13 @@ under the License.
series: seriesInfo.series
};
testHelper.createChart(echarts, 'plain', option);
testHelper.create(echarts, 'plain', {
title: [
'No scroll, left not set (should be center)',
'color: yellow, borderColor: green, backgroundColor: blue, emphasis backgroundColor: red'
],
option: option
});
})
</script>
......
/*
* 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.
*/
const glob = require('glob');
const fs = require('fs');
......
......@@ -33,8 +33,8 @@ under the License.
class="recording-button" circle :type="recordingAction ? 'danger' : 'info'"
>
</el-button>
<div class="hint"><span class="emphasis">SHIFT + R</span>to {{recordingAction ? 'stop' : 'start'}} recording</div>
<div class="hint" v-if="recordingAction"><span class="emphasis">SHIFT + S</span>to take screenshot</div>
<div class="hint"><span class="emphasis">ALT + R</span>to {{recordingAction ? 'stop' : 'start'}} recording</div>
<div class="hint" v-if="recordingAction"><span class="emphasis">ALT + S</span>to take screenshot</div>
<div class="recording-time" v-if="recordingAction">{{(recordingTimeElapsed / 1000).toFixed(0)}} s</div>
</div>
<div id="actions">
......
......@@ -196,7 +196,7 @@ function notify(title, message) {
}
function keyboardRecordingHandler(e) {
if (e.key.toLowerCase() === 'r' && e.shiftKey) {
if (e.keyCode === 82 && e.altKey) {
let $iframe = getIframe();
if (!app.recordingAction) {
// Create a new action if currentAction has ops.
......@@ -230,7 +230,7 @@ function keyboardRecordingHandler(e) {
}
// Get scroll
}
else if (e.key.toLowerCase() === 's' && e.shiftKey) {
else if (e.keyCode === 83 && e.altKey) {
if (app.recordingAction) {
app.recordingAction.ops.push({
type: 'screenshot',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册