提交 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 });
})));
此差异已折叠。
......@@ -72481,7 +72481,5 @@ exports.List = List;
exports.Model = Model;
exports.Axis = Axis;
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=echarts-en.js.map
此差异已折叠。
此差异已折叠。
......@@ -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 });
})));
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
......@@ -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
此差异已折叠。
!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
此差异已折叠。
!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.
先完成此消息的编辑!
想要评论请 注册