install.16575870.js 6.2 KB

1
  1. import{dW as f,dX as S,dY as _,d5 as m,dZ as w,d_ as D,d$ as C,d8 as I,e0 as g,e1 as b,e2 as x,c_ as L,e3 as A}from"./index.76214426.js";var P=function(n){f(e,n);function e(){var t=n!==null&&n.apply(this,arguments)||this;return t.type=e.type,t.hasSymbolVisual=!0,t}return e.prototype.getInitialData=function(t,r){return S(null,this,{useEncodeDefaulter:!0})},e.prototype.getProgressive=function(){var t=this.option.progressive;return t==null?this.option.large?5e3:this.get("progressive"):t},e.prototype.getProgressiveThreshold=function(){var t=this.option.progressiveThreshold;return t==null?this.option.large?1e4:this.get("progressiveThreshold"):t},e.prototype.brushSelector=function(t,r,a){return a.point(r.getItemLayout(t))},e.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:""},e.type="series.scatter",e.dependencies=["grid","polar","geo","singleAxis","calendar"],e.defaultOption={coordinateSystem:"cartesian2d",z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:"#212121"}},universalTransition:{divideShape:"clone"}},e}(_);const z=P;var y=4,M=function(){function n(){}return n}(),T=function(n){f(e,n);function e(t){var r=n.call(this,t)||this;return r._off=0,r.hoverDataIdx=-1,r}return e.prototype.getDefaultShape=function(){return new M},e.prototype.reset=function(){this.notClear=!1,this._off=0},e.prototype.buildPath=function(t,r){var a=r.points,o=r.size,i=this.symbolProxy,p=i.shape,h=t.getContext?t.getContext():t,s=h&&o[0]<y,l=this.softClipShape,u;if(s){this._ctx=h;return}for(this._ctx=null,u=this._off;u<a.length;){var c=a[u++],d=a[u++];isNaN(c)||isNaN(d)||l&&!l.contain(c,d)||(p.x=c-o[0]/2,p.y=d-o[1]/2,p.width=o[0],p.height=o[1],i.buildPath(t,p,!0))}this.incremental&&(this._off=u,this.notClear=!0)},e.prototype.afterBrush=function(){var t=this.shape,r=t.points,a=t.size,o=this._ctx,i=this.softClipShape,p;if(!!o){for(p=this._off;p<r.length;){var h=r[p++],s=r[p++];isNaN(h)||isNaN(s)||i&&!i.contain(h,s)||o.fillRect(h-a[0]/2,s-a[1]/2,a[0],a[1])}this.incremental&&(this._off=p,this.notClear=!0)}},e.prototype.findDataIndex=function(t,r){for(var a=this.shape,o=a.points,i=a.size,p=Math.max(i[0],4),h=Math.max(i[1],4),s=o.length/2-1;s>=0;s--){var l=s*2,u=o[l]-p/2,c=o[l+1]-h/2;if(t>=u&&r>=c&&t<=u+p&&r<=c+h)return s}return-1},e.prototype.contain=function(t,r){var a=this.transformCoordToLocal(t,r),o=this.getBoundingRect();if(t=a[0],r=a[1],o.contain(t,r)){var i=this.hoverDataIdx=this.findDataIndex(t,r);return i>=0}return this.hoverDataIdx=-1,!1},e.prototype.getBoundingRect=function(){var t=this._rect;if(!t){for(var r=this.shape,a=r.points,o=r.size,i=o[0],p=o[1],h=1/0,s=1/0,l=-1/0,u=-1/0,c=0;c<a.length;){var d=a[c++],v=a[c++];h=Math.min(d,h),l=Math.max(d,l),s=Math.min(v,s),u=Math.max(v,u)}t=this._rect=new m(h-i/2,s-p/2,l-h+i,u-s+p)}return t},e}(w),R=function(){function n(){this.group=new D}return n.prototype.updateData=function(e,t){this._clear();var r=this._create();r.setShape({points:e.getLayout("points")}),this._setCommon(r,e,t)},n.prototype.updateLayout=function(e){var t=e.getLayout("points");this.group.eachChild(function(r){if(r.startIndex!=null){var a=(r.endIndex-r.startIndex)*2,o=r.startIndex*4*2;t=new Float32Array(t.buffer,o,a)}r.setShape("points",t),r.reset()})},n.prototype.incrementalPrepareUpdate=function(e){this._clear()},n.prototype.incrementalUpdate=function(e,t,r){var a=this._newAdded[0],o=t.getLayout("points"),i=a&&a.shape.points;if(i&&i.length<2e4){var p=i.length,h=new Float32Array(p+o.length);h.set(i),h.set(o,p),a.endIndex=e.end,a.setShape({points:h})}else{this._newAdded=[];var s=this._create();s.startIndex=e.start,s.endIndex=e.end,s.incremental=!0,s.setShape({points:o}),this._setCommon(s,t,r)}},n.prototype.eachRendered=function(e){this._newAdded[0]&&e(this._newAdded[0])},n.prototype._create=function(){var e=new T({cursor:"default"});return this.group.add(e),this._newAdded.push(e),e},n.prototype._setCommon=function(e,t,r){var a=t.hostModel;r=r||{};var o=t.getVisual("symbolSize");e.setShape("size",o instanceof Array?o:[o,o]),e.softClipShape=r.clipShape||null,e.symbolProxy=C(t.getVisual("symbol"),0,0,0,0),e.setColor=e.symbolProxy.setColor;var i=e.shape.size[0]<y;e.useStyle(a.getModel("itemStyle").getItemStyle(i?["color","shadowBlur","shadowColor"]:["color"]));var p=t.getVisual("style"),h=p&&p.fill;h&&e.setColor(h);var s=I(e);s.seriesIndex=a.seriesIndex,e.on("mousemove",function(l){s.dataIndex=null;var u=e.hoverDataIdx;u>=0&&(s.dataIndex=u+(e.startIndex||0))})},n.prototype.remove=function(){this._clear()},n.prototype._clear=function(){this._newAdded=[],this.group.removeAll()},n}();const V=R;var N=function(n){f(e,n);function e(){var t=n!==null&&n.apply(this,arguments)||this;return t.type=e.type,t}return e.prototype.render=function(t,r,a){var o=t.getData(),i=this._updateSymbolDraw(o,t);i.updateData(o,{clipShape:this._getClipShape(t)}),this._finished=!0},e.prototype.incrementalPrepareRender=function(t,r,a){var o=t.getData(),i=this._updateSymbolDraw(o,t);i.incrementalPrepareUpdate(o),this._finished=!1},e.prototype.incrementalRender=function(t,r,a){this._symbolDraw.incrementalUpdate(t,r.getData(),{clipShape:this._getClipShape(r)}),this._finished=t.end===r.getData().count()},e.prototype.updateTransform=function(t,r,a){var o=t.getData();if(this.group.dirty(),!this._finished||o.count()>1e4)return{update:!0};var i=g("").reset(t,r,a);i.progress&&i.progress({start:0,end:o.count(),count:o.count()},o),this._symbolDraw.updateLayout(o)},e.prototype.eachRendered=function(t){this._symbolDraw&&this._symbolDraw.eachRendered(t)},e.prototype._getClipShape=function(t){var r=t.coordinateSystem,a=r&&r.getArea&&r.getArea();return t.get("clip",!0)?a:null},e.prototype._updateSymbolDraw=function(t,r){var a=this._symbolDraw,o=r.pipelineContext,i=o.large;return(!a||i!==this._isLargeDraw)&&(a&&a.remove(),a=this._symbolDraw=i?new V:new b,this._isLargeDraw=i,this.group.removeAll()),this.group.add(a.group),a},e.prototype.remove=function(t,r){this._symbolDraw&&this._symbolDraw.remove(!0),this._symbolDraw=null},e.prototype.dispose=function(){},e.type="scatter",e}(x);const B=N;function O(n){L(A),n.registerSeriesModel(z),n.registerChartView(B),n.registerLayout(g("scatter"))}export{O as i};