@mescius/wijmo.chart.interaction 5.20232.939
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMMERCIAL-LICENSE.html +485 -0
- package/README.md +363 -0
- package/es2015-commonjs.js +14 -0
- package/es2015-esm.js +14 -0
- package/es5-esm.js +14 -0
- package/index.d.ts +421 -0
- package/index.js +14 -0
- package/package.json +45 -0
package/es5-esm.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import{getElementRect,Point,setCss,removeClass,addClass,hasClass,createElement,Event,asNumber,asBoolean,copy,assert,isArray,toggleClass,isDate,asEnum,isIE,asType,_registerModule}from"@mescius/wijmo";import{FlexChartCore,FlexChart}from"@mescius/wijmo.chart";import*as selfModule from"@mescius/wijmo.chart.interaction";export var MouseAction;!function(t){t[t.Zoom=0]="Zoom";t[t.Pan=1]="Pan"}(MouseAction||(MouseAction={}));export var InteractiveAxes;!function(t){t[t.X=0]="X";t[t.Y=1]="Y";t[t.XY=2]="XY"}(InteractiveAxes||(InteractiveAxes={}));var ChartGestures=function(){function ChartGestures(t,e){this._chart=null;this._zoomEle=null;this._overlayEle=null;this._wrapperMousedown=null;this._wrapperMouseMove=null;this._wrapperMouseup=null;this._wrapperPointerdown=null;this._wrapperPointerMove=null;this._wrapperPointerup=null;this._wrapperTouchStart=null;this._wrapperTouchMove=null;this._wrapperTouchEnd=null;this._wrapperMouseWheel=null;this._startFirstPt=null;this._minX=null;this._maxX=null;this._minY=null;this._maxY=null;this._threadHold=20;this._clip={};this._selection={};this._startPointers=[];this._mvPointers=[];this._pinchStartEvents=[];this._minXRange=null;this._minYRange=null;this._innerUpdating=!1;this._lastMinX=null;this._lastMaxX=null;this._lastMinY=null;this._lastMaxY=null;this._mouseAction=MouseAction.Zoom;this._interactiveAxes=InteractiveAxes.X;this._enable=!0;this._scaleX=1;this._scaleY=1;this._posX=0;this._posY=0;t||assert(!1,"The FlexChart cannot be null.");this._chart=t;copy(this,e);this._initialize()}Object.defineProperty(ChartGestures.prototype,"mouseAction",{get:function(){return this._mouseAction},set:function(t){this._mouseAction=asEnum(t,MouseAction)},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"interactiveAxes",{get:function(){return this._interactiveAxes},set:function(t){t!==this._interactiveAxes&&(this._interactiveAxes=asEnum(t,InteractiveAxes))},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"enable",{get:function(){return this._enable},set:function(t){t!==this._enable&&(this._enable=asBoolean(t,!0))},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){if(t!==this._scaleX){this._scaleX=t<0?0:t>1?1:asNumber(t);this._seriesGroup&&this._initAxisRangeWithPosAndScale(!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){if(t!==this._scaleY){this._scaleY=t<0?0:t>1?1:asNumber(t);this._seriesGroup&&this._initAxisRangeWithPosAndScale(!1)}},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"posX",{get:function(){return this._posX},set:function(t){if(t!==this._posX){this._posX=t<0?0:t>1?1:asNumber(t);this._seriesGroup&&this._initAxisRangeWithPosAndScale(!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"posY",{get:function(){return this._posY},set:function(t){if(t!==this._posY){this._posY=t<0?0:t>1?1:asNumber(t);this._seriesGroup&&this._initAxisRangeWithPosAndScale(!1)}},enumerable:!0,configurable:!0});ChartGestures.prototype.remove=function(){if(this._zoomEle){this._chart.hostElement.removeChild(this._zoomEle);this._zoomEle=null}removeClass(this._chart.hostElement,ChartGestures._CSS_TOUCH_DISABLED);this._switchEvent(!1);this._wrapperMousedown=null;this._wrapperMouseMove=null;this._wrapperMouseup=null;this._wrapperPointerdown=null;this._wrapperPointerMove=null;this._wrapperPointerup=null;this._wrapperTouchStart=null;this._wrapperTouchMove=null;this._wrapperTouchEnd=null;this._wrapperMouseWheel=null};ChartGestures.prototype.reset=function(){var t=this._chart,e=t.axisX,i=t.axisY;t.beginUpdate();this._maxX&&(e.max=this._maxX);this._minX&&(e.min=this._minX);this._maxY&&(i.max=this._maxY);this._minY&&(i.min=this._minY);this._initAxisRangeWithPosAndScale(!0);this._initAxisRangeWithPosAndScale(!1);t.endUpdate()};ChartGestures.prototype._refreshChart=function(){var t=this._chart,e=t.axisX,i=t.axisY;this._minX=e._actualMin;this._maxX=e._actualMax;this._minY=i._actualMin;this._maxY=i._actualMax;this._minXRange=.005*(this._maxX-this._minX);this._minYRange=.005*(this._maxY-this._minY);this._initAxisRangeWithPosAndScale(!0);this._initAxisRangeWithPosAndScale(!1)};ChartGestures.prototype._initialize=function(){var t=this._chart.hostElement;this._zoomEle=createElement('<div class="'+ChartGestures._CSS_ZOOM+'"><div class="'+ChartGestures._CSS_ZOOM_OVERLAY+'"></div>');this._zoomEle.style.visibility="visible";t.appendChild(this._zoomEle);addClass(t,ChartGestures._CSS_TOUCH_DISABLED);this._overlayEle=this._zoomEle.querySelector("."+ChartGestures._CSS_ZOOM_OVERLAY);this._wrapperMousedown=this._onMousedown.bind(this);this._wrapperMouseMove=this._onMouseMove.bind(this);this._wrapperMouseup=this._onMouseup.bind(this);this._wrapperPointerdown=this._onPointerdown.bind(this);this._wrapperPointerMove=this._onPointerMove.bind(this);this._wrapperPointerup=this._onPointerup.bind(this);this._wrapperMouseWheel=this._onMouseWheel.bind(this);this._wrapperTouchStart=this._onTouchStart.bind(this);this._wrapperTouchMove=this._onTouchMove.bind(this);this._wrapperTouchEnd=this._onTouchEnd.bind(this);this._switchEvent(!0)};ChartGestures.prototype._switchEvent=function(t){var e=this._chart.hostElement,i=t?"addEventListener":"removeEventListener",s=t?"addHandler":"removeHandler";if(e){e[i]("mousedown",this._wrapperMousedown);e[i]("mousemove",this._wrapperMouseMove);document[i]("mouseup",this._wrapperMouseup);if("onpointerdown"in window){e[i]("pointerdown",this._wrapperPointerdown);e[i]("pointermove",this._wrapperPointerMove);document[i]("pointerup",this._wrapperPointerup)}e[i]("wheel",this._wrapperMouseWheel);if("ontouchstart"in window){e[i]("touchstart",this._wrapperTouchStart);e[i]("touchmove",this._wrapperTouchMove);document[i]("touchend",this._wrapperTouchEnd)}this._chart.rendered[s](this._refresh,this)}};ChartGestures.prototype._refresh=function(){var t,e,i,s=this._chart,n=s.axisX,a=s.axisY,r=s.hostElement;this._seriesGroup=r.querySelector(".wj-series-group");t=r.querySelector("."+FlexChart._CSS_PLOT_AREA);this._plotOffset=getElementRect(t);this._plotBox=t.getBBox();this._zoomEleOffset=getElementRect(this._zoomEle);this._overlayEle&&this._overlayEle.removeAttribute("style");if(this._innerUpdating)this._innerUpdating=!1;else{e=!1;i=!1;if(null===this._minX||isNaN(this._minX)||0===this._minX||-1===this._minX||this._lastMinX!==n._actualMin){this._minX=n._actualMin;null===this._minX||isNaN(this._minX)||0===this._minX||-1===this._minX||(e=!0)}if(null===this._maxX||isNaN(this._maxX)||0===this._maxX||-1===this._maxX||this._lastMaxX!==n._actualMax){this._maxX=n._actualMax;null===this._maxX||isNaN(this._maxX)||0===this._maxX||-1===this._maxX||(e=!0)}if(null===this._minY||isNaN(this._minY)||this._lastMinY!==a._actualMin){this._minY=a._actualMin;isNaN(this._minY)||(i=!0)}if(null===this._maxY||isNaN(this._maxY)||this._lastMaxY!==a._actualMax){this._maxY=a._actualMax;isNaN(this._maxY)||(i=!0)}this._minXRange=.005*(this._maxX-this._minX);this._minYRange=.005*(this._maxY-this._minY);e&&null!==this._scaleX&&void 0!==this._scaleX&&1!==this._scaleX&&null!==this._posX&&void 0!==this._posX&&0!==this._posX&&this._initAxisRangeWithPosAndScale(!0);i&&null!==this._scaleY&&void 0!==this._scaleY&&1!==this._scaleY&&null!==this._posY&&void 0!==this._posY&&0!==this._posY&&this._initAxisRangeWithPosAndScale(!1)}};ChartGestures.prototype._onMousedown=function(t){if(this._enable){this._disabledOthersInteraction(!0);this._mouseDown(t);t.preventDefault()}};ChartGestures.prototype._onMouseMove=function(t){if(this._enable){this._mouseMove(t);t.preventDefault()}};ChartGestures.prototype._onMouseup=function(t){if(this._enable){this._mouseup(t);this._disabledOthersInteraction(!1)}};ChartGestures.prototype._onMouseWheel=function(t){var e=-t.deltaY>0?.05:-.05;if(this._enable){this._scaling=!0;this._interactiveAxes!==InteractiveAxes.X&&this._interactiveAxes!==InteractiveAxes.XY||this._updateAxisByChg(!0,e,-e);this._interactiveAxes!==InteractiveAxes.Y&&this._interactiveAxes!==InteractiveAxes.XY||this._updateAxisByChg(!1,e,-e);this._scaling=!1;t.preventDefault()}};ChartGestures.prototype._focus=function(){if(isIE()){var t=document.activeElement;if(t){var e=t.tagName.toLowerCase();("input"===e&&"text"===t.type||"textarea"===e)&&t.setSelectionRange(0,0)}this._chart.focus()}else this._chart.focus()};ChartGestures.prototype._mouseDown=function(t){this._focus();this._startFirstPt=this._getPoint(t);this._updatePoint(this._startFirstPt);if(this._mouseAction===MouseAction.Zoom)this._initOverlay();else{this._seriesGroup.setAttribute("clip-path","url(#"+this._chart._plotrectId+")");toggleClass(this._chart.hostElement,ChartGestures._CSS_PANABLE,this._mouseAction===MouseAction.Pan)}};ChartGestures.prototype._mouseMove=function(t){var e;if(this._startFirstPt){e=this._getPoint(t);this._updatePoint(e);this._endPoint=new Point(e.x,e.y);if(this._mouseAction===MouseAction.Zoom)this._updateOverLay(e);else{this._panning=!0;this._panningChart(e.x-this._startFirstPt.x,e.y-this._startFirstPt.y)}}};ChartGestures.prototype._mouseup=function(t){var e=this._endPoint;this._chart.axisX;if(this._startFirstPt&&e){if(this._mouseAction===MouseAction.Zoom){this._zoomedChart(e);this._reset()}else{this._pannedChart(e.x-this._startFirstPt.x,e.y-this._startFirstPt.y);this._reset()}removeClass(this._chart.hostElement,ChartGestures._CSS_PANABLE)}else{removeClass(this._chart.hostElement,ChartGestures._CSS_PANABLE);this._reset()}};ChartGestures.prototype._onPointerdown=function(t){if(this._enable){this._disabledOthersInteraction(!0);switch(t.pointerType){case"touch":this._pointerDown(t);break;case"mouse":this._mouseDown(t)}t.preventDefault()}};ChartGestures.prototype._onPointerMove=function(t){if(this._enable){switch(t.pointerType){case"touch":this._pointerMove(t);break;case"mouse":this._mouseMove(t)}t.preventDefault()}};ChartGestures.prototype._onPointerup=function(t){if(this._enable){switch(t.pointerType){case"touch":this._pointerUp(t);break;case"mouse":this._mouseup(t)}this._disabledOthersInteraction(!1);t.preventDefault()}};ChartGestures.prototype._pointerDown=function(t){this._focus();t.preventManipulation&&t.preventManipulation();this._seriesGroup.setAttribute("clip-path","url(#"+this._chart._plotrectId+")");this._startPointers.push({id:t.pointerId,x:t.pageX,y:t.pageY});if(1===this._startPointers.length){this._scaling=!1;this._panning=!0}else if(2===this._startPointers.length){this._panning=!1;this._scaling=!0;this._startDistance={x:this._startPointers[0].x-this._startPointers[1].x,y:this._startPointers[0].y-this._startPointers[1].y}}};ChartGestures.prototype._pointerMove=function(t){var e,i,s,n,a=new Point(t.pageX,t.pageY),r={},h={};t.preventManipulation&&t.preventManipulation();if(this._panning){if(!this._pointInPlotArea(a))return;this._endPoint=new Point(t.pageX,t.pageY);this._panningChart(this._endPoint.x-this._startPointers[0].x,this._endPoint.y-this._startPointers[0].y)}else if(this._scaling){e=this._startPointers[0].id+"";i=this._startPointers[1].id+"";this._mvPointers[t.pointerId+""]={x:t.pageX,y:t.pageY};if(this._mvPointers[e]&&this._mvPointers[i]){if(Math.abs(this._startDistance.x)>this._threadHold&&this._interactiveAxes!==InteractiveAxes.Y){s=this._mvPointers[e].x-this._plotOffset.left;n=this._startPointers[0].x-this._plotOffset.left;h.x=Math.abs((this._mvPointers[e].x-this._mvPointers[i].x)/this._startDistance.x);r.x=s-h.x*n;this._clip.x=(this._plotBox.x-s)/h.x+n;this._selection.w=this._plotBox.width/h.x}if(Math.abs(this._startDistance.y)>this._threadHold&&this._interactiveAxes!==InteractiveAxes.X){s=this._mvPointers[e].y-this._plotOffset.top;n=this._startPointers[0].y-this._plotOffset.top;h.y=Math.abs((this._mvPointers[e].y-this._mvPointers[i].y)/this._startDistance.y);r.y=s-h.y*n;this._clip.y=(this._plotBox.y-s)/h.y+n;this._selection.h=this._plotBox.height/h.y}this._scalingChart(h,r)}}};ChartGestures.prototype._pointerUp=function(t){t.preventManipulation&&t.preventManipulation();if(this._panning){this._endPoint&&this._pannedChart(this._endPoint.x-this._startPointers[0].x,this._endPoint.y-this._startPointers[0].y);this._reset()}else if(this._scaling){this._scaledChart(t);this._reset()}};ChartGestures.prototype._onTouchStart=function(t){if(this._enable){this._disabledOthersInteraction(!0);if(1==t.touches.length){this._scaling=!1;this._panning=!0;this._startFirstPt=this._getPoint(t)}else if(2==t.touches.length){this._pinchStartEvents=this._getTouchPair(t);this._startDistance=this._touchDistance(t);this._panning=!1;this._scaling=!0}this._seriesGroup&&this._seriesGroup.setAttribute("clip-path","url(#"+this._chart._plotrectId+")");this._chart._hideToolTip();return!0}};ChartGestures.prototype._onTouchMove=function(t){if(this._enable){var e,i,s,n,a,r={},h={},o=t.touches[0],_=new Point(o.pageX,o.pageY);t.preventDefault();if(this._panning){if(this._startFirstPt){if(!this._pointInPlotArea(_))return;this._endPoint=new Point(o.pageX,o.pageY);this._panningChart(this._endPoint.x-this._startFirstPt.x,this._endPoint.y-this._startFirstPt.y)}}else if(this._scaling){s=this._touchDistance(t);n=this._getTouchPair(t)[0];a=this._pinchStartEvents[0];if(Math.abs(this._startDistance.x)>this._threadHold&&this._interactiveAxes!==InteractiveAxes.Y){e=n.pageX-this._plotOffset.left;i=a.pageX-this._plotOffset.left;r.x=Math.abs(s.x/this._startDistance.x);h.x=e-r.x*i;this._clip.x=(this._plotBox.x-e)/r.x+i;this._selection.w=this._plotBox.width/r.x}if(Math.abs(this._startDistance.y)>this._threadHold&&this._interactiveAxes!==InteractiveAxes.X){e=n.pageY-this._plotOffset.top;i=a.pageY-this._plotOffset.top;r.y=Math.abs(s.y/this._startDistance.y);h.y=e-r.y*i;this._clip.y=(this._plotBox.y-e)/r.y+i;this._selection.h=this._plotBox.height/r.y}this._scalingChart(r,h)}return!0}};ChartGestures.prototype._onTouchEnd=function(t){if(this._enable){var e=this._endPoint;if(this._panning){if(!this._startFirstPt||!e){this._reset();return}this._pannedChart(e.x-this._startFirstPt.x,e.y-this._startFirstPt.y)}else this._scaling&&this._scaledChart(t);this._reset();this._disabledOthersInteraction(!1);return!0}};ChartGestures.prototype._initOverlay=function(){this._zoomEle.style.visibility="visible";switch(this._interactiveAxes){case InteractiveAxes.X:this._overlayEle.style.left=this._startFirstPt.x-this._zoomEleOffset.left+"px";this._overlayEle.style.top=this._plotOffset.top-this._zoomEleOffset.top+"px";break;case InteractiveAxes.Y:this._overlayEle.style.left=this._plotBox.x+"px";this._overlayEle.style.top=this._startFirstPt.y-this._zoomEleOffset.top+"px";break;case InteractiveAxes.XY:this._overlayEle.style.left=this._startFirstPt.x-this._zoomEleOffset.left+"px";this._overlayEle.style.top=this._startFirstPt.y-this._zoomEleOffset.top+"px"}};ChartGestures.prototype._updateOverLay=function(t){var e=this._startFirstPt.x-t.x,i=this._startFirstPt.y-t.y,s={};switch(this._interactiveAxes){case InteractiveAxes.X:if(Math.abs(e)<this._threadHold)return;s=e<=0?{width:Math.abs(e)+"px",height:this._plotBox.height+"px"}:{left:t.x-this._zoomEleOffset.left+"px",width:e+"px",height:this._plotBox.height+"px"};break;case InteractiveAxes.Y:if(Math.abs(i)<this._threadHold)return;s=i<=0?{height:Math.abs(i)+"px",width:this._plotBox.width+"px"}:{top:t.y-this._zoomEleOffset.top+"px",height:i+"px",width:this._plotBox.width+"px"};break;case InteractiveAxes.XY:if(Math.abs(e)>=this._threadHold){s.width=Math.abs(e)+"px";e>0&&(s.left=t.x-this._zoomEleOffset.left+"px")}if(Math.abs(i)>=this._threadHold){s.height=Math.abs(i)+"px";i>0&&(s.top=t.y-this._zoomEleOffset.top+"px")}}setCss(this._overlayEle,s)};ChartGestures.prototype._updatePoint=function(t){var e=this._plotOffset;t.x<e.left&&(t.x=e.left);t.x>e.left+e.width&&(t.x=e.left+e.width);t.y<e.top&&(t.y=e.top);t.y>e.top+e.height&&(t.y=e.top+e.height)};ChartGestures.prototype._pointInPlotArea=function(t){var e=this._plotOffset;return t.x>=e.left&&t.x<=e.left+e.width&&t.y>=e.top&&t.y<=e.top+e.height};ChartGestures.prototype._zoomedChart=function(t){if(t){this._interactiveAxes!==InteractiveAxes.X&&this._interactiveAxes!==InteractiveAxes.XY||this._zoomedAxis(t,!0);this._interactiveAxes!==InteractiveAxes.Y&&this._interactiveAxes!==InteractiveAxes.XY||this._zoomedAxis(t,!1);this._startFirstPt=null}};ChartGestures.prototype._zoomedAxis=function(t,e){var i,s,n=e?this._chart.axisX:this._chart.axisY,a=e?"x":"y",r=e?"left":"top";if(t&&Math.abs(this._startFirstPt[a]-t[a])>this._threadHold){i=n.convertBack(this._startFirstPt[a]-this._plotOffset[r]+this._plotBox[a]);(s=n.convertBack(t[a]-this._plotOffset[r]+this._plotBox[a]))-i!=0&&this._updateAxisRange(n,Math.min(i,s),Math.max(i,s))}};ChartGestures.prototype._panningChart=function(t,e){var i=this._chart.axisX,s=this._chart.axisY,n=this._getTransFormGroups();t=Math.abs(t)<this._threadHold?0:t;e=Math.abs(e)<this._threadHold?0:e;this._interactiveAxes===InteractiveAxes.X&&(e=0);this._interactiveAxes===InteractiveAxes.Y&&(t=0);var a=i.reversed?-t:t;a>0&&i.actualMin.valueOf()===this._minX&&(t=0);a<0&&i.actualMax.valueOf()===this._maxX&&(t=0);var r=s.reversed?-e:e;r>0&&s.actualMax.valueOf()===this._maxY&&(e=0);r<0&&s.actualMin.valueOf()===this._minY&&(e=0);for(var h=0;h<n.length;h++)n[h].setAttribute("transform","translate("+t+","+e+")")};ChartGestures.prototype._pannedChart=function(t,e){this._interactiveAxes!==InteractiveAxes.X&&this._interactiveAxes!==InteractiveAxes.XY||this._updateAxisByDistance(!0,t);this._interactiveAxes!==InteractiveAxes.Y&&this._interactiveAxes!==InteractiveAxes.XY||this._updateAxisByDistance(!1,-e)};ChartGestures.prototype._scalingChart=function(t,e){var i,s,n,a=this._chart.axisX,r=this._chart.axisY,h=void 0!==e.x?e.x:0,o=void 0!==e.y?e.y:0;if(t){i=this._getTransFormGroups();if(void 0!==t.x&&t.x<1&&a.actualMin.valueOf()===this._minX&&a.actualMax.valueOf()===this._maxX){t.x=1;h=0}if(void 0!==t.y&&t.y<1&&r.actualMin.valueOf()===this._minY&&r.actualMax.valueOf()===this._maxY){t.y=1;o=0}s=void 0!==t.x?t.x:1;n=void 0!==t.y?t.y:1;for(var _=0;_<i.length;_++)i[_].setAttribute("transform","translate("+h+", "+o+") scale("+s+", "+n+")")}};ChartGestures.prototype._scaledChart=function(t){var e,i,s=this._chart,n=s.axisX,a=s.axisY;if(this._clip){if(this._interactiveAxes!==InteractiveAxes.Y&&void 0!==this._clip.x){if((e=Math.max(this._minX,n.convertBack(this._clip.x)))>(i=Math.min(this._maxX,n.convertBack(this._clip.x+this._selection.w)))){var r=e;e=i;i=r}e-i!=0&&this._updateAxisRange(n,e,i)}if(this._interactiveAxes!==InteractiveAxes.X&&void 0!==this._clip.y){i=Math.min(this._maxY,a.convertBack(this._clip.y));if((e=Math.max(this._minY,a.convertBack(this._clip.y+this._selection.h)))>i){r=e;e=i;i=r}e-i!=0&&this._updateAxisRange(a,e,i)}}};ChartGestures.prototype._updateAxisByDistance=function(t,e){var i,s=t?this._chart.axisX:this._chart.axisY,n=t?this._minX:this._minY,a=t?this._maxX:this._maxY,r=s.actualMin.valueOf(),h=s.actualMax.valueOf();if(0!==e){var o=s.reversed?-e:e;if(o>0&&n===r||o<0&&a===h){this._innerUpdating=!0;this._chart.invalidate()}else{i=e/(t?this._plotBox.width:this._plotBox.height);this._updateAxisByChg(t,-i,-i)}}};ChartGestures.prototype._updateAxisByChg=function(t,e,i){var s,n,a=t?this._chart.axisX:this._chart.axisY,r=t?this._minX:this._minY,h=t?this._maxX:this._maxY,o=a.actualMin.valueOf(),_=(a.actualMax.valueOf(),this._chart._plotRect),l=t?_.left:_.top,c=t?_.width:_.height,u=t?this._minXRange:this._minYRange;if(!isNaN(e)&&!isNaN(i)){if(this._panning){if(a.reversed)if(e<0)if((s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c))>h){s=h;n=t?a.convertBack(a.convert(s)+c):a.convertBack(a.convert(s)-c)}else n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c);else if((n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c))<r){n=r;s=t?a.convertBack(a.convert(n)-c):a.convertBack(a.convert(n)+c)}else s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c);else if(e<0)if((s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c))<r){s=r;n=t?a.convertBack(a.convert(s)+c):a.convertBack(a.convert(s)-c)}else n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c);else if((n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c))>h){n=h;s=t?a.convertBack(a.convert(n)-c):a.convertBack(a.convert(n)+c)}else s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c);if(s>n){var p=s;s=n;n=p}}else if(this._scaling){if((s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c))>(n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c))){p=s;s=n;n=p}s<r&&(s=r);n>h&&(n=h);n-s<u&&(s=n-u)}this._updateAxisRange(a,s,n)}};ChartGestures.prototype._initAxisRangeWithPosAndScale=function(t){var e,i,s,n;if(t){e=this._maxX-this._minX;if(!isNaN(e)){i=e*this._scaleX;n=(s=this._minX+this._posX*(e-i))+i;this._innerUpdating=!0;this._chart.axisX.min=s;this._chart.axisX.max=n;this._lastMinX=s;this._lastMaxX=n}}else{e=this._maxY-this._minY;if(!isNaN(e)){i=e*this._scaleY;n=(s=this._minY+this._posY*(e-i))+i;this._innerUpdating=!0;this._chart.axisY.min=s;this._chart.axisY.max=n;this._lastMinY=s;this._lastMaxY=n}}};ChartGestures.prototype._updateAxisRange=function(t,e,i){this._chart.beginUpdate();t.min=e;t.max=i;if(t===this._chart.axisX){this._lastMinX=e;this._lastMaxX=i}else{this._lastMinY=e;this._lastMaxY=i}this._innerUpdating=!0;this._chart.endUpdate()};ChartGestures.prototype._reset=function(){this._scaling=!1;this._panning=!1;this._startDistance=0;this._startFirstPt=null;this._pinchStartEvents=[];this._startPointers=[];this._mvPointers=[];this._endPoint=null;this._clip={};this._selection={}};ChartGestures.prototype._getTransFormGroups=function(){var t=this._seriesGroup.querySelectorAll("g[clip-path]");0===t.length&&(t=this._seriesGroup.querySelectorAll("g"));return t};ChartGestures.prototype._disabledOthersInteraction=function(t){var e=this._chart.hostElement;if(null!=e)for(var i=e.querySelectorAll(".wj-chart-linemarker-container"),s=0;s<i.length;s++)t?addClass(i[s],ChartGestures._CSS_BLOCK_INTERACTION):removeClass(i[s],ChartGestures._CSS_BLOCK_INTERACTION)};ChartGestures.prototype._getPoint=function(t){return t instanceof MouseEvent?new Point(t.pageX,t.pageY):new Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY)};ChartGestures.prototype._getTouchPair=function(t){var e=[];if(isArray(t)){e[0]=t[0];e[1]=t[1]}else if("touchend"===t.type){if(1===t.touches.length){e[0]=t.touches[0];e[1]=t.changedTouches[0]}else if(0===t.touches.length){e[0]=t.changedTouches[0];e[1]=t.changedTouches[1]}}else{e[0]=t.touches[0];e[1]=t.touches[1]}return e};ChartGestures.prototype._touchDistance=function(t){var e=this._getTouchPair(t),i=0,s=0;e[0]&&void 0!==e[0].pageX&&e[1]&&void 0!==e[1].pageX&&(i=e[0].pageX-e[1].pageX);e[0]&&void 0!==e[0].pageY&&e[1]&&void 0!==e[1].pageY&&(s=e[0].pageY-e[1].pageY);return{x:i,y:s}};ChartGestures._CSS_ZOOM="wj-zoom";ChartGestures._CSS_ZOOM_OVERLAY="wj-zoom-overlay";ChartGestures._CSS_PANABLE="wj-panable";ChartGestures._CSS_TOUCH_DISABLED="wj-flexchart-touch-disabled";ChartGestures._CSS_BLOCK_INTERACTION="wj-block-other-interaction";return ChartGestures}();export{ChartGestures};var _RangeSlider=function(){function _RangeSlider(t,e,i,s){this._isVisible=!0;this._buttonsVisible=!0;this._minScale=0;this._maxScale=1;this._seamless=!1;this._rsContainer=null;this._rsEle=null;this._decBtn=null;this._incBtn=null;this._rsContent=null;this._minHandler=null;this._rangeHandler=null;this._maxHandler=null;this._wrapperSliderMousedown=null;this._wrapperDocMouseMove=null;this._wrapperDocMouseup=null;this._wrapperBtnMousedown=null;this._wrapperRangeSpaceMousedown=null;this._wrapperRangeMouseleave=null;this._isTouch=!1;this._slidingInterval=null;this._rangeSliderRect=null;this._isHorizontal=!0;this._isBtnMousedown=!1;this._needSpaceClick=!1;this._hasButtons=!0;this._movingEle=null;this._movingOffset=null;this._range=null;this._startPt=null;this._minPos=0;this._maxPos=1;this.rangeChanged=new Event;this.rangeChanging=new Event;t||assert(!1,"The container cannot be null.");this._isTouch="ontouchstart"in window;this._needSpaceClick=e;this._hasButtons=i;copy(this,s);this._createSlider(t)}Object.defineProperty(_RangeSlider.prototype,"buttonsVisible",{get:function(){return this._buttonsVisible},set:function(t){if(t!=this._buttonsVisible){this._buttonsVisible=asBoolean(t);if(!this._rsContainer||!this._hasButtons)return;this._refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"isHorizontal",{get:function(){return this._isHorizontal},set:function(t){if(t!=this._isHorizontal){this._isHorizontal=asBoolean(t);if(!this._rsContainer)return;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(t!=this._isVisible){this._isVisible=asBoolean(t);if(!this._rsContainer)return;this._rsContainer.style.visibility=this._isVisible?"visible":"hidden"}},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"minScale",{get:function(){return this._minScale},set:function(t){t>=0&&t!=this._minScale&&(this._minScale=asNumber(t))},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"maxScale",{get:function(){return this._maxScale},set:function(t){t>=0&&t!=this._maxScale&&(this._maxScale=asNumber(t))},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"seamless",{get:function(){return this._seamless},set:function(t){t!=this._seamless&&(this._seamless=asBoolean(t))},enumerable:!0,configurable:!0});_RangeSlider.prototype.onRangeChanged=function(t){this.rangeChanged.raise(this,t)};_RangeSlider.prototype.onRangeChanging=function(t){this.rangeChanging.raise(this,t)};Object.defineProperty(_RangeSlider.prototype,"_isSliding",{get:function(){return null!==this._startPt},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"_handleWidth",{get:function(){return this._minHandler.offsetWidth},enumerable:!0,configurable:!0});_RangeSlider.prototype._createSlider=function(t){var e=this._isHorizontal?_RangeSlider._HRANGESLIDER:_RangeSlider._VRANGESLIDER,i=this._isHorizontal?"wj-glyph-left":"wj-glyph-down",s=this._isHorizontal?"wj-glyph-right":"wj-glyph-up";this._rsContainer=t;this._rsContainer.style.visibility=this._isVisible?"visible":"hidden";this._rsEle=createElement('<div class="wj-chart-rangeslider '+e+'"></div>');this._rsContainer.appendChild(this._rsEle);if(this._hasButtons){this._decBtn=createElement('<button class="wj-rangeslider-decbtn wj-btn wj-btn-default" type="button" tabindex="-1"><span class="'+i+" "+_RangeSlider._RANGESLIDER_DECBTN+'"></span></button>');this._rsEle.appendChild(this._decBtn);this._incBtn=createElement('<button class="wj-rangeslider-incbtn wj-btn wj-btn-default" type="button" tabindex="-1"><span class="'+s+" "+_RangeSlider._RANGESLIDER_INCBTN+'"></span></button>');this._rsEle.appendChild(this._incBtn)}this._rsContent=createElement('<div class="wj-rangeslider-content"><div class="wj-rangeslider-rangehandle"></div><div class="wj-rangeslider-minhandle"></div><div class="wj-rangeslider-maxhandle"></div>');this._rsEle.appendChild(this._rsContent);this._minHandler=this._rsContent.querySelector("."+_RangeSlider._RANGESLIDER_MINHANDLE);this._rangeHandler=this._rsContent.querySelector("."+_RangeSlider._RANGESLIDER_RANGEHANDLE);this._maxHandler=this._rsContent.querySelector("."+_RangeSlider._RANGESLIDER_MAXHANDLE);this._wrapperSliderMousedown=this._onSliderMousedown.bind(this);this._wrapperDocMouseMove=this._onDocMouseMove.bind(this);this._wrapperDocMouseup=this._onDocMouseup.bind(this);this._wrapperRangeSpaceMousedown=this._onRangeSpaceMousedown.bind(this);this._wrapperRangeMouseleave=this._onRangeMouseleave.bind(this);this._wrapperBtnMousedown=this._onBtnMousedown.bind(this);this._switchEvent(!0)};_RangeSlider.prototype._switchEvent=function(t){var e=t?"addEventListener":"removeEventListener";if(this._rsContainer){this._needSpaceClick&&this._rsEle[e]("mousedown",this._wrapperRangeSpaceMousedown);this._rsEle[e]("mouseleave",this._wrapperRangeMouseleave);this._rsContent[e]("mousedown",this._wrapperSliderMousedown);if(this._hasButtons){this._decBtn[e]("mousedown",this._wrapperBtnMousedown);this._incBtn[e]("mousedown",this._wrapperBtnMousedown)}document[e]("mousemove",this._wrapperDocMouseMove);document[e]("mouseup",this._wrapperDocMouseup);if("ontouchstart"in window){this._needSpaceClick&&this._rsEle[e]("touchstart",this._wrapperRangeSpaceMousedown);this._rsContent[e]("touchstart",this._wrapperSliderMousedown);if(this._hasButtons){this._decBtn[e]("touchstart",this._wrapperBtnMousedown);this._incBtn[e]("touchstart",this._wrapperBtnMousedown)}document[e]("touchmove",this._wrapperDocMouseMove);document[e]("touchend",this._wrapperDocMouseup)}}};_RangeSlider.prototype._onSliderMousedown=function(t){if(this._isVisible){var e=getElementRect(this._rsContent);this._plotBox={x:e.left,y:e.top,width:e.width,height:e.height};this._movingEle=t.srcElement||t.target;this._startPt=t instanceof MouseEvent?new Point(t.pageX,t.pageY):new Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY);removeClass(this._minHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);removeClass(this._maxHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);this._movingOffset=getElementRect(this._movingEle);if(this._movingEle!=this._rangeHandler){this._isHorizontal?this._movingOffset.left+=.5*this._movingEle.offsetWidth:this._movingOffset.top+=.5*this._movingEle.offsetHeight;addClass(this._movingEle,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE)}else this._range=this._maxPos-this._minPos;t.preventDefault()}};_RangeSlider.prototype._onDocMouseMove=function(t){if(this._isVisible&&this._startPt){var e=t instanceof MouseEvent?new Point(t.pageX,t.pageY):new Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY);this._onMove(e)}};_RangeSlider.prototype._onMove=function(t){var e,i=this._startPt,s=this._movingOffset,n=this._plotBox,a=this._range,r=this._movingEle,h=this._minHandler,o=this._rangeHandler,_=this._maxHandler;if(i&&s){(e=this._isHorizontal?(s.left+t.x-i.x-n.x)/n.width:1-(s.top+t.y-i.y-n.y)/n.height)<0?e=0:e>1&&(e=1);if(r===h)if(this._seamless&&0===this._minScale&&e>=this._maxPos){this._minPos=this._maxPos;this._movingEle=_;removeClass(this._minHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);addClass(this._maxHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE)}else{e>this._maxPos-this._minScale&&(e=this._maxPos-this._minScale);e<this._maxPos-this._maxScale&&(e=this._maxPos-this._maxScale);this._minPos=e}else if(r===_)if(this._seamless&&0===this._minScale&&e<=this._minPos){this._maxPos=this._minPos;this._movingEle=h;removeClass(this._maxHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);addClass(this._minHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE)}else{e<this._minPos+this._minScale&&(e=this._minPos+this._minScale);e>this._minPos+this._maxScale&&(e=this._minPos+this._maxScale);this._maxPos=e}else if(r===o)if(this._isHorizontal){this._minPos=e;this._maxPos=this._minPos+a;if(this._maxPos>=1){this._maxPos=1;this._minPos=this._maxPos-a}}else{this._maxPos=e;this._minPos=this._maxPos-a;if(this._minPos<=0){this._minPos=0;this._maxPos=this._minPos+a}}this._updateElesPosition();this.onRangeChanging()}};_RangeSlider.prototype._onDocMouseup=function(t){if(this._isVisible){this._clearInterval();this._isBtnMousedown=!1;if(this._startPt){this.onRangeChanged();this._startPt=null;this._movingOffset=null}removeClass(this._minHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);removeClass(this._maxHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE)}};_RangeSlider.prototype._onRangeSpaceMousedown=function(t){var e=t instanceof MouseEvent?new Point(t.pageX,t.pageY):new Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY),i=getElementRect(this._rsContent),s=getElementRect(this._rangeHandler),n=t.srcElement||t.target,a=0;t.stopPropagation();t.preventDefault();if(n===this._rsContent||n===this._rsEle){if(this._isHorizontal){a=s.width/i.width;e.x<s.left?a*=-1:e.x>s.left+s.width&&(a*=1)}else{a=s.height/i.height;e.y<s.top?a*=1:e.y>s.top+s.height&&(a*=-1)}0!==a&&this._doSliding(a,e)}};_RangeSlider.prototype._onRangeMouseleave=function(t){t.stopPropagation();t.preventDefault();if(this._isBtnMousedown){this._clearInterval();this.onRangeChanged()}};_RangeSlider.prototype._onBtnMousedown=function(t){var e=t.srcElement||t.target,i=0;t.stopPropagation();t.preventDefault();if(hasClass(e,_RangeSlider._RANGESLIDER_DECBTN)){if(0===this._minPos)return;i=-.05}else if(hasClass(e,_RangeSlider._RANGESLIDER_INCBTN)){if(1===this._maxPos)return;i=.05}this._isBtnMousedown=!0;0!==i&&this._doSliding(i)};_RangeSlider.prototype._refresh=function(t){var e,i,s=0,n=getElementRect(this._rsContainer);t&&(this._rangeSliderRect=t);if(this._rangeSliderRect){if(this._hasButtons&&this._buttonsVisible){this._decBtn.style.display="block";this._incBtn.style.display="block";s=this._isHorizontal?this._decBtn.offsetWidth+this._minHandler.offsetWidth/2:this._decBtn.offsetHeight+this._minHandler.offsetHeight/2}else{if(this._hasButtons){this._decBtn.style.display="none";this._incBtn.style.display="none"}s=this._isHorizontal?this._minHandler.offsetWidth/2:this._minHandler.offsetHeight/2}e=this._getRsRect();if(this._isHorizontal){e.left-=this._minHandler.offsetWidth/2;e.width+=this._minHandler.offsetWidth;i={left:s,width:e.width-2*s}}else{e.top-=this._minHandler.offsetHeight/2;e.height+=this._minHandler.offsetHeight;i={top:s,height:e.height-2*s}}setCss(this._rsEle,e);setCss(this._rsContent,i);n=getElementRect(this._rsContent);this._plotBox={x:n.left,y:n.top,width:n.width,height:n.height};this._updateElesPosition()}};_RangeSlider.prototype._updateElesPosition=function(){var t,e,i,s=this._minHandler,n=(this._rangeHandler,this._maxHandler),a=this._plotBox,r=this._isHorizontal;if(a){t=r?{left:this._minPos*a.width-.5*s.offsetWidth}:{top:(1-this._minPos)*a.height-.5*n.offsetHeight};e=r?{left:this._minPos*a.width,width:(this._maxPos-this._minPos)*a.width}:{top:(1-this._maxPos)*a.height,height:(this._maxPos-this._minPos)*a.height};i=r?{left:this._maxPos*a.width-.5*n.offsetWidth}:{top:(1-this._maxPos)*a.height-.5*s.offsetHeight};this._refreshSlider(t,e,i)}};_RangeSlider.prototype._refreshSlider=function(t,e,i){setCss(this._minHandler,t);setCss(this._rangeHandler,e);setCss(this._maxHandler,i)};_RangeSlider.prototype._invalidate=function(){var t,e;if(this._rsContainer){t=this._isHorizontal?_RangeSlider._HRANGESLIDER:_RangeSlider._VRANGESLIDER;e=this._isHorizontal?_RangeSlider._VRANGESLIDER:_RangeSlider._HRANGESLIDER;removeClass(this._rsEle,e);addClass(this._rsEle,t);[this._rsEle,this._rsContent,this._minHandler,this._maxHandler,this._rangeHandler].forEach((function(t){t.removeAttribute("style")}));this._refresh()}};_RangeSlider.prototype._changeRange=function(t){var e=this._maxPos-this._minPos;if(!(t<0&&0===this._minPos||t>0&&1===this._maxPos)){if(t<0){this._minPos+=t;this._minPos=this._minPos<0?0:this._minPos;this._maxPos=this._minPos+e}else{this._maxPos+=t;this._maxPos=this._maxPos>1?1:this._maxPos;this._minPos=this._maxPos-e}this._updateElesPosition()}};_RangeSlider.prototype._doSliding=function(t,e){getElementRect(this._rsContent),getElementRect(this._rangeHandler);this._clearInterval();this._startPt=new Point;this._changeRange(t);this.onRangeChanged();this._setSlidingInterval(t,e)};_RangeSlider.prototype._setSlidingInterval=function(t,e){var i,s=this;this._slidingInterval=window.setInterval((function(){if(e){getElementRect(s._rsContent);i=getElementRect(s._rangeHandler);if(s._isHorizontal){if(e.x>=i.left&&e.x<=i.left+i.width){s._clearInterval();return}}else if(e.y>=i.top&&e.y<=i.top+i.height){s._clearInterval();return}}s._changeRange(t);s.onRangeChanged()}),200)};_RangeSlider.prototype._clearInterval=function(){this._slidingInterval&&window.clearInterval(this._slidingInterval)};_RangeSlider.prototype._getRsRect=function(){var t=this._rangeSliderRect,e={};if(t){["left","top","width","height"].forEach((function(i){t[i]&&(e[i]=t[i])}));return e}};_RangeSlider._HRANGESLIDER="wj-chart-hrangeslider";_RangeSlider._VRANGESLIDER="wj-chart-vrangeslider";_RangeSlider._RANGESLIDER_DECBTN="wj-rangeslider-decbtn";_RangeSlider._RANGESLIDER_INCBTN="wj-rangeslider-incbtn";_RangeSlider._RANGESLIDER_RANGEHANDLE="wj-rangeslider-rangehandle";_RangeSlider._RANGESLIDER_MINHANDLE="wj-rangeslider-minhandle";_RangeSlider._RANGESLIDER_MAXHANDLE="wj-rangeslider-maxhandle";_RangeSlider._RANGESLIDER_HANDLE_ACTIVE="wj-rangeslider-handle-active";return _RangeSlider}();export{_RangeSlider};export var Orientation;!function(t){t[t.X=0]="X";t[t.Y=1]="Y"}(Orientation||(Orientation={}));var RangeSelector=function(){function RangeSelector(t,e){this._isVisible=!0;this._orientation=Orientation.X;this._seamless=!1;this._minScale=0;this._maxScale=1;this.rangeChanged=new Event;this._chart=asType(t,FlexChartCore,!1);this._createRangeSelector();copy(this,e)}Object.defineProperty(RangeSelector.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(t!=this._isVisible){this._isVisible=asBoolean(t);this._rangeSlider&&(this._rangeSlider.isVisible=t)}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"min",{get:function(){return this._min},set:function(t){if((t=asNumber(t,!0,!1))!=this._min){var e=!1;if(null==t||void 0===t||isNaN(t)||null==this._max){this._min=t;e=!0}else if(t<=this._max||void 0===this._max){this._min=t;e=!0}this._rangeSlider&&e&&this._changeRange()}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"max",{get:function(){return this._max},set:function(t){if((t=asNumber(t,!0,!1))!=this._max){var e=!1;if(null==t||isNaN(t)){this._max=t;e=!0}else if(t>=this._min||void 0===this._min){this._max=t;e=!0}this._rangeSlider&&e&&this._changeRange()}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"orientation",{get:function(){return this._orientation},set:function(t){if((t=asEnum(t,Orientation))!==this._orientation){this._orientation=t;this._rangeSlider&&(this._rangeSlider.isHorizontal=t==Orientation.X)}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"seamless",{get:function(){return this._seamless},set:function(t){if((t=asBoolean(t,!0))!=this._seamless){this._seamless=t;this._rangeSlider&&(this._rangeSlider.seamless=t)}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"minScale",{get:function(){return this._minScale},set:function(t){if((t=asNumber(t))<=1&&t>=0&&t!=this._minScale&&t<this._maxScale){this._minScale=t;if(this._rangeSlider){this._rangeSlider.minScale=asNumber(t);this._updateMinAndMaxWithScale(!0)}}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"maxScale",{get:function(){return this._maxScale},set:function(t){if((t=asNumber(t))<=1&&t>=0&&t!=this._maxScale&&t>this._minScale){this._maxScale=t;if(this._rangeSlider){this._rangeSlider.maxScale=asNumber(t);this._updateMinAndMaxWithScale(!0)}}},enumerable:!0,configurable:!0});RangeSelector.prototype.remove=function(){if(this._rangeSelectorEle){this._chart.hostElement.removeChild(this._rangeSelectorEle);this._switchEvent(!1);this._rangeSelectorEle=null;this._rangeSlider=null}};RangeSelector.prototype.onRangeChanged=function(t){this.rangeChanged.raise(this,t)};RangeSelector.prototype._createRangeSelector=function(){var t=this._chart.hostElement,e=this._orientation===Orientation.X;this._rangeSelectorEle=createElement('<div class="wj-chart-rangeselector-container"></div>');this._rangeSlider=new _RangeSlider(this._rangeSelectorEle,!1,!1,{isHorizontal:e,isVisible:this._isVisible,seamless:this._seamless});t.appendChild(this._rangeSelectorEle);this._switchEvent(!0)};RangeSelector.prototype._switchEvent=function(t){var e=t?"addHandler":"removeHandler";if(this._chart.hostElement){this._rangeSlider.rangeChanged[e](this._updateRange,this);this._chart.rendered[e](this._refresh,this)}};RangeSelector.prototype._refresh=function(){var t,e,i,s=this._chart.hostElement,n=getElementRect(this._rangeSelectorEle);t=s.querySelector("."+FlexChart._CSS_PLOT_AREA);e=getElementRect(t);if((i=t.getBBox())&&i.width&&i.height){this._adjustMinAndMax();this._rangeSlider._refresh({left:i.x,top:e.top-n.top,width:i.width,height:i.height})}};RangeSelector.prototype._adjustMinAndMax=function(){var t=this._chart,e=this._rangeSlider,i=this._min,s=this._max,n=this._orientation===Orientation.X?t.axisX:t.axisY,a=isDate(n.actualMin)?n.actualMin.valueOf():n.actualMin,r=isDate(n.actualMax)?n.actualMax.valueOf():n.actualMax;this._min=null===i||isNaN(i)||void 0===i||i<a||i>r?a:i;this._max=null===s||isNaN(s)||void 0===s||s<a||s>r?r:s;var h=this._chart._plotRect;if(h){var o=void 0,_=void 0;if(this._orientation===Orientation.X){o=(n.convert(this._min)-h.left)/h.width;_=(n.convert(this._max)-h.left)/h.width}else{o=(h.top-n.convert(this._min))/h.height+1;_=(h.top-n.convert(this._max))/h.height+1}e._minPos=isNaN(o)?0:o;e._maxPos=isNaN(_)?1:_;this._updateMinAndMaxWithScale(!1)}};RangeSelector.prototype._updateMinAndMaxWithScale=function(t){var e,i=this._rangeSlider,s=!1;if(0!==this._minScale&&i._minPos+this._minScale>i._maxPos){if((e=i._minPos+this._minScale)>1){i._maxPos=1;i._minPos=1-this._minScale}else i._maxPos=e;s=!0}if(1!==this._maxScale&&i._minPos+this._maxScale<i._maxPos){if((e=i._minPos+this._maxScale)>1){i._maxPos=1;i._minPos=1-this._maxScale}else i._maxPos=e;s=!0}if(s){var n=this._getMinAndMax();this._min=n.min;this._max=n.max;if(t&&this._rangeSelectorEle){this._rangeSlider._refresh();this.onRangeChanged()}}};RangeSelector.prototype._changeRange=function(){this._adjustMinAndMax();if(this._rangeSelectorEle){this._rangeSlider._refresh();this.onRangeChanged()}};RangeSelector.prototype._updateRange=function(){var t;this._rangeSlider;t=this._chart;this._orientation===Orientation.X?t.axisX:t.axisY;var e=this._getMinAndMax();this._min=e.min;this._max=e.max;this.onRangeChanged()};RangeSelector.prototype._getMinAndMax=function(){var t=this._rangeSlider,e=this._chart,i=e._plotRect,s=null,n=null;if(i)if(this._orientation===Orientation.X){s=e.axisX.convertBack(i.left+t._minPos*i.width);n=e.axisX.convertBack(i.left+t._maxPos*i.width)}else{s=e.axisY.convertBack(i.top+(1-t._minPos)*i.height);n=e.axisY.convertBack(i.top+(1-t._maxPos)*i.height)}return{min:s,max:n}};return RangeSelector}();export{RangeSelector};_registerModule("wijmo.chart.interaction",selfModule);
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* {@module wijmo.chart.interaction}
|
|
15
|
+
* Defines classes that add interactive features to charts.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export declare var ___keepComment: any;
|
|
21
|
+
import { Point, Event, EventArgs } from '@grapecity/wijmo';
|
|
22
|
+
import { FlexChartCore } from '@grapecity/wijmo.chart';
|
|
23
|
+
import * as selfModule from '@grapecity/wijmo.chart.interaction';
|
|
24
|
+
/**
|
|
25
|
+
* Specifies the mouse action of the chart gestures.
|
|
26
|
+
*/
|
|
27
|
+
export declare enum MouseAction {
|
|
28
|
+
/** Zoom chart by mouse. */
|
|
29
|
+
Zoom = 0,
|
|
30
|
+
/** Pan chart by mouse. */
|
|
31
|
+
Pan = 1
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Specifies the interactive axes of the chart gestures.
|
|
35
|
+
*/
|
|
36
|
+
export declare enum InteractiveAxes {
|
|
37
|
+
/** Interactive Axis X. */
|
|
38
|
+
X = 0,
|
|
39
|
+
/** Interactive Axis Y. */
|
|
40
|
+
Y = 1,
|
|
41
|
+
/** Interactive Both Axis X and Axis Y. */
|
|
42
|
+
XY = 2
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The {@link ChartGestures} control allows the user to zoom or pan on
|
|
46
|
+
* the specified {@link FlexChart}.
|
|
47
|
+
*
|
|
48
|
+
* To use the {@link ChartGestures} control, specify the {@link FlexChart}
|
|
49
|
+
* control on which to zoom or pan.
|
|
50
|
+
*
|
|
51
|
+
* <pre>
|
|
52
|
+
* var chartGestures = new ChartGestures(chart);
|
|
53
|
+
* </pre>
|
|
54
|
+
*/
|
|
55
|
+
export declare class ChartGestures {
|
|
56
|
+
static _CSS_ZOOM: string;
|
|
57
|
+
static _CSS_ZOOM_OVERLAY: string;
|
|
58
|
+
static _CSS_PANABLE: string;
|
|
59
|
+
static _CSS_TOUCH_DISABLED: string;
|
|
60
|
+
static _CSS_BLOCK_INTERACTION: string;
|
|
61
|
+
private _chart;
|
|
62
|
+
private _zoomEle;
|
|
63
|
+
private _overlayEle;
|
|
64
|
+
private _zoomEleOffset;
|
|
65
|
+
private _wrapperMousedown;
|
|
66
|
+
private _wrapperMouseMove;
|
|
67
|
+
private _wrapperMouseup;
|
|
68
|
+
private _wrapperPointerdown;
|
|
69
|
+
private _wrapperPointerMove;
|
|
70
|
+
private _wrapperPointerup;
|
|
71
|
+
private _wrapperTouchStart;
|
|
72
|
+
private _wrapperTouchMove;
|
|
73
|
+
private _wrapperTouchEnd;
|
|
74
|
+
private _wrapperMouseWheel;
|
|
75
|
+
private _plotBox;
|
|
76
|
+
private _startFirstPt;
|
|
77
|
+
private _minX;
|
|
78
|
+
private _maxX;
|
|
79
|
+
private _minY;
|
|
80
|
+
private _maxY;
|
|
81
|
+
private _seriesGroup;
|
|
82
|
+
private _threadHold;
|
|
83
|
+
private _scaling;
|
|
84
|
+
private _panning;
|
|
85
|
+
private _startDistance;
|
|
86
|
+
private _clip;
|
|
87
|
+
private _selection;
|
|
88
|
+
private _startPointers;
|
|
89
|
+
private _mvPointers;
|
|
90
|
+
private _plotOffset;
|
|
91
|
+
private _endPoint;
|
|
92
|
+
private _pinchStartEvents;
|
|
93
|
+
private _minXRange;
|
|
94
|
+
private _minYRange;
|
|
95
|
+
private _innerUpdating;
|
|
96
|
+
private _lastMinX;
|
|
97
|
+
private _lastMaxX;
|
|
98
|
+
private _lastMinY;
|
|
99
|
+
private _lastMaxY;
|
|
100
|
+
private _mouseAction;
|
|
101
|
+
private _interactiveAxes;
|
|
102
|
+
private _enable;
|
|
103
|
+
private _scaleX;
|
|
104
|
+
private _scaleY;
|
|
105
|
+
private _posX;
|
|
106
|
+
private _posY;
|
|
107
|
+
/**
|
|
108
|
+
* Initializes a new instance of the {@link ChartGestures} class.
|
|
109
|
+
*
|
|
110
|
+
* @param chart The {@link FlexChart} that allows the user to zoom or pan.
|
|
111
|
+
* @param options A JavaScript object containing initialization data for the control.
|
|
112
|
+
*/
|
|
113
|
+
constructor(chart: FlexChartCore, options?: any);
|
|
114
|
+
/**
|
|
115
|
+
* Gets or sets the mouse action of the ChartGestures.
|
|
116
|
+
*/
|
|
117
|
+
mouseAction: MouseAction;
|
|
118
|
+
/**
|
|
119
|
+
* Gets or sets the interactive axes of the ChartGestures.
|
|
120
|
+
*/
|
|
121
|
+
interactiveAxes: InteractiveAxes;
|
|
122
|
+
/**
|
|
123
|
+
* Gets or sets the enable of the ChartGestures.
|
|
124
|
+
*/
|
|
125
|
+
enable: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Gets or sets the initial scale of axis X.
|
|
128
|
+
* The scale should be more than 0 and less than or equal to 1.
|
|
129
|
+
* The scale specifies which part of the range between Min and Max
|
|
130
|
+
* is shown. When scale is 1 (default value), the whole axis range
|
|
131
|
+
* is visible.
|
|
132
|
+
*/
|
|
133
|
+
scaleX: number;
|
|
134
|
+
/**
|
|
135
|
+
* Gets or sets the initial scale of axis Y.
|
|
136
|
+
* The scale should be more than 0 and less than or equal to 1.
|
|
137
|
+
* The scale specifies which part of the range between Min and Max
|
|
138
|
+
* is shown. When scale is 1 (default value), the whole axis range
|
|
139
|
+
* is visible.
|
|
140
|
+
*/
|
|
141
|
+
scaleY: number;
|
|
142
|
+
/**
|
|
143
|
+
* Gets or sets the initial position of the axis X.
|
|
144
|
+
* The value represents initial position on the axis when the Scale
|
|
145
|
+
* is less than 1. Otherwise, the Value has no effect. The Value should
|
|
146
|
+
* lie between 0 to 1.
|
|
147
|
+
*/
|
|
148
|
+
posX: number;
|
|
149
|
+
/**
|
|
150
|
+
* Gets or sets the initial position of the axis Y.
|
|
151
|
+
* The value represents initial position on the axis when the Scale
|
|
152
|
+
* is less than 1. Otherwise, the Value has no effect. The Value should
|
|
153
|
+
* lie between 0 to 1.
|
|
154
|
+
*/
|
|
155
|
+
posY: number;
|
|
156
|
+
/**
|
|
157
|
+
* Removes the {@link ChartGestures} control from the chart.
|
|
158
|
+
*/
|
|
159
|
+
remove(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Reset the axis of the chart.
|
|
162
|
+
*/
|
|
163
|
+
reset(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Refreshes the {@link FlexChart} with the gestures settings.
|
|
166
|
+
*/
|
|
167
|
+
_refreshChart(): void;
|
|
168
|
+
private _initialize;
|
|
169
|
+
private _switchEvent;
|
|
170
|
+
private _refresh;
|
|
171
|
+
/** mouse event*/
|
|
172
|
+
private _onMousedown;
|
|
173
|
+
private _onMouseMove;
|
|
174
|
+
private _onMouseup;
|
|
175
|
+
private _onMouseWheel;
|
|
176
|
+
private _focus;
|
|
177
|
+
private _mouseDown;
|
|
178
|
+
private _mouseMove;
|
|
179
|
+
private _mouseup;
|
|
180
|
+
/** ms pointer event*/
|
|
181
|
+
private _onPointerdown;
|
|
182
|
+
private _onPointerMove;
|
|
183
|
+
private _onPointerup;
|
|
184
|
+
private _pointerDown;
|
|
185
|
+
private _pointerMove;
|
|
186
|
+
private _pointerUp;
|
|
187
|
+
/** touch event*/
|
|
188
|
+
private _onTouchStart;
|
|
189
|
+
private _onTouchMove;
|
|
190
|
+
private _onTouchEnd;
|
|
191
|
+
/** help method of zooming chart by mouse */
|
|
192
|
+
private _initOverlay;
|
|
193
|
+
private _updateOverLay;
|
|
194
|
+
_updatePoint(mvPt: Point): void;
|
|
195
|
+
_pointInPlotArea(mvPt: Point): boolean;
|
|
196
|
+
private _zoomedChart;
|
|
197
|
+
private _zoomedAxis;
|
|
198
|
+
private _panningChart;
|
|
199
|
+
private _pannedChart;
|
|
200
|
+
private _scalingChart;
|
|
201
|
+
private _scaledChart;
|
|
202
|
+
private _updateAxisByDistance;
|
|
203
|
+
private _updateAxisByChg;
|
|
204
|
+
private _initAxisRangeWithPosAndScale;
|
|
205
|
+
private _updateAxisRange;
|
|
206
|
+
private _reset;
|
|
207
|
+
private _getTransFormGroups;
|
|
208
|
+
private _disabledOthersInteraction;
|
|
209
|
+
private _getPoint;
|
|
210
|
+
private _getTouchPair;
|
|
211
|
+
private _touchDistance;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Range Slider.
|
|
215
|
+
*/
|
|
216
|
+
export declare class _RangeSlider {
|
|
217
|
+
private static _HRANGESLIDER;
|
|
218
|
+
private static _VRANGESLIDER;
|
|
219
|
+
private static _RANGESLIDER_DECBTN;
|
|
220
|
+
private static _RANGESLIDER_INCBTN;
|
|
221
|
+
private static _RANGESLIDER_RANGEHANDLE;
|
|
222
|
+
private static _RANGESLIDER_MINHANDLE;
|
|
223
|
+
private static _RANGESLIDER_MAXHANDLE;
|
|
224
|
+
private static _RANGESLIDER_HANDLE_ACTIVE;
|
|
225
|
+
private _isVisible;
|
|
226
|
+
private _buttonsVisible;
|
|
227
|
+
private _minScale;
|
|
228
|
+
private _maxScale;
|
|
229
|
+
private _seamless;
|
|
230
|
+
private _rsContainer;
|
|
231
|
+
private _rsEle;
|
|
232
|
+
private _decBtn;
|
|
233
|
+
private _incBtn;
|
|
234
|
+
private _rsContent;
|
|
235
|
+
private _minHandler;
|
|
236
|
+
private _rangeHandler;
|
|
237
|
+
private _maxHandler;
|
|
238
|
+
private _wrapperSliderMousedown;
|
|
239
|
+
private _wrapperDocMouseMove;
|
|
240
|
+
private _wrapperDocMouseup;
|
|
241
|
+
private _wrapperBtnMousedown;
|
|
242
|
+
private _wrapperRangeSpaceMousedown;
|
|
243
|
+
private _wrapperRangeMouseleave;
|
|
244
|
+
private _isTouch;
|
|
245
|
+
private _slidingInterval;
|
|
246
|
+
private _rangeSliderRect;
|
|
247
|
+
private _isHorizontal;
|
|
248
|
+
private _isBtnMousedown;
|
|
249
|
+
private _needSpaceClick;
|
|
250
|
+
private _hasButtons;
|
|
251
|
+
private _movingEle;
|
|
252
|
+
private _movingOffset;
|
|
253
|
+
private _range;
|
|
254
|
+
private _plotBox;
|
|
255
|
+
private _startPt;
|
|
256
|
+
_minPos: number;
|
|
257
|
+
_maxPos: number;
|
|
258
|
+
constructor(container: HTMLElement, needSpaceClick: boolean, hasButtons?: boolean, options?: any);
|
|
259
|
+
/**
|
|
260
|
+
* Gets or sets whether the increase/decrease buttons are displayed or not.
|
|
261
|
+
*/
|
|
262
|
+
buttonsVisible: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Gets or sets the orientation of the range slider.
|
|
265
|
+
*/
|
|
266
|
+
isHorizontal: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Gets or sets the visibility of the range slider.
|
|
269
|
+
*/
|
|
270
|
+
isVisible: boolean;
|
|
271
|
+
/**
|
|
272
|
+
* Gets or sets the minimum range scale of the range slider.
|
|
273
|
+
*/
|
|
274
|
+
minScale: number;
|
|
275
|
+
/**
|
|
276
|
+
* Gets or sets the maximum range scale of the range slider.
|
|
277
|
+
*/
|
|
278
|
+
maxScale: number;
|
|
279
|
+
/**
|
|
280
|
+
* Gets or sets a value that determines whether the min/max elements
|
|
281
|
+
* may be reversed by dragging one over the other.
|
|
282
|
+
*/
|
|
283
|
+
seamless: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Occurs after the range changes.
|
|
286
|
+
*/
|
|
287
|
+
readonly rangeChanged: Event<_RangeSlider, EventArgs>;
|
|
288
|
+
/**
|
|
289
|
+
* Raises the {@link rangeChanged} event.
|
|
290
|
+
*/
|
|
291
|
+
onRangeChanged(e?: EventArgs): void;
|
|
292
|
+
/**
|
|
293
|
+
* Occurs while the range is changing.
|
|
294
|
+
*/
|
|
295
|
+
readonly rangeChanging: Event<_RangeSlider, EventArgs>;
|
|
296
|
+
/**
|
|
297
|
+
* Raises the {@link rangeChanging} event.
|
|
298
|
+
*/
|
|
299
|
+
onRangeChanging(e?: EventArgs): void;
|
|
300
|
+
readonly _isSliding: boolean;
|
|
301
|
+
readonly _handleWidth: number;
|
|
302
|
+
private _createSlider;
|
|
303
|
+
private _switchEvent;
|
|
304
|
+
private _onSliderMousedown;
|
|
305
|
+
private _onDocMouseMove;
|
|
306
|
+
private _onMove;
|
|
307
|
+
private _onDocMouseup;
|
|
308
|
+
private _onRangeSpaceMousedown;
|
|
309
|
+
private _onRangeMouseleave;
|
|
310
|
+
private _onBtnMousedown;
|
|
311
|
+
_refresh(rsRect?: any): void;
|
|
312
|
+
private _updateElesPosition;
|
|
313
|
+
private _refreshSlider;
|
|
314
|
+
private _invalidate;
|
|
315
|
+
private _changeRange;
|
|
316
|
+
private _doSliding;
|
|
317
|
+
private _setSlidingInterval;
|
|
318
|
+
private _clearInterval;
|
|
319
|
+
private _getRsRect;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Specifies the orientation of the range selector.
|
|
323
|
+
*/
|
|
324
|
+
export declare enum Orientation {
|
|
325
|
+
/** Horizontal, x-data range. */
|
|
326
|
+
X = 0,
|
|
327
|
+
/** Vertical, y-data range. */
|
|
328
|
+
Y = 1
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* The {@link RangeSelector} control displays a range selector that allows the user to
|
|
332
|
+
* choose the range of data to display on the specified {@link FlexChart}.
|
|
333
|
+
*
|
|
334
|
+
* To use the {@link RangeSelector} control, specify the {@link FlexChart}
|
|
335
|
+
* control to display the selected range of data.
|
|
336
|
+
*
|
|
337
|
+
* The {@link rangeChanged} event is fired when there is a change in min or max value.
|
|
338
|
+
* For example:
|
|
339
|
+
* <pre>
|
|
340
|
+
* var rangeSelector = new RangeSelector(chart);
|
|
341
|
+
* rangeSelector.rangeChanged.addHandler(function () {
|
|
342
|
+
* // perform related updates
|
|
343
|
+
* // e.g. modify displayed range of another chart
|
|
344
|
+
* update(rangeSelector.min, rangeSelector.max);
|
|
345
|
+
* });
|
|
346
|
+
* </pre>
|
|
347
|
+
*/
|
|
348
|
+
export declare class RangeSelector {
|
|
349
|
+
private _isVisible;
|
|
350
|
+
private _min;
|
|
351
|
+
private _max;
|
|
352
|
+
private _orientation;
|
|
353
|
+
private _seamless;
|
|
354
|
+
private _minScale;
|
|
355
|
+
private _maxScale;
|
|
356
|
+
private _chart;
|
|
357
|
+
private _rangeSelectorEle;
|
|
358
|
+
private _rangeSlider;
|
|
359
|
+
/**
|
|
360
|
+
* Initializes a new instance of the {@link RangeSelector} class.
|
|
361
|
+
*
|
|
362
|
+
* @param chart The {@link FlexChart} that displays the selected range.
|
|
363
|
+
* @param options A JavaScript object containing initialization data for the control.
|
|
364
|
+
*/
|
|
365
|
+
constructor(chart: FlexChartCore, options?: any);
|
|
366
|
+
/**
|
|
367
|
+
* Gets or sets the visibility of the range selector.
|
|
368
|
+
*/
|
|
369
|
+
isVisible: boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Gets or sets the minimum value of the range.
|
|
372
|
+
* If not set, the minimum is calculated automatically.
|
|
373
|
+
*/
|
|
374
|
+
min: number;
|
|
375
|
+
/**
|
|
376
|
+
* Gets or sets the maximum value of the range.
|
|
377
|
+
* If not set, the maximum is calculated automatically.
|
|
378
|
+
*/
|
|
379
|
+
max: number;
|
|
380
|
+
/**
|
|
381
|
+
* Gets or sets the orientation of the range selector.
|
|
382
|
+
*/
|
|
383
|
+
orientation: Orientation;
|
|
384
|
+
/**
|
|
385
|
+
* Gets or sets a value that determines whether the min/max elements
|
|
386
|
+
* may be reversed by dragging one over the other.
|
|
387
|
+
*/
|
|
388
|
+
seamless: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* Gets or sets the minimum amount of data that can be selected,
|
|
391
|
+
* as a percentage of the overall chart range.
|
|
392
|
+
* This property must be set to a value between zero and one.
|
|
393
|
+
*/
|
|
394
|
+
minScale: number;
|
|
395
|
+
/**
|
|
396
|
+
* Gets or sets the maximum amount of data that can be selected,
|
|
397
|
+
* as a percentage of the total range.
|
|
398
|
+
* This property must be set to a value between zero and one.
|
|
399
|
+
*/
|
|
400
|
+
maxScale: number;
|
|
401
|
+
/**
|
|
402
|
+
* Removes the {@link RangeSelector} control from the chart.
|
|
403
|
+
*/
|
|
404
|
+
remove(): void;
|
|
405
|
+
/**
|
|
406
|
+
* Occurs after the range changes.
|
|
407
|
+
*/
|
|
408
|
+
rangeChanged: Event<RangeSelector, EventArgs>;
|
|
409
|
+
/**
|
|
410
|
+
* Raises the {@link rangeChanged} event.
|
|
411
|
+
*/
|
|
412
|
+
onRangeChanged(e?: EventArgs): void;
|
|
413
|
+
private _createRangeSelector;
|
|
414
|
+
private _switchEvent;
|
|
415
|
+
private _refresh;
|
|
416
|
+
private _adjustMinAndMax;
|
|
417
|
+
private _updateMinAndMaxWithScale;
|
|
418
|
+
private _changeRange;
|
|
419
|
+
private _updateRange;
|
|
420
|
+
private _getMinAndMax;
|
|
421
|
+
}
|
package/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Wijmo Library 5.20232.939
|
|
4
|
+
* https://developer.mescius.com/wijmo
|
|
5
|
+
*
|
|
6
|
+
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the End-User License Agreement For MESCIUS Wijmo Software.
|
|
9
|
+
* us.sales@mescius.com
|
|
10
|
+
* https://developer.mescius.com/wijmo/licensing
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
"use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});var MouseAction,InteractiveAxes,wijmo_1=require("@mescius/wijmo"),wijmo_chart_1=require("@mescius/wijmo.chart"),selfModule=__importStar(require("@mescius/wijmo.chart.interaction"));!function(t){t[t.Zoom=0]="Zoom";t[t.Pan=1]="Pan"}(MouseAction=exports.MouseAction||(exports.MouseAction={}));!function(t){t[t.X=0]="X";t[t.Y=1]="Y";t[t.XY=2]="XY"}(InteractiveAxes=exports.InteractiveAxes||(exports.InteractiveAxes={}));var ChartGestures=function(){function ChartGestures(t,e){this._chart=null;this._zoomEle=null;this._overlayEle=null;this._wrapperMousedown=null;this._wrapperMouseMove=null;this._wrapperMouseup=null;this._wrapperPointerdown=null;this._wrapperPointerMove=null;this._wrapperPointerup=null;this._wrapperTouchStart=null;this._wrapperTouchMove=null;this._wrapperTouchEnd=null;this._wrapperMouseWheel=null;this._startFirstPt=null;this._minX=null;this._maxX=null;this._minY=null;this._maxY=null;this._threadHold=20;this._clip={};this._selection={};this._startPointers=[];this._mvPointers=[];this._pinchStartEvents=[];this._minXRange=null;this._minYRange=null;this._innerUpdating=!1;this._lastMinX=null;this._lastMaxX=null;this._lastMinY=null;this._lastMaxY=null;this._mouseAction=MouseAction.Zoom;this._interactiveAxes=InteractiveAxes.X;this._enable=!0;this._scaleX=1;this._scaleY=1;this._posX=0;this._posY=0;t||wijmo_1.assert(!1,"The FlexChart cannot be null.");this._chart=t;wijmo_1.copy(this,e);this._initialize()}Object.defineProperty(ChartGestures.prototype,"mouseAction",{get:function(){return this._mouseAction},set:function(t){this._mouseAction=wijmo_1.asEnum(t,MouseAction)},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"interactiveAxes",{get:function(){return this._interactiveAxes},set:function(t){t!==this._interactiveAxes&&(this._interactiveAxes=wijmo_1.asEnum(t,InteractiveAxes))},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"enable",{get:function(){return this._enable},set:function(t){t!==this._enable&&(this._enable=wijmo_1.asBoolean(t,!0))},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){if(t!==this._scaleX){this._scaleX=t<0?0:t>1?1:wijmo_1.asNumber(t);this._seriesGroup&&this._initAxisRangeWithPosAndScale(!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){if(t!==this._scaleY){this._scaleY=t<0?0:t>1?1:wijmo_1.asNumber(t);this._seriesGroup&&this._initAxisRangeWithPosAndScale(!1)}},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"posX",{get:function(){return this._posX},set:function(t){if(t!==this._posX){this._posX=t<0?0:t>1?1:wijmo_1.asNumber(t);this._seriesGroup&&this._initAxisRangeWithPosAndScale(!0)}},enumerable:!0,configurable:!0});Object.defineProperty(ChartGestures.prototype,"posY",{get:function(){return this._posY},set:function(t){if(t!==this._posY){this._posY=t<0?0:t>1?1:wijmo_1.asNumber(t);this._seriesGroup&&this._initAxisRangeWithPosAndScale(!1)}},enumerable:!0,configurable:!0});ChartGestures.prototype.remove=function(){if(this._zoomEle){this._chart.hostElement.removeChild(this._zoomEle);this._zoomEle=null}wijmo_1.removeClass(this._chart.hostElement,ChartGestures._CSS_TOUCH_DISABLED);this._switchEvent(!1);this._wrapperMousedown=null;this._wrapperMouseMove=null;this._wrapperMouseup=null;this._wrapperPointerdown=null;this._wrapperPointerMove=null;this._wrapperPointerup=null;this._wrapperTouchStart=null;this._wrapperTouchMove=null;this._wrapperTouchEnd=null;this._wrapperMouseWheel=null};ChartGestures.prototype.reset=function(){var t=this._chart,e=t.axisX,i=t.axisY;t.beginUpdate();this._maxX&&(e.max=this._maxX);this._minX&&(e.min=this._minX);this._maxY&&(i.max=this._maxY);this._minY&&(i.min=this._minY);this._initAxisRangeWithPosAndScale(!0);this._initAxisRangeWithPosAndScale(!1);t.endUpdate()};ChartGestures.prototype._refreshChart=function(){var t=this._chart,e=t.axisX,i=t.axisY;this._minX=e._actualMin;this._maxX=e._actualMax;this._minY=i._actualMin;this._maxY=i._actualMax;this._minXRange=.005*(this._maxX-this._minX);this._minYRange=.005*(this._maxY-this._minY);this._initAxisRangeWithPosAndScale(!0);this._initAxisRangeWithPosAndScale(!1)};ChartGestures.prototype._initialize=function(){var t=this._chart.hostElement;this._zoomEle=wijmo_1.createElement('<div class="'+ChartGestures._CSS_ZOOM+'"><div class="'+ChartGestures._CSS_ZOOM_OVERLAY+'"></div>');this._zoomEle.style.visibility="visible";t.appendChild(this._zoomEle);wijmo_1.addClass(t,ChartGestures._CSS_TOUCH_DISABLED);this._overlayEle=this._zoomEle.querySelector("."+ChartGestures._CSS_ZOOM_OVERLAY);this._wrapperMousedown=this._onMousedown.bind(this);this._wrapperMouseMove=this._onMouseMove.bind(this);this._wrapperMouseup=this._onMouseup.bind(this);this._wrapperPointerdown=this._onPointerdown.bind(this);this._wrapperPointerMove=this._onPointerMove.bind(this);this._wrapperPointerup=this._onPointerup.bind(this);this._wrapperMouseWheel=this._onMouseWheel.bind(this);this._wrapperTouchStart=this._onTouchStart.bind(this);this._wrapperTouchMove=this._onTouchMove.bind(this);this._wrapperTouchEnd=this._onTouchEnd.bind(this);this._switchEvent(!0)};ChartGestures.prototype._switchEvent=function(t){var e=this._chart.hostElement,i=t?"addEventListener":"removeEventListener",s=t?"addHandler":"removeHandler";if(e){e[i]("mousedown",this._wrapperMousedown);e[i]("mousemove",this._wrapperMouseMove);document[i]("mouseup",this._wrapperMouseup);if("onpointerdown"in window){e[i]("pointerdown",this._wrapperPointerdown);e[i]("pointermove",this._wrapperPointerMove);document[i]("pointerup",this._wrapperPointerup)}e[i]("wheel",this._wrapperMouseWheel);if("ontouchstart"in window){e[i]("touchstart",this._wrapperTouchStart);e[i]("touchmove",this._wrapperTouchMove);document[i]("touchend",this._wrapperTouchEnd)}this._chart.rendered[s](this._refresh,this)}};ChartGestures.prototype._refresh=function(){var t,e,i,s=this._chart,n=s.axisX,a=s.axisY,r=s.hostElement;this._seriesGroup=r.querySelector(".wj-series-group");t=r.querySelector("."+wijmo_chart_1.FlexChart._CSS_PLOT_AREA);this._plotOffset=wijmo_1.getElementRect(t);this._plotBox=t.getBBox();this._zoomEleOffset=wijmo_1.getElementRect(this._zoomEle);this._overlayEle&&this._overlayEle.removeAttribute("style");if(this._innerUpdating)this._innerUpdating=!1;else{e=!1;i=!1;if(null===this._minX||isNaN(this._minX)||0===this._minX||-1===this._minX||this._lastMinX!==n._actualMin){this._minX=n._actualMin;null===this._minX||isNaN(this._minX)||0===this._minX||-1===this._minX||(e=!0)}if(null===this._maxX||isNaN(this._maxX)||0===this._maxX||-1===this._maxX||this._lastMaxX!==n._actualMax){this._maxX=n._actualMax;null===this._maxX||isNaN(this._maxX)||0===this._maxX||-1===this._maxX||(e=!0)}if(null===this._minY||isNaN(this._minY)||this._lastMinY!==a._actualMin){this._minY=a._actualMin;isNaN(this._minY)||(i=!0)}if(null===this._maxY||isNaN(this._maxY)||this._lastMaxY!==a._actualMax){this._maxY=a._actualMax;isNaN(this._maxY)||(i=!0)}this._minXRange=.005*(this._maxX-this._minX);this._minYRange=.005*(this._maxY-this._minY);e&&null!==this._scaleX&&void 0!==this._scaleX&&1!==this._scaleX&&null!==this._posX&&void 0!==this._posX&&0!==this._posX&&this._initAxisRangeWithPosAndScale(!0);i&&null!==this._scaleY&&void 0!==this._scaleY&&1!==this._scaleY&&null!==this._posY&&void 0!==this._posY&&0!==this._posY&&this._initAxisRangeWithPosAndScale(!1)}};ChartGestures.prototype._onMousedown=function(t){if(this._enable){this._disabledOthersInteraction(!0);this._mouseDown(t);t.preventDefault()}};ChartGestures.prototype._onMouseMove=function(t){if(this._enable){this._mouseMove(t);t.preventDefault()}};ChartGestures.prototype._onMouseup=function(t){if(this._enable){this._mouseup(t);this._disabledOthersInteraction(!1)}};ChartGestures.prototype._onMouseWheel=function(t){var e=-t.deltaY>0?.05:-.05;if(this._enable){this._scaling=!0;this._interactiveAxes!==InteractiveAxes.X&&this._interactiveAxes!==InteractiveAxes.XY||this._updateAxisByChg(!0,e,-e);this._interactiveAxes!==InteractiveAxes.Y&&this._interactiveAxes!==InteractiveAxes.XY||this._updateAxisByChg(!1,e,-e);this._scaling=!1;t.preventDefault()}};ChartGestures.prototype._focus=function(){if(wijmo_1.isIE()){var t=document.activeElement;if(t){var e=t.tagName.toLowerCase();("input"===e&&"text"===t.type||"textarea"===e)&&t.setSelectionRange(0,0)}this._chart.focus()}else this._chart.focus()};ChartGestures.prototype._mouseDown=function(t){this._focus();this._startFirstPt=this._getPoint(t);this._updatePoint(this._startFirstPt);if(this._mouseAction===MouseAction.Zoom)this._initOverlay();else{this._seriesGroup.setAttribute("clip-path","url(#"+this._chart._plotrectId+")");wijmo_1.toggleClass(this._chart.hostElement,ChartGestures._CSS_PANABLE,this._mouseAction===MouseAction.Pan)}};ChartGestures.prototype._mouseMove=function(t){var e;if(this._startFirstPt){e=this._getPoint(t);this._updatePoint(e);this._endPoint=new wijmo_1.Point(e.x,e.y);if(this._mouseAction===MouseAction.Zoom)this._updateOverLay(e);else{this._panning=!0;this._panningChart(e.x-this._startFirstPt.x,e.y-this._startFirstPt.y)}}};ChartGestures.prototype._mouseup=function(t){var e=this._endPoint;this._chart.axisX;if(this._startFirstPt&&e){if(this._mouseAction===MouseAction.Zoom){this._zoomedChart(e);this._reset()}else{this._pannedChart(e.x-this._startFirstPt.x,e.y-this._startFirstPt.y);this._reset()}wijmo_1.removeClass(this._chart.hostElement,ChartGestures._CSS_PANABLE)}else{wijmo_1.removeClass(this._chart.hostElement,ChartGestures._CSS_PANABLE);this._reset()}};ChartGestures.prototype._onPointerdown=function(t){if(this._enable){this._disabledOthersInteraction(!0);switch(t.pointerType){case"touch":this._pointerDown(t);break;case"mouse":this._mouseDown(t)}t.preventDefault()}};ChartGestures.prototype._onPointerMove=function(t){if(this._enable){switch(t.pointerType){case"touch":this._pointerMove(t);break;case"mouse":this._mouseMove(t)}t.preventDefault()}};ChartGestures.prototype._onPointerup=function(t){if(this._enable){switch(t.pointerType){case"touch":this._pointerUp(t);break;case"mouse":this._mouseup(t)}this._disabledOthersInteraction(!1);t.preventDefault()}};ChartGestures.prototype._pointerDown=function(t){this._focus();t.preventManipulation&&t.preventManipulation();this._seriesGroup.setAttribute("clip-path","url(#"+this._chart._plotrectId+")");this._startPointers.push({id:t.pointerId,x:t.pageX,y:t.pageY});if(1===this._startPointers.length){this._scaling=!1;this._panning=!0}else if(2===this._startPointers.length){this._panning=!1;this._scaling=!0;this._startDistance={x:this._startPointers[0].x-this._startPointers[1].x,y:this._startPointers[0].y-this._startPointers[1].y}}};ChartGestures.prototype._pointerMove=function(t){var e,i,s,n,a=new wijmo_1.Point(t.pageX,t.pageY),r={},o={};t.preventManipulation&&t.preventManipulation();if(this._panning){if(!this._pointInPlotArea(a))return;this._endPoint=new wijmo_1.Point(t.pageX,t.pageY);this._panningChart(this._endPoint.x-this._startPointers[0].x,this._endPoint.y-this._startPointers[0].y)}else if(this._scaling){e=this._startPointers[0].id+"";i=this._startPointers[1].id+"";this._mvPointers[t.pointerId+""]={x:t.pageX,y:t.pageY};if(this._mvPointers[e]&&this._mvPointers[i]){if(Math.abs(this._startDistance.x)>this._threadHold&&this._interactiveAxes!==InteractiveAxes.Y){s=this._mvPointers[e].x-this._plotOffset.left;n=this._startPointers[0].x-this._plotOffset.left;o.x=Math.abs((this._mvPointers[e].x-this._mvPointers[i].x)/this._startDistance.x);r.x=s-o.x*n;this._clip.x=(this._plotBox.x-s)/o.x+n;this._selection.w=this._plotBox.width/o.x}if(Math.abs(this._startDistance.y)>this._threadHold&&this._interactiveAxes!==InteractiveAxes.X){s=this._mvPointers[e].y-this._plotOffset.top;n=this._startPointers[0].y-this._plotOffset.top;o.y=Math.abs((this._mvPointers[e].y-this._mvPointers[i].y)/this._startDistance.y);r.y=s-o.y*n;this._clip.y=(this._plotBox.y-s)/o.y+n;this._selection.h=this._plotBox.height/o.y}this._scalingChart(o,r)}}};ChartGestures.prototype._pointerUp=function(t){t.preventManipulation&&t.preventManipulation();if(this._panning){this._endPoint&&this._pannedChart(this._endPoint.x-this._startPointers[0].x,this._endPoint.y-this._startPointers[0].y);this._reset()}else if(this._scaling){this._scaledChart(t);this._reset()}};ChartGestures.prototype._onTouchStart=function(t){if(this._enable){this._disabledOthersInteraction(!0);if(1==t.touches.length){this._scaling=!1;this._panning=!0;this._startFirstPt=this._getPoint(t)}else if(2==t.touches.length){this._pinchStartEvents=this._getTouchPair(t);this._startDistance=this._touchDistance(t);this._panning=!1;this._scaling=!0}this._seriesGroup&&this._seriesGroup.setAttribute("clip-path","url(#"+this._chart._plotrectId+")");this._chart._hideToolTip();return!0}};ChartGestures.prototype._onTouchMove=function(t){if(this._enable){var e,i,s,n,a,r={},o={},h=t.touches[0],_=new wijmo_1.Point(h.pageX,h.pageY);t.preventDefault();if(this._panning){if(this._startFirstPt){if(!this._pointInPlotArea(_))return;this._endPoint=new wijmo_1.Point(h.pageX,h.pageY);this._panningChart(this._endPoint.x-this._startFirstPt.x,this._endPoint.y-this._startFirstPt.y)}}else if(this._scaling){s=this._touchDistance(t);n=this._getTouchPair(t)[0];a=this._pinchStartEvents[0];if(Math.abs(this._startDistance.x)>this._threadHold&&this._interactiveAxes!==InteractiveAxes.Y){e=n.pageX-this._plotOffset.left;i=a.pageX-this._plotOffset.left;r.x=Math.abs(s.x/this._startDistance.x);o.x=e-r.x*i;this._clip.x=(this._plotBox.x-e)/r.x+i;this._selection.w=this._plotBox.width/r.x}if(Math.abs(this._startDistance.y)>this._threadHold&&this._interactiveAxes!==InteractiveAxes.X){e=n.pageY-this._plotOffset.top;i=a.pageY-this._plotOffset.top;r.y=Math.abs(s.y/this._startDistance.y);o.y=e-r.y*i;this._clip.y=(this._plotBox.y-e)/r.y+i;this._selection.h=this._plotBox.height/r.y}this._scalingChart(r,o)}return!0}};ChartGestures.prototype._onTouchEnd=function(t){if(this._enable){var e=this._endPoint;if(this._panning){if(!this._startFirstPt||!e){this._reset();return}this._pannedChart(e.x-this._startFirstPt.x,e.y-this._startFirstPt.y)}else this._scaling&&this._scaledChart(t);this._reset();this._disabledOthersInteraction(!1);return!0}};ChartGestures.prototype._initOverlay=function(){this._zoomEle.style.visibility="visible";switch(this._interactiveAxes){case InteractiveAxes.X:this._overlayEle.style.left=this._startFirstPt.x-this._zoomEleOffset.left+"px";this._overlayEle.style.top=this._plotOffset.top-this._zoomEleOffset.top+"px";break;case InteractiveAxes.Y:this._overlayEle.style.left=this._plotBox.x+"px";this._overlayEle.style.top=this._startFirstPt.y-this._zoomEleOffset.top+"px";break;case InteractiveAxes.XY:this._overlayEle.style.left=this._startFirstPt.x-this._zoomEleOffset.left+"px";this._overlayEle.style.top=this._startFirstPt.y-this._zoomEleOffset.top+"px"}};ChartGestures.prototype._updateOverLay=function(t){var e=this._startFirstPt.x-t.x,i=this._startFirstPt.y-t.y,s={};switch(this._interactiveAxes){case InteractiveAxes.X:if(Math.abs(e)<this._threadHold)return;s=e<=0?{width:Math.abs(e)+"px",height:this._plotBox.height+"px"}:{left:t.x-this._zoomEleOffset.left+"px",width:e+"px",height:this._plotBox.height+"px"};break;case InteractiveAxes.Y:if(Math.abs(i)<this._threadHold)return;s=i<=0?{height:Math.abs(i)+"px",width:this._plotBox.width+"px"}:{top:t.y-this._zoomEleOffset.top+"px",height:i+"px",width:this._plotBox.width+"px"};break;case InteractiveAxes.XY:if(Math.abs(e)>=this._threadHold){s.width=Math.abs(e)+"px";e>0&&(s.left=t.x-this._zoomEleOffset.left+"px")}if(Math.abs(i)>=this._threadHold){s.height=Math.abs(i)+"px";i>0&&(s.top=t.y-this._zoomEleOffset.top+"px")}}wijmo_1.setCss(this._overlayEle,s)};ChartGestures.prototype._updatePoint=function(t){var e=this._plotOffset;t.x<e.left&&(t.x=e.left);t.x>e.left+e.width&&(t.x=e.left+e.width);t.y<e.top&&(t.y=e.top);t.y>e.top+e.height&&(t.y=e.top+e.height)};ChartGestures.prototype._pointInPlotArea=function(t){var e=this._plotOffset;return t.x>=e.left&&t.x<=e.left+e.width&&t.y>=e.top&&t.y<=e.top+e.height};ChartGestures.prototype._zoomedChart=function(t){if(t){this._interactiveAxes!==InteractiveAxes.X&&this._interactiveAxes!==InteractiveAxes.XY||this._zoomedAxis(t,!0);this._interactiveAxes!==InteractiveAxes.Y&&this._interactiveAxes!==InteractiveAxes.XY||this._zoomedAxis(t,!1);this._startFirstPt=null}};ChartGestures.prototype._zoomedAxis=function(t,e){var i,s,n=e?this._chart.axisX:this._chart.axisY,a=e?"x":"y",r=e?"left":"top";if(t&&Math.abs(this._startFirstPt[a]-t[a])>this._threadHold){i=n.convertBack(this._startFirstPt[a]-this._plotOffset[r]+this._plotBox[a]);(s=n.convertBack(t[a]-this._plotOffset[r]+this._plotBox[a]))-i!=0&&this._updateAxisRange(n,Math.min(i,s),Math.max(i,s))}};ChartGestures.prototype._panningChart=function(t,e){var i=this._chart.axisX,s=this._chart.axisY,n=this._getTransFormGroups();t=Math.abs(t)<this._threadHold?0:t;e=Math.abs(e)<this._threadHold?0:e;this._interactiveAxes===InteractiveAxes.X&&(e=0);this._interactiveAxes===InteractiveAxes.Y&&(t=0);var a=i.reversed?-t:t;a>0&&i.actualMin.valueOf()===this._minX&&(t=0);a<0&&i.actualMax.valueOf()===this._maxX&&(t=0);var r=s.reversed?-e:e;r>0&&s.actualMax.valueOf()===this._maxY&&(e=0);r<0&&s.actualMin.valueOf()===this._minY&&(e=0);for(var o=0;o<n.length;o++)n[o].setAttribute("transform","translate("+t+","+e+")")};ChartGestures.prototype._pannedChart=function(t,e){this._interactiveAxes!==InteractiveAxes.X&&this._interactiveAxes!==InteractiveAxes.XY||this._updateAxisByDistance(!0,t);this._interactiveAxes!==InteractiveAxes.Y&&this._interactiveAxes!==InteractiveAxes.XY||this._updateAxisByDistance(!1,-e)};ChartGestures.prototype._scalingChart=function(t,e){var i,s,n,a=this._chart.axisX,r=this._chart.axisY,o=void 0!==e.x?e.x:0,h=void 0!==e.y?e.y:0;if(t){i=this._getTransFormGroups();if(void 0!==t.x&&t.x<1&&a.actualMin.valueOf()===this._minX&&a.actualMax.valueOf()===this._maxX){t.x=1;o=0}if(void 0!==t.y&&t.y<1&&r.actualMin.valueOf()===this._minY&&r.actualMax.valueOf()===this._maxY){t.y=1;h=0}s=void 0!==t.x?t.x:1;n=void 0!==t.y?t.y:1;for(var _=0;_<i.length;_++)i[_].setAttribute("transform","translate("+o+", "+h+") scale("+s+", "+n+")")}};ChartGestures.prototype._scaledChart=function(t){var e,i,s=this._chart,n=s.axisX,a=s.axisY;if(this._clip){if(this._interactiveAxes!==InteractiveAxes.Y&&void 0!==this._clip.x){if((e=Math.max(this._minX,n.convertBack(this._clip.x)))>(i=Math.min(this._maxX,n.convertBack(this._clip.x+this._selection.w)))){var r=e;e=i;i=r}e-i!=0&&this._updateAxisRange(n,e,i)}if(this._interactiveAxes!==InteractiveAxes.X&&void 0!==this._clip.y){i=Math.min(this._maxY,a.convertBack(this._clip.y));if((e=Math.max(this._minY,a.convertBack(this._clip.y+this._selection.h)))>i){r=e;e=i;i=r}e-i!=0&&this._updateAxisRange(a,e,i)}}};ChartGestures.prototype._updateAxisByDistance=function(t,e){var i,s=t?this._chart.axisX:this._chart.axisY,n=t?this._minX:this._minY,a=t?this._maxX:this._maxY,r=s.actualMin.valueOf(),o=s.actualMax.valueOf();if(0!==e){var h=s.reversed?-e:e;if(h>0&&n===r||h<0&&a===o){this._innerUpdating=!0;this._chart.invalidate()}else{i=e/(t?this._plotBox.width:this._plotBox.height);this._updateAxisByChg(t,-i,-i)}}};ChartGestures.prototype._updateAxisByChg=function(t,e,i){var s,n,a=t?this._chart.axisX:this._chart.axisY,r=t?this._minX:this._minY,o=t?this._maxX:this._maxY,h=a.actualMin.valueOf(),_=(a.actualMax.valueOf(),this._chart._plotRect),l=t?_.left:_.top,c=t?_.width:_.height,u=t?this._minXRange:this._minYRange;if(!isNaN(e)&&!isNaN(i)){if(this._panning){if(a.reversed)if(e<0)if((s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c))>o){s=o;n=t?a.convertBack(a.convert(s)+c):a.convertBack(a.convert(s)-c)}else n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c);else if((n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c))<r){n=r;s=t?a.convertBack(a.convert(n)-c):a.convertBack(a.convert(n)+c)}else s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c);else if(e<0)if((s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c))<r){s=r;n=t?a.convertBack(a.convert(s)+c):a.convertBack(a.convert(s)-c)}else n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c);else if((n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c))>o){n=o;s=t?a.convertBack(a.convert(n)-c):a.convertBack(a.convert(n)+c)}else s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c);if(s>n){var p=s;s=n;n=p}}else if(this._scaling){if((s=t?a.convertBack(l+e*c):a.convertBack(l+c-e*c))>(n=t?a.convertBack(l+c+i*c):a.convertBack(l-i*c))){p=s;s=n;n=p}s<r&&(s=r);n>o&&(n=o);n-s<u&&(s=n-u)}this._updateAxisRange(a,s,n)}};ChartGestures.prototype._initAxisRangeWithPosAndScale=function(t){var e,i,s,n;if(t){e=this._maxX-this._minX;if(!isNaN(e)){i=e*this._scaleX;n=(s=this._minX+this._posX*(e-i))+i;this._innerUpdating=!0;this._chart.axisX.min=s;this._chart.axisX.max=n;this._lastMinX=s;this._lastMaxX=n}}else{e=this._maxY-this._minY;if(!isNaN(e)){i=e*this._scaleY;n=(s=this._minY+this._posY*(e-i))+i;this._innerUpdating=!0;this._chart.axisY.min=s;this._chart.axisY.max=n;this._lastMinY=s;this._lastMaxY=n}}};ChartGestures.prototype._updateAxisRange=function(t,e,i){this._chart.beginUpdate();t.min=e;t.max=i;if(t===this._chart.axisX){this._lastMinX=e;this._lastMaxX=i}else{this._lastMinY=e;this._lastMaxY=i}this._innerUpdating=!0;this._chart.endUpdate()};ChartGestures.prototype._reset=function(){this._scaling=!1;this._panning=!1;this._startDistance=0;this._startFirstPt=null;this._pinchStartEvents=[];this._startPointers=[];this._mvPointers=[];this._endPoint=null;this._clip={};this._selection={}};ChartGestures.prototype._getTransFormGroups=function(){var t=this._seriesGroup.querySelectorAll("g[clip-path]");0===t.length&&(t=this._seriesGroup.querySelectorAll("g"));return t};ChartGestures.prototype._disabledOthersInteraction=function(t){var e=this._chart.hostElement;if(null!=e)for(var i=e.querySelectorAll(".wj-chart-linemarker-container"),s=0;s<i.length;s++)t?wijmo_1.addClass(i[s],ChartGestures._CSS_BLOCK_INTERACTION):wijmo_1.removeClass(i[s],ChartGestures._CSS_BLOCK_INTERACTION)};ChartGestures.prototype._getPoint=function(t){return t instanceof MouseEvent?new wijmo_1.Point(t.pageX,t.pageY):new wijmo_1.Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY)};ChartGestures.prototype._getTouchPair=function(t){var e=[];if(wijmo_1.isArray(t)){e[0]=t[0];e[1]=t[1]}else if("touchend"===t.type){if(1===t.touches.length){e[0]=t.touches[0];e[1]=t.changedTouches[0]}else if(0===t.touches.length){e[0]=t.changedTouches[0];e[1]=t.changedTouches[1]}}else{e[0]=t.touches[0];e[1]=t.touches[1]}return e};ChartGestures.prototype._touchDistance=function(t){var e=this._getTouchPair(t),i=0,s=0;e[0]&&void 0!==e[0].pageX&&e[1]&&void 0!==e[1].pageX&&(i=e[0].pageX-e[1].pageX);e[0]&&void 0!==e[0].pageY&&e[1]&&void 0!==e[1].pageY&&(s=e[0].pageY-e[1].pageY);return{x:i,y:s}};ChartGestures._CSS_ZOOM="wj-zoom";ChartGestures._CSS_ZOOM_OVERLAY="wj-zoom-overlay";ChartGestures._CSS_PANABLE="wj-panable";ChartGestures._CSS_TOUCH_DISABLED="wj-flexchart-touch-disabled";ChartGestures._CSS_BLOCK_INTERACTION="wj-block-other-interaction";return ChartGestures}();exports.ChartGestures=ChartGestures;var Orientation,_RangeSlider=function(){function _RangeSlider(t,e,i,s){this._isVisible=!0;this._buttonsVisible=!0;this._minScale=0;this._maxScale=1;this._seamless=!1;this._rsContainer=null;this._rsEle=null;this._decBtn=null;this._incBtn=null;this._rsContent=null;this._minHandler=null;this._rangeHandler=null;this._maxHandler=null;this._wrapperSliderMousedown=null;this._wrapperDocMouseMove=null;this._wrapperDocMouseup=null;this._wrapperBtnMousedown=null;this._wrapperRangeSpaceMousedown=null;this._wrapperRangeMouseleave=null;this._isTouch=!1;this._slidingInterval=null;this._rangeSliderRect=null;this._isHorizontal=!0;this._isBtnMousedown=!1;this._needSpaceClick=!1;this._hasButtons=!0;this._movingEle=null;this._movingOffset=null;this._range=null;this._startPt=null;this._minPos=0;this._maxPos=1;this.rangeChanged=new wijmo_1.Event;this.rangeChanging=new wijmo_1.Event;t||wijmo_1.assert(!1,"The container cannot be null.");this._isTouch="ontouchstart"in window;this._needSpaceClick=e;this._hasButtons=i;wijmo_1.copy(this,s);this._createSlider(t)}Object.defineProperty(_RangeSlider.prototype,"buttonsVisible",{get:function(){return this._buttonsVisible},set:function(t){if(t!=this._buttonsVisible){this._buttonsVisible=wijmo_1.asBoolean(t);if(!this._rsContainer||!this._hasButtons)return;this._refresh()}},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"isHorizontal",{get:function(){return this._isHorizontal},set:function(t){if(t!=this._isHorizontal){this._isHorizontal=wijmo_1.asBoolean(t);if(!this._rsContainer)return;this._invalidate()}},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(t!=this._isVisible){this._isVisible=wijmo_1.asBoolean(t);if(!this._rsContainer)return;this._rsContainer.style.visibility=this._isVisible?"visible":"hidden"}},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"minScale",{get:function(){return this._minScale},set:function(t){t>=0&&t!=this._minScale&&(this._minScale=wijmo_1.asNumber(t))},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"maxScale",{get:function(){return this._maxScale},set:function(t){t>=0&&t!=this._maxScale&&(this._maxScale=wijmo_1.asNumber(t))},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"seamless",{get:function(){return this._seamless},set:function(t){t!=this._seamless&&(this._seamless=wijmo_1.asBoolean(t))},enumerable:!0,configurable:!0});_RangeSlider.prototype.onRangeChanged=function(t){this.rangeChanged.raise(this,t)};_RangeSlider.prototype.onRangeChanging=function(t){this.rangeChanging.raise(this,t)};Object.defineProperty(_RangeSlider.prototype,"_isSliding",{get:function(){return null!==this._startPt},enumerable:!0,configurable:!0});Object.defineProperty(_RangeSlider.prototype,"_handleWidth",{get:function(){return this._minHandler.offsetWidth},enumerable:!0,configurable:!0});_RangeSlider.prototype._createSlider=function(t){var e=this._isHorizontal?_RangeSlider._HRANGESLIDER:_RangeSlider._VRANGESLIDER,i=this._isHorizontal?"wj-glyph-left":"wj-glyph-down",s=this._isHorizontal?"wj-glyph-right":"wj-glyph-up";this._rsContainer=t;this._rsContainer.style.visibility=this._isVisible?"visible":"hidden";this._rsEle=wijmo_1.createElement('<div class="wj-chart-rangeslider '+e+'"></div>');this._rsContainer.appendChild(this._rsEle);if(this._hasButtons){this._decBtn=wijmo_1.createElement('<button class="wj-rangeslider-decbtn wj-btn wj-btn-default" type="button" tabindex="-1"><span class="'+i+" "+_RangeSlider._RANGESLIDER_DECBTN+'"></span></button>');this._rsEle.appendChild(this._decBtn);this._incBtn=wijmo_1.createElement('<button class="wj-rangeslider-incbtn wj-btn wj-btn-default" type="button" tabindex="-1"><span class="'+s+" "+_RangeSlider._RANGESLIDER_INCBTN+'"></span></button>');this._rsEle.appendChild(this._incBtn)}this._rsContent=wijmo_1.createElement('<div class="wj-rangeslider-content"><div class="wj-rangeslider-rangehandle"></div><div class="wj-rangeslider-minhandle"></div><div class="wj-rangeslider-maxhandle"></div>');this._rsEle.appendChild(this._rsContent);this._minHandler=this._rsContent.querySelector("."+_RangeSlider._RANGESLIDER_MINHANDLE);this._rangeHandler=this._rsContent.querySelector("."+_RangeSlider._RANGESLIDER_RANGEHANDLE);this._maxHandler=this._rsContent.querySelector("."+_RangeSlider._RANGESLIDER_MAXHANDLE);this._wrapperSliderMousedown=this._onSliderMousedown.bind(this);this._wrapperDocMouseMove=this._onDocMouseMove.bind(this);this._wrapperDocMouseup=this._onDocMouseup.bind(this);this._wrapperRangeSpaceMousedown=this._onRangeSpaceMousedown.bind(this);this._wrapperRangeMouseleave=this._onRangeMouseleave.bind(this);this._wrapperBtnMousedown=this._onBtnMousedown.bind(this);this._switchEvent(!0)};_RangeSlider.prototype._switchEvent=function(t){var e=t?"addEventListener":"removeEventListener";if(this._rsContainer){this._needSpaceClick&&this._rsEle[e]("mousedown",this._wrapperRangeSpaceMousedown);this._rsEle[e]("mouseleave",this._wrapperRangeMouseleave);this._rsContent[e]("mousedown",this._wrapperSliderMousedown);if(this._hasButtons){this._decBtn[e]("mousedown",this._wrapperBtnMousedown);this._incBtn[e]("mousedown",this._wrapperBtnMousedown)}document[e]("mousemove",this._wrapperDocMouseMove);document[e]("mouseup",this._wrapperDocMouseup);if("ontouchstart"in window){this._needSpaceClick&&this._rsEle[e]("touchstart",this._wrapperRangeSpaceMousedown);this._rsContent[e]("touchstart",this._wrapperSliderMousedown);if(this._hasButtons){this._decBtn[e]("touchstart",this._wrapperBtnMousedown);this._incBtn[e]("touchstart",this._wrapperBtnMousedown)}document[e]("touchmove",this._wrapperDocMouseMove);document[e]("touchend",this._wrapperDocMouseup)}}};_RangeSlider.prototype._onSliderMousedown=function(t){if(this._isVisible){var e=wijmo_1.getElementRect(this._rsContent);this._plotBox={x:e.left,y:e.top,width:e.width,height:e.height};this._movingEle=t.srcElement||t.target;this._startPt=t instanceof MouseEvent?new wijmo_1.Point(t.pageX,t.pageY):new wijmo_1.Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY);wijmo_1.removeClass(this._minHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);wijmo_1.removeClass(this._maxHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);this._movingOffset=wijmo_1.getElementRect(this._movingEle);if(this._movingEle!=this._rangeHandler){this._isHorizontal?this._movingOffset.left+=.5*this._movingEle.offsetWidth:this._movingOffset.top+=.5*this._movingEle.offsetHeight;wijmo_1.addClass(this._movingEle,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE)}else this._range=this._maxPos-this._minPos;t.preventDefault()}};_RangeSlider.prototype._onDocMouseMove=function(t){if(this._isVisible&&this._startPt){var e=t instanceof MouseEvent?new wijmo_1.Point(t.pageX,t.pageY):new wijmo_1.Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY);this._onMove(e)}};_RangeSlider.prototype._onMove=function(t){var e,i=this._startPt,s=this._movingOffset,n=this._plotBox,a=this._range,r=this._movingEle,o=this._minHandler,h=this._rangeHandler,_=this._maxHandler;if(i&&s){(e=this._isHorizontal?(s.left+t.x-i.x-n.x)/n.width:1-(s.top+t.y-i.y-n.y)/n.height)<0?e=0:e>1&&(e=1);if(r===o)if(this._seamless&&0===this._minScale&&e>=this._maxPos){this._minPos=this._maxPos;this._movingEle=_;wijmo_1.removeClass(this._minHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);wijmo_1.addClass(this._maxHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE)}else{e>this._maxPos-this._minScale&&(e=this._maxPos-this._minScale);e<this._maxPos-this._maxScale&&(e=this._maxPos-this._maxScale);this._minPos=e}else if(r===_)if(this._seamless&&0===this._minScale&&e<=this._minPos){this._maxPos=this._minPos;this._movingEle=o;wijmo_1.removeClass(this._maxHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);wijmo_1.addClass(this._minHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE)}else{e<this._minPos+this._minScale&&(e=this._minPos+this._minScale);e>this._minPos+this._maxScale&&(e=this._minPos+this._maxScale);this._maxPos=e}else if(r===h)if(this._isHorizontal){this._minPos=e;this._maxPos=this._minPos+a;if(this._maxPos>=1){this._maxPos=1;this._minPos=this._maxPos-a}}else{this._maxPos=e;this._minPos=this._maxPos-a;if(this._minPos<=0){this._minPos=0;this._maxPos=this._minPos+a}}this._updateElesPosition();this.onRangeChanging()}};_RangeSlider.prototype._onDocMouseup=function(t){if(this._isVisible){this._clearInterval();this._isBtnMousedown=!1;if(this._startPt){this.onRangeChanged();this._startPt=null;this._movingOffset=null}wijmo_1.removeClass(this._minHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE);wijmo_1.removeClass(this._maxHandler,_RangeSlider._RANGESLIDER_HANDLE_ACTIVE)}};_RangeSlider.prototype._onRangeSpaceMousedown=function(t){var e=t instanceof MouseEvent?new wijmo_1.Point(t.pageX,t.pageY):new wijmo_1.Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY),i=wijmo_1.getElementRect(this._rsContent),s=wijmo_1.getElementRect(this._rangeHandler),n=t.srcElement||t.target,a=0;t.stopPropagation();t.preventDefault();if(n===this._rsContent||n===this._rsEle){if(this._isHorizontal){a=s.width/i.width;e.x<s.left?a*=-1:e.x>s.left+s.width&&(a*=1)}else{a=s.height/i.height;e.y<s.top?a*=1:e.y>s.top+s.height&&(a*=-1)}0!==a&&this._doSliding(a,e)}};_RangeSlider.prototype._onRangeMouseleave=function(t){t.stopPropagation();t.preventDefault();if(this._isBtnMousedown){this._clearInterval();this.onRangeChanged()}};_RangeSlider.prototype._onBtnMousedown=function(t){var e=t.srcElement||t.target,i=0;t.stopPropagation();t.preventDefault();if(wijmo_1.hasClass(e,_RangeSlider._RANGESLIDER_DECBTN)){if(0===this._minPos)return;i=-.05}else if(wijmo_1.hasClass(e,_RangeSlider._RANGESLIDER_INCBTN)){if(1===this._maxPos)return;i=.05}this._isBtnMousedown=!0;0!==i&&this._doSliding(i)};_RangeSlider.prototype._refresh=function(t){var e,i,s=0,n=wijmo_1.getElementRect(this._rsContainer);t&&(this._rangeSliderRect=t);if(this._rangeSliderRect){if(this._hasButtons&&this._buttonsVisible){this._decBtn.style.display="block";this._incBtn.style.display="block";s=this._isHorizontal?this._decBtn.offsetWidth+this._minHandler.offsetWidth/2:this._decBtn.offsetHeight+this._minHandler.offsetHeight/2}else{if(this._hasButtons){this._decBtn.style.display="none";this._incBtn.style.display="none"}s=this._isHorizontal?this._minHandler.offsetWidth/2:this._minHandler.offsetHeight/2}e=this._getRsRect();if(this._isHorizontal){e.left-=this._minHandler.offsetWidth/2;e.width+=this._minHandler.offsetWidth;i={left:s,width:e.width-2*s}}else{e.top-=this._minHandler.offsetHeight/2;e.height+=this._minHandler.offsetHeight;i={top:s,height:e.height-2*s}}wijmo_1.setCss(this._rsEle,e);wijmo_1.setCss(this._rsContent,i);n=wijmo_1.getElementRect(this._rsContent);this._plotBox={x:n.left,y:n.top,width:n.width,height:n.height};this._updateElesPosition()}};_RangeSlider.prototype._updateElesPosition=function(){var t,e,i,s=this._minHandler,n=(this._rangeHandler,this._maxHandler),a=this._plotBox,r=this._isHorizontal;if(a){t=r?{left:this._minPos*a.width-.5*s.offsetWidth}:{top:(1-this._minPos)*a.height-.5*n.offsetHeight};e=r?{left:this._minPos*a.width,width:(this._maxPos-this._minPos)*a.width}:{top:(1-this._maxPos)*a.height,height:(this._maxPos-this._minPos)*a.height};i=r?{left:this._maxPos*a.width-.5*n.offsetWidth}:{top:(1-this._maxPos)*a.height-.5*s.offsetHeight};this._refreshSlider(t,e,i)}};_RangeSlider.prototype._refreshSlider=function(t,e,i){wijmo_1.setCss(this._minHandler,t);wijmo_1.setCss(this._rangeHandler,e);wijmo_1.setCss(this._maxHandler,i)};_RangeSlider.prototype._invalidate=function(){var t,e;if(this._rsContainer){t=this._isHorizontal?_RangeSlider._HRANGESLIDER:_RangeSlider._VRANGESLIDER;e=this._isHorizontal?_RangeSlider._VRANGESLIDER:_RangeSlider._HRANGESLIDER;wijmo_1.removeClass(this._rsEle,e);wijmo_1.addClass(this._rsEle,t);[this._rsEle,this._rsContent,this._minHandler,this._maxHandler,this._rangeHandler].forEach((function(t){t.removeAttribute("style")}));this._refresh()}};_RangeSlider.prototype._changeRange=function(t){var e=this._maxPos-this._minPos;if(!(t<0&&0===this._minPos||t>0&&1===this._maxPos)){if(t<0){this._minPos+=t;this._minPos=this._minPos<0?0:this._minPos;this._maxPos=this._minPos+e}else{this._maxPos+=t;this._maxPos=this._maxPos>1?1:this._maxPos;this._minPos=this._maxPos-e}this._updateElesPosition()}};_RangeSlider.prototype._doSliding=function(t,e){wijmo_1.getElementRect(this._rsContent),wijmo_1.getElementRect(this._rangeHandler);this._clearInterval();this._startPt=new wijmo_1.Point;this._changeRange(t);this.onRangeChanged();this._setSlidingInterval(t,e)};_RangeSlider.prototype._setSlidingInterval=function(t,e){var i,s=this;this._slidingInterval=window.setInterval((function(){if(e){wijmo_1.getElementRect(s._rsContent);i=wijmo_1.getElementRect(s._rangeHandler);if(s._isHorizontal){if(e.x>=i.left&&e.x<=i.left+i.width){s._clearInterval();return}}else if(e.y>=i.top&&e.y<=i.top+i.height){s._clearInterval();return}}s._changeRange(t);s.onRangeChanged()}),200)};_RangeSlider.prototype._clearInterval=function(){this._slidingInterval&&window.clearInterval(this._slidingInterval)};_RangeSlider.prototype._getRsRect=function(){var t=this._rangeSliderRect,e={};if(t){["left","top","width","height"].forEach((function(i){t[i]&&(e[i]=t[i])}));return e}};_RangeSlider._HRANGESLIDER="wj-chart-hrangeslider";_RangeSlider._VRANGESLIDER="wj-chart-vrangeslider";_RangeSlider._RANGESLIDER_DECBTN="wj-rangeslider-decbtn";_RangeSlider._RANGESLIDER_INCBTN="wj-rangeslider-incbtn";_RangeSlider._RANGESLIDER_RANGEHANDLE="wj-rangeslider-rangehandle";_RangeSlider._RANGESLIDER_MINHANDLE="wj-rangeslider-minhandle";_RangeSlider._RANGESLIDER_MAXHANDLE="wj-rangeslider-maxhandle";_RangeSlider._RANGESLIDER_HANDLE_ACTIVE="wj-rangeslider-handle-active";return _RangeSlider}();exports._RangeSlider=_RangeSlider;!function(t){t[t.X=0]="X";t[t.Y=1]="Y"}(Orientation=exports.Orientation||(exports.Orientation={}));var RangeSelector=function(){function RangeSelector(t,e){this._isVisible=!0;this._orientation=Orientation.X;this._seamless=!1;this._minScale=0;this._maxScale=1;this.rangeChanged=new wijmo_1.Event;this._chart=wijmo_1.asType(t,wijmo_chart_1.FlexChartCore,!1);this._createRangeSelector();wijmo_1.copy(this,e)}Object.defineProperty(RangeSelector.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(t!=this._isVisible){this._isVisible=wijmo_1.asBoolean(t);this._rangeSlider&&(this._rangeSlider.isVisible=t)}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"min",{get:function(){return this._min},set:function(t){if((t=wijmo_1.asNumber(t,!0,!1))!=this._min){var e=!1;if(null==t||void 0===t||isNaN(t)||null==this._max){this._min=t;e=!0}else if(t<=this._max||void 0===this._max){this._min=t;e=!0}this._rangeSlider&&e&&this._changeRange()}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"max",{get:function(){return this._max},set:function(t){if((t=wijmo_1.asNumber(t,!0,!1))!=this._max){var e=!1;if(null==t||isNaN(t)){this._max=t;e=!0}else if(t>=this._min||void 0===this._min){this._max=t;e=!0}this._rangeSlider&&e&&this._changeRange()}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"orientation",{get:function(){return this._orientation},set:function(t){if((t=wijmo_1.asEnum(t,Orientation))!==this._orientation){this._orientation=t;this._rangeSlider&&(this._rangeSlider.isHorizontal=t==Orientation.X)}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"seamless",{get:function(){return this._seamless},set:function(t){if((t=wijmo_1.asBoolean(t,!0))!=this._seamless){this._seamless=t;this._rangeSlider&&(this._rangeSlider.seamless=t)}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"minScale",{get:function(){return this._minScale},set:function(t){if((t=wijmo_1.asNumber(t))<=1&&t>=0&&t!=this._minScale&&t<this._maxScale){this._minScale=t;if(this._rangeSlider){this._rangeSlider.minScale=wijmo_1.asNumber(t);this._updateMinAndMaxWithScale(!0)}}},enumerable:!0,configurable:!0});Object.defineProperty(RangeSelector.prototype,"maxScale",{get:function(){return this._maxScale},set:function(t){if((t=wijmo_1.asNumber(t))<=1&&t>=0&&t!=this._maxScale&&t>this._minScale){this._maxScale=t;if(this._rangeSlider){this._rangeSlider.maxScale=wijmo_1.asNumber(t);this._updateMinAndMaxWithScale(!0)}}},enumerable:!0,configurable:!0});RangeSelector.prototype.remove=function(){if(this._rangeSelectorEle){this._chart.hostElement.removeChild(this._rangeSelectorEle);this._switchEvent(!1);this._rangeSelectorEle=null;this._rangeSlider=null}};RangeSelector.prototype.onRangeChanged=function(t){this.rangeChanged.raise(this,t)};RangeSelector.prototype._createRangeSelector=function(){var t=this._chart.hostElement,e=this._orientation===Orientation.X;this._rangeSelectorEle=wijmo_1.createElement('<div class="wj-chart-rangeselector-container"></div>');this._rangeSlider=new _RangeSlider(this._rangeSelectorEle,!1,!1,{isHorizontal:e,isVisible:this._isVisible,seamless:this._seamless});t.appendChild(this._rangeSelectorEle);this._switchEvent(!0)};RangeSelector.prototype._switchEvent=function(t){var e=t?"addHandler":"removeHandler";if(this._chart.hostElement){this._rangeSlider.rangeChanged[e](this._updateRange,this);this._chart.rendered[e](this._refresh,this)}};RangeSelector.prototype._refresh=function(){var t,e,i,s=this._chart.hostElement,n=wijmo_1.getElementRect(this._rangeSelectorEle);t=s.querySelector("."+wijmo_chart_1.FlexChart._CSS_PLOT_AREA);e=wijmo_1.getElementRect(t);if((i=t.getBBox())&&i.width&&i.height){this._adjustMinAndMax();this._rangeSlider._refresh({left:i.x,top:e.top-n.top,width:i.width,height:i.height})}};RangeSelector.prototype._adjustMinAndMax=function(){var t=this._chart,e=this._rangeSlider,i=this._min,s=this._max,n=this._orientation===Orientation.X?t.axisX:t.axisY,a=wijmo_1.isDate(n.actualMin)?n.actualMin.valueOf():n.actualMin,r=wijmo_1.isDate(n.actualMax)?n.actualMax.valueOf():n.actualMax;this._min=null===i||isNaN(i)||void 0===i||i<a||i>r?a:i;this._max=null===s||isNaN(s)||void 0===s||s<a||s>r?r:s;var o=this._chart._plotRect;if(o){var h=void 0,_=void 0;if(this._orientation===Orientation.X){h=(n.convert(this._min)-o.left)/o.width;_=(n.convert(this._max)-o.left)/o.width}else{h=(o.top-n.convert(this._min))/o.height+1;_=(o.top-n.convert(this._max))/o.height+1}e._minPos=isNaN(h)?0:h;e._maxPos=isNaN(_)?1:_;this._updateMinAndMaxWithScale(!1)}};RangeSelector.prototype._updateMinAndMaxWithScale=function(t){var e,i=this._rangeSlider,s=!1;if(0!==this._minScale&&i._minPos+this._minScale>i._maxPos){if((e=i._minPos+this._minScale)>1){i._maxPos=1;i._minPos=1-this._minScale}else i._maxPos=e;s=!0}if(1!==this._maxScale&&i._minPos+this._maxScale<i._maxPos){if((e=i._minPos+this._maxScale)>1){i._maxPos=1;i._minPos=1-this._maxScale}else i._maxPos=e;s=!0}if(s){var n=this._getMinAndMax();this._min=n.min;this._max=n.max;if(t&&this._rangeSelectorEle){this._rangeSlider._refresh();this.onRangeChanged()}}};RangeSelector.prototype._changeRange=function(){this._adjustMinAndMax();if(this._rangeSelectorEle){this._rangeSlider._refresh();this.onRangeChanged()}};RangeSelector.prototype._updateRange=function(){var t;this._rangeSlider;t=this._chart;this._orientation===Orientation.X?t.axisX:t.axisY;var e=this._getMinAndMax();this._min=e.min;this._max=e.max;this.onRangeChanged()};RangeSelector.prototype._getMinAndMax=function(){var t=this._rangeSlider,e=this._chart,i=e._plotRect,s=null,n=null;if(i)if(this._orientation===Orientation.X){s=e.axisX.convertBack(i.left+t._minPos*i.width);n=e.axisX.convertBack(i.left+t._maxPos*i.width)}else{s=e.axisY.convertBack(i.top+(1-t._minPos)*i.height);n=e.axisY.convertBack(i.top+(1-t._maxPos)*i.height)}return{min:s,max:n}};return RangeSelector}();exports.RangeSelector=RangeSelector;wijmo_1._registerModule("wijmo.chart.interaction",selfModule);
|