/*
    *
    * Wijmo Library 5.20181.462
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const wjcCore=require("wijmo/wijmo"),wjcSelfRef=require("wijmo/wijmo.chart");var wjcSelf=wjcSelfRef||exports;window.wijmo=window.wijmo||{},window.wijmo.chart=wjcSelf;class DataPoint{constructor(t=0,e=0){this.x=t,this.y=e}}exports.DataPoint=DataPoint;class RenderEventArgs extends wjcCore.CancelEventArgs{constructor(t){super(),this._engine=t}get engine(){return this._engine}}exports.RenderEventArgs=RenderEventArgs;class SeriesRenderingEventArgs extends RenderEventArgs{constructor(t,e,i){super(t),this._index=e,this._count=i}get index(){return this._index}get count(){return this._count}}exports.SeriesRenderingEventArgs=SeriesRenderingEventArgs;var ImageFormat;!function(t){t[t.Png=0]="Png",t[t.Jpeg=1]="Jpeg",t[t.Svg=2]="Svg"}(ImageFormat=exports.ImageFormat||(exports.ImageFormat={}));class FlexChartBase extends wjcCore.Control{constructor(){super(...arguments),this._palette=null,this._selectionMode=SelectionMode.None,this._defPalette=Palettes.standard,this._notifyCurrentChanged=!0,this._legendHost=null,this._needBind=!1,this.rendering=new wjcCore.Event,this.rendered=new wjcCore.Event,this.selectionChanged=new wjcCore.Event}get itemsSource(){return this._items}set itemsSource(t){this._items!=t&&(this._cv&&(this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this),this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this),this._cv=null),this._items=t,this._cv=wjcCore.asCollectionView(t),null!=this._cv&&(this._cv.currentChanged.addHandler(this._cvCurrentChanged,this),this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this)),this._clearCachedValues(),this._bindChart())}get collectionView(){return this._cv}get palette(){return this._palette}set palette(t){t!=this._palette&&(this._palette=wjcCore.asArray(t),this.invalidate())}get plotMargin(){return this._plotMargin}set plotMargin(t){t!=this._plotMargin&&(this._plotMargin=t,this.invalidate())}get legend(){return this._legend}set legend(t){t!=this._legend&&(this._legend=wjcCore.asType(t,Legend),null!=this._legend&&(this._legend._chart=this))}get header(){return this._header}set header(t){t!=this._header&&(this._header=wjcCore.asString(t,!0),this.invalidate())}get footer(){return this._footer}set footer(t){t!=this._footer&&(this._footer=wjcCore.asString(t,!0),this.invalidate())}get headerStyle(){return this._headerStyle}set headerStyle(t){t!=this._headerStyle&&(this._headerStyle=t,this.invalidate())}get footerStyle(){return this._footerStyle}set footerStyle(t){t!=this._footerStyle&&(this._footerStyle=t,this.invalidate())}get selectionMode(){return this._selectionMode}set selectionMode(t){(t=wjcCore.asEnum(t,SelectionMode))!=this._selectionMode&&(this._selectionMode=t,this.invalidate())}get itemFormatter(){return this._itemFormatter}set itemFormatter(t){t!=this._itemFormatter&&(this._itemFormatter=wjcCore.asFunction(t),this.invalidate())}onRendered(t){this.rendered.raise(this,t)}onRendering(t){this.rendering.raise(this,t)}saveImageToFile(t){var e,i,s,r;t&&0!==t.length&&-1!==t.indexOf(".")||(t="image.png"),r=t.split("."),e=r[0].toLowerCase(),i=r[1].toLowerCase(),s=ImageFormat[i[0].toUpperCase()+i.substring(1)],this.saveImageToDataUrl(s,t=>{ExportHelper.downloadImage(t,e,i)})}saveImageToDataUrl(t,e){var i=wjcCore.asEnum(t,ImageFormat,!1),s=ImageFormat[i].toLowerCase();s&&s.length&&this._exportToImage(s,t=>{e.call(e,t)})}_exportToImage(t,e){var i,s=new Image,r=this._currentRenderEngine.element;i=ExportHelper.getDataUri(r),"svg"===t?e.call(null,i):(s.onload=(()=>{var i,a=document.createElement("canvas"),n=r.parentNode||r,h=wjcCore.getElementRect(n);a.width=h.width,a.height=h.height;var o=a.getContext("2d");o.fillStyle="#ffffff",o.fillRect(0,0,h.width,h.height);var l=window.getComputedStyle(n,null).getPropertyValue("padding-left").replace("px",""),_=window.getComputedStyle(n,null).getPropertyValue("padding-top").replace("px","");o.drawImage(s,+l||0,+_||0),i=a.toDataURL("image/"+t),e.call(null,i),a=null}),s.src=i)}refresh(t=!0){super.refresh(t),this.isUpdating||this._refreshChart()}onSelectionChanged(t){this.selectionChanged.raise(this,t)}onLostFocus(t){this._tooltip&&this._tooltip.isVisible&&this._tooltip.hide(),super.onLostFocus(t)}_cvCollectionChanged(t,e){this._clearCachedValues(),this._bindChart()}_cvCurrentChanged(t,e){this._notifyCurrentChanged&&this._bindChart()}_getColor(t){var e=this._defPalette;return null!=this._palette&&this._palette.length>0&&(e=this._palette),e[t%e.length]}_getColorLight(t){var e=this._getColor(t);return this._getLightColor(e)}_getLightColor(t){var e=new wjcCore.Color(t);return null!=e&&-1===t.indexOf("-")&&(1==e.a&&-1==t.indexOf("rgba")&&(e.a*=.7),t=e.toString()),t}_bindChart(){this._needBind=!0,this.invalidate()}_clearCachedValues(){}_render(t,e=!0){this.hostElement;let i=this._getHostSize(),s=i.width,r=i.height;if(0!=s){if(isNaN(s)&&(s=FlexChart._WIDTH),(0==r||isNaN(r))&&(r=FlexChart._HEIGHT),t.beginRender(),s>0&&r>0){t.setViewportSize(s,r),this._rectChart=new wjcCore.Rect(0,0,s,r),this._prepareRender();let i=new wjcCore.Rect(0,0,s,r);this._chartRectId="chartRect"+(1e6*Math.random()).toFixed(),t.addClipRect(i,this._chartRectId),this._renderHeader(t,i),this._renderFooter(t,i),this._renderLegends(t,i),this._renderChart(t,i,e)}t.endRender()}}_renderHeader(t,e){t.startGroup(FlexChart._CSS_HEADER,this._chartRectId),e=this._drawTitle(t,e,this.header,this.headerStyle,!1),t.endGroup()}_renderFooter(t,e){t.startGroup(FlexChart._CSS_FOOTER,this._chartRectId),e=this._drawTitle(t,e,this.footer,this.footerStyle,!0),t.endGroup()}_renderLegends(t,e){var i,s,r=this.legend,a=e.width,n=e.height,h=r._getPosition(a,n);switch(i=r._getDesiredSize(t,h,a,n),h){case Position.Right:a-=i.width,s=new wjcCore.Point(a,e.top+.5*(n-i.height));break;case Position.Left:e.left+=i.width,a-=i.width,s=new wjcCore.Point(0,e.top+.5*(n-i.height));break;case Position.Top:n-=i.height,s=new wjcCore.Point(.5*(a-i.width),e.top),e.top+=i.height;break;case Position.Bottom:n-=i.height,s=new wjcCore.Point(.5*(a-i.width),e.top+n)}e.width=a,e.height=n,i?(this._legendHost=t.startGroup(FlexChart._CSS_LEGEND,this._chartRectId),this._rectLegend=new wjcCore.Rect(s.x,s.y,i.width,i.height),this.legend._render(t,s,h,i.width,i.height),t.endGroup()):(this._legendHost=null,this._rectLegend=null)}_prepareRender(){}_renderChart(t,e,i){}_performBind(){}_getDesiredLegendSize(t,e,i,s){return null}_renderLegend(t,e,i,s,r,a){}_getHitTestItem(t){return null}_getHitTestValue(t){return null}_getHitTestLabel(t){return null}_refreshChart(){this._needBind&&(this._needBind=!1,this._performBind()),this.hostElement&&this._render(this._currentRenderEngine)}_drawTitle(t,e,i,s,r){var a=FlexChart._CSS_TITLE,n=r?FlexChart._CSS_FOOTER:FlexChart._CSS_HEADER,h=null;if(r?this._rectFooter=null:this._rectHeader=null,null!=i){var o=null,l=null,_=null,c=null;s&&(s.fontSize&&(o=s.fontSize),s.foreground&&(l=s.foreground),s.fill&&(l=s.fill),s.fontFamily&&(_=s.fontFamily),s.halign&&(c=s.halign)),t.fontSize=o,t.fontFamily=_,h=t.measureString(i,a,n,s),e.height-=h.height,l||(l=FlexChart._FG),t.textFill=l,r?("left"==c?FlexChart._renderText(t,i,new wjcCore.Point(e.left,e.bottom),0,0,a,n,s):"right"==c?FlexChart._renderText(t,i,new wjcCore.Point(e.left+e.width,e.bottom),2,0,a,n,s):FlexChart._renderText(t,i,new wjcCore.Point(e.left+.5*e.width,e.bottom),1,0,a,n,s),this._rectFooter=new wjcCore.Rect(e.left,e.bottom,e.width,h.height)):(this._rectHeader=new wjcCore.Rect(e.left,e.top,e.width,h.height),e.top+=h.height,"left"==c?FlexChart._renderText(t,i,new wjcCore.Point(e.left,0),0,0,a,n,s):"right"==c?FlexChart._renderText(t,i,new wjcCore.Point(e.left+e.width,0),2,0,a,n,s):FlexChart._renderText(t,i,new wjcCore.Point(e.left+.5*e.width,0),1,0,a,n,s)),t.textFill=null,t.fontSize=null,t.fontFamily=null}return e}pageToControl(t,e){return this._toControl(t,e)}_toControl(t,e){wjcCore.isNumber(t)&&wjcCore.isNumber(e)?t=new wjcCore.Point(t,e):t instanceof MouseEvent&&(t=wjcCore.mouseToPage(t)),wjcCore.asType(t,wjcCore.Point);var i=t.clone(),s=this._getHostOffset();i.x-=s.x,i.y-=s.y;var r=this._getHostComputedStyle();if(r){var a=parseInt(r.paddingLeft.replace("px",""));a&&!isNaN(a)&&(i.x-=a);var n=parseInt(r.paddingTop.replace("px",""));n&&!isNaN(n)&&(i.y-=n)}return i}_highlightItems(t,e,i){if(i)for(s=0;s<t.length;s++)wjcCore.addClass(t[s],e);else for(var s=0;s<t.length;s++)wjcCore.removeClass(t[s],e)}_parseMargin(t){var e={};if(wjcCore.isNumber(t)&&!isNaN(t))e.top=e.bottom=e.left=e.right=wjcCore.asNumber(t);else if(wjcCore.isString(t)){var i=wjcCore.asString(t).split(" ",4),s=NaN,r=NaN,a=NaN,n=NaN;i&&(4==i.length?(s=parseFloat(i[0]),n=parseFloat(i[1]),r=parseFloat(i[2]),a=parseFloat(i[3])):2==i.length?(s=r=parseFloat(i[0]),a=n=parseFloat(i[1])):1==i.length&&(s=r=a=n=parseFloat(i[1])),isNaN(s)||(e.top=s),isNaN(r)||(e.bottom=r),isNaN(a)||(e.left=a),isNaN(n)||(e.right=n))}return e}_showToolTip(t,e){var i=this,s=this._tooltip.showDelay;i._clearTimeouts(),s>0?i._toShow=setTimeout(function(){i._tooltip.show(i.hostElement,t,e),i._tooltip.hideDelay>0&&(i._toHide=setTimeout(function(){i._tooltip.hide()},i._tooltip.hideDelay))},s):(i._tooltip.show(i.hostElement,t,e),i._tooltip.hideDelay>0&&(i._toHide=setTimeout(function(){i._tooltip.hide()},i._tooltip.hideDelay)))}_hideToolTip(){this._clearTimeouts(),this._tooltip.hide()}_clearTimeouts(){this._toShow&&(clearTimeout(this._toShow),this._toShow=null),this._toHide&&(clearTimeout(this._toHide),this._toHide=null)}_getHostOffset(){var t=wjcCore.getElementRect(this.hostElement);return new wjcCore.Point(t.left,t.top)}_getHostSize(){var t=new wjcCore.Size,e=this.hostElement,i=this._getHostComputedStyle(),s=e.offsetWidth,r=e.offsetHeight;if(i){var a=parseFloat(i.paddingLeft.replace("px","")),n=parseFloat(i.paddingRight.replace("px","")),h=parseFloat(i.paddingTop.replace("px","")),o=parseFloat(i.paddingBottom.replace("px",""));isNaN(a)||(s-=a),isNaN(n)||(s-=n),isNaN(h)||(r-=h),isNaN(o)||(r-=o);var l=parseFloat(i.borderLeftWidth.replace("px","")),_=parseFloat(i.borderRightWidth.replace("px","")),c=parseFloat(i.borderTopWidth.replace("px","")),d=parseFloat(i.borderBottomWidth.replace("px",""));isNaN(l)||(s-=l),isNaN(_)||(s-=_),isNaN(c)||(r-=c),isNaN(d)||(r-=d),t.width=s,t.height=r}return t}_getHostComputedStyle(){var t=this.hostElement;return t&&t.ownerDocument&&t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(this.hostElement):null}_find(t,e){for(var i=[],s=0;s<t.childElementCount;s++){var r=t.childNodes.item(s);if(e.indexOf(r.nodeName)>=0)i.push(r);else{var a=this._find(r,e);if(a.length>0)for(var n=0;n<a.length;n++)i.push(a[n])}}return i}}FlexChartBase._WIDTH=300,FlexChartBase._HEIGHT=200,FlexChartBase._SELECTION_THRESHOLD=15,exports.FlexChartBase=FlexChartBase;class _KeyWords{constructor(){this._keys={},this._keys.seriesName=null,this._keys.pointIndex=null,this._keys.x=null,this._keys.y=null,this._keys.value=null,this._keys.name=null}replace(t,e){var i=this;return wjcCore.format(t,{},function(t,s,r,a){return i.getValue(s,e,r)})}getValue(t,e,i){switch(t){case"seriesName":return e.series?e.series.name:"";case"pointIndex":return null!=e.pointIndex?e.pointIndex.toFixed():"";case"x":return i?wjcCore.Globalize.format(e.x,i):e._xfmt;case"y":return i?wjcCore.Globalize.format(e.y,i):e._yfmt;case"value":return i?wjcCore.Globalize.format(e.value,i):e.value;case"name":return e.name}return e.item&&(0==t.indexOf("item.")&&(t=t.substr(5)),t in e.item)?i?wjcCore.Globalize.format(e.item[t],i):e.item[t]:""}}exports._KeyWords=_KeyWords;class ExportHelper{static downloadImage(t,e,i){var s=document.createElement("a"),r="image/"+i;if(navigator.msSaveOrOpenBlob){t=t.substring(t.indexOf(",")+1);var a,n,h,o=atob(t),l=[];for(a=0;a<o.length;a+=512){n=o.slice(a,a+512);for(var _=new Array(n.length),c=0;c<n.length;c++)_[c]=n.charCodeAt(c);var d=new Uint8Array(_);l.push(d)}h=new Blob(l,{type:r}),navigator.msSaveOrOpenBlob(h,e+"."+i)}else s.download=e+"."+i,s.href=t,document.body.appendChild(s),s.addEventListener("click",function(t){wjcCore.removeChild(s)}),s.click()}static getDataUri(t){var e,i,s,r,a,n,h,o,l,_,c=document.createElement("div"),d=t.cloneNode(!0);return"svg"==t.tagName?(i=(e=wjcCore.getElementRect(t.parentNode||t)).width||0,s=e.height||0,r=t.viewBox.baseVal&&0!==t.viewBox.baseVal.width?t.viewBox.baseVal.width:i,a=t.viewBox.baseVal&&0!==t.viewBox.baseVal.height?t.viewBox.baseVal.height:s):(i=(n=t.getBBox()).x+n.width,s=n.y+n.height,d.setAttribute("transform",d.getAttribute("transform").replace(/translate\(.*?\)/,"")),r=i,a=s,(o=document.createElementNS("http://www.w3.org/2000/svg","svg")).appendChild(d),d=o),d.setAttribute("version","1.1"),d.setAttributeNS(ExportHelper.xmlns,"xmlns","http://www.w3.org/2000/svg"),d.setAttributeNS(ExportHelper.xmlns,"xmlns:xlink","http://www.w3.org/1999/xlink"),d.setAttribute("width",i),d.setAttribute("height",s),d.setAttribute("viewBox","0 0 "+r+" "+a),wjcCore.addClass(d,t.parentNode&&t.parentNode.getAttribute("class")||""),c.appendChild(d),h=ExportHelper.getStyles(t),(l=document.createElement("style")).setAttribute("type","text/css"),l.innerHTML="<![CDATA[\n"+h+"\n]]>",(_=document.createElement("defs")).appendChild(l),d.insertBefore(_,d.firstChild),"data:image/svg+xml;base64,"+window.btoa(window.unescape(encodeURIComponent(ExportHelper.doctype+c.innerHTML)))}static getStyles(t){var e="",i=document.styleSheets;return null==i||0===i.length?null:([].forEach.call(i,i=>{var s;try{if(null==i.cssRules||0===i.cssRules.length)return!0}catch(t){if("SecurityError"==t.name)return console.log("SecurityError. Can't read: "+i.href),!0}s=i.cssRules,[].forEach.call(s,i=>{var s,r=i.style;if(null==r)return!0;try{s=t.querySelector(i.selectorText)}catch(t){console.warn('Invalid CSS selector "'+i.selectorText+'"',t)}s?e+=i.selectorText+" { "+r.cssText+" }\n":i.cssText.match(/^@font-face/)&&(e+=i.cssText+"\n")})}),e)}}ExportHelper.doctype='<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',ExportHelper.xmlns="http://www.w3.org/2000/xmlns/";class FlexPie extends FlexChartBase{constructor(t,e){super(t,null,!0),this._areas=[],this._keywords=new _KeyWords,this._startAngle=0,this._innerRadius=0,this._offset=0,this._reversed=!1,this._isAnimated=!1,this._selectedItemPosition=Position.None,this._selectedItemOffset=0,this._rotationAngle=0,this._center=new wjcCore.Point,this._selectedOffset=new wjcCore.Point,this._selectedIndex=-1,this._angles=[],this._colRowLens=[],this._values=[],this._labels=[],this._pels=[],this._sum=0,this.applyTemplate("wj-control wj-flexchart wj-flexpie",null,null),this._currentRenderEngine=new _SvgRenderEngine(this.hostElement),this._legend=new Legend(this),this._tooltip=new ChartTooltip,this._tooltip.content="<b>{name}</b><br/>{value}",this._tooltip.showDelay=0,this._lbl=new PieDataLabel,this._lbl._chart=this;var i=this;this.hostElement.addEventListener("mousemove",function(t){var e=i._tooltip;if(e.content&&!i.isTouching){var s=i.hitTest(t);if(s.distance<=e.threshold){var r=i._getLabelContent(s,i.tooltip.content);i._showToolTip(r,new wjcCore.Rect(t.clientX,t.clientY,5,5))}else i._hideToolTip()}}),this.hostElement.addEventListener("click",function(t){var e=!0;if(i.selectionMode!=SelectionMode.None){var s=i.hitTest(t),r=FlexChart._SELECTION_THRESHOLD;i.tooltip&&i.tooltip.threshold&&(r=i.tooltip.threshold),s.distance<=r?(s.pointIndex!=i._selectionIndex&&i.selectedItemPosition!=Position.None&&(e=!1),s.pointIndex!=i._selectionIndex&&i._select(s.pointIndex,!0)):i._selectedIndex>=0&&i._select(null)}if(e&&i.isTouching){var a=i._tooltip;if(a.content)if((s=i.hitTest(t)).distance<=a.threshold){var n=i._getLabelContent(s,i.tooltip.content);i._showToolTip(n,new wjcCore.Rect(t.clientX,t.clientY,5,5))}else i._hideToolTip()}}),this.hostElement.addEventListener("mouseleave",function(t){i._hideToolTip()}),this.initialize(e),this.refresh()}get binding(){return this._binding}set binding(t){t!=this._binding&&(this._binding=wjcCore.asString(t,!0),this._bindChart())}get bindingName(){return this._bindingName}set bindingName(t){t!=this._bindingName&&(this._bindingName=wjcCore.asString(t,!0),this._bindChart())}get startAngle(){return this._startAngle}set startAngle(t){t!=this._startAngle&&(this._startAngle=wjcCore.asNumber(t,!0),this.invalidate())}get offset(){return this._offset}set offset(t){t!=this._offset&&(this._offset=wjcCore.asNumber(t,!0),this.invalidate())}get innerRadius(){return this._innerRadius}set innerRadius(t){t!=this._innerRadius&&(this._innerRadius=wjcCore.asNumber(t,!0),this.invalidate())}get reversed(){return this._reversed}set reversed(t){t!=this._reversed&&(this._reversed=wjcCore.asBoolean(t,!0),this.invalidate())}get selectedItemPosition(){return this._selectedItemPosition}set selectedItemPosition(t){(t=wjcCore.asEnum(t,Position,!0))!=this._selectedItemPosition&&(this._selectedItemPosition=t,this.invalidate())}get selectedItemOffset(){return this._selectedItemOffset}set selectedItemOffset(t){t!=this._selectedItemOffset&&(this._selectedItemOffset=wjcCore.asNumber(t,!0),this.invalidate())}get isAnimated(){return this._isAnimated}set isAnimated(t){t!=this._isAnimated&&(this._isAnimated=t)}get tooltip(){return this._tooltip}get dataLabel(){return this._lbl}set dataLabel(t){t!=this._lbl&&(this._lbl=t,this._lbl&&(this._lbl._chart=this))}get selectedIndex(){return this._selectedIndex}set selectedIndex(t){if(t!=this._selectedIndex){var e=wjcCore.asNumber(t,!0);this._select(e,!0)}}_getLabelsForLegend(){return this._labels}hitTest(t,e){var i=this._toControl(t,e),s=new HitTestInfo(this,i),r=null;if(FlexChart._contains(this._rectHeader,i))s._chartElement=ChartElement.Header;else if(FlexChart._contains(this._rectFooter,i))s._chartElement=ChartElement.Footer;else if(FlexChart._contains(this._rectLegend,i))s._chartElement=ChartElement.Legend,null!==(r=this.legend._hitTest(i))&&r>=0&&r<this._areas.length&&s._setData(null,r);else if(FlexChart._contains(this._rectChart,i)){for(var a,n=this._areas.length,h=NaN,o=0;o<n;o++){var l=i.clone();if(0!=this._rotationAngle){var _=this._center.x,c=this._center.y,d=-_+l.x,u=-c+l.y,g=Math.sqrt(d*d+u*u),p=Math.atan2(u,d)-this._rotationAngle*Math.PI/180;l.x=_+g*Math.cos(p),l.y=c+g*Math.sin(p)}o==this._selectedIndex&&(l.x-=this._selectedOffset.x,l.y-=this._selectedOffset.y);var m=this._areas[o];if(m.contains(l)&&(s._setData(null,m.tag),s._dist=0,o!=this._selectedIndex))break;var x=m.distance(l);void 0!==x&&(isNaN(h)||x<h)&&(h=x,a=m)}0!==s._dist&&null!=a&&(s._setData(null,a.tag),s._dist=h),s._chartElement=ChartElement.ChartArea}else s._chartElement=ChartElement.None;return s}_performBind(){if(this._initData(),this._cv){this._selectionIndex=this._cv.currentPosition;var t=this._cv.items;if(t)for(var e=t.length,i=0;i<e;i++){var s=t[i];this._sum+=Math.abs(this._getBindData(s,this._values,this._labels,this.binding,this.bindingName))}}}_initData(){this._sum=0,this._values=[],this._labels=[]}_getBindData(t,e,i,s,r){var a,n=0;s&&(a=t[s]);n=0;if(wjcCore.isNumber(a)?n=wjcCore.asNumber(a):a&&(n=parseFloat(a.toString())),!isNaN(n)&&isFinite(n)?e.push(n):(n=0,e.push(n)),r&&t){var h=t[r];h&&(h=h.toString()),i.push(h)}else i.push(n.toString());return n}_render(t,e=!0){this._selectionAnimationID&&clearInterval(this._selectionAnimationID),super._render(t,e)}_prepareRender(){this._areas=[]}_renderChart(t,e,i){var s=this._rectChart.clone();new wjcCore.Size(s.width,s.height);this.onRendering(new RenderEventArgs(t));var r=e.width,a=e.height;this._pieGroup=t.startGroup("wj-slice-group",null,!0);var n=this._parseMargin(this.plotMargin),h=this.dataLabel,o=h.content&&h.position==PieLabelPosition.Outside,l=o?(wjcCore.isNumber(h.offset)?h.offset:0)+24:0;isNaN(n.left)&&(n.left=o?l:FlexPie._MARGIN),isNaN(n.right)&&(n.right=o?l:FlexPie._MARGIN),isNaN(n.top)&&(n.top=o?l:FlexPie._MARGIN),isNaN(n.bottom)&&(n.bottom=o?l:FlexPie._MARGIN),e.top+=n.top;a=e.height-(n.top+n.bottom);e.height=a>0?a:24,e.left+=n.left;r=e.width-(n.left+n.right);e.width=r>0?r:24,this._renderData(t,e,this._pieGroup),t.endGroup(),this._rotationAngle=0,this._highlightCurrent(),this.dataLabel.content&&this.dataLabel.position!=PieLabelPosition.None&&this._renderLabels(t),this.onRendered(new RenderEventArgs(t))}_getDesiredLegendSize(t,e,i,s){var r=new wjcCore.Size,a=this,n=new wjcCore.Size(i,s),h=a._getLabelsForLegend(),o=h.length,l=0,_=0;this._colRowLens=[];for(var c=0;c<o;c++){var d=a._measureLegendItem(t,h[c]);e?(_+d.height>s&&(r.height=s,this._colRowLens.push(l),l=0,_=0),l<d.width&&(l=d.width),_+=d.height):(l+d.width>i&&(r.width=i,this._colRowLens.push(_),_=0,l=0),_<d.height&&(_=d.height),l+=d.width)}return e?(r.height<_&&(r.height=_),this._colRowLens.push(l),r.width=this._colRowLens.reduce((t,e)=>t+e,0),r.width>n.width/2&&(r.width=n.width/2)):(r.width<l&&(r.width=l),this._colRowLens.push(_),r.height=this._colRowLens.reduce((t,e)=>t+e,0),r.height>n.height/2&&(r.height=n.height/2)),r}_renderLegend(t,e,i,s,r,a){for(var n=this,h=n._rectLegend,o=n._getLabelsForLegend(),l=o.length,_=0,c=e.clone(),d=0;d<l;d++){var u=n._measureLegendItem(t,o[d]);s?c.y+u.height>h.top+h.height+1&&(c.x+=this._colRowLens[_],_++,c.y=e.y):c.x+u.width>h.left+h.width+1&&(c.y+=this._colRowLens[_],_++,c.x=e.x);var g=new wjcCore.Rect(c.x,c.y,u.width,u.height);n._drawLegendItem(t,g,d,o[d]),i.push(g),s?c.y+=u.height:c.x+=u.width}}_renderData(t,e,i){this._pels=[],this._angles=[];var s=this._sum,r=this.startAngle+180,a=this.innerRadius,n=this.offset;if(s>0){var h=r*Math.PI/180,o=e.left+.5*e.width,l=e.top+.5*e.height,_=Math.min(.5*e.width,.5*e.height);this._center.x=o,this._center.y=l;var c=Math.max(n,this.selectedItemOffset);c>0&&(n*=_/=1+c),this._radius=_;var d=a*_;this._renderPie(t,_,d,h,n),this._highlightCurrent()}}_renderPie(t,e,i,s,r){this._renderSlices(t,this._values,this._sum,e,i,s,2*Math.PI,r)}_getCenter(){return this._center}_renderSlices(t,e,i,s,r,a,n,h){for(var o,l,_,c=e.length,d=a,u=1==this.reversed,g=this._center,p=1===c?360:359.9/360,m=0;m<c;m++){l=g.x,_=g.y,o=t.startGroup("wj-slice"),t.fill=this._getColorLight(m),t.stroke=this._getColor(m);var x=Math.abs(e[m]),v=Math.abs(x-i)<1e-10?n:n*x/i;v=Math.min(v,n*p);var w=u?d-.5*v:d+.5*v;h>0&&v<n&&(l+=h*Math.cos(w),_+=h*Math.sin(w)),this._renderSlice(t,l,_,w,m,s,r,d,v,n),u?d-=v:d+=v,t.endGroup(),this._pels.push(o)}}_renderSlice(t,e,i,s,r,a,n,h,o,l){var _=!!this.reversed;if(this._angles.push(s),this.itemFormatter){var c=new HitTestInfo(this,new wjcCore.Point(e+a*Math.cos(s),i+a*Math.sin(s)),ChartElement.SeriesSymbol);c._setData(null,r),this.itemFormatter(t,c,()=>{this._drawSlice(t,r,_,e,i,a,n,h,o)})}else this._drawSlice(t,r,_,e,i,a,n,h,o)}_renderLabels(t){var e=this._areas.length,i=this.dataLabel,s=i.position,r="wj-data-label",a=this._rotationAngle,n=i.connectingLine,h=i.offset?i.offset:0;t.stroke="null",t.fill="transparent",t.strokeWidth=1,t.startGroup("wj-data-labels");for(var o=0;o<e;o++){var l=this._areas[o];if(l){var _=l.radius,c=l.langle+a,d=1,u=1;s==PieLabelPosition.Center||s===PieLabelPosition.Radial||s===PieLabelPosition.Circular?_*=.5*(1+(l.innerRadius||0)/l.radius):((c=_Math.clampAngle(c))<=-170||c>=170?(d=2,u=1):c>=-100&&c<=-80?(d=1,u=2):c>=-10&&c<=10?(d=0,u=1):c>=80&&c<=100?(d=1,u=0):-180<c&&c<-90?(d=2,u=2):-90<=c&&c<0?(d=0,u=2):0<c&&c<90?(d=0,u=0):90<c&&c<180&&(d=2,u=0),s==PieLabelPosition.Inside&&(d=2-d,u=2-u)),c*=Math.PI/180;var g=0,p=0,m=0;o==this._selectedIndex&&this.selectedItemOffset>0&&(m=this.selectedItemOffset),m>0&&(g=Math.cos(c)*m*this._radius,p=Math.sin(c)*m*this._radius);var x=_;s==PieLabelPosition.Outside?x+=h:s==PieLabelPosition.Inside&&(x-=h);var v=l.center.x,w=l.center.y,f=v-this._center.x,C=w-this._center.y;if(0!=this._rotationAngle){var y=Math.sqrt(f*f+C*C),b=Math.atan2(C,f)+this._rotationAngle*Math.PI/180;v=this._center.x+y*Math.cos(b),w=this._center.y+y*Math.sin(b)}var S=new wjcCore.Point(v+g+x*Math.cos(c),w+p+x*Math.sin(c));i.border&&s!=PieLabelPosition.Center&&(0==d?S.x+=2:2==d&&(S.x-=2),0==u?S.y+=2:2==u&&(S.y-=2));var M=new HitTestInfo(this,S);M._setData(null,o);var T=this._getLabelContent(M,i.content),A=new DataLabelRenderEventArgs(t,M,S,T);if(i.onRendering&&(i.onRendering(A)?(T=A.text,S=A.point):T=null),T){var L,P=180*Math.atan2(w-S.y,v-S.x)/Math.PI;if(P=(P+360)%360,s===PieLabelPosition.Radial||s===PieLabelPosition.Circular?(s===PieLabelPosition.Radial?P>90&&P<270&&(P+=180):(P>180&&P<360&&(P+=180),P-=90),(L=FlexChart._renderRotatedText(t,T,S,d,u,S,P,r).getBBox()).left=L.x,L.top=L.y):L=FlexChart._renderText(t,T,S,d,u,r),i.border&&t.drawRect(L.left-2,L.top-2,L.width+4,L.height+4,"wj-data-label-border"),n){var k=new wjcCore.Point(v+g+_*Math.cos(c),w+p+_*Math.sin(c));t.drawLine(S.x,S.y,k.x,k.y,"wj-data-label-line")}}}}t.endGroup()}_drawSlice(t,e,i,s,r,a,n,h,o){var l;i?n>0?(0!=o&&t.drawDonutSegment(s,r,a,n,h-o,o),(l=new _DonutSegment(new wjcCore.Point(s,r),a,n,h-o,o,this.startAngle)).tag=e,this._areas.push(l)):(0!=o&&t.drawPieSegment(s,r,a,h-o,o),(l=new _PieSegment(new wjcCore.Point(s,r),a,h-o,o,this.startAngle)).tag=e,this._areas.push(l)):(n>0?(0!=o&&t.drawDonutSegment(s,r,a,n,h,o),(l=new _DonutSegment(new wjcCore.Point(s,r),a,n,h,o,this.startAngle)).tag=e,this._areas.push(l)):(0!=o&&t.drawPieSegment(s,r,a,h,o),(l=new _PieSegment(new wjcCore.Point(s,r),a,h,o,this.startAngle)).tag=e,this._areas.push(l)),h+=o)}_measureLegendItem(t,e){var i=new wjcCore.Size;if(i.width=Series._LEGEND_ITEM_WIDTH,i.height=Series._LEGEND_ITEM_HEIGHT,e){var s=t.measureString(e,FlexChart._CSS_LABEL,FlexChart._CSS_LEGEND);i.width+=s.width,i.height<s.height&&(i.height=s.height)}return i.width+=3*Series._LEGEND_ITEM_MARGIN,i.height+=2*Series._LEGEND_ITEM_MARGIN,i}_drawLegendItem(t,e,i,s){t.strokeWidth=1;var r=Series._LEGEND_ITEM_MARGIN,a=null,n=null;null===a&&(a=this._getColorLight(i)),null===n&&(n=this._getColor(i)),t.fill=a,t.stroke=n;var h=e.top+.5*e.height,o=Series._LEGEND_ITEM_WIDTH,l=Series._LEGEND_ITEM_HEIGHT;t.drawRect(e.left+r,h-.5*l,o,l,null),null!=s&&FlexChart._renderText(t,s.toString(),new wjcCore.Point(e.left+l+2*r,h),0,1,FlexChart._CSS_LABEL)}_getLabelContent(t,e){return wjcCore.isString(e)?this._keywords.replace(e,t):wjcCore.isFunction(e)?e(t):null}_select(t,e=!1){if(this._highlight(!1,this._selectionIndex),this._selectionIndex=t,this.selectionMode==SelectionMode.Point){var i=this._cv;i&&(this._notifyCurrentChanged=!1,i.moveCurrentToPosition(t),this._notifyCurrentChanged=!0)}this.isAnimated&&this.selectedItemPosition!=Position.None||!(this.selectedItemOffset>0||this.selectedItemPosition!=Position.None)?this._highlight(!0,this._selectionIndex,e):(this._selectedIndex=null==t?-1:t,this.invalidate()),this.onSelectionChanged()}_highlightCurrent(){if(this.selectionMode!=SelectionMode.None){var t=-1,e=this._cv;e&&(t=e.currentPosition),this._highlight(!0,t)}}_highlight(t,e,i=!1){if(this.selectionMode==SelectionMode.Point&&void 0!==e&&null!==e&&e>=0){var s=this._pels[e];if(t){if(s){s.parentNode.appendChild(s);var r=this._find(s,["ellipse"]);this._highlightItems(this._find(s,["path","ellipse"]),FlexChart._CSS_SELECTION,t)}var a=this._angles[e];if(this.selectedItemPosition!=Position.None&&0!=a){var n=0;this.selectedItemPosition==Position.Left?n=180:this.selectedItemPosition==Position.Top?n=-90:this.selectedItemPosition==Position.Bottom&&(n=90);var h=n*Math.PI/180-a;h*=180/Math.PI,i&&this.isAnimated?this._animateSelectionAngle(h,.5):(this._rotationAngle=h,this._pieGroup.transform.baseVal.getItem(0).setRotate(h,this._center.x,this._center.y))}var o=this.selectedItemOffset;if(o>0&&r&&0==r.length){var l=this._selectedOffset.x=Math.cos(a)*o*this._radius,_=this._selectedOffset.y=Math.sin(a)*o*this._radius;s&&s.setAttribute("transform","translate("+l.toFixed()+","+_.toFixed()+")")}this._selectedIndex=e}else s&&(s.parentNode.insertBefore(s,s.parentNode.childNodes.item(e)),s.removeAttribute("transform"),this._highlightItems(this._find(s,["path","ellipse"]),FlexChart._CSS_SELECTION,t)),this._selectedIndex==e&&(this._selectedIndex=-1)}}_animateSelectionAngle(t,e){var i=_Math.clampAngle(this._rotationAngle),s=(t=_Math.clampAngle(t))-i,r=this,a=i,n=r._pieGroup;r._selectionAnimationID&&clearInterval(this._selectionAnimationID),this._selectionAnimationID=wjcCore.animate(function(t){n==r._pieGroup&&(r._rotationAngle=i=a+s*t,r._pieGroup.transform.baseVal.getItem(0).setRotate(i,r._center.x,r._center.y),1==t&&clearInterval(r._selectionAnimationID),t>.99&&(r.selectedItemOffset>0||r.selectedItemPosition!=Position.None)&&r.invalidate())},1e3*e)}_getHitTestItem(t){var e=null,i=null;return(e=null!=this._cv?this._cv.items:this.itemsSource)&&t<e.length&&(i=e[t]),i}_getHitTestValue(t){return this._values[t]}_getHitTestLabel(t){return this._labels[t]}}FlexPie._MARGIN=4,exports.FlexPie=FlexPie;class _Math{static clampAngle(t,e=0){var i=(t+180)%360-180;return i<-180+(e<0?e+360:e)&&(i+=360),i}}class _PieSegment{constructor(t,e,i,s,r=0){this._isFull=!1,this._center=t,this._radius=e,this._originAngle=i,this._originSweep=s,s>=2*Math.PI&&(this._isFull=!0),this._sweep=.5*s*180/Math.PI,this._angle=_Math.clampAngle(180*i/Math.PI+this._sweep),this._radius2=e*e,this._startAngle=r}contains(t){var e=t.x-this._center.x,i=t.y-this._center.y;if(e*e+i*i<=this._radius2){var s=180*Math.atan2(i,e)/Math.PI,r=_Math.clampAngle(this._angle,this._startAngle)-_Math.clampAngle(s,this._startAngle);if(this._isFull||Math.abs(r)<=this._sweep)return!0}return!1}distance(t){if(this.contains(t))return 0;var e=t.x-this._center.x,i=t.y-this._center.y,s=e*e+i*i,r=180*Math.atan2(i,e)/Math.PI,a=_Math.clampAngle(this._angle,this._startAngle)-_Math.clampAngle(r,this._startAngle);return this._isFull||Math.abs(a)<=this._sweep?Math.sqrt(s)-this._radius:void 0}get center(){return this._center}get radius(){return this._radius}get langle(){return this._angle}get angle(){return this._originAngle}get sweep(){return this._originSweep}}exports._PieSegment=_PieSegment;class _DonutSegment{constructor(t,e,i,s,r,a=0){this._isFull=!1,this._center=t,this._radius=e,this._iradius=i,this._originAngle=s,this._originSweep=r,r>=2*Math.PI&&(this._isFull=!0),this._sweep=.5*r*180/Math.PI,this._angle=_Math.clampAngle(180*s/Math.PI+this._sweep),this._radius2=e*e,this._iradius2=i*i,this._startAngle=a}contains(t){var e=t.x-this._center.x,i=t.y-this._center.y,s=e*e+i*i;if(s>=this._iradius2&&s<=this._radius2){var r=180*Math.atan2(i,e)/Math.PI,a=_Math.clampAngle(this._angle,this._startAngle)-_Math.clampAngle(r,this._startAngle);if(this._isFull||Math.abs(a)<=this._sweep)return!0}return!1}distance(t){if(this.contains(t))return 0}get center(){return this._center}get radius(){return this._radius}get langle(){return this._angle}get angle(){return this._originAngle}get sweep(){return this._originSweep}get innerRadius(){return this._iradius}}exports._DonutSegment=_DonutSegment;var Stacking;!function(t){t[t.None=0]="None",t[t.Stacked=1]="Stacked",t[t.Stacked100pc=2]="Stacked100pc"}(Stacking=exports.Stacking||(exports.Stacking={}));var SelectionMode;!function(t){t[t.None=0]="None",t[t.Series=1]="Series",t[t.Point=2]="Point"}(SelectionMode=exports.SelectionMode||(exports.SelectionMode={}));class FlexChartCore extends FlexChartBase{constructor(t,e){super(t,null,!0),this._series=new wjcCore.ObservableArray,this._axes=new AxisCollection,this._pareas=new PlotAreaCollection,this._interpolateNulls=!1,this._legendToggle=!1,this._symbolSize=10,this._dataInfo=new _DataInfo,this.__barPlotter=null,this.__linePlotter=null,this.__areaPlotter=null,this.__bubblePlotter=null,this.__financePlotter=null,this.__funnelPlotter=null,this._plotters=[],this._rotated=!1,this._stacking=Stacking.None,this._xlabels=[],this._xvals=[],this._lblAreas=[],this._colRowLens=[],this._bindingSeparator=",",this.seriesVisibilityChanged=new wjcCore.Event,this.applyTemplate("wj-control wj-flexchart",null,null);var i=this;i._series.collectionChanged.addHandler(function(){for(var t=i._series,e=0;e<t.length;e++){var s=wjcCore.tryCast(t[e],SeriesBase);if(!s)throw"chartSeries array must contain SeriesBase objects.";s._chart=i,s.axisX&&(s.axisX._chart=i),s.axisY&&(s.axisY._chart=i)}i.invalidate()}),this._currentRenderEngine=new _SvgRenderEngine(this.hostElement),this._hitTester=new _HitTester(this),this._legend=new Legend(this),this._tooltip=new ChartTooltip,this._tooltip.showDelay=0,this._lbl=new DataLabel,this._lbl._chart=this,this._initAxes(),i._axes.collectionChanged.addHandler(function(){for(var t=i._axes,e=0;e<t.length;e++){var s=wjcCore.tryCast(t[e],Axis);if(!s)throw"axes array must contain Axis objects.";s._chart=i}i.invalidate()}),i._pareas.collectionChanged.addHandler(function(){for(var t=i._pareas,e=0;e<t.length;e++){var s=wjcCore.tryCast(t[e],PlotArea);if(!s)throw"plotAreas array must contain PlotArea objects.";s._chart=i}i.invalidate()}),this._keywords=new _KeyWords,this.hostElement.addEventListener("click",function(t){var e=i._tooltip;if(e.content&&i.isTouching){var s=i.hitTest(t);if(s.distance<=e.threshold){var r=i._getLabelContent(s,i._tooltip.content);i._showToolTip(r,new wjcCore.Rect(t.clientX,t.clientY,5,5))}else i._hideToolTip()}}),this.hostElement.addEventListener("mousemove",function(t){var e=i._tooltip;if(e.content&&!i.isTouching){var s=i.hitTest(t);if(s.distance<=e.threshold){var r=i._getLabelContent(s,i._tooltip.content);i._showToolTip(r,new wjcCore.Rect(t.clientX,t.clientY,5,5))}else i._hideToolTip()}}),this.hostElement.addEventListener("mouseleave",function(t){i._hideToolTip()}),this.hostElement.addEventListener("click",function(t){if(i.selectionMode!=SelectionMode.None){var e=i._hitTestData(t),s=FlexChart._SELECTION_THRESHOLD;i.tooltip&&i.tooltip.threshold&&(s=i.tooltip.threshold),e.distance<=s&&e.series?i._select(e.series,e.pointIndex):i.selectionMode==SelectionMode.Series&&(e=i.hitTest(t)).chartElement==ChartElement.Legend&&e.series?i._select(e.series,null):i._select(null,null)}!0===i.legendToggle&&(e=i.hitTest(t)).chartElement==ChartElement.Legend&&e.series&&(e.series.visibility==SeriesVisibility.Legend?e.series.visibility=SeriesVisibility.Visible:e.series.visibility==SeriesVisibility.Visible&&(e.series.visibility=SeriesVisibility.Legend),i.focus())}),this.initialize(e)}_initAxes(){this._axisX=new Axis(Position.Bottom),this._axisY=new Axis(Position.Left),this._axisX.majorGrid=!1,this._axisX.name="axisX",this._axisY.majorGrid=!0,this._axisY.majorTickMarks=TickMark.None,this._axisY.name="axisY",this._axisX._chart=this,this._axisY._chart=this,this._axes.push(this._axisX),this._axes.push(this._axisY)}get series(){return this._series}get axes(){return this._axes}get axisX(){return this._axisX}set axisX(t){if(t!=this._axisX){var e=this._axisX=wjcCore.asType(t,Axis);this.beginUpdate(),e&&(void 0===e.majorGrid&&(e.majorGrid=!1),void 0===e.name&&(e.name="axisX"),void 0==e.position&&(e.position=Position.Bottom),e._axisType=AxisType.X,e._chart=this),this.endUpdate()}}get axisY(){return this._axisY}set axisY(t){if(t!=this._axisY){var e=this._axisY=wjcCore.asType(t,Axis);this.beginUpdate(),e&&(void 0===e.majorGrid&&(e.majorGrid=!0),void 0===e.name&&(e.name="axisY"),e.majorTickMarks=TickMark.None,void 0==e.position&&(e.position=Position.Left),e._axisType=AxisType.Y,e._chart=this),this.endUpdate()}}get plotAreas(){return this._pareas}get binding(){return this._binding}set binding(t){t!=this._binding&&(this._binding=wjcCore.asString(t,!0),this.invalidate())}get bindingX(){return this._bindingX}set bindingX(t){t!=this._bindingX&&(this._bindingX=wjcCore.asString(t,!0),this._bindChart())}get symbolSize(){return this._symbolSize}set symbolSize(t){t!=this._symbolSize&&(this._symbolSize=wjcCore.asNumber(t,!1,!0),this.invalidate())}get interpolateNulls(){return this._interpolateNulls}set interpolateNulls(t){t!=this._interpolateNulls&&(this._interpolateNulls=wjcCore.asBoolean(t),this.invalidate())}get legendToggle(){return this._legendToggle}set legendToggle(t){t!=this._legendToggle&&(this._legendToggle=wjcCore.asBoolean(t))}get tooltip(){return this._tooltip}get dataLabel(){return this._lbl}set dataLabel(t){t!=this._lbl&&(this._lbl=wjcCore.asType(t,DataLabel),this._lbl&&(this._lbl._chart=this))}get selection(){return this._selection}set selection(t){t!=this._selection&&(this._selection=wjcCore.asType(t,SeriesBase,!0),this.invalidate())}onSeriesVisibilityChanged(t){this.seriesVisibilityChanged.raise(this,t)}hitTest(t,e){var i=this._toControl(t,e),s=new HitTestInfo(this,i),r=null;if(FlexChart._contains(this._rectHeader,i))s._chartElement=ChartElement.Header;else if(FlexChart._contains(this._rectFooter,i))s._chartElement=ChartElement.Footer;else if(FlexChart._contains(this._rectLegend,i))s._chartElement=ChartElement.Legend,null!==(r=this.legend._hitTest(i))&&r>=0&&r<this.series.length&&(this._getChartType()===ChartType.Bar?s._setData(this.series[this.series.length-1-r]):s._setData(this.series[r]));else if(FlexChart._contains(this._rectChart,i)){var a=this._hitTestLabels(i);if(a)s._chartElement=ChartElement.DataLabel,s._dist=0,s._setDataPoint(a.tag);else{for(var n=this._hitTester.hitTest(i),h=null,o=null,l=this.series.length-1;l>=0;l--)if(this.series[l].hitTest!==Series.prototype.hitTest){var _=this.series[l].hitTest(t);if(_&&((!h||_.distance<h.distance)&&(h=_,o=l),0===_.distance))break}n&&n.area?h&&h.distance<n.distance?s=h:h&&h.distance==n.distance&&o>n.area.tag.seriesIndex?s=h:(s._setDataPoint(n.area.tag),s._dist=n.distance):h&&(s=h),FlexChart._contains(this.axisX._axrect,i)?s._chartElement=ChartElement.AxisX:FlexChart._contains(this.axisY._axrect,i)?s._chartElement=ChartElement.AxisY:FlexChart._contains(this._plotRect,i)?s._chartElement=ChartElement.PlotArea:FlexChart._contains(this._rectChart,i)&&(s._chartElement=ChartElement.ChartArea)}}else s._chartElement=ChartElement.None;return s}pointToData(t,e){return wjcCore.isNumber(t)&&wjcCore.isNumber(e)&&(t=new wjcCore.Point(t,e)),t instanceof MouseEvent?(t=new wjcCore.Point(t.pageX,t.pageY),t=this._toControl(t)):t=t.clone(),t.x=this.axisX.convertBack(t.x),t.y=this.axisY.convertBack(t.y),t}dataToPoint(t,e){wjcCore.isNumber(t)&&wjcCore.isNumber(e)&&(t=new wjcCore.Point(t,e)),wjcCore.asType(t,wjcCore.Point);var i=t.clone();return i.x=this.axisX.convert(i.x),i.y=this.axisY.convert(i.y),i}_copy(t,e){if("series"==t){this.series.clear();for(var i=wjcCore.asArray(e),s=0;s<i.length;s++){var r=this._createSeries();wjcCore.copy(r,i[s]),this.series.push(r)}return!0}return!1}_createSeries(){return new Series}_clearCachedValues(){for(var t=0;t<this._series.length;t++){var e=this._series[t];null==e.itemsSource&&e._clearValues()}}_performBind(){if(this._xDataType=null,this._xlabels.splice(0),this._xvals.splice(0),this._cv){var t=this._cv.items;if(t){for(var e=t.length,i=0;i<e;i++){var s=t[i];if(this._bindingX){var r=s[this._bindingX];wjcCore.isNumber(r)?(this._xvals.push(wjcCore.asNumber(r)),this._xDataType=wjcCore.DataType.Number):wjcCore.isDate(r)&&(this._xvals.push(wjcCore.asDate(r).valueOf()),this._xDataType=wjcCore.DataType.Date),this._xlabels.push(s[this._bindingX])}}this._xvals.length==e?this._xlabels.splice(0):this._xvals.splice(0)}}}_hitTestSeries(t,e){var i=this._toControl(t),s=new HitTestInfo(this,i),r=this._hitTester.hitTestSeries(i,e);return r&&r.area&&(s._setDataPoint(r.area.tag),s._chartElement=ChartElement.PlotArea,s._dist=r.distance),s}_hitTestData(t){var e=this._toControl(t),i=new HitTestInfo(this,e),s=this._hitTester.hitTest(e,!0);return s&&s.area&&(i._setDataPoint(s.area.tag),i._dist=s.distance),i}_hitTestLabels(t){for(var e=null,i=this._lblAreas.length,s=0;s<i;s++)if(this._lblAreas[s].contains(t)){e=this._lblAreas[s];break}return e}static _dist2(t,e){var i=t.x-e.x,s=t.y-e.y;return i*i+s*s}static _dist(t,e,i){return Math.sqrt(FlexChart._distToSegmentSquared(t,e,i))}static _distToSegmentSquared(t,e,i){var s=FlexChart._dist2(e,i);if(0==s)return FlexChart._dist2(t,e);var r=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/s;return r<0?FlexChart._dist2(t,e):r>1?FlexChart._dist2(t,i):FlexChart._dist2(t,new wjcCore.Point(e.x+r*(i.x-e.x),e.y+r*(i.y-e.y)))}_isRotated(){return this._getChartType()==ChartType.Bar?!this._rotated:this._rotated}_getChartType(){return null}_prepareRender(){this._hitTester.clear()}_renderChart(t,e,i){var s=this._rectChart.clone(),r=new wjcCore.Size(s.width,s.height);e.width,e.height;(m=this._getPlotter(null)).stacking=this._stacking,this._curPlotter!=m&&(this._curPlotter&&this._curPlotter.unload(),this._curPlotter=m),m.load();var a=this._isRotated();this._dataInfo.analyse(this._series,a,m.stacking,this._xvals.length>0?this._xvals:null,this.axisX._getLogBase()>0,this.axisY._getLogBase()>0);var n=m.adjustLimits(this._dataInfo,e.clone());if(a){var h=this._dataInfo.getDataTypeX();h||(h=this._xDataType),this.axisX._updateActualLimits(this._dataInfo.getDataTypeY(),n.left,n.right),this.axisY._updateActualLimits(h,n.top,n.bottom,this._xlabels,this._xvals)}else{var o=this._dataInfo.getDataTypeX();o||(o=this._xDataType),this.axisX._updateActualLimits(o,n.left,n.right,this._xlabels,this._xvals),this.axisY._updateActualLimits(this._dataInfo.getDataTypeY(),n.top,n.bottom)}var l=this._getAxes();if(this._updateAuxAxes(l,a),this._layout(e,r,t),t.startGroup(FlexChart._CSS_PLOT_AREA),t.fill="transparent",t.stroke=null,this.plotAreas.length>0)for(u=0;u<this.plotAreas.length;u++)this.plotAreas[u]._render(t);else{var _=this._plotRect;t.drawRect(_.left,_.top,_.width,_.height)}t.endGroup();var c=this._series.length;this._clearPlotters();for(var d={},u=0;u<c;u++){var g=this._series[u];if(((f=g.visibility)==SeriesVisibility.Visible||f==SeriesVisibility.Plot)&&g.getValues(0)){var p=g._getAxisY(),m=this._getPlotter(g);if(!p||p==this.axisY||m instanceof _BarPlotter)m.seriesCount++;else{var x=p._uniqueId;d[x]?d[x].count+=1:d[x]={count:1,index:0}}}}if(this.onRendering(new RenderEventArgs(t)),this._getChartType()!==ChartType.Funnel)for(u=0;u<l.length;u++){var v=l[u];w=v.axisType==AxisType.X?t.startGroup(FlexChart._CSS_AXIS_X,this._chartRectId):t.startGroup(FlexChart._CSS_AXIS_Y,this._chartRectId),v._hostElement=i?w:v._hostElement,v._render(t),t.endGroup()}t.startGroup("wj-series-group"),this._plotrectId="plotRect"+(1e6*Math.random()).toFixed(),t.addClipRect(this._plotRect,this._plotrectId);for(u=0;u<c;u++){let e=this._series[u];e._pointIndexes=[];m=this._getPlotter(e);e._plotter=m;var w=t.startGroup(e.cssClass,m.clipping?this._plotrectId:null);e._hostElement=i?w:e._hostElement;var f=e.visibility,C=e.axisX,y=e.axisY;if(C||(C=this.axisX),y||(y=this.axisY),f==SeriesVisibility.Visible||f==SeriesVisibility.Plot){var b,S,M=d[y._uniqueId];M?(b=M.index,S=M.count,M.index++,e.onRendering(t,b,S)||m.plotSeries(t,C,y,e,this,b,S)):(b=m.seriesIndex,S=m.seriesCount,m.seriesIndex++,e.onRendering(t,b,S)||m.plotSeries(t,C,y,e,this,b,S)),e.onRendered(t)}t.endGroup()}t.endGroup(),this._lblAreas=[],this.dataLabel.content&&this.dataLabel.position!=LabelPosition.None&&this._renderLabels(t),this._highlightCurrent(),this.onRendered(new RenderEventArgs(t))}_getDesiredLegendSize(t,e,i,s){var r=new wjcCore.Size,a=this.series,n=a.length,h=0,o=0;this._colRowLens=[];for(var l=0;l<n;l++){var _=wjcCore.tryCast(a[l],SeriesBase),c=_.visibility;if(_.name&&c!=SeriesVisibility.Hidden&&c!=SeriesVisibility.Plot)for(var d=_.legendItemLength(),u=0;u<d;u++){var g=_.measureLegendItem(t,u);e?(h+g.height>s&&(r.height=s,this._colRowLens.push(o),o=0,h=0),o<g.width&&(o=g.width),h+=g.height):(o+g.width>i&&(r.width=i,this._colRowLens.push(h),h=0,o=0),h<g.height&&(h=g.height),o+=g.width)}}return e?(r.height<h&&(r.height=h),this._colRowLens.push(o),r.width=this._colRowLens.reduce((t,e)=>t+e,0),r.width>i/2&&(r.width=i/2)):(r.width<o&&(r.width=o),this._colRowLens.push(h),r.height=this._colRowLens.reduce((t,e)=>t+e,0),r.height>s/2&&(r.height=s/2)),r}_renderLegend(t,e,i,s,r,a){var n,h=this.series,o=h.length,l=e.clone(),_=0;if(this._getChartType()===ChartType.Bar)for(c=o-1;c>=0;c--)n=wjcCore.tryCast(h[c],SeriesBase),_=this._renderLegendElements(t,n,e,l,i,s,r,a,_);else for(var c=0;c<o;c++)n=wjcCore.tryCast(h[c],SeriesBase),_=this._renderLegendElements(t,n,e,l,i,s,r,a,_)}_renderLegendElements(t,e,i,s,r,a,n,h,o){var l=this._rectLegend,_=o;if(!e)return _;var c=e.visibility;if(!e.name||c==SeriesVisibility.Hidden||c==SeriesVisibility.Plot)return e._legendElement=null,r.push(null),_;var d=e.legendItemLength(),u=t.startGroup(e.cssClass);c==SeriesVisibility.Legend?(u.setAttribute("opacity","0.5"),e._legendElement=u):c==SeriesVisibility.Visible?e._legendElement=u:e._legendElement=null;for(var g=0;g<d;g++){var p=e.measureLegendItem(t,g);a?s.y+p.height>l.top+l.height+1&&(s.x+=this._colRowLens[_],_++,s.y=i.y):s.x+p.width>l.left+l.width+1&&(s.y+=this._colRowLens[_],_++,s.x=i.x);var m=new wjcCore.Rect(s.x,s.y,p.width,p.height);c!=SeriesVisibility.Legend&&c!=SeriesVisibility.Visible||e.drawLegendItem(t,m,g),r.push(m),a?s.y+=p.height:s.x+=p.width}return t.endGroup(),_}_renderLabels(t){var e=this.series,i=e.length;t.stroke="null",t.fill="transparent",t.strokeWidth=1;var s=FlexChartCore._CSS_DATA_LABELS;t.startGroup(s);for(var r=0;r<i;r++){var a=e[r],n=this._hitTester._map[r];n&&a._renderLabels(t,n,this,this._lblAreas)}t.endGroup()}_getAxes(){for(var t=[this.axisX,this.axisY],e=this.series.length,i=0;i<e;i++){var s=this.series[i],r=s.axisX;r&&-1===t.indexOf(r)&&t.push(r);var a=s.axisY;a&&-1===t.indexOf(a)&&t.push(a)}return t}_clearPlotters(){for(var t=this._plotters.length,e=0;e<t;e++)this._plotters[e].clear()}_initPlotter(t){t.chart=this,t.dataInfo=this._dataInfo,t.hitTester=this._hitTester,this._plotters.push(t)}get _barPlotter(){return null===this.__barPlotter&&(this.__barPlotter=new _BarPlotter,this._initPlotter(this.__barPlotter)),this.__barPlotter}get _linePlotter(){return null===this.__linePlotter&&(this.__linePlotter=new _LinePlotter,this._initPlotter(this.__linePlotter)),this.__linePlotter}get _areaPlotter(){return null===this.__areaPlotter&&(this.__areaPlotter=new _AreaPlotter,this._initPlotter(this.__areaPlotter)),this.__areaPlotter}get _bubblePlotter(){return null===this.__bubblePlotter&&(this.__bubblePlotter=new _BubblePlotter,this._initPlotter(this.__bubblePlotter)),this.__bubblePlotter}get _financePlotter(){return null===this.__financePlotter&&(this.__financePlotter=new _FinancePlotter,this._initPlotter(this.__financePlotter)),this.__financePlotter}get _funnelPlotter(){return null===this.__funnelPlotter&&(this.__funnelPlotter=new _FunnelPlotter,this._initPlotter(this.__funnelPlotter)),this.__funnelPlotter}_getPlotter(t){var e=this._getChartType(),i=!1;if(t){var s=t._getChartType();null!==s&&void 0!==s&&s!=e&&(e=s,i=!0)}var r;switch(e){case ChartType.Column:this._barPlotter.isVolume=!1,this._barPlotter.width=.7,r=this._barPlotter;break;case ChartType.Bar:this._barPlotter.rotated=!this._rotated,this._barPlotter.isVolume=!1,this._barPlotter.width=.7,r=this._barPlotter;break;case ChartType.Line:this._linePlotter.hasSymbols=!1,this._linePlotter.hasLines=!0,this._linePlotter.isSpline=!1,r=this._linePlotter;break;case ChartType.Scatter:this._linePlotter.hasSymbols=!0,this._linePlotter.hasLines=!1,this._linePlotter.isSpline=!1,r=this._linePlotter;break;case ChartType.LineSymbols:this._linePlotter.hasSymbols=!0,this._linePlotter.hasLines=!0,this._linePlotter.isSpline=!1,r=this._linePlotter;break;case ChartType.Area:this._areaPlotter.isSpline=!1,r=this._areaPlotter;break;case ChartType.Bubble:r=this._bubblePlotter;break;case ChartType.Candlestick:(a=this._financePlotter).isCandle=!0,a.isEqui=!1,a.isArms=!1,a.isVolume=!1,r=a;break;case ChartType.HighLowOpenClose:var a=this._financePlotter;a.isCandle=!1,a.isEqui=!1,a.isArms=!1,a.isVolume=!1,r=a;break;case ChartType.Spline:this._linePlotter.hasSymbols=!1,this._linePlotter.hasLines=!0,this._linePlotter.isSpline=!0,r=this._linePlotter;break;case ChartType.SplineSymbols:this._linePlotter.hasSymbols=!0,this._linePlotter.hasLines=!0,this._linePlotter.isSpline=!0,r=this._linePlotter;break;case ChartType.SplineArea:this._areaPlotter.isSpline=!0,r=this._areaPlotter;break;case ChartType.Funnel:r=this._funnelPlotter;break;default:throw"Invalid chart type."}return r.rotated=this._rotated,e==ChartType.Bar&&(r.rotated=!r.rotated),i&&(r.rotated=this._isRotated()),r}_layout(t,e,i){this.plotAreas.length>0?this._layoutMultiple(t,e,i):this._layoutSingle(t,e,i)}_layoutSingle(t,e,i){for(var s=t.width,r=t.height,a=new wjcCore.Size(s,.75*r),n=new wjcCore.Size(r,.75*s),h=0,o=0,l=s,_=r,c=0,d=0,u=s,g=r,p=this._getAxes(),m=0;m<p.length;m++){var x=(b=p[m]).origin,v=b._getPosition();if(b.axisType==AxisType.X){(C=b._getHeight(i,s))>a.height&&(C=a.height),b._desiredSize=new wjcCore.Size(a.width,C);var w=b._hasOrigin=wjcCore.isNumber(x)&&x>this.axisY._getMinNum()&&x<this.axisY._getMaxNum(),f=Math.min(.25*s,b._annoSize.width);if(v==Position.Bottom)if(h=Math.max(h,.5*f),l=Math.min(l,s-.5*f),w){M=this._convertY(x,d,g);g-=Math.max(0,M+C-g)}else g-=C;else if(v==Position.Top)if(h=Math.max(h,.5*f),l=Math.min(l,s-.5*f),w){M=this._convertY(x,d,g);d+=Math.max(0,d-(M-C))}else d+=C}else if(b.axisType==AxisType.Y){var C=b._getHeight(i,r);C>n.height&&(C=n.height),b._desiredSize=new wjcCore.Size(n.width,C);w=b._hasOrigin=wjcCore.isNumber(x)&&x>this.axisX._getMinNum()&&x<this.axisX._getMaxNum();if(v==Position.Left)if(b._actualAngle<0?_=Math.min(_,r-b._annoSize.height):b._actualAngle>0?o=Math.max(o,b._annoSize.height):(o=Math.max(o,b._annoSize.height),_=Math.min(_,r-b._annoSize.height)),w){A=this._convertX(x,c,u);c+=Math.max(0,c-(A-C))}else c+=C;else if(v==Position.Right)if(b._actualAngle>0?_=Math.min(_,r-b._annoSize.height):b._actualAngle<0?o=Math.max(o,b._annoSize.height):(o=Math.max(o,b._annoSize.height),_=Math.min(_,r-b._annoSize.height)),w){A=this._convertX(x,c,u);u-=Math.max(0,A+C-u)}else u-=C}}var y=this._parseMargin(this.plotMargin);h=c=isNaN(y.left)?Math.max(h,c)+t.left:y.left,l=u=isNaN(y.right)?Math.min(l,u)+t.left:e.width-y.right,o=d=isNaN(y.top)?Math.max(o,d)+t.top:y.top,_=g=isNaN(y.bottom)?Math.min(_,g)+t.top:e.height-y.bottom,s=Math.max(1,l-h),r=Math.max(1,_-o),this._plotRect=new wjcCore.Rect(h,o,s,r),i.stroke=null;for(m=0;m<p.length;m++){var b=p[m],x=b.origin,v=b._getPosition();if(b.axisType==AxisType.X){var S;if(b._hasOrigin){var M=this._convertY(x,this._plotRect.top,this._plotRect.bottom);v==Position.Bottom?(S=new wjcCore.Rect(h,M,s,b._desiredSize.height),g+=Math.max(0,S.bottom-this._plotRect.bottom)):v==Position.Top?(S=new wjcCore.Rect(h,M-b._desiredSize.height,s,b._desiredSize.height),d-=Math.max(0,this._plotRect.top-S.top)):S=new wjcCore.Rect(h,M,s,1)}else v==Position.Bottom?(S=new wjcCore.Rect(h,g,s,b._desiredSize.height),g+=b._desiredSize.height):v==Position.Top?(S=new wjcCore.Rect(h,d-b._desiredSize.height,s,b._desiredSize.height),d-=b._desiredSize.height):S=new wjcCore.Rect(h,d,s,1);b._layout(S,this._plotRect)}else if(b.axisType==AxisType.Y){var T;if(b._hasOrigin){var A=this._convertX(x,this._plotRect.left,this._plotRect.right);v==Position.Left?(T=new wjcCore.Rect(A-b._desiredSize.height,o,r,b._desiredSize.height),c-=b._desiredSize.height):v==Position.Right?(T=new wjcCore.Rect(A,o,r,b._desiredSize.height),u+=b._desiredSize.height):T=new wjcCore.Rect(A,o,r,1)}else v==Position.Left?(T=new wjcCore.Rect(c-b._desiredSize.height,o,r,b._desiredSize.height),c-=b._desiredSize.height):v==Position.Right?(T=new wjcCore.Rect(u,o,r,b._desiredSize.height),u+=b._desiredSize.height):T=new wjcCore.Rect(c,o,r,1);b._layout(T,this._plotRect)}}}_layoutMultiple(t,e,i){for(var s=t.width,r=t.height,a=[],n=[],h=this._getAxes(),o=h.length,l=0;l<o;l++)if((b=h[l])._plotrect=null,b.axisType==AxisType.X){for(var _=b.plotArea?b.plotArea.column:0;a.length<=_;)a.push(new _AreaDef);a[_].axes.push(b)}else if(b.axisType==AxisType.Y){for(var c=b.plotArea?b.plotArea.row:0;n.length<=c;)n.push(new _AreaDef);n[c].axes.push(b)}for(var d=a.length,u=n.length,g=new wjcCore.Size(s,.3*r),p=new wjcCore.Size(r,.3*s),m=0,x=0,v=s,w=r,f=0;f<d;f++){(I=a[f]).right=s,I.bottom=r;for(l=0;l<I.axes.length;l++){var C=(b=I.axes[l])._getHeight(i,b.axisType==AxisType.X?s:r);C>g.height&&(C=g.height);var y=new wjcCore.Size(g.width,C);b._desiredSize=y,0==f&&(I.left=Math.max(I.left,.5*b._annoSize.width)),f==d-1&&(I.right=Math.min(I.right,s-.5*b._annoSize.width)),(D=b._getPosition())==Position.Bottom?I.bottom-=y.height:D==Position.Top&&(I.top+=y.height)}}for(X=0;X<u;X++){(I=n[X]).right=s,I.bottom=r;for(l=0;l<I.axes.length;l++){var b=I.axes[l],S=new wjcCore.Size(p.width,b._getHeight(i,b.axisType==AxisType.X?s:r));S.height>p.height&&(S.height=p.height),b._desiredSize=S,0==X&&(I.top=Math.max(I.top,.5*b._annoSize.width)),X==u-1&&(I.bottom=Math.min(I.bottom,r-.5*b._annoSize.width)),(D=b._getPosition())==Position.Left?I.left+=S.height:D==Position.Right&&(I.right-=S.height)}}for(var M=0,T=0,A=s,L=r,f=0;f<d;f++){I=a[f];M=Math.max(M,I.left),T=Math.max(T,I.top),A=Math.min(A,I.right),L=Math.min(L,I.bottom)}for(X=0;X<u;X++){I=n[X];M=Math.max(M,I.left),T=Math.max(T,I.top),A=Math.min(A,I.right),L=Math.min(L,I.bottom)}M=m=Math.max(m,M),A=v=Math.min(v,A),T=x=Math.max(x,T),L=w=Math.min(w,L),this._plotRect=new wjcCore.Rect(m,x,v-m,w-x);for(var P=this._plotRect.clone(),k=m,N=this.plotAreas._calculateWidths(this._plotRect.width,d),f=0;f<d;f++){L=w,T=x;for(var I=a[f],j=N[f],l=0;l<I.axes.length;l++){var E,D=(b=I.axes[l])._getPosition(),R=new wjcCore.Rect(k,P.top,j,P.height);D==Position.Bottom?(E=new wjcCore.Rect(k,L,j,b._desiredSize.height),L+=b._desiredSize.height):D==Position.Top&&(E=new wjcCore.Rect(k,T-b._desiredSize.height,j,b._desiredSize.height),T-=b._desiredSize.height),b._layout(E,R)}for(l=0;l<this.plotAreas.length;l++)(H=this.plotAreas[l]).column==f&&H._setPlotX(k,j);k+=j}for(var F=x,V=this.plotAreas._calculateHeights(this._plotRect.height,u),X=0;X<u;X++){M=m,A=v;for(var I=n[X],B=V[X],l=0;l<I.axes.length;l++){var D=(b=I.axes[l])._getPosition(),R=new wjcCore.Rect(P.left,F,P.width,B);b._plotrect?(R.left=b._plotrect.left,R.width=b._plotrect.width):N&&N.length>0&&(R.width=N[0]);var Y;D==Position.Left?(Y=new wjcCore.Rect(M-b._desiredSize.height,F,B,b._desiredSize.height),M-=b._desiredSize.height):D==Position.Right&&(Y=new wjcCore.Rect(A,F,B,b._desiredSize.height),A+=b._desiredSize.height),b._layout(Y,R)}for(l=0;l<this.plotAreas.length;l++){var H=this.plotAreas[l];H.row==X&&H._setPlotY(F,B)}F+=B}}_convertX(t,e,i){var s=this.axisX;return s.reversed?i-(i-e)*(t-s._getMinNum())/(s._getMaxNum()-s._getMinNum()):e+(i-e)*(t-s._getMinNum())/(s._getMaxNum()-s._getMinNum())}_convertY(t,e,i){var s=this.axisY;return s.reversed?e+(i-e)*(t-s._getMinNum())/(s._getMaxNum()-s._getMinNum()):i-(i-e)*(t-s._getMinNum())/(s._getMaxNum()-s._getMinNum())}_getLabelContent(t,e){return wjcCore.isString(e)?this._keywords.replace(e,t):wjcCore.isFunction(e)?e(t):null}_select(t,e){var i=!1;if(t==this._selection&&e==this._selectionIndex||(i=!0),this._selection&&this._highlight(this._selection,!1,this._selectionIndex),this._selection=t,this._selectionIndex=e,this._selection&&this._highlight(this._selection,!0,this._selectionIndex),this.selectionMode==SelectionMode.Point){var s=t?t.collectionView:this._cv;s&&(this._notifyCurrentChanged=!1,s.moveCurrentToPosition(t?e:-1),this._notifyCurrentChanged=!0)}i&&this.onSelectionChanged()}_highlightCurrent(){if(this.selectionMode!=SelectionMode.None){var t=this._selection,e=-1;if(t){var i=t.collectionView;i||(i=this._cv),i&&(e=i.currentPosition),this._highlight(t,!0,e)}}}_highlight(t,e,i){if(t=wjcCore.asType(t,SeriesBase,!0),this.selectionMode==SelectionMode.Series){var s=this.series.indexOf(t),r=t.hostElement;e?r.parentNode.appendChild(r):r.parentNode.insertBefore(r,r.parentNode.childNodes.item(s));n=this._find(r,["rect","ellipse","polyline","polygon","line","path"]);this._highlightItems(n,FlexChart._CSS_SELECTION,e),t.legendElement&&this._highlightItems(this._find(t.legendElement,["rect","ellipse","line"]),FlexChart._CSS_SELECTION,e)}else if(this.selectionMode==SelectionMode.Point){var s=this.series.indexOf(t),r=t.hostElement;if(e){r.parentNode.appendChild(r);var a=t.getPlotElement(i);if(a){"g"!=a.nodeName&&this._highlightItems([a],FlexChart._CSS_SELECTION,e);n=this._find(a,["line","rect","ellipse","path","polygon"]);this._highlightItems(n,FlexChart._CSS_SELECTION,e)}}else{r.parentNode.insertBefore(r,r.parentNode.childNodes.item(s));var n=this._find(r,["rect","ellipse","line","path","polygon"]);this._highlightItems(n,FlexChart._CSS_SELECTION,e)}}}_updateAuxAxes(t,e){for(var i=2;i<t.length;i++){var s=t[i];s._chart=this;for(var r=[],a=0;a<this.series.length;a++){var n=this.series[a];n.axisX!=s&&n.axisY!=s||r.push(n)}for(var h,o,a=0;a<r.length;a++){var l=r[a].getDataRect()||r[a]._getDataRect();l&&(s.axisType==AxisType.X&&!e||s.axisType==AxisType.Y&&e?((void 0===h||l.left<h)&&(h=l.left),(void 0===o||l.right>o)&&(o=l.right)):((void 0===h||l.top<h)&&(h=l.top),(void 0===o||l.bottom>o)&&(o=l.bottom)))}var _=r[0].getDataType(0);null==_&&(_=wjcCore.DataType.Number),t[i]._updateActualLimits(_,h,o)}}static _contains(t,e){return!(!t||!e)&&(e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom)}static _intersects(t,e){return!(t.left>e.right||t.right<e.left||t.top>e.bottom||t.bottom<e.top)}static _toOADate(t){return t.valueOf()}static _fromOADate(t){return new Date(t)}static _renderText(t,e,i,s,r,a,n,h,o){var l=t.measureString(e,a,n,h),_=i.x,c=i.y;switch(s){case 1:_-=.5*l.width;break;case 2:_-=l.width}switch(r){case 1:c+=.5*l.height;break;case 0:c+=l.height}var d=new wjcCore.Rect(_,c-l.height,l.width,l.height);return o?o(d)?(t.drawString(e,new wjcCore.Point(_,c),a,h),d):null:(t.drawString(e,new wjcCore.Point(_,c),a,h),d)}static _renderRotatedText(t,e,i,s,r,a,n,h,o,l){var _=t.measureString(e,h,o,l),c=i.x,d=i.y;switch(s){case 1:c-=.5*_.width;break;case 2:c-=_.width}switch(r){case 1:d+=.5*_.height;break;case 0:d+=_.height}return t.drawStringRotated(e,new wjcCore.Point(c,d),a,n,h,l)}}FlexChartCore._CSS_AXIS_X="wj-axis-x",FlexChartCore._CSS_AXIS_Y="wj-axis-y",FlexChartCore._CSS_LINE="wj-line",FlexChartCore._CSS_GRIDLINE="wj-gridline",FlexChartCore._CSS_TICK="wj-tick",FlexChartCore._CSS_GRIDLINE_MINOR="wj-gridline-minor",FlexChartCore._CSS_TICK_MINOR="wj-tick-minor",FlexChartCore._CSS_LABEL="wj-label",FlexChartCore._CSS_LEGEND="wj-legend",FlexChartCore._CSS_HEADER="wj-header",FlexChartCore._CSS_FOOTER="wj-footer",FlexChartCore._CSS_TITLE="wj-title",FlexChartCore._CSS_SELECTION="wj-state-selected",FlexChartCore._CSS_PLOT_AREA="wj-plot-area",FlexChartCore._CSS_DATA_LABELS="wj-data-labels",FlexChartCore._FG="#666",FlexChartCore._epoch=new Date(1899,11,30).getTime(),FlexChartCore._msPerDay=864e5,exports.FlexChartCore=FlexChartCore;class _AreaDef{constructor(){this._axes=new Array,this.left=0,this.right=0,this.top=0,this.bottom=0}get axes(){return this._axes}}class _DataInfo{constructor(){this.stackAbs={},this._xvals=null}analyse(t,e,i,s,r,a){this.minY=NaN,this.maxY=NaN,this.minX=NaN,this.maxX=NaN,this.minXp=NaN,this.minYp=NaN,this.dx=0;var n={},h={},o={};if(this.dataTypeX=null,this.dataTypeY=null,this._xvals=s,null!=s)for(var l=s.length,_=0;_<l;_++){b=s[_];if((isNaN(this.minX)||this.minX>b)&&(this.minX=b),(isNaN(this.maxX)||this.maxX<b)&&(this.maxX=b),b>0&&(isNaN(this.minXp)||this.minXp>b)&&(this.minXp=b),_>0){v=Math.abs(b-s[_-1]);!isNaN(v)&&(v<this.dx||0==this.dx)&&(this.dx=v)}}for(_=0;_<t.length;_++){var c=t[_],d=c._getChartType(),u=void 0!==c.chartType,g=c.visibility;if(g!=SeriesVisibility.Hidden&&g!=SeriesVisibility.Legend){var p,m=c.getDataRect();m&&(!isNaN(this.minX)&&this.minX<m.left&&(p=m.right,m.left=this.minX,m.width=p-this.minX),!isNaN(this.maxX)&&this.maxX>m.right&&(m.width=this.maxX-m.left),!isNaN(this.minY)&&this.minY<m.top&&(p=m.bottom,m.top=this.minY,m.height=p-this.minY),!isNaN(this.maxY)&&this.maxY>m.bottom&&(m.height=this.maxY-m.top));var x=null;if(e?c._isCustomAxisY()||(x=c.getValues(1)):c._isCustomAxisX()||(x=c.getValues(1)),x){this.dataTypeX||(this.dataTypeX=c.getDataType(1));for(C=0;C<x.length;C++){y=x[C];if(_DataInfo.isValid(y)&&((isNaN(this.minX)||this.minX>y)&&(this.minX=y),(isNaN(this.maxX)||this.maxX<y)&&(this.maxX=y),C>0&&(!d||d==ChartType.Column||d==ChartType.Bar))){var v=Math.abs(y-x[C-1]);!isNaN(v)&&v>0&&(v<this.dx||0==this.dx)&&(this.dx=v)}}}var w=null,f=!1;if(e?(f=c._isCustomAxisX(),w=c.getValues(0)):(f=c._isCustomAxisY(),w=c.getValues(0)),w&&(this.dataTypeY||f||(this.dataTypeY=c.getDataType(0)),isNaN(this.minX)?this.minX=0:x||s||(this.minX=Math.min(this.minX,0)),isNaN(this.maxX)?this.maxX=w.length-1:x||s||(this.maxX=Math.max(this.maxX,w.length-1)),!f))for(var C=0;C<w.length;C++){var y=w[C],b=x?wjcCore.asNumber(x[C],!0):s?wjcCore.asNumber(s[C],!0):C;wjcCore.isArray(y)?y.forEach(t=>{this._parseYVal(t,b,u,o,n,h)}):this._parseYVal(y,b,u,o,n,h)}var S=c.getDataRect(new wjcCore.Rect(this.minX,this.minY,this.maxX-this.minX,this.maxY-this.minY),m);S&&(this.minX=S.left,this.maxX=S.right,this.minY=S.top,this.maxY=S.bottom)}}if(i==Stacking.Stacked){for(var M in n)n[M]>this.maxY&&(this.maxY=n[M]);for(var M in h)h[M]<this.minY&&(this.minY=h[M])}else if(i==Stacking.Stacked100pc){this.minY=0,this.maxY=1;for(var M in o){var T=o[M];if(isFinite(T)&&0!=T){var A=n[M],L=h[M];isFinite(A)&&(A=Math.min(A/T,this.maxY)),isFinite(L)&&(L=Math.max(L/T,this.minY))}}}this.stackAbs=o,r&&(e?this.minY=isNaN(this.minYp)?1:this.minYp:this.minX=isNaN(this.minXp)?1:this.minXp),a&&(e?this.minX=isNaN(this.minXp)?1:this.minXp:this.minY=isNaN(this.minYp)?1:this.minYp)}_parseYVal(t,e,i,s,r,a){_DataInfo.isValid(t)&&(null!=t&&(isNaN(this.minY)||this.minY>t)&&(this.minY=t),null!=t&&(isNaN(this.maxY)||this.maxY<t)&&(this.maxY=t),t>0&&(isNaN(this.minYp)||this.minYp>t)&&(this.minYp=t),i||(t>0?isNaN(r[e])?r[e]=t:r[e]+=t:isNaN(a[e])?a[e]=t:a[e]+=t,isNaN(s[e])?s[e]=Math.abs(t):s[e]+=Math.abs(t)))}getMinY(){return this.minY}getMaxY(){return this.maxY}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinXp(){return this.minXp}getMinYp(){return this.minYp}getDeltaX(){return this.dx}getDataTypeX(){return this.dataTypeX}getDataTypeY(){return this.dataTypeY}getStackedAbsSum(t){var e=this.stackAbs[t];return isFinite(e)?e:0}getXVals(){return this._xvals}static isValid(t){return isFinite(t)}}exports._DataInfo=_DataInfo;class ChartTooltip extends wjcCore.Tooltip{constructor(){super(),this._content="<b>{seriesName}</b><br/>{x} {y}",this._threshold=15}get content(){return this._content}set content(t){t!=this._content&&(this._content=t)}get threshold(){return this._threshold}set threshold(t){t!=this._threshold&&(this._threshold=wjcCore.asNumber(t))}}exports.ChartTooltip=ChartTooltip;var ChartType;!function(t){t[t.Column=0]="Column",t[t.Bar=1]="Bar",t[t.Scatter=2]="Scatter",t[t.Line=3]="Line",t[t.LineSymbols=4]="LineSymbols",t[t.Area=5]="Area",t[t.Bubble=6]="Bubble",t[t.Candlestick=7]="Candlestick",t[t.HighLowOpenClose=8]="HighLowOpenClose",t[t.Spline=9]="Spline",t[t.SplineSymbols=10]="SplineSymbols",t[t.SplineArea=11]="SplineArea",t[t.Funnel=12]="Funnel"}(ChartType=exports.ChartType||(exports.ChartType={}));class FlexChart extends FlexChartCore{constructor(t,e){super(t,null),this._chartType=ChartType.Column,this.initialize(e)}_getChartType(){return this._chartType}get chartType(){return this._chartType}set chartType(t){(t=wjcCore.asEnum(t,ChartType))!=this._chartType&&(this._chartType=t,this.invalidate())}get rotated(){return this._rotated}set rotated(t){t!=this._rotated&&(this._rotated=wjcCore.asBoolean(t),this.invalidate())}get stacking(){return this._stacking}set stacking(t){(t=wjcCore.asEnum(t,Stacking))!=this._stacking&&(this._stacking=t,this.invalidate())}get options(){return this._options}set options(t){t!=this._options&&(this._options=t,this.invalidate())}}exports.FlexChart=FlexChart;var Position;!function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Top=2]="Top",t[t.Right=3]="Right",t[t.Bottom=4]="Bottom",t[t.Auto=5]="Auto"}(Position=exports.Position||(exports.Position={}));var AxisType;!function(t){t[t.X=0]="X",t[t.Y=1]="Y"}(AxisType=exports.AxisType||(exports.AxisType={}));var OverlappingLabels;!function(t){t[t.Auto=0]="Auto",t[t.Show=1]="Show"}(OverlappingLabels=exports.OverlappingLabels||(exports.OverlappingLabels={}));var TickMark;!function(t){t[t.None=0]="None",t[t.Outside=1]="Outside",t[t.Inside=2]="Inside",t[t.Cross=3]="Cross"}(TickMark=exports.TickMark||(exports.TickMark={}));class Axis{constructor(t){this._GRIDLINE_WIDTH=1,this._LINE_WIDTH=1,this._TICK_WIDTH=1,this._TICK_HEIGHT=4,this._TICK_OVERLAP=1,this._TICK_LABEL_DISTANCE=4,this._minorGrid=!1,this._labels=!0,this._axisLine=!0,this._isTimeAxis=!1,this._labelPadding=5,this.rangeChanged=new wjcCore.Event,this._customConvert=null,this._customConvertBack=null,this.__uniqueId=Axis._id++,this._position=t,t==Position.Bottom||t==Position.Top?this._axisType=AxisType.X:(this._axisType=AxisType.Y,this._axisLine=!1),this._minorTickMarks=TickMark.None,this._overlap=OverlappingLabels.Auto}get hostElement(){return this._hostElement}get actualMin(){return this._isTimeAxis?new Date(this._actualMin):this._actualMin}get actualMax(){return this._isTimeAxis?new Date(this._actualMax):this._actualMax}get min(){return this._min}set min(t){t!=this._min&&(wjcCore.isDate(t)?this._min=wjcCore.asDate(t,!0):this._min=wjcCore.asNumber(t,!0),this._invalidate())}get max(){return this._max}set max(t){t!=this._max&&(wjcCore.isDate(t)?this._max=wjcCore.asDate(t,!0):this._max=wjcCore.asNumber(t,!0),this._invalidate())}get reversed(){return this._reversed}set reversed(t){this._reversed!=t&&(this._reversed=wjcCore.asBoolean(t),this._invalidate())}get position(){return this._position}set position(t){(t=wjcCore.asEnum(t,Position,!1))!=this._position&&(this._position=t,this._position==Position.Bottom||this._position==Position.Top?this._axisType=AxisType.X:this._position!=Position.Left&&this._position!=Position.Right||(this._axisType=AxisType.Y),this._invalidate())}get majorUnit(){return this._majorUnit}set majorUnit(t){t!=this._majorUnit&&(this._majorUnit=wjcCore.asNumber(t,!0),this._invalidate())}get minorUnit(){return this._minorUnit}set minorUnit(t){t!=this._minorUnit&&(this._minorUnit=wjcCore.asNumber(t,!0),this._invalidate())}get name(){return this._name}set name(t){t!=this._name&&(this._name=wjcCore.asString(t,!0))}get title(){return this._title}set title(t){t!=this._title&&(this._title=wjcCore.asString(t,!0),this._invalidate())}get format(){return this._format}set format(t){t!=this._format&&(this._format=wjcCore.asString(t,!0),this._invalidate())}get majorGrid(){return this._majorGrid}set majorGrid(t){t!=this._majorGrid&&(this._majorGrid=wjcCore.asBoolean(t,!0),this._invalidate())}get majorTickMarks(){return this._majorTickMarks}set majorTickMarks(t){(t=wjcCore.asEnum(t,TickMark,!0))!=this._majorTickMarks&&(this._majorTickMarks=t,this._invalidate())}get minorGrid(){return this._minorGrid}set minorGrid(t){t!=this._minorGrid&&(this._minorGrid=wjcCore.asBoolean(t,!0),this._invalidate())}get minorTickMarks(){return this._minorTickMarks}set minorTickMarks(t){(t=wjcCore.asEnum(t,TickMark,!0))!=this._minorTickMarks&&(this._minorTickMarks=t,this._invalidate())}get axisLine(){return this._axisLine}set axisLine(t){t!=this._axisLine&&(this._axisLine=wjcCore.asBoolean(t,!0),this._invalidate())}get labels(){return this._labels}set labels(t){t!=this._labels&&(this._labels=wjcCore.asBoolean(t,!0),this._invalidate())}get labelAlign(){return this._labelAlign}set labelAlign(t){t!=this._labelAlign&&(this._labelAlign=wjcCore.asString(t,!0),this._invalidate())}get labelAngle(){return this._labelAngle}set labelAngle(t){t!=this._labelAngle&&(this._labelAngle=wjcCore.asNumber(t,!0),this._invalidate())}get origin(){return this._origin}set origin(t){t!=this._origin&&(this._origin=wjcCore.asNumber(t,!0),this._invalidate())}get overlappingLabels(){return this._overlap}set overlappingLabels(t){(t=wjcCore.asEnum(t,OverlappingLabels,!0))!=this._overlap&&(this._overlap=t,this._invalidate())}get itemsSource(){return this._items}set itemsSource(t){this._items!=t&&(this._cv&&(this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this),this._cv=null),this._items=t,this._cv=wjcCore.asCollectionView(t),null!=this._cv&&this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this))}get binding(){return this._binding}set binding(t){t!=this._binding&&(this._binding=wjcCore.asString(t,!0),this._invalidate())}get itemFormatter(){return this._ifmt}set itemFormatter(t){this._ifmt!=t&&(this._ifmt=wjcCore.asFunction(t,!0),this._invalidate())}get logBase(){return this._logBase}set logBase(t){t!=this._logBase&&(this._logBase=wjcCore.asNumber(t,!0,!0),this._invalidate())}_getLogBase(){return this._chart&&this._chart._stacking===Stacking.Stacked100pc?0:this.logBase}get plotArea(){return this._parea}set plotArea(t){t!=this._parea&&(this._parea=wjcCore.asType(t,PlotArea,!0),this._invalidate())}get labelPadding(){return this._labelPadding}set labelPadding(t){t!=this._labelPadding&&(this._labelPadding=wjcCore.asNumber(t,!0,!0),this._invalidate())}get _groupClass(){return this.axisType===AxisType.X?FlexChartCore._CSS_AXIS_X:FlexChartCore._CSS_AXIS_Y}onRangeChanged(t){this.rangeChanged.raise(this,t)}_getPosition(){if(this.axisType==AxisType.X){if(this.position==Position.Auto)return Position.Bottom}else if(this.axisType==AxisType.Y&&this.position==Position.Auto)return Position.Left;return this.position}_isOverlapped(t,e,i,s){var r=this._lbls;if(null!=r&&r.length>1)for(var a=r.length,n=this._values&&this._values.length==a?this._values:null,h=0,o=0,l=0;l<a;l++){var _=n?n[l]:l;if(_>=this._actualMin&&_<=this._actualMax){var c=e*(_-this._actualMin)/(this._actualMax-this._actualMin),d=t.measureString(r[l],i,this._groupClass);if(this.axisType==AxisType.X){if(l>0&&Math.abs(c-h)<Math.max(d.width,o)+12)return!0;h=c,o=d.width}else this.axisType,AxisType.Y}}return!1}_getHeight(t,e){this._actualAngle=null;var i=FlexChart._CSS_LABEL,s=FlexChart._CSS_TITLE,r=this._actualMax-this._actualMin,a=this._nicePrecision(r);(a<0||a>15)&&(a=0);var n=.1*r,h=this._lbls,o=this.labelAngle;if(this.labels&&this._chart._getChartType()!==ChartType.Funnel){if(n=this._updateAutoFormat(n),null!=h&&h.length>0){var l=h.length,_=this._values&&this._values.length==l?this._values:null;this._annoSize=new wjcCore.Size;for(var c=0;c<l;c++){var d=_?_[c]:c;if(d>=this._actualMin&&d<=this._actualMax){g=t.measureString(h[c],i,this._groupClass);this.axisType,AxisType.X,g.width>this._annoSize.width&&(this._annoSize.width=g.width),g.height>this._annoSize.height&&(this._annoSize.height=g.height)}}null==o&&this.axisType==AxisType.X&&(this._isOverlapped(t,e,i,this.axisType)?o=this._actualAngle=-45:this._actualAngle=0)}else{var u=this._formatValue(this._actualMin-n),g=t.measureString(u,i,this._groupClass);this._annoSize=g,u=this._formatValue(this._actualMax+n),(g=t.measureString(u,i,this._groupClass)).width>this._annoSize.width&&(this._annoSize.width=g.width),g.height>this._annoSize.height&&(this._annoSize.height=g.height)}if(o){o>90?o=90:o<-90&&(o=-90);var p=o*Math.PI/180,m=this._annoSize.width,x=this._annoSize.height;this._annoSize.width=m*Math.abs(Math.cos(p))+x*Math.abs(Math.sin(p)),this._annoSize.height=m*Math.abs(Math.sin(p))+x*Math.abs(Math.cos(p))}}else this._annoSize=new wjcCore.Size;x=2*(this._labelPadding||5);this._axisType==AxisType.X?x+=this._annoSize.height:x+=this._annoSize.width+this._TICK_LABEL_DISTANCE+2;var v=this._TICK_HEIGHT,w=this._TICK_OVERLAP;f==TickMark.Outside?w=1:f==TickMark.Inside?w=-1:f==TickMark.Cross&&(w=0);var f=this.majorTickMarks;return null==f&&(f=TickMark.Outside),f!=TickMark.None&&(x+=.5*(1+w)*v),this._title&&(u=this._title,this._szTitle=t.measureString(u,s,this._groupClass),x+=this._szTitle.height),t.fontSize=null,x}_updateAutoFormat(t){if(this._isTimeAxis){var e=this.format,i=.001*(this._actualMax-this._actualMin)/10,s=new _timeSpan(i*_timeSpan.TicksPerSecond),r=wjcCore.isNumber(this._majorUnit)?_timeSpan.fromDays(this._majorUnit):_timeHelper.NiceTimeSpan(s,e);e||(this._tfmt=_timeHelper.GetTimeDefaultFormat(1e3*r.TotalSeconds,0)),t=r.TotalSeconds}return t}_updateActualLimitsByChartType(t,e,i){if(t&&t.length>0&&!this._isTimeAxis){var s=this._chart._getChartType();s!=ChartType.Column&&s!=ChartType.Bar&&(e-=.5,i+=.5)}return{min:e,max:i}}_updateActualLimits(t,e,i,s=null,r=null){var a=this._actualMin,n=this._actualMax;this._isTimeAxis=t==wjcCore.DataType.Date;var h=this._updateActualLimitsByChartType(s,e,i);e=h.min,i=h.max;var o=this._min,l=this._max;if(wjcCore.isDate(o)&&(o=o.valueOf()),wjcCore.isDate(l)&&(l=l.valueOf()),this._actualMin=null!=o&&this._chart&&this._chart._stacking!==Stacking.Stacked100pc?o:e,this._actualMax=null!=l&&this._chart&&this._chart._stacking!==Stacking.Stacked100pc?l:i,this._actualMin==this._actualMax&&(this._actualMin-=.5,this._actualMax+=.5),this._getLogBase()>0){var _=this.logBase,c=Math.log(_);if(!this._max){var d=Math.ceil(Math.log(this._actualMax)/c);this._actualMax=Math.pow(_,d)}if(!this._min){var u=Math.floor(Math.log(this._actualMin)/c);this._actualMin=Math.pow(_,u)}(this._actualMin<=0||!wjcCore.isNumber(this._actualMin))&&(this._actualMin=1),this._actualMax<this._actualMin&&(this._actualMax=this._actualMin+1)}if((a!=this._actualMin&&(wjcCore.isNumber(a)||wjcCore.isNumber(this._actualMin))||n!=this._actualMax&&(wjcCore.isNumber(n)||wjcCore.isNumber(this._actualMax)))&&this.onRangeChanged(),this._items){this._values=[],this._lbls=[];var g=this._items.length,p="value",m="text";if(this.binding){var x=this.binding.split(",");2==x.length&&(p=x[0],m=x[1])}for(var v=0;v<g;v++){var w=this._items[v],f=w[p];wjcCore.isNumber(f)&&(this._values.push(f),this._lbls.push(w[m]))}}else this._lbls=s,this._values=r}_layout(t,e){var i=this.axisType==AxisType.Y;this._plotrect=e,this._axrect=i?new wjcCore.Rect(t.left,t.top,t.height,t.width):t}_hasVisibileSeries(){for(var t,e=this._chart.series,i=0,s=e.length;i<s;i++)if((t=e[i].visibility)==SeriesVisibility.Plot||t==SeriesVisibility.Visible)return!0;return!1}_render(t){if(this.position!=Position.None&&this._hasVisibileSeries()){this._vals={};var e=0;this.labelAngle&&((e=this.labelAngle)>90?e=90:e<-90&&(e=-90)),null==this.labelAngle&&null!=this._actualAngle&&(e=this._actualAngle);var i=FlexChart._FG,s=this._actualMax-this._actualMin;if(wjcCore.isNumber(s)){var r=this._calcMajorUnit();0==r&&(r=.1*this._niceTickNumber(s));var a=Math.min(Axis.MAX_MAJOR,Math.floor(s/r)+1),n=[],h=[];this._rects=[],this._vals.major=n,this._vals.hasLbls=[];var o=Math.floor(this._actualMin/r)*r;o<this._actualMin&&(o+=r);var l=!1;if(this._lbls&&this._lbls.length>0)if(h=this._lbls,0==this._values.length){l=!0;for(p=0;p<h.length;p++)n.push(p)}else n=this._values;else this._isTimeAxis?this._createTimeLabels(o,a,n,h):this._getLogBase()?this._createLogarithmicLabels(this._actualMin,this._actualMax,this.majorUnit,n,h,!0):this._createLabels(o,a,r,n,h);a=Math.min(n.length,h.length),t.textFill=i;var _=this._TICK_HEIGHT,c=this._TICK_OVERLAP,d=this.majorTickMarks;null==d&&(d=TickMark.Outside),d==TickMark.Outside?c=1:d==TickMark.Inside?c=-1:d==TickMark.Cross&&(c=0);for(var u=.5*(c-1)*_,g=.5*(1+c)*_,p=0;p<a;p++){var m=!0,x=n[p],v=h[p],w=this.labels;if(w&&(l||this.itemsSource)&&this.majorUnit&&p%this.majorUnit!=0&&(w=!1),x>=this._actualMin&&x<=this._actualMax){var f=t.textFill;m=this._renderLabelsAndTicks(t,p,x,v,e,d,w,u,g),t.textFill=f}this._vals.hasLbls.push(m)}}(this.minorGrid||this.minorTickMarks!=TickMark.None)&&this._renderMinor(t,n,l),t.stroke=i,t.fontSize=null,this._renderLineAndTitle(t),t.stroke=null,t.fontSize=null,t.textFill=null,t.strokeWidth=null}}_renderLineAndTitle(t){var e=this._getPosition(),i=this.axisType==AxisType.Y,s=e!=Position.Top&&e!=Position.Right,r=FlexChart._CSS_TITLE,a=FlexChart._CSS_LINE;if(i)if(s){if(this._title){n=new wjcCore.Point(this._axrect.left+.5*this._szTitle.height,this._axrect.top+.5*this._axrect.height);FlexChart._renderRotatedText(t,this._title,n,1,1,n,-90,r,this._groupClass)}this.axisLine&&t.drawLine(this._axrect.right,this._axrect.top,this._axrect.right,this._axrect.bottom,a)}else{if(this._title){var n=new wjcCore.Point(this._axrect.right-.5*this._szTitle.height,this._axrect.top+.5*this._axrect.height);FlexChart._renderRotatedText(t,this._title,n,1,1,n,90,r,this._groupClass)}this.axisLine&&t.drawLine(this._axrect.left,this._axrect.top,this._axrect.left,this._axrect.bottom,a)}else s?(this.axisLine&&t.drawLine(this._axrect.left,this._axrect.top,this._axrect.right,this._axrect.top,a),this._title&&FlexChart._renderText(t,this._title,new wjcCore.Point(this._axrect.left+.5*this._axrect.width,this._axrect.bottom),1,2,r)):(this.axisLine&&t.drawLine(this._axrect.left,this._axrect.bottom,this._axrect.right,this._axrect.bottom,a),this._title&&FlexChart._renderText(t,this._title,new wjcCore.Point(this._axrect.left+.5*this._axrect.width,this._axrect.top),1,0,r))}_renderMinor(t,e,i){var s=this._getPosition(),r=this.axisType==AxisType.Y,a=s!=Position.Top&&s!=Position.Right;if(this._getLogBase()){if(this.minorUnit>0){var n=[];this._createLogarithmicLabels(this._actualMin,this._actualMax,this.minorUnit,n,null,!1);for(var h=[],o=0;o<n.length;o++){var l=n[o];-1==e.indexOf(l)&&l>this._actualMin&&h.push(l)}this._renderMinors(t,h,r,a)}}else this._createMinors(t,e,r,a,i)}_renderRotatedText(t,e,i,s,r,a,n,h,o,l,_){if(this.itemFormatter){var c=this._getFormattedItem(t,e,i,s,o);c?(i=c.text,o=c.cls):i=null}FlexChart._renderRotatedText(t,i,s,r,a,n,h,o,l,_)}_getFormattedItem(t,e,i,s,r){if(this.itemFormatter){var a=s.clone();this.axisType==AxisType.X?this.position==Position.Top?a.y=this._plotrect.top:a.y=this._plotrect.bottom:this.position==Position.Right?a.x=this._plotrect.right:a.x=this._plotrect.left;var n={val:e,text:i,pos:a,cls:r};return n=this.itemFormatter(t,n)}}_renderLabelsAndTicks(t,e,i,s,r,a,n,h,o){var l=this._getPosition(),_=!0,c=this.axisType==AxisType.Y,d=l!=Position.Top&&l!=Position.Right,u=this.labelPadding||5,g=this._TICK_WIDTH,p=this._getLabelAlign(c),m=FlexChart._CSS_LABEL,x=FlexChart._CSS_GRIDLINE,v=FlexChart._CSS_TICK,w=FlexChart._FG,f=FlexChart._FG,C=this._GRIDLINE_WIDTH,y=i!=this._actualMin&&this.majorGrid;if(c){var b=this.convert(i);if(y&&(t.stroke=w,t.strokeWidth=C,t.drawLine(this._plotrect.left,b,this._plotrect.right,b,x)),t.stroke=f,t.strokeWidth=g,d){if(a!=TickMark.None&&t.drawLine(this._axrect.right-h,b,this._axrect.right-o,b,v),n){M=new wjcCore.Point(this._axrect.right-o-this._TICK_LABEL_DISTANCE-u,b);r>0?90==r?this._renderRotatedText(t,i,s,M,1,0,M,r,m,this._groupClass):this._renderRotatedText(t,i,s,M,2,1,M,r,m,this._groupClass):r<0?-90==r?this._renderRotatedText(t,i,s,M,1,2,M,r,m,this._groupClass):this._renderRotatedText(t,i,s,M,2,1,M,r,m,this._groupClass):this._renderLabel(t,i,s,M,2,p,m)}}else if(a!=TickMark.None&&t.drawLine(this._axrect.left+h,b,this._axrect.left+o,b,v),n){M=new wjcCore.Point(this._axrect.left+o+this._TICK_LABEL_DISTANCE+u,b);r>0?90==r?this._renderRotatedText(t,i,s,M,1,2,M,r,m,this._groupClass):this._renderRotatedText(t,i,s,M,0,1,M,r,m,this._groupClass):r<0?-90==r?this._renderRotatedText(t,i,s,M,1,0,M,r,m,this._groupClass):this._renderRotatedText(t,i,s,M,0,1,M,r,m,this._groupClass):this._renderLabel(t,i,s,M,0,p,m)}}else{var S=this.convert(i);if(this.overlappingLabels==OverlappingLabels.Auto&&this._xCross(S)&&(n=!1),y&&n&&(t.stroke=w,t.strokeWidth=C,t.drawLine(S,this._plotrect.top,S,this._plotrect.bottom,x)),t.stroke=f,t.strokeWidth=g,d){if(_=!1,n){M=new wjcCore.Point(S,this._axrect.top+o+u);_=0!=r?this._renderRotatedLabel(t,i,s,M,p,r,m,d):this._renderLabel(t,i,s,M,p,0,m)}a!=TickMark.None&&_&&(S=this.convert(i),t.drawLine(S,this._axrect.top+h,S,this._axrect.top+o,v))}else{if(n){var M=new wjcCore.Point(S,this._axrect.bottom-o-u);_=0!=r?this._renderRotatedLabel(t,i,s,M,p,r,m,d):this._renderLabel(t,i,s,M,p,2,m)}a!=TickMark.None&&_&&(S=this.convert(i),t.drawLine(S,this._axrect.bottom-h,S,this._axrect.bottom-o,v))}}return _}_xCross(t){for(var e=this._rects.length,i=0;i<e;i++){var s=this._rects[i];if(t>=s.left&&t<=s.right)return!0}return!1}_createMinors(t,e,i,s,r){if(e&&e.length>1){for(var a=this.majorUnit?this._isTimeAxis?24*this.majorUnit*3600*1e3:this.majorUnit:e[1]-e[0],n=wjcCore.isNumber(this.minorUnit)?this._isTimeAxis?24*this.minorUnit*3600*1e3:this.minorUnit:.5*a,h=[],o=e[0];o>this._actualMin&&h.length<Axis.MAX_MINOR;o-=n)-1==e.indexOf(o)&&h.push(o);for(o=e[0]+n;o<this._actualMax&&h.length<Axis.MAX_MINOR;o+=n)-1==e.indexOf(o)?h.push(o):r&&this.majorUnit&&o%this.majorUnit!=0&&h.push(o);this._renderMinors(t,h,i,s)}}_renderMinors(t,e,i,s){var r=this._TICK_HEIGHT,a=this._TICK_WIDTH,n=this._TICK_OVERLAP,h=FlexChart._FG,o=this.minorTickMarks,l=!0;this._vals.minor=e,o==TickMark.Outside?n=1:o==TickMark.Inside?n=-1:o==TickMark.Cross?n=0:l=!1;for(var _=.5*(n-1)*r,c=.5*(1+n)*r,d=e?e.length:0,u=this.minorGrid,g=this._plotrect,p=this._GRIDLINE_WIDTH,m=FlexChart._FG,x=FlexChart._CSS_GRIDLINE_MINOR,v=FlexChart._CSS_TICK_MINOR,w=0;w<d;w++)if(e[w]>=this.actualMin&&e[w]<=this.actualMax)if(i){var f=this.convert(e[w]);l&&(t.stroke=h,t.strokeWidth=a,s?t.drawLine(this._axrect.right-_,f,this._axrect.right-c,f,v):t.drawLine(this._axrect.left+_,f,this._axrect.left+c,f,v)),u&&(t.stroke=m,t.strokeWidth=p,t.drawLine(g.left,f,g.right,f,x))}else{var C=this.convert(e[w]);l&&(t.stroke=h,t.strokeWidth=a,s?t.drawLine(C,this._axrect.top+_,C,this._axrect.top+c,v):t.drawLine(C,this._axrect.bottom-_,C,this._axrect.bottom-c,v)),u&&(t.stroke=m,t.strokeWidth=p,t.drawLine(C,g.top,C,g.bottom,x))}}_renderLabel(t,e,i,s,r,a,n){var h=!1;if(this.itemFormatter){var o=this._getFormattedItem(t,e,i,s,n);o?(i=o.text,n=o.cls):i=null}if(i){var l=this._rects,_=this.overlappingLabels==OverlappingLabels.Auto&&!wjcCore.isNumber(this._actualAngle),c=FlexChart._renderText(t,i,s,r,a,n,this._groupClass,null,function(t){if(_)for(var e=l.length,i=0;i<e;i++)if(FlexChart._intersects(l[i],t))return!1;return!0});c&&(c.left+=4,c.width+=8,l.push(c),h=!0)}return h}_renderRotatedLabel(t,e,i,s,r,a,n,h){if(this.itemFormatter){var o=this._getFormattedItem(t,e,i,s,n);o?(i=o.text,n=o.cls):i=null}if(i){var l=t.measureString(i,n,this._groupClass),_=.5*l.height,c=.5*l.width*Math.abs(Math.sin(a*Math.PI/180)),d=.5*l.width,u=.5*(l.width*Math.abs(Math.cos(a*Math.PI/180))+l.height*Math.abs(Math.sin(a*Math.PI/180))),g=new wjcCore.Point(s.x,s.y),p=new wjcCore.Point(s.x,s.y);this.labelAlign||(r=90==a||-90==a?1:h?a>0?0:2:a>0?2:0),h?(s.y+=_+c,g.y+=_+c-.5*l.height):(s.y-=_+c-l.height,g.y-=_+c-.5*l.height);var m=0;2===r?(g.x-=u,s.x-=d+u,m=g.x+u-l.height-2):0===r?(g.x+=u,s.x-=d-u,m=g.x-u):(s.x-=d,m=g.x-l.height/2);var x=new wjcCore.Rect(m,p.y,l.height+2,l.width),v=this._rects;if(this.overlappingLabels==OverlappingLabels.Auto)for(var w=v.length,f=0;f<w;f++)if(FlexChart._intersects(v[f],x))return!1;return FlexChart._renderRotatedText(t,i,s,0,2,g,a,n,this._groupClass),this._rects.push(x),!0}return!1}_getLabelAlign(t){var e=1;if(this.labelAlign){var i=this.labelAlign.toLowerCase();t?"top"==i?e=0:"bottom"==i&&(e=2):"left"==i?e=0:"right"==i&&(e=2)}return e}convert(t,e,i){var s=null==e?this._actualMax:e,r=null==i?this._actualMin:i;if(s==r)return 0;var a=this._axrect.left,n=this._axrect.width,h=this._axrect.top,o=this._axrect.height;if(null!=this._customConvert){var l=this._customConvert(t,r,s);return this.axisType==AxisType.Y?h+l*o:a+l*n}if(this._getLogBase()){if(t<=0)return NaN;var _=Math.log(s/r);return this._reversed?this.axisType==AxisType.Y?h+Math.log(t/r)/_*o:a+n-Math.log(t/r)/_*n:this.axisType==AxisType.Y?h+o-Math.log(t/r)/_*o:a+Math.log(t/r)/_*n}return this._reversed?this.axisType==AxisType.Y?h+(t-r)/(s-r)*o:a+n-(t-r)/(s-r)*n:this.axisType==AxisType.Y?h+o-(t-r)/(s-r)*o:a+(t-r)/(s-r)*n}convertBack(t){if(this._actualMax==this._actualMin)return 0;var e=this._plotrect.left,i=this._plotrect.width,s=this._plotrect.top,r=this._plotrect.height,a=this._actualMax-this._actualMin,n=this._getLogBase();if(null!=this._customConvertBack)return this.axisType==AxisType.Y?this._customConvertBack((t-s)/r,this._actualMin,this._actualMax):this._customConvertBack((t-e)/i,this._actualMin,this._actualMax);if(n){var h=0;return h=this._reversed?this.axisType==AxisType.Y?(t-s)/r:1-(t-e)/i:this.axisType==AxisType.Y?1-(t-s)/r:(t-e)/i,Math.pow(n,(Math.log(this._actualMin)+(Math.log(this._actualMax)-Math.log(this._actualMin))*h)/Math.log(n))}return this._reversed?this.axisType==AxisType.Y?this._actualMin+(t-s)*a/r:this._actualMin+(e+i-t)*a/i:this.axisType==AxisType.Y?this._actualMax-(t-s)*a/r:this._actualMin+(t-e)*a/i}get axisType(){var t=this._chart;if(t){if(t.axisX==this)return AxisType.X;if(t.axisY==this)return AxisType.Y}return this._axisType}_getMinNum(){return this._actualMin}_getMaxNum(){return this._actualMax}_invalidate(){this._chart&&this._chart.invalidate()}_cvCollectionChanged(t,e){this._invalidate()}_createLabels(t,e,i,s,r){for(var a=0;a<e;a++){var n=(t+i*a).toFixed(14),h=parseFloat(n),o=this._formatValue(h);s.push(h),r.push(o)}}_createLogarithmicLabels(t,e,i,s,r,a){var n=this._getLogBase(),h=Math.log(n),o=Math.floor(Math.log(t)/h),l=Math.ceil(Math.log(e)/h),_=n,c=!0;i>0&&(c=!1,_=i),_<n&&(_=n);var d=(l-o+1)*n/_,u=1;if(a){var g=this._getPosition(),p=this._getAnnoNumber(g==Position.Left||g==Position.Right);d>p?u=Math.floor(d/p+1):c&&(d<=.2*p?_=.2*n:d<=.1*p&&(_=.1*n))}for(var m=o;m<=l;m+=u)if(c)for(var x=Math.pow(n,m),v=0;v*_<n-1;v++)(w=x*(1+v*_))>=t&&w<=e&&(0==v?(s.unshift(w),r&&r.unshift(this._formatValue(w))):(s.push(w),r&&r.push(this._formatValue(w))));else{var w=Math.pow(_,m);w>=t&&w<=e&&(s.push(w),r&&r.push(this._formatValue(w)))}}_createTimeLabels(t,e,i,s){var r=this._actualMin,a=this._actualMax,n=new Date(r),h=new Date(a),o=this._format,l=this._getAnnoNumber(this._axisType==AxisType.Y);l>12&&(l=12);var _=.001*(this._actualMax-this._actualMin)/l,c=new _timeSpan(_*_timeSpan.TicksPerSecond),d=wjcCore.isNumber(this._majorUnit)?_timeSpan.fromDays(this._majorUnit):_timeHelper.NiceTimeSpan(c,o);o||(this._tfmt=o=_timeHelper.GetTimeDefaultFormat(1e3*d.TotalSeconds,0));var u=d.Ticks,g=_timeHelper.RoundTime(r,d.TotalDays,!1);isFinite(g)&&(r=g);var p=_timeHelper.RoundTime(a,d.TotalDays,!0);isFinite(p)&&(a=p);var m=new Date(r);new Date(a);if(d.TotalDays>=365&&!wjcCore.isNumber(this._majorUnit)){(m=new Date(n.getFullYear(),1,1))<n&&m.setFullYear(m.getFullYear()+1);var x=d.TotalDays/365;x-=x%1;for(f=m;f<=h&&x;f.setFullYear(f.getFullYear()+x)){y=f.valueOf();i.push(y),s.push(this._formatValue(y))}}else if(d.TotalDays>=30&&!wjcCore.isNumber(this._majorUnit)){(m=new Date(n.getFullYear(),n.getMonth(),1))<n&&m.setMonth(m.getMonth()+1);var v=d.TotalDays/30;v-=v%1;for(f=m;f<=h;f.setMonth(f.getMonth()+v)){y=f.valueOf();i.push(y),s.push(this._formatValue(y))}}else{var w=1e3*u/_timeSpan.TicksPerSecond,f=m,C=n.getTime()-f.getTime();for(C>w&&(f=new Date(f.getTime()+Math.floor(C/w)*w));f<=h&&w;f=new Date(f.getTime()+w))if(f>=n){var y=f.valueOf();i.push(y),s.push(this._formatValue(y))}}}_formatValue(t){if(this._isTimeAxis)return this._format?wjcCore.Globalize.format(new Date(t),this._format):wjcCore.Globalize.format(new Date(t),this._tfmt);if(this._format)return wjcCore.Globalize.format(t,this._format);var e=t==Math.round(t)?"n0":"n";return wjcCore.Globalize.format(t,e)}_calcMajorUnit(){var t=this._majorUnit;if(!wjcCore.isNumber(t)){var e=this._actualMax-this._actualMin,i=this._nicePrecision(e),s=e/this._getAnnoNumber(this.axisType==AxisType.Y);(t=this._niceNumber(2*s,-i,!0))<s&&(t=this._niceNumber(s,1-i,!1)),t<s&&(t=this._niceTickNumber(s))}return t}_getAnnoNumber(t){var e=t?this._annoSize.height:this._annoSize.width,i=t?this._axrect.height:this._axrect.width;if(e>0&&i>0){var s=Math.floor(i/(e+6));return s<=0&&(s=1),s}return 10}_nicePrecision(t){if(!wjcCore.isNumber(t)||t<=0)return 0;var e,i=Math.log(t)/Math.LN10;e=i>=0?Math.floor(i):Math.ceil(i);var s=t/Math.pow(10,e);return s<3&&(e=1-e,(s=t/Math.pow(10,e))<3&&(e+=1)),e}_niceTickNumber(t){if(0==t)return t;t<0&&(t=-t);var e=Math.log(t)/Math.LN10,i=Math.floor(e),s=t/Math.pow(10,i),r=10;return s<=1?r=1:s<=2?r=2:s<=5&&(r=5),r*Math.pow(10,i)}_niceNumber(t,e,i){if(0==t)return t;t<0&&(t=-t);var s=t/Math.pow(10,e),r=10;return i?s<1.5?r=1:s<3?r=2:s<4.5?r=4:s<7&&(r=5):s<=1?r=1:s<=2?r=2:s<=5&&(r=5),r*Math.pow(10,e)}get _uniqueId(){return this.__uniqueId}}Axis.MAX_MAJOR=1e3,Axis.MAX_MINOR=2e3,Axis._id=0,exports.Axis=Axis;class AxisCollection extends wjcCore.ObservableArray{getAxis(t){var e=this.indexOf(t);return e>-1?this[e]:null}indexOf(t){for(var e=0;e<this.length;e++)if(this[e].name==t)return e;return-1}}exports.AxisCollection=AxisCollection;var _tmInc;!function(t){t[t.tickf7=-7]="tickf7",t[t.tickf6=-6]="tickf6",t[t.tickf5=-5]="tickf5",t[t.tickf4=-4]="tickf4",t[t.tickf3=-3]="tickf3",t[t.tickf2=-2]="tickf2",t[t.tickf1=-1]="tickf1",t[t.second=1]="second",t[t.minute=60]="minute",t[t.hour=3600]="hour",t[t.day=86400]="day",t[t.week=604800]="week",t[t.month=2678400]="month",t[t.year=31536e3]="year",t[t.maxtime=Number.MAX_VALUE]="maxtime"}(_tmInc||(_tmInc={}));class _timeSpan{constructor(t){this.ticks=t}get Ticks(){return this.ticks}get TotalSeconds(){return this.ticks/1e7}get TotalDays(){return this.ticks/1e7/86400}static fromSeconds(t){return new _timeSpan(1e7*t)}static fromDays(t){return new _timeSpan(1e7*t*24*60*60)}}_timeSpan.TicksPerSecond=1e7;class _timeHelper{constructor(t){wjcCore.isDate(t)?this.init(t):wjcCore.isNumber(t)&&this.init(FlexChart._fromOADate(t))}init(t){this.year=t.getFullYear(),this.month=t.getMonth(),this.day=t.getDate(),this.hour=t.getHours(),this.minute=t.getMinutes(),this.second=t.getSeconds()}getTimeAsDateTime(){this.hour>=24&&(this.hour-=24,this.day+=1),this.month<0?(-1-this.day,this.month=1):this.month>11&&(this.month-12,this.month=12),this.day<1?(-1-this.day,this.day=1):this.day>28&&2==this.month?(this.day-28,this.day=28):this.day>30&&(4==this.month||4==this.month||6==this.month||9==this.month||11==this.month)?(this.day-30,this.day=30):this.day>31&&(this.day-31,this.day=31),this.second>59&&(this.second-59,this.second=59);return this.minute>59&&(this.minute-59,this.minute=59),new Date(this.year,this.month,this.day,this.hour,this.minute,this.second)}getTimeAsDouble(){return this.getTimeAsDateTime().valueOf()}static tround(t,e,i){var s=t/e*e;return s-=s%1,i&&s!=t&&(s+=e-=e%1),s}static RoundTime(t,e,i){var s=24*e*60*60;if(s>0){var r=new _timeHelper(t);return s<_tmInc.minute?(r.second=this.tround(r.second,s,i),r.getTimeAsDouble()):(r.second=0,s<_tmInc.hour?(s/=_tmInc.minute,r.minute=this.tround(r.minute,s,i),r.getTimeAsDouble()):(r.minute=0,s<_tmInc.day?(s/=_tmInc.hour,r.hour=this.tround(r.hour,s,i),r.getTimeAsDouble()):(r.hour=0,s<_tmInc.month?(s/=_tmInc.day,r.day=this.tround(r.day,s,i),r.getTimeAsDouble()):(r.day=1,s<_tmInc.year?(s/=_tmInc.month,1!=r.month&&(r.month=this.tround(r.month,s,i)),r.getTimeAsDouble()):(r.month=1,s/=_tmInc.year,r.year=this.tround(r.year,s,i),r.getTimeAsDouble())))))}var a=t,n=a-s,h=n/e*e;return i&&h!=n&&(h+=e),a=s+h}static TimeSpanFromTmInc(t){var e=_timeSpan.fromSeconds(1);if(t!=_tmInc.maxtime)if(t>_tmInc.tickf1)e=_timeSpan.fromSeconds(t);else{var i=t,s=1;for(i+=7;i>0;)s*=10,i--;e=new _timeSpan(s)}return e}static manualTimeInc(t){var e=_tmInc.second;if(null==t||0==t.length)return e;var i=t.indexOf("f");if(i>=0){var s=-1;if(i>0&&"%"==t.substr(i-1,1))s=-1;else for(var r=1;r<6&&!(i+r>=t.length)&&"f"==t.substr(i+r,1);r++)s--;e=s}else t.indexOf("s")>=0?e=_tmInc.second:t.indexOf("m")>=0?e=_tmInc.minute:t.indexOf("h")>=0||t.indexOf("H")?e=_tmInc.hour:t.indexOf("d")>=0?e=_tmInc.day:t.indexOf("M")>=0?e=_tmInc.month:t.indexOf("y")>=0&&(e=_tmInc.year);return e}static getNiceInc(t,e,i){for(var s=0;s<t.length;s++){var r=t[s]*i;if(e<=r)return r}return 0}static NiceTimeSpan(t,e){var i=_tmInc.second;null!=e&&e.length>0&&(i=_timeHelper.manualTimeInc(e));var s=0,r=0;if(i<_tmInc.second&&t.TotalSeconds<10){for(s=t.Ticks,r=_timeHelper.TimeSpanFromTmInc(i).Ticks;s>10*r;)r*=10;var a=r;return s>a&&(a*=2),s>a&&(a=5*r),s>a&&(a=10*r),new _timeSpan(a)}if(0==(s=Math.ceil(t.TotalSeconds)))return _timeHelper.TimeSpanFromTmInc(i);if(r=1,i<_tmInc.minute){if(s<_tmInc.minute&&0!=(r=_timeHelper.getNiceInc([1,2,5,10,15,30],s,i)))return _timeSpan.fromSeconds(r);i=_tmInc.minute}if(i<_tmInc.hour){if(s<_tmInc.hour&&0!=(r=_timeHelper.getNiceInc([1,2,5,10,15,30],s,i)))return _timeSpan.fromSeconds(r);i=_tmInc.hour}if(i<_tmInc.day){if(s<_tmInc.day&&0!=(r=_timeHelper.getNiceInc([1,3,6,12],s,i)))return _timeSpan.fromSeconds(r);i=_tmInc.day}if(i<_tmInc.month){if(s<_tmInc.month&&0!=(r=_timeHelper.getNiceInc([1,2,7,14],s,i)))return _timeSpan.fromSeconds(r);i=_tmInc.month}if(i<_tmInc.year){if(s<_tmInc.year&&0!=(r=_timeHelper.getNiceInc([1,2,3,4,6],s,i)))return _timeSpan.fromSeconds(r);i=_tmInc.year}return r=100*_tmInc.year,s<r&&0==(r=_timeHelper.getNiceInc([1,2,5,10,20,50],s,i))&&(r=100*_tmInc.year),_timeSpan.fromSeconds(r)}static NiceTimeUnit(t,e){var i=_timeSpan.fromDays(t);return(i=_timeHelper.NiceTimeSpan(i,e)).TotalDays}static GetTimeDefaultFormat(t,e){if(!wjcCore.isNumber(t)||!wjcCore.isNumber(e))return"";var i="s",s=_timeSpan.fromSeconds(.001*(t-e)),r=s.TotalSeconds;if(r>=_tmInc.year)i="yyyy";else if(r>=_tmInc.month)i="MMM yyyy";else if(r>=_tmInc.day)i="MMM d";else if(r>=_tmInc.hour)i="ddd H:mm";else if(r>=.5*_tmInc.hour)i="H:mm";else if(r>=1)i="H:mm:ss";else if(r>0){var a=s.Ticks;for(i="s.";a<_timeSpan.TicksPerSecond;)a*=10,i+="f"}return i}}_timeHelper.secInYear=86400;class PlotArea{constructor(t){this._row=0,this._col=0,this._rect=new wjcCore.Rect(0,0,0,0),t&&wjcCore.copy(this,t)}get row(){return this._row}set row(t){t!=this._row&&(this._row=wjcCore.asInt(t,!0,!0),this._invalidate())}get column(){return this._col}set column(t){t!=this._col&&(this._col=wjcCore.asInt(t,!0,!0),this._invalidate())}get name(){return this._name}set name(t){t!=this._name&&(this._name=wjcCore.asString(t,!0))}get width(){return this._width}set width(t){t!=this._width&&(this._width=t,this._invalidate())}get height(){return this._height}set height(t){t!=this._height&&(this._height=t,this._invalidate())}get style(){return this._style}set style(t){t!=this._style&&(this._style=t,this._invalidate())}_invalidate(){this._chart&&this._chart.invalidate()}_render(t){t.drawRect(this._rect.left,this._rect.top,this._rect.width,this._rect.height,null,this.style)}_setPlotX(t,e){this._rect.left=t,this._rect.width=e}_setPlotY(t,e){this._rect.top=t,this._rect.height=e}}exports.PlotArea=PlotArea;class PlotAreaCollection extends wjcCore.ObservableArray{getPlotArea(t){var e=this.indexOf(t);return e>-1?this[e]:null}indexOf(t){for(var e=0;e<this.length;e++)if(this[e].name==t)return e;return-1}_getWidth(t){for(var e=0;e<this.length;e++){var i=this[e];if(i.column==t&&0==i.row)return i.width}}_getHeight(t){for(var e=0;e<this.length;e++){var i=this[e];if(i.row==t&&0==i.column)return i.height}}_calculateWidths(t,e){if(e<=0)throw"ncols";for(var i=[],s=0;s<e;s++){var r=this._getWidth(s);i[s]=new _GridLength(r)}return this._calculateLengths(t,e,i)}_calculateHeights(t,e){if(e<=0)throw"nrows";for(var i=[],s=0;s<e;s++){var r=this._getHeight(s);i[s]=new _GridLength(r)}return this._calculateLengths(t,e,i)}_calculateLengths(t,e,i){for(var s=[e],r=0,a=0,n=0;n<e;n++)i[n].isAbsolute?(s[n]=i[n].value,r+=s[n]):i[n].isStar?a+=i[n].value:i[n].isAuto&&a++;for(var h=(t-r)/a,n=0;n<e;n++)i[n].isStar?s[n]=h*i[n].value:i[n].isAuto&&(s[n]=h),s[n]<0&&(s[n]=0);return s}}exports.PlotAreaCollection=PlotAreaCollection;var _GridUnitType;!function(t){t[t.Auto=0]="Auto",t[t.Pixel=1]="Pixel",t[t.Star=2]="Star"}(_GridUnitType||(_GridUnitType={}));class _GridLength{constructor(t=null){this._unitType=_GridUnitType.Auto,t&&((t=t.toString()).indexOf("*")>=0?(this._unitType=_GridUnitType.Star,t=t.replace("*",""),this._value=parseFloat(t),isNaN(this._value)&&(this._value=1)):(this._unitType=_GridUnitType.Pixel,this._value=parseFloat(t),isNaN(this._value)&&(this._unitType=_GridUnitType.Auto,this._value=1)))}get value(){return this._value}get isStar(){return this._unitType==_GridUnitType.Star}get isAbsolute(){return this._unitType==_GridUnitType.Pixel}get isAuto(){return this._unitType==_GridUnitType.Auto}}var SeriesVisibility;!function(t){t[t.Visible=0]="Visible",t[t.Plot=1]="Plot",t[t.Legend=2]="Legend",t[t.Hidden=3]="Hidden"}(SeriesVisibility=exports.SeriesVisibility||(exports.SeriesVisibility={}));var Marker;!function(t){t[t.Dot=0]="Dot",t[t.Box=1]="Box"}(Marker=exports.Marker||(exports.Marker={}));class DataArray{}exports.DataArray=DataArray;class SeriesEventArgs extends wjcCore.EventArgs{constructor(t){super(),this._series=wjcCore.asType(t,SeriesBase)}get series(){return this._series}}exports.SeriesEventArgs=SeriesEventArgs;class SeriesBase{constructor(t){this._altStyle=null,this._symbolMarker=Marker.Dot,this._visibility=SeriesVisibility.Visible,this.rendering=new wjcCore.Event,this.rendered=new wjcCore.Event,t&&this.initialize(t)}get style(){return this._style}set style(t){t!=this._style&&(this._style=t,this._invalidate())}get altStyle(){return this._altStyle}set altStyle(t){t!=this._altStyle&&(this._altStyle=t,this._invalidate())}get symbolStyle(){return this._symbolStyle}set symbolStyle(t){t!=this._symbolStyle&&(this._symbolStyle=t,this._invalidate())}get symbolSize(){return this._symbolSize}set symbolSize(t){t!=this._symbolSize&&(this._symbolSize=wjcCore.asNumber(t,!0,!0),this._invalidate())}get symbolMarker(){return this._symbolMarker}set symbolMarker(t){(t=wjcCore.asEnum(t,Marker,!0))!=this._symbolMarker&&(this._symbolMarker=t,this._invalidate())}get binding(){return this._binding?this._binding:this._chart?this._chart.binding:null}set binding(t){t!=this._binding&&(this._binding=wjcCore.asString(t,!0),this._clearValues(),this._invalidate())}get bindingX(){return this._bindingX?this._bindingX:this._chart?this._chart.bindingX:null}set bindingX(t){t!=this._bindingX&&(this._bindingX=wjcCore.asString(t,!0),this._clearValues(),this._invalidate())}get name(){return this._name}set name(t){this._name=t}get itemsSource(){return this._itemsSource}set itemsSource(t){t!=this._itemsSource&&(this._cv&&(this._cv.currentChanged.removeHandler(this._cvCurrentChanged,this),this._cv.collectionChanged.removeHandler(this._cvCollectionChanged,this),this._cv=null),this._itemsSource=t,this._cv=wjcCore.asCollectionView(t),null!=this._cv&&(this._cv.currentChanged.addHandler(this._cvCurrentChanged,this),this._cv.collectionChanged.addHandler(this._cvCollectionChanged,this)),this._clearValues(),this._itemsSource=t,this._invalidate())}get collectionView(){return this._cv?this._cv:this._chart?this._chart.collectionView:null}get chart(){return this._chart}get hostElement(){return this._hostElement}get legendElement(){return this._legendElement}get cssClass(){return this._cssClass}set cssClass(t){this._cssClass=wjcCore.asString(t,!0)}get visibility(){return this._visibility}set visibility(t){(t=wjcCore.asEnum(t,SeriesVisibility))!=this._visibility&&(this._visibility=t,this._clearValues(),this._invalidate(),this._chart&&this._chart.onSeriesVisibilityChanged(new SeriesEventArgs(this)))}hitTest(t,e){return wjcCore.isNumber(t)&&wjcCore.isNumber(e)?t=new wjcCore.Point(t,e):t instanceof MouseEvent&&(t=new wjcCore.Point(t.pageX,t.pageY)),wjcCore.asType(t,wjcCore.Point),this._chart?this._chart._hitTestSeries(t,this._chart.series.indexOf(this)):null}getPlotElement(t){if(this.hostElement&&t<this._pointIndexes.length){var e=this._pointIndexes[t];if(e<this.hostElement.childNodes.length)return this.hostElement.childNodes[e]}return null}get axisX(){return this._axisX}set axisX(t){if(t!=this._axisX){if(this._axisX=wjcCore.asType(t,Axis,!0),this._axisX){var e=this._axisX._chart=this._chart;e&&-1==e.axes.indexOf(this._axisX)&&e.axes.push(this._axisX)}this._invalidate()}}get axisY(){return this._axisY}set axisY(t){if(t!=this._axisY){if(this._axisY=wjcCore.asType(t,Axis,!0),this._axisY){var e=this._axisY._chart=this._chart;e&&-1==e.axes.indexOf(this._axisY)&&e.axes.push(this._axisY)}this._invalidate()}}initialize(t){t&&wjcCore.copy(this,t)}pointToData(t){return wjcCore.asType(t,wjcCore.Point),t=t.clone(),t.x=this._getAxisX().convertBack(t.x),t.y=this._getAxisY().convertBack(t.y),t}dataToPoint(t){return wjcCore.asType(t,wjcCore.Point),t=t.clone(),t.x=this._getAxisX().convert(t.x),t.y=this._getAxisY().convert(t.y),t}onRendering(t,e,i){var s=new SeriesRenderingEventArgs(t,e,i);return this.rendering.raise(this,s),s.cancel}onRendered(t){this.rendered.raise(this,new RenderEventArgs(t))}get _chart(){return this.__chart}set _chart(t){t!==this.__chart&&(this.__chart=t)}_getSymbolSize(){return null!=this.symbolSize?this.symbolSize:this.chart.symbolSize}get _plotter(){return this.chart&&!this.__plotter&&(this.__plotter=this.chart._getPlotter(this)),this.__plotter}set _plotter(t){t!=this.__plotter&&(this.__plotter=t)}getDataType(t){return 0==t?this._valueDataType:1==t?this._xvalueDataType:null}getValues(t){if(0==t){if(null==this._values)if(this._valueDataType=null,null!=this._cv){i=this._bindValues(this._cv.items,this._getBinding(0));this._values=i.values,this._valueDataType=i.dataType}else if(null!=this.binding&&null!=this._chart&&null!=this._chart.collectionView){i=this._bindValues(this._chart.collectionView.items,this._getBinding(0));this._values=i.values,this._valueDataType=i.dataType}return this._values}if(1==t){if(null==this._xvalues){this._xvalueDataType=null;var e=this;if(null!=this.bindingX)if(null!=e._cv){i=this._bindValues(e._cv.items,this.bindingX,!0);this._xvalueDataType=i.dataType,this._xvalues=i.values}else{if(null==this._bindingX)return null;if(null!=e._chart&&null!=e._chart.collectionView){var i=this._bindValues(e._chart.collectionView.items,this.bindingX,!0);this._xvalueDataType=i.dataType,this._xvalues=i.values}}}return this._xvalues}return null}drawLegendItem(t,e,i){var s=this._getChartType();null==s&&(s=this._chart._getChartType());let r=this._getLegendStyle(this.style);s===ChartType.Funnel?this._drawFunnelLegendItem(t,e,i,r,this.symbolStyle):this._drawLegendItem(t,e,s,this.name,r,this.symbolStyle)}_getLegendStyle(t){if(!t)return;let e={};return t.fill&&(e.fill=t.fill),t.stroke&&(e.stroke=t.stroke),e}measureLegendItem(t,e){var i=this._getChartType();return null==i&&(i=this._chart._getChartType()),i===ChartType.Funnel?this._measureLegendItem(t,this._getFunnelLegendName(e)):this._measureLegendItem(t,this.name)}legendItemLength(){var t=this._getChartType();return null==t&&(t=this._chart._getChartType()),t===ChartType.Funnel?this._chart._xlabels&&this._chart._xlabels.length?this._chart._xlabels.length:this._chart._xvals&&this._chart._xvals.length?this._chart._xvals.length:1:1}getDataRect(t,e){return null}_getChartType(){return this._chartType}_clearValues(){this._values=null,this._xvalues=null,this.__plotter=null}_getBinding(t){var e=this.binding;if(e){var i=this.chart?this.chart._bindingSeparator:",";if(i){var s=e.split(i);s&&s.length>t&&(e=s[t].trim())}}return e}_getBindingValues(t){var e;return null!=this._cv?e=this._cv.items:null!=this._chart&&null!=this._chart.collectionView&&(e=this._chart.collectionView.items),this._bindValues(e,this._getBinding(t)).values}_getItem(t){var e=null,i=null;return null!=this.itemsSource?i=null!=this._cv?this._cv.items:this.itemsSource:null!=this._chart.itemsSource&&(i=null!=this._chart.collectionView?this._chart.collectionView.items:this._chart.itemsSource),null!=i&&(e=i[t]),e}_getLength(){var t=0,e=null;return null!=this.itemsSource?e=null!=this._cv?this._cv.items:this.itemsSource:null!=this._chart.itemsSource&&(e=null!=this._chart.collectionView?this._chart.collectionView.items:this._chart.itemsSource),null!=e&&(t=e.length),t}_setPointIndex(t,e){this._pointIndexes[t]=e}_getDataRect(){var t=this.getValues(0),e=this.getValues(1);if(t){for(var i=NaN,s=NaN,r=NaN,a=NaN,n=t.length,h=0;h<n;h++){var o=t[h];if(isFinite(o)&&(isNaN(s)?s=a=o:o<s?s=o:o>a&&(a=o)),e){var l=e[h];isFinite(l)&&(isNaN(i)?i=r=l:l<i?i=l:o>a&&(r=l))}}if(e||(i=0,r=n-1),!isNaN(s))return new wjcCore.Rect(i,s,r-i,a-s)}return null}_isCustomAxisX(){return!!this._axisX&&(!this._chart||this._axisX!=this.chart.axisX)}_isCustomAxisY(){return!!this._axisY&&(!this._chart||this._axisY!=this.chart.axisY)}_getAxisX(){var t=null;return this.axisX?t=this.axisX:this.chart&&(t=this.chart.axisX),t}_getAxisY(){var t=null;return this.axisY?t=this.axisY:this.chart&&(t=this.chart.axisY),t}_measureLegendItem(t,e){var i=new wjcCore.Size;if(i.width=Series._LEGEND_ITEM_WIDTH,i.height=Series._LEGEND_ITEM_HEIGHT,this._name){var s=t.measureString(e,FlexChart._CSS_LABEL,FlexChart._CSS_LEGEND);i.width+=s.width,i.height<s.height&&(i.height=s.height)}return i.width+=3*Series._LEGEND_ITEM_MARGIN,i.height+=2*Series._LEGEND_ITEM_MARGIN,i}_drawFunnelLegendItem(t,e,i,s,r){t.strokeWidth=1;var a=Series._LEGEND_ITEM_MARGIN,n=null,h=null;null===n&&(n=this._chart._getColorLight(i)),null===h&&(h=this._chart._getColor(i)),t.fill=n,t.stroke=h;var o=e.top+.5*e.height,l=Series._LEGEND_ITEM_WIDTH,_=Series._LEGEND_ITEM_HEIGHT,c=this._getFunnelLegendName(i);t.drawRect(e.left+a,o-.5*_,l,_,null,r||s),null!=c&&FlexChart._renderText(t,c,new wjcCore.Point(e.left+_+2*a,o),0,1,FlexChart._CSS_LABEL,FlexChart._CSS_LEGEND)}_getFunnelLegendName(t){var e,i=this._chart;return i._xlabels&&i._xlabels.length&&t<i._xlabels.length?e=i._xlabels[t]:i._xvals&&i._xvals.length&&t<i._xvals.length&&(e=i._xvals[t],i._xDataType===wjcCore.DataType.Date&&(e=FlexChart._fromOADate(e))),null==e&&(e=this.name),e.toString()}_drawLegendItem(t,e,i,s,r,a){t.strokeWidth=1;var n=Series._LEGEND_ITEM_MARGIN,h=null,o=null;null===h&&(h=this._chart._getColorLight(this._chart.series.indexOf(this))),null===o&&(o=this._chart._getColor(this._chart.series.indexOf(this))),t.fill=h,t.stroke=o;var l=e.top+.5*e.height,_=Series._LEGEND_ITEM_WIDTH,c=Series._LEGEND_ITEM_HEIGHT;switch(i){case ChartType.Area:case ChartType.SplineArea:t.drawRect(e.left+n,l-.5*c,_,c,null,r);break;case ChartType.Bar:case ChartType.Column:t.drawRect(e.left+n,l-.5*c,_,c,null,a||r);break;case ChartType.Scatter:case ChartType.Bubble:var d=.3*_,u=.3*c;this.symbolMarker==Marker.Box?t.drawRect(e.left+n+.5*_-d,l-u,2*d,2*u,null,a||r):t.drawEllipse(e.left+.5*_+n,l,d,u,null,a||r);break;case ChartType.Line:case ChartType.Spline:t.drawLine(e.left+n,l,e.left+_+n,l,null,r);break;case ChartType.LineSymbols:case ChartType.SplineSymbols:var d=.3*_,u=.3*c;this.symbolMarker==Marker.Box?t.drawRect(e.left+n+.5*_-d,l-u,2*d,2*u,null,a||r):t.drawEllipse(e.left+.5*_+n,l,d,u,null,a||r),t.drawLine(e.left+n,l,e.left+_+n,l,null,r);break;case ChartType.Candlestick:case ChartType.HighLowOpenClose:t.drawLine(e.left+n,l,e.left+_+n,l,null,a||r)}this._name&&FlexChart._renderText(t,s,new wjcCore.Point(e.left+c+2*n,l),0,1,FlexChart._CSS_LABEL,FlexChart._CSS_LEGEND)}_cvCollectionChanged(t,e){this._clearValues(),this._invalidate()}_cvCurrentChanged(t,e){this._chart&&this._chart._notifyCurrentChanged&&this._invalidate()}_bindValues(t,e,i=!1){var s,r,a;if(null!=t){var n=t.length;s=new Array(t.length);for(var h=0;h<n;h++){a=null;var o=t[h];null!=e&&(o=o[e]),wjcCore.isArray(o)&&o.length>0&&(a=o,o=o[0]),wjcCore.isNumber(o)?(s[h]=o,r=wjcCore.DataType.Number):wjcCore.isDate(o)?(s[h]=o.valueOf(),r=wjcCore.DataType.Date):i&&o&&(s[h]=h,r=wjcCore.DataType.Number),wjcCore.isArray(a)&&a.length>0&&(s[h]=a)}}var l=new DataArray;return l.values=s,l.dataType=r,l}_invalidate(){this._chart&&this._chart.invalidate()}_indexToPoint(t){if(t>=0&&t<this._values.length){var e=this._values[t],i=this._xvalues?this._xvalues[t]:t;return new wjcCore.Point(i,e)}return null}_getSymbolFill(t){var e=null;return this.symbolStyle&&(e=this.symbolStyle.fill),!e&&this.style&&(e=this.style.fill),!e&&this.chart&&(e=this.chart._getColorLight(t)),e}_getSymbolStroke(t){var e=null;return this.symbolStyle&&(e=this.symbolStyle.stroke),!e&&this.style&&(e=this.style.stroke),!e&&this.chart&&(e=this.chart._getColor(t)),e}_getAltSymbolStroke(t){var e=null;return this.altStyle&&(e=this.altStyle.stroke),e}_getAltSymbolFill(t){var e=null;return this.altStyle&&(e=this.altStyle.fill),e}_renderLabels(t,e,i,s){this._plotter&&this._plotter._renderLabels(t,this,e,i,s)}}SeriesBase._LEGEND_ITEM_WIDTH=10,SeriesBase._LEGEND_ITEM_HEIGHT=10,SeriesBase._LEGEND_ITEM_MARGIN=4,SeriesBase._DEFAULT_SYM_SIZE=10,exports.SeriesBase=SeriesBase;class Series extends SeriesBase{get chartType(){return this._chartType}set chartType(t){(t=wjcCore.asEnum(t,ChartType,!0))!=this._chartType&&(this._chartType=t,this._invalidate())}}exports.Series=Series;class _SvgRenderEngine{constructor(t){this._strokeWidth=1,this._fontSize=null,this._fontFamily=null,this._savedGradient={},this._bbCache={},this._element=t,this._create(),this._element.appendChild(this._svg),void 0===_SvgRenderEngine._isff&&(_SvgRenderEngine._isff=navigator.userAgent.toLowerCase().indexOf("firefox")>=0)}beginRender(){for(;this._svg.firstChild;)wjcCore.removeChild(this._svg.firstChild);this._savedGradient={},this._bbCache={},this._svg.appendChild(this._defs),this._svg.appendChild(this._textGroup)}endRender(){wjcCore.removeChild(this._textGroup)}setViewportSize(t,e){this._svg.setAttribute("width",t.toString()),this._svg.setAttribute("height",e.toString())}get element(){return this._svg}get fill(){return this._fill}set fill(t){this._fill=t}get fontSize(){return this._fontSize}set fontSize(t){this._fontSize=t}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t}get stroke(){return this._stroke}set stroke(t){this._stroke=t}get strokeWidth(){return this._strokeWidth}set strokeWidth(t){this._strokeWidth=t}get textFill(){return this._textFill}set textFill(t){this._textFill=t}addClipRect(t,e){if(t&&e){var i=document.createElementNS(_SvgRenderEngine.svgNS,"clipPath"),s=document.createElementNS(_SvgRenderEngine.svgNS,"rect");s.setAttribute("x",(t.left-1).toFixed()),s.setAttribute("y",(t.top-1).toFixed()),s.setAttribute("width",(t.width+2).toFixed()),s.setAttribute("height",(t.height+2).toFixed()),i.appendChild(s),i.setAttribute("id",e),this._svg.appendChild(i)}}drawEllipse(t,e,i,s,r,a){var n=document.createElementNS(_SvgRenderEngine.svgNS,"ellipse");return this._applyColor(n,"stroke",this._stroke),null!==this._strokeWidth&&n.setAttribute("stroke-width",this._strokeWidth.toString()),this._applyColor(n,"fill",this._fill),n.setAttribute("cx",t.toFixed(1)),n.setAttribute("cy",e.toFixed(1)),n.setAttribute("rx",i.toFixed(1)),n.setAttribute("ry",s.toFixed(1)),r&&n.setAttribute("class",r),this._applyStyle(n,a),this._appendChild(n),n}drawRect(t,e,i,s,r,a,n){var h=document.createElementNS(_SvgRenderEngine.svgNS,"rect");return this._applyColor(h,"fill",this._fill),this._applyColor(h,"stroke",this._stroke),null!==this._strokeWidth&&h.setAttribute("stroke-width",this._strokeWidth.toString()),h.setAttribute("x",t.toFixed(1)),h.setAttribute("y",e.toFixed(1)),i>0&&i<.05?h.setAttribute("width","0.1"):h.setAttribute("width",i.toFixed(1)),s>0&&s<.05?h.setAttribute("height","0.1"):h.setAttribute("height",s.toFixed(1)),n&&h.setAttribute("clip-path","url(#"+n+")"),r&&h.setAttribute("class",r),this._applyStyle(h,a),this._appendChild(h),h}drawLine(t,e,i,s,r,a){var n=document.createElementNS(_SvgRenderEngine.svgNS,"line");return this._applyColor(n,"stroke",this._stroke),null!==this._strokeWidth&&n.setAttribute("stroke-width",this._strokeWidth.toString()),n.setAttribute("x1",t.toFixed(1)),n.setAttribute("x2",i.toFixed(1)),n.setAttribute("y1",e.toFixed(1)),n.setAttribute("y2",s.toFixed(1)),r&&n.setAttribute("class",r),this._applyStyle(n,a),this._appendChild(n),n}drawLines(t,e,i,s,r){if(t&&e){var a=Math.min(t.length,e.length);if(a>0){var n=document.createElementNS(_SvgRenderEngine.svgNS,"polyline");this._applyColor(n,"stroke",this._stroke),null!==this._strokeWidth&&n.setAttribute("stroke-width",this._strokeWidth.toString()),n.setAttribute("fill","none");for(var h="",o=0;o<a;o++)h+=t[o].toFixed(1)+","+e[o].toFixed(1)+" ";return n.setAttribute("points",h),i&&n.setAttribute("class",i),r&&n.setAttribute("clip-path","url(#"+r+")"),this._applyStyle(n,s),this._appendChild(n),n}}return null}drawSplines(t,e,i,s,r){if(t&&e){var a=new _Spline(t,e).calculate(),n=a.xs,h=a.ys,o=Math.min(n.length,h.length);if(o>0){var l=document.createElementNS(_SvgRenderEngine.svgNS,"polyline");this._applyColor(l,"stroke",this._stroke),null!==this._strokeWidth&&l.setAttribute("stroke-width",this._strokeWidth.toString()),l.setAttribute("fill","none");for(var _="",c=0;c<o;c++)_+=n[c].toFixed(1)+","+h[c].toFixed(1)+" ";return l.setAttribute("points",_),i&&l.setAttribute("class",i),r&&l.setAttribute("clip-path","url(#"+r+")"),this._applyStyle(l,s),this._appendChild(l),l}}return null}drawPolygon(t,e,i,s,r){if(t&&e){var a=Math.min(t.length,e.length);if(a>0){var n=document.createElementNS(_SvgRenderEngine.svgNS,"polygon");this._applyColor(n,"stroke",this._stroke),null!==this._strokeWidth&&n.setAttribute("stroke-width",this._strokeWidth.toString()),this._applyColor(n,"fill",this._fill);for(var h="",o=0;o<a;o++)h+=t[o].toFixed(1)+","+e[o].toFixed(1)+" ";return n.setAttribute("points",h),i&&n.setAttribute("class",i),r&&n.setAttribute("clip-path","url(#"+r+")"),this._applyStyle(n,s),this._appendChild(n),n}}return null}drawPieSegment(t,e,i,s,r,a,n,h){if(r>=2*Math.PI)return this.drawEllipse(t,e,i,i,a,n);var o=document.createElementNS(_SvgRenderEngine.svgNS,"path");this._applyColor(o,"fill",this._fill),this._applyColor(o,"stroke",this._stroke),null!==this._strokeWidth&&o.setAttribute("stroke-width",this._strokeWidth.toString());var l=new wjcCore.Point(t,e);l.x+=i*Math.cos(s),l.y+=i*Math.sin(s);var _=s+r,c=new wjcCore.Point(t,e);c.x+=i*Math.cos(_),c.y+=i*Math.sin(_);var d=" 0 0,1 ";Math.abs(r)>Math.PI&&(d=" 0 1,1 ");var u="M "+l.x.toFixed(1)+","+l.y.toFixed(1);return u+=" A "+i.toFixed(1)+","+i.toFixed(1)+d,u+=c.x.toFixed(1)+","+c.y.toFixed(1),u+=" L "+t.toFixed(1)+","+e.toFixed(1)+" z",o.setAttribute("d",u),h&&o.setAttribute("clip-path","url(#"+h+")"),a&&o.setAttribute("class",a),this._applyStyle(o,n),this._appendChild(o),o}drawDonutSegment(t,e,i,s,r,a,n,h,o){var l=!1;a>=2*Math.PI&&(l=!0,a-=.001);var _=document.createElementNS(_SvgRenderEngine.svgNS,"path");this._applyColor(_,"fill",this._fill),this._applyColor(_,"stroke",this._stroke),null!==this._strokeWidth&&_.setAttribute("stroke-width",this._strokeWidth.toString());var c=new wjcCore.Point(t,e);c.x+=i*Math.cos(r),c.y+=i*Math.sin(r);var d=r+a,u=new wjcCore.Point(t,e);u.x+=i*Math.cos(d),u.y+=i*Math.sin(d);var g=new wjcCore.Point(t,e);g.x+=s*Math.cos(d),g.y+=s*Math.sin(d);var p=new wjcCore.Point(t,e);p.x+=s*Math.cos(r),p.y+=s*Math.sin(r);var m=" 0 0,1 ",x=" 0 0,0 ";Math.abs(a)>Math.PI&&(m=" 0 1,1 ",x=" 0 1,0 ");var v="M "+c.x.toFixed(3)+","+c.y.toFixed(3);return v+=" A "+i.toFixed(3)+","+i.toFixed(3)+m,v+=u.x.toFixed(3)+","+u.y.toFixed(3),v+=l?" M "+g.x.toFixed(3)+","+g.y.toFixed(3):" L "+g.x.toFixed(3)+","+g.y.toFixed(3),v+=" A "+s.toFixed(3)+","+s.toFixed(3)+x,v+=p.x.toFixed(3)+","+p.y.toFixed(3),l||(v+=" z"),_.setAttribute("d",v),o&&_.setAttribute("clip-path","url(#"+o+")"),n&&_.setAttribute("class",n),this._applyStyle(_,h),this._appendChild(_),_}drawString(t,e,i,s){var r=this._createText(e,t);i&&r.setAttribute("class",i),this._applyStyle(r,s),this._appendChild(r);var a,n=this._getKey(t,i,this._groupCls);return this._bbCache[n]?(a=this._bbCache[n],r.setAttribute("y",(e.y-(a.y+a.height)).toFixed(1))):(a=this._getBBox(r),r.setAttribute("y",(e.y-(a.y+a.height-e.y)).toFixed(1))),r}drawStringRotated(t,e,i,s,r,a){var n=this._createText(e,t);r&&n.setAttribute("class",r),this._applyStyle(n,a);var h=document.createElementNS(_SvgRenderEngine.svgNS,"g");h.setAttribute("transform","rotate("+s.toFixed(1)+","+i.x.toFixed(1)+","+i.y.toFixed(1)+")"),h.appendChild(n),this._appendChild(h);var o=this._getBBox(n);return n.setAttribute("y",(e.y-(o.y+o.height-e.y)).toFixed(1)),n}measureString(t,e,i,s){var r=new wjcCore.Size(0,0);if(!this._fontFamily&&!this._fontSize){let s=this._getKey(t,e,i);if(this._bbCache[s])return this._bbCache[s]}this._fontSize&&this._text.setAttribute("font-size",this._fontSize),this._fontFamily&&this._text.setAttribute("font-family",this._fontFamily),e&&this._text.setAttribute("class",e),i&&this._textGroup.setAttribute("class",i),this._applyStyle(this._text,s),this._setText(this._text,t);var a=this._getBBox(this._text);if(r.width=a.width,r.height=a.height,this._text.removeAttribute("font-size"),this._text.removeAttribute("font-family"),this._text.removeAttribute("class"),s)for(var n in s)this._text.removeAttribute(this._deCase(n));if(this._textGroup.removeAttribute("class"),this._text.textContent=null,!this._fontFamily&&!this._fontSize){let s=this._getKey(t,e,i);this._bbCache[s]={x:a.x,y:a.y+1e3,width:a.width,height:a.height}}return r}startGroup(t,e,i=!1){var s=document.createElementNS(_SvgRenderEngine.svgNS,"g");return t&&(s.setAttribute("class",t),this._groupCls=t),e&&s.setAttribute("clip-path","url(#"+e+")"),this._appendChild(s),i&&s.transform.baseVal.appendItem(this._svg.createSVGTransform()),this._group=s,s}endGroup(){if(this._group){var t=this._group.parentNode;t==this._svg?(this._group=null,this._groupCls=null):(this._group=t,this._groupCls=this._getClass(this._group))}}drawImage(t,e,i,s,r){var a=document.createElementNS(_SvgRenderEngine.svgNS,"image");return a.setAttributeNS(_SvgRenderEngine.xlinkNS,"href",t),a.setAttribute("x",e.toFixed(1)),a.setAttribute("y",i.toFixed(1)),a.setAttribute("width",s.toFixed(1)),a.setAttribute("height",r.toFixed(1)),this._appendChild(a),a}_appendChild(t){var e=this._group;e||(e=this._svg),e.appendChild(t)}_create(){this._svg=document.createElementNS(_SvgRenderEngine.svgNS,"svg"),this._defs=document.createElementNS(_SvgRenderEngine.svgNS,"defs"),this._svg.appendChild(this._defs),this._text=this._createText(new wjcCore.Point(-1e3,-1e3),""),this._textGroup=document.createElementNS(_SvgRenderEngine.svgNS,"g"),this._textGroup.appendChild(this._text),this._svg.appendChild(this._textGroup)}_setText(t,e){var i=e?e.toString():null;if(i&&i.indexOf("tspan")>=0)try{t.textContent=null;for(var s='<svg xmlns="http://www.w3.org/2000/svg">'+i+"</svg>",r=(new DOMParser).parseFromString(s,"text/xml").documentElement.firstChild;r;)t.appendChild(t.ownerDocument.importNode(r,!0)),r=r.nextSibling}catch(t){throw new Error("Error parsing XML string.")}else t.textContent=i}_getKey(t,e,i){return t+(e||"")+(i||"")}_createText(t,e){var i=document.createElementNS(_SvgRenderEngine.svgNS,"text");return this._setText(i,e),i.setAttribute("x",t.x.toFixed(1)),i.setAttribute("y",t.y.toFixed(1)),null!=this._textFill&&i.setAttribute("fill",this._textFill),this._fontSize&&i.setAttribute("font-size",this._fontSize),this._fontFamily&&i.setAttribute("font-family",this._fontFamily),i}_applyStyle(t,e){if(e)for(var i in e)"fill"===i||"stroke"===i?this._applyColor(t,i,e[i]):t.setAttribute(this._deCase(i),e[i])}_deCase(t){return t.replace(/[A-Z]/g,function(t){return"-"+t.toLowerCase()})}_getClass(t){let e;if(t)for(let i=t;i&&!(e=i.getAttribute("class"));i=i.parentNode);return e}_getBBox(t){if(!_SvgRenderEngine._isff)return t.getBBox();try{return t.getBBox()}catch(t){return{x:0,y:0,width:0,height:0}}}_applyColor(t,e,i){var s=_GradientColorUtil.tryParse(i);if(null!=s)if(wjcCore.isString(s))t.setAttribute(e,s);else{if(null==this._savedGradient[i]){var r,a="gc"+(1e6*Math.random()).toFixed();null!=s.x1?(r=document.createElementNS(_SvgRenderEngine.svgNS,"linearGradient"),["x1","y1","x2","y2","gradientUnits"].forEach(t=>{null!=s[t]&&r.setAttribute(t,s[t])})):null!=s.r&&(r=document.createElementNS(_SvgRenderEngine.svgNS,"radialGradient"),["cx","cy","r","fx","fy","fr","gradientUnits"].forEach(t=>{null!=s[t]&&r.setAttribute(t,s[t])})),s.colors&&s.colors&&s.colors.length>0&&s.colors.forEach(t=>{var e=document.createElementNS(_SvgRenderEngine.svgNS,"stop");null!=t.color&&e.setAttribute("stop-color",t.color),null!=t.offset&&e.setAttribute("offset",t.offset),null!=t.opacity&&e.setAttribute("stop-opacity",t.opacity),r.appendChild(e)}),r.setAttribute("id",a),this._defs.appendChild(r),this._savedGradient[i]=a}t.setAttribute(e,"url(#"+this._savedGradient[i]+")")}}}_SvgRenderEngine.svgNS="http://www.w3.org/2000/svg",_SvgRenderEngine.xlinkNS="http://www.w3.org/1999/xlink",exports._SvgRenderEngine=_SvgRenderEngine;class _GradientColorUtil{static tryParse(t){if(_GradientColorUtil.parsedColor[t])return _GradientColorUtil.parsedColor[t];if(null==t||-1===t.indexOf("-"))return t;var e,i=t.replace(/\s+/g,"").split(/\-/g),s=i[0][0],r=!1,a=i[0].match(/\(\S+\)/)[0].replace(/[\(\\)]/g,"").split(/\,/g);"l"===s||"L"===s?(e={x1:"0",y1:"0",x2:"0",y2:"0",colors:[]},"l"===s&&(r=!0),["x1","y1","x2","y2"].forEach((t,i)=>{null!=a[i]&&(e[t]=r?100*+a[i]+"%":a[i]+"")})):"r"!==s&&"R"!==s||(e={cx:"0",cy:"0",r:"0",colors:[]},"r"===s&&(r=!0),["cx","cy","r","fx","fy","fr"].forEach((t,i)=>{null!=a[i]&&""!==a[i]&&(e[t]=r?100*+a[i]+"%":a[i]+"")})),r||(e.gradientUnits="userSpaceOnUse"),_GradientColorUtil.parsedColor[t]=e;var n=i.length-1;return i.forEach((t,i)=>{t.indexOf(")")>-1&&(t=t.match(/\)\S+/)[0].replace(")",""));var s=t.split(":"),a={color:"black"};null!=s[0]&&(a.color=s[0]),null!=s[1]?a.offset=r?100*+s[1]+"%":s[1]+"":a.offset=i/n*100+"%",null!=s[2]&&(a.opacity=s[2]),e.colors.push(a)}),e}}_GradientColorUtil.parsedColor={};class Legend{constructor(t){this._position=Position.Right,this._title="",this._titleAlign="left",this._titlePadding=5,this._areas=new Array,this._sz=new wjcCore.Size,this._colRowLens=[],this._chart=t}get position(){return this._position}set position(t){(t=wjcCore.asEnum(t,Position))!=this._position&&(this._position=t,this._chart&&this._chart.invalidate())}get title(){return this._title}set title(t){t!=this._title&&(this._title=wjcCore.asString(t,!1),this._chart&&this._chart.invalidate())}get titleAlign(){return this._titleAlign}set titleAlign(t){if(t!=this._titleAlign){var e=wjcCore.asString(t,!1);this._titleAlign="right"===e?"right":"center"===e?"center":"left",this._chart&&this._chart.invalidate()}}_getDesiredSize(t,e,i,s){if(e==Position.None)return null;var r=e==Position.Right||e==Position.Left,a=this._chart._getDesiredLegendSize(t,r,i,s);if(null!=a){if(this.title.length>0){var n=t.measureString(this.title,"wj-title","wj-legend");a.height+=n.height+this._titlePadding,n.width>a.width&&(a.width=n.width)}this._sz=a}return a}_getPosition(t,e){return this.position==Position.Auto?t>=e?Position.Right:Position.Bottom:this.position}_render(t,e,i,s,r){this._areas=[];var a=i==Position.Right||i==Position.Left;if(t.fill="transparent",t.stroke=null,t.drawRect(e.x,e.y,this._sz.width,this._sz.height),this.title.length){var n=t.drawString(this.title,e,"wj-title"),h=n.getBBox();n.setAttribute("y",Number(n.getAttribute("y"))+h.height),"right"===this.titleAlign?n.setAttribute("x",e.x+s-h.width):"center"===this.titleAlign&&n.setAttribute("x",e.x+s/2-h.width/2);var o=h.height+this._titlePadding;e.y+=o,r-=o}this._chart._renderLegend(t,e,this._areas,a,s,r)}_hitTest(t){for(var e=this._areas,i=0;i<e.length;i++)if(e[i]&&FlexChartCore._contains(e[i],t))return i;return null}}exports.Legend=Legend;var ChartElement;!function(t){t[t.PlotArea=0]="PlotArea",t[t.AxisX=1]="AxisX",t[t.AxisY=2]="AxisY",t[t.ChartArea=3]="ChartArea",t[t.Legend=4]="Legend",t[t.Header=5]="Header",t[t.Footer=6]="Footer",t[t.Series=7]="Series",t[t.SeriesSymbol=8]="SeriesSymbol",t[t.DataLabel=9]="DataLabel",t[t.None=10]="None"}(ChartElement=exports.ChartElement||(exports.ChartElement={}));class HitTestInfo{constructor(t,e,i){this._pointIndex=null,this._chartElement=ChartElement.None,this._chart=t,this._pt=e,this._chartElement=i}get chart(){return this._chart}get point(){return this._pt}get series(){return this._series}get pointIndex(){return this._pointIndex}get chartElement(){return this._chartElement}get distance(){return this._dist}get item(){if(null==this._item&&null!==this.pointIndex)if(null!=this.series)this._item=this.series._getItem(this.pointIndex);else{var t=this._chart._getHitTestItem(this.pointIndex);t&&(this._item=t)}return this._item}get x(){return void 0===this._x&&(this._x=this._getValue(1,!1)),this._x}get y(){return void 0===this._y&&(this._y=this._getValue(0,!1)),this._y}get value(){var t=this._chart._getHitTestValue(this.pointIndex);return null!=t?t:this.y}get name(){if(void 0===this._name){var t=this._chart._getHitTestLabel(this.pointIndex);return null==t?this.series.name:t.toString()}return this._name}get _xfmt(){return void 0===this.__xfmt&&(this.__xfmt=this._getValue(1,!0)),this.__xfmt}get _yfmt(){return void 0===this.__yfmt&&(this.__yfmt=this._getValue(0,!0)),this.__yfmt}_setData(t,e){this._series=t,this._pointIndex=e}_setDataPoint(t){if(t=wjcCore.asType(t,_DataPoint,!0)){this._pointIndex=t.pointIndex;var e=wjcCore.asType(this._chart,FlexChartCore,!0),i=t.seriesIndex;null!==i&&i>=0&&i<e.series.length&&(this._series=e.series[i]),null!=t.item&&(this._item=t.item),null!=t.x&&(this._x=t.x),null!=t.y&&(this._y=t.y),null!=t.xfmt&&(this.__xfmt=t.xfmt),null!=t.yfmt&&(this.__yfmt=t.yfmt),null!=t.name&&(this._name=t.name)}}_getValue(t,e){var i=this._chart._getHitTestValue(this.pointIndex);if(null!=i)return i;var s=null,r=this._chart,a=this.pointIndex,n=r._isRotated();if(null!==this.series&&null!==a){var h=this.series.getValues(t),o=this.series.getDataType(t);h&&this.pointIndex<h.length?(s=h[this.pointIndex],o!=wjcCore.DataType.Date||e||(s=new Date(s))):1==t&&(r._xlabels&&r._xlabels.length>0&&a<r._xlabels.length?s=r._xlabels[a]:r._xvals&&a<r._xvals.length&&(s=r._xvals[a],r._xDataType!=wjcCore.DataType.Date||e||(s=new Date(s))))}return null!==s&&e&&(n?0==t?s=this.ax._formatValue(s):1==t&&(s=this.ay._formatValue(s)):0==t?s=this.ay._formatValue(s):1==t&&(s=this.ax._formatValue(s))),s}get ax(){return this.series.axisX?this.series.axisX:this._chart.axisX}get ay(){return this.series.axisY?this.series.axisY:this._chart.axisY}}exports.HitTestInfo=HitTestInfo;class Palettes{}Palettes.standard=["#88bde6","#fbb258","#90cd97","#f6aac9","#bfa554","#bc99c7","#eddd46","#f07e6e","#8c8c8c"],Palettes.cocoa=["#466bb0","#c8b422","#14886e","#b54836","#6e5944","#8b3872","#73b22b","#b87320","#141414"],Palettes.coral=["#84d0e0","#f48256","#95c78c","#efa5d6","#ba8452","#ab95c2","#ede9d0","#e96b7d","#888888"],Palettes.dark=["#005fad","#f06400","#009330","#e400b1","#b65800","#6a279c","#d5a211","#dc0127","#000000"],Palettes.highcontrast=["#ff82b0","#0dda2c","#0021ab","#bcf28c","#19c23b","#890d3a","#607efd","#1b7700","#000000"],Palettes.light=["#ddca9a","#778deb","#cb9fbb","#b5eae2","#7270be","#a6c7a7","#9e95c7","#95b0c7","#9b9b9b"],Palettes.midnight=["#83aaca","#e37849","#14a46a","#e097da","#a26d54","#a584b7","#d89c54","#e86996","#2c343b"],Palettes.modern=["#2d9fc7","#ec993c","#89c235","#e377a4","#a68931","#a672a6","#d0c041","#e35855","#68706a"],Palettes.organic=["#9c88d9","#a3d767","#8ec3c0","#e9c3a9","#91ab36","#d4ccc0","#61bbd8","#e2d76f","#80715a"],Palettes.slate=["#7493cd","#f99820","#71b486","#e4a491","#cb883b","#ae83a4","#bacc5c","#e5746a","#505d65"],Palettes.zen=["#7bb5ae","#e2d287","#92b8da","#eac4cb","#7b8bbd","#c7d189","#b9a0c8","#dfb397","#a9a9a9"],Palettes.cyborg=["#2a9fd6","#77b300","#9933cc","#ff8800","#cc0000","#00cca3","#3d6dcc","#525252","#000000"],Palettes.superhero=["#5cb85c","#f0ad4e","#5bc0de","#d9534f","#9f5bde","#46db8c","#b6b86e","#4e5d6c","#2b3e4b"],Palettes.flatly=["#18bc9c","#3498db","#f39c12","#6cc1be","#99a549","#8f54b5","#e74c3c","#8a9899","#2c3e50"],Palettes.darkly=["#375a7f","#00bc8c","#3498db","#f39c12","#e74c3c","#8f61b3","#b08725","#4a4949","#000000"],Palettes.cerulan=["#033e76","#87c048","#59822c","#53b3eb","#fc6506","#d42323","#e3bb00","#cccccc","#222222"],exports.Palettes=Palettes;class _Spline{constructor(t,e){this.k=.002,this._a=[],this._b=[],this._c=[],this._d=[],this.m=[[-.5,1.5,-1.5,.5],[1,-2.5,2,-.5],[-.5,0,.5,0],[0,1,0,0]],this._x=t,this._y=e;var i=this._len=Math.min(t.length,e.length);if(i>3)for(var s=0;s<i-1;s++){var r=0==s?new wjcCore.Point(t[s],e[s]):new wjcCore.Point(t[s-1],e[s-1]),a=new wjcCore.Point(t[s],e[s]),n=new wjcCore.Point(t[s+1],e[s+1]),h=s==i-2?new wjcCore.Point(t[s+1],e[s+1]):new wjcCore.Point(t[s+2],e[s+2]),o=new wjcCore.Point,l=new wjcCore.Point,_=new wjcCore.Point,c=new wjcCore.Point;o.x=r.x*this.m[0][0]+a.x*this.m[0][1]+n.x*this.m[0][2]+h.x*this.m[0][3],l.x=r.x*this.m[1][0]+a.x*this.m[1][1]+n.x*this.m[1][2]+h.x*this.m[1][3],_.x=r.x*this.m[2][0]+a.x*this.m[2][1]+n.x*this.m[2][2]+h.x*this.m[2][3],c.x=r.x*this.m[3][0]+a.x*this.m[3][1]+n.x*this.m[3][2]+h.x*this.m[3][3],o.y=r.y*this.m[0][0]+a.y*this.m[0][1]+n.y*this.m[0][2]+h.y*this.m[0][3],l.y=r.y*this.m[1][0]+a.y*this.m[1][1]+n.y*this.m[1][2]+h.y*this.m[1][3],_.y=r.y*this.m[2][0]+a.y*this.m[2][1]+n.y*this.m[2][2]+h.y*this.m[2][3],c.y=r.y*this.m[3][0]+a.y*this.m[3][1]+n.y*this.m[3][2]+h.y*this.m[3][3],this._a.push(o),this._b.push(l),this._c.push(_),this._d.push(c)}}calculatePoint(t){var e=Math.floor(t);e<0&&(e=0),e>this._len-2&&(e=this._len-2);var i=t-e;return{x:((this._a[e].x*i+this._b[e].x)*i+this._c[e].x)*i+this._d[e].x,y:((this._a[e].y*i+this._b[e].y)*i+this._c[e].y)*i+this._d[e].y}}calculate(){if(this._len<=3)return{xs:this._x,ys:this._y};var t=[],e=[],i=this.calculatePoint(0);t.push(i.x),e.push(i.y);for(var s=this._len*this.k,r=s;r<=this._len-1;r+=s){var a=this.calculatePoint(r);(Math.abs(i.x-a.x)>=3||Math.abs(i.y-a.y)>=3)&&(t.push(a.x),e.push(a.y),i=a)}return{xs:t,ys:e}}}exports._Spline=_Spline;var LabelPosition;!function(t){t[t.None=0]="None",t[t.Left=1]="Left",t[t.Top=2]="Top",t[t.Right=3]="Right",t[t.Bottom=4]="Bottom",t[t.Center=5]="Center"}(LabelPosition=exports.LabelPosition||(exports.LabelPosition={}));var PieLabelPosition;!function(t){t[t.None=0]="None",t[t.Inside=1]="Inside",t[t.Center=2]="Center",t[t.Outside=3]="Outside",t[t.Radial=4]="Radial",t[t.Circular=5]="Circular"}(PieLabelPosition=exports.PieLabelPosition||(exports.PieLabelPosition={}));class DataLabelRenderEventArgs extends RenderEventArgs{constructor(t,e,i,s){super(t),this.cancel=!1,this._ht=e,this._pt=i,this._text=s}get point(){return this._pt}get text(){return this._text}set text(t){this._text=wjcCore.asString(t)}get hitTestInfo(){return this._ht}}exports.DataLabelRenderEventArgs=DataLabelRenderEventArgs;class DataLabelBase{constructor(){this.rendering=new wjcCore.Event}get content(){return this._content}set content(t){t!=this._content&&(this._content=t,this._invalidate())}get border(){return this._bdr}set border(t){t!=this._bdr&&(this._bdr=wjcCore.asBoolean(t,!0),this._invalidate())}get offset(){return this._off}set offset(t){t!=this._off&&(this._off=wjcCore.asNumber(t,!0),this._invalidate())}get connectingLine(){return this._line}set connectingLine(t){t!=this._line&&(this._line=wjcCore.asBoolean(t,!0),this._invalidate())}onRendering(t){return this.rendering.raise(this,t),!t.cancel}_invalidate(){this._chart&&this._chart.invalidate()}}exports.DataLabelBase=DataLabelBase;class DataLabel extends DataLabelBase{constructor(){super(...arguments),this._pos=LabelPosition.Top}get position(){return this._pos}set position(t){(t=wjcCore.asEnum(t,LabelPosition))!=this._pos&&(this._pos=t,this._invalidate())}}exports.DataLabel=DataLabel;class PieDataLabel extends DataLabelBase{constructor(){super(...arguments),this._pos=PieLabelPosition.Center}get position(){return this._pos}set position(t){(t=wjcCore.asEnum(t,PieLabelPosition))!=this._pos&&(this._pos=t,this._invalidate())}}exports.PieDataLabel=PieDataLabel;class LineMarkers{constructor(){this._moveMarker=function(t){var e=t.currentTarget,i=this._markers,s=e.getAttribute("data-markerIndex");null!=s&&i[s].forEach(function(e){e._moveMarker(t)})},this._markers=[],this._bindMoveMarker=this._moveMarker.bind(this)}attach(t){var e,i,s=t.chart.hostElement,r=this._markers,a=s.getAttribute("data-markerIndex");null!=a?(i=r[a])&&wjcCore.isArray(i)?i.push(t):(r[a]=[t],this._bindMoveEvent(s)):(e=r.length,i=[t],r.push(i),s.setAttribute("data-markerIndex",e),this._bindMoveEvent(s))}detach(t){var e,i,s=t.chart.hostElement,r=this._markers,a=s.getAttribute("data-markerIndex");null!=a&&((e=(i=r[a]).indexOf(t))>-1&&i.splice(e,1),0===i.length&&((e=r.indexOf(i))>-1&&(r[e]=void 0),this._unbindMoveEvent(s)))}_unbindMoveEvent(t){var e=this._bindMoveMarker;t.removeEventListener("mousemove",e),"ontouchstart"in window&&t.removeEventListener("touchmove",e)}_bindMoveEvent(t){var e=this._bindMoveMarker;t.addEventListener("mousemove",e),"ontouchstart"in window&&t.addEventListener("touchmove",e)}}var lineMarkers=new LineMarkers,LineMarkerLines;!function(t){t[t.None=0]="None",t[t.Vertical=1]="Vertical",t[t.Horizontal=2]="Horizontal",t[t.Both=3]="Both"}(LineMarkerLines=exports.LineMarkerLines||(exports.LineMarkerLines={}));var LineMarkerInteraction;!function(t){t[t.None=0]="None",t[t.Move=1]="Move",t[t.Drag=2]="Drag"}(LineMarkerInteraction=exports.LineMarkerInteraction||(exports.LineMarkerInteraction={}));var LineMarkerAlignment;!function(t){t[t.Auto=2]="Auto",t[t.Right=0]="Right",t[t.Left=1]="Left",t[t.Bottom=4]="Bottom",t[t.Top=6]="Top"}(LineMarkerAlignment=exports.LineMarkerAlignment||(exports.LineMarkerAlignment={}));class LineMarker{constructor(t,e){this._wrapperMousedown=null,this._wrapperMouseup=null,this.positionChanged=new wjcCore.Event;var i=this;i._chart=t,t.rendered.addHandler(i._initialize,i),i._resetDefaultValue(),wjcCore.copy(this,e),i._initialize()}get chart(){return this._chart}get isVisible(){return this._isVisible}set isVisible(t){var e=this;t!==e._isVisible&&(e._isVisible=wjcCore.asBoolean(t),e._marker&&e._toggleVisibility())}get seriesIndex(){return this._seriesIndex}set seriesIndex(t){var e=this;t!==e._seriesIndex&&(e._seriesIndex=wjcCore.asNumber(t,!0))}get horizontalPosition(){return this._horizontalPosition}set horizontalPosition(t){var e=this;if(t!==e._horizontalPosition){if(e._horizontalPosition=wjcCore.asNumber(t,!0),e._horizontalPosition<0||e._horizontalPosition>1)throw"horizontalPosition's value should be in (0, 1).";e._marker&&e._updateMarkerPosition()}}get x(){var t=this,e=t._targetPoint.x-t._plotRect.left;return t._chart.axisX.convertBack(e)}get y(){var t=this,e=t._targetPoint.y-t._plotRect.top;return t._chart.axisY.convertBack(e)}get content(){return this._content}set content(t){t!==this._content&&(this._content=wjcCore.asFunction(t),this._updateMarkerPosition())}get verticalPosition(){return this._verticalPosition}set verticalPosition(t){var e=this;if(t!==e._verticalPosition){if(e._verticalPosition=wjcCore.asNumber(t,!0),e._verticalPosition<0||e._verticalPosition>1)throw"verticalPosition's value should be in (0, 1).";e._marker&&e._updateMarkerPosition()}}get alignment(){return this._alignment}set alignment(t){var e=this;t!==e._alignment&&(e._alignment=t,e._marker&&e._updatePositionByAlignment())}get lines(){return this._lines}set lines(t){(t=wjcCore.asEnum(t,LineMarkerLines))!=this._lines&&(this._lines=t,this._marker&&this._resetLinesVisibility())}get interaction(){return this._interaction}set interaction(t){(t=wjcCore.asEnum(t,LineMarkerInteraction))!=this._interaction&&(this._marker&&this._detach(),this._interaction=t,this._marker&&this._attach(),this._toggleElesDraggableClass(this._interaction==LineMarkerInteraction.Drag))}get dragThreshold(){return this._dragThreshold}set dragThreshold(t){t!=this._dragThreshold&&(this._dragThreshold=wjcCore.asNumber(t))}get dragContent(){return this._dragContent}set dragContent(t){var e=this;t!==e._dragContent&&(e._dragContent=wjcCore.asBoolean(t)),wjcCore.toggleClass(e._dragEle,LineMarker._CSS_LINE_DRAGGABLE,e._interaction===LineMarkerInteraction.Drag&&e._dragContent&&e._lines!==LineMarkerLines.None)}get dragLines(){return this._dragLines}set dragLines(t){t!=this._dragLines&&(this._dragLines=wjcCore.asBoolean(t))}onPositionChanged(t){this.positionChanged.raise(this,t)}remove(){var t=this,e=t._chart;t._marker&&(e.rendered.removeHandler(t._initialize,t),t._detach(),t._removeMarker(),t._wrapperMoveMarker=null,t._wrapperMousedown=null,t._wrapperMouseup=null)}_attach(){var t=this,e=t._chart.hostElement;this._interaction!==LineMarkerInteraction.None?wjcCore.addClass(e,LineMarker._CSS_TOUCH_DISABLED):wjcCore.removeClass(e,LineMarker._CSS_TOUCH_DISABLED),lineMarkers.attach(t),t._attachDrag()}_attachDrag(){var t=this;t._interaction===LineMarkerInteraction.Drag&&(t._wrapperMousedown||(t._wrapperMousedown=t._onMousedown.bind(t)),t._wrapperMouseup||(t._wrapperMouseup=t._onMouseup.bind(t)),t._toggleDragEventAttach(!0))}_detach(){var t=this;wjcCore.removeClass(t._chart.hostElement,LineMarker._CSS_TOUCH_DISABLED),lineMarkers.detach(t),t._detachDrag()}_detachDrag(){var t=this;t._interaction===LineMarkerInteraction.Drag&&t._toggleDragEventAttach(!1)}_toggleDragEventAttach(t){var e=this,i=e._chart.hostElement,s=t?"addEventListener":"removeEventListener";i[s]("mousedown",e._wrapperMousedown),document[s]("mouseup",e._wrapperMouseup),"ontouchstart"in window&&i[s]("touchstart",e._wrapperMousedown),"ontouchend"in window&&document[s]("touchend",e._wrapperMouseup)}_onMousedown(t){var e,i,s,r,a,n=this,h=n._getEventPoint(t);n._interaction===LineMarkerInteraction.Drag&&(r=!(0===(e=wjcCore.getElementRect(n._hLine)).width||0===e.height),a=!(0===(i=wjcCore.getElementRect(n._vLine)).width||0===i.height),s=wjcCore.getElementRect(n._markerContent),n._dragContent&&n._pointInRect(h,s)?(n._capturedEle=n._markerContent,n._contentDragStartPoint=new wjcCore.Point(h.x,h.y),n._mouseDownCrossPoint=new wjcCore.Point(n._targetPoint.x,n._targetPoint.y)):r&&(Math.abs(e.top-h.y)<=n._dragThreshold||Math.abs(h.y-e.top-e.height)<=n._dragThreshold||h.y>=e.top&&h.y<=e.top+e.height)?(n._capturedEle=n._hLine,n._contentDragStartPoint=void 0,wjcCore.addClass(n._chart.hostElement,LineMarker._CSS_LINE_DRAGGABLE)):a&&(Math.abs(i.left-h.x)<=n._dragThreshold||Math.abs(h.x-i.left-i.width)<=n._dragThreshold||h.x>=i.left&&h.x<=i.left+i.width)&&(n._capturedEle=n._vLine,n._contentDragStartPoint=void 0,wjcCore.addClass(n._chart.hostElement,LineMarker._CSS_LINE_DRAGGABLE)),t.preventDefault())}_onMouseup(t){var e=this,i=e._alignment===LineMarkerAlignment.Auto&&e._capturedEle===e._markerContent&&e._lines!==LineMarkerLines.None;e._capturedEle=void 0,e._contentDragStartPoint=void 0,e._mouseDownCrossPoint=void 0,i&&(e._updatePositionByAlignment(),e._updatePositionByAlignment()),wjcCore.removeClass(e._chart.hostElement,LineMarker._CSS_LINE_DRAGGABLE)}_moveMarker(t){var e,i,s,r,a,n,h=this,o=h._chart,l=h._getEventPoint(t),_=h._plotRect,c=h._interaction===LineMarkerInteraction.Drag,d=h._lines===LineMarkerLines.Horizontal,u=h._lines===LineMarkerLines.Vertical,g=h._seriesIndex,p=wjcCore.getElementRect(o.hostElement);if(_&&h._isVisible&&h._interaction!==LineMarkerInteraction.None&&(h._interaction!==LineMarkerInteraction.Drag||h._capturedEle&&h._lines!==LineMarkerLines.None)){if(c&&(h._contentDragStartPoint?(l.x=d?h._targetPoint.x:h._mouseDownCrossPoint.x+l.x-h._contentDragStartPoint.x,l.y=u?h._targetPoint.y:h._mouseDownCrossPoint.y+l.y-h._contentDragStartPoint.y):d||!h._dragLines&&h._capturedEle===h._hLine?l.x=h._targetPoint.x:(u||!h._dragLines&&h._capturedEle===h._vLine)&&(l.y=h._targetPoint.y)),c&&h._lines===LineMarkerLines.Horizontal||!h._dragLines&&h._capturedEle===h._hLine){if(l.y<=_.top||l.y>=_.top+_.height)return}else if(c&&h._lines===LineMarkerLines.Vertical||!h._dragLines&&h._capturedEle===h._vLine){if(l.x<=_.left||l.x>=_.left+_.width)return}else if(l.x<=_.left||l.y<=_.top||l.x>=_.left+_.width||l.y>=_.top+_.height)return;if(null!=g&&g>=0&&g<o.series.length){if(e=o.series[g],null==(i=e.hitTest(new wjcCore.Point(l.x,NaN)))||null==i.x||null==i.y)return;s=e.axisX||o.axisX,r=e._getAxisY(),a=wjcCore.isDate(i.x)?FlexChart._toOADate(i.x):i.x,a=wjcCore.isString(a)?i.pointIndex:a,n=wjcCore.isDate(i.y)?FlexChart._toOADate(i.y):i.y,l.x=s.convert(a)+p.left,l.y=r.convert(n)+p.top}h._updateMarkerPosition(l),t.preventDefault()}}_show(t){(t||this._marker).style.display="block"}_hide(t){(t||this._marker).style.display="none"}_toggleVisibility(){this._isVisible?this._show():this._hide()}_resetDefaultValue(){var t=this;t._isVisible=!0,t._alignment=LineMarkerAlignment.Auto,t._lines=LineMarkerLines.None,t._interaction=LineMarkerInteraction.None,t._horizontalPosition=null,t._verticalPosition=null,t._content=null,t._seriesIndex=null,t._dragThreshold=15,t._dragContent=!1,t._dragLines=!1,t._targetPoint=new wjcCore.Point}_initialize(){var t,e=this,i=e._chart.hostElement.querySelector("."+FlexChart._CSS_PLOT_AREA);e._plot=i,e._marker||e._createMarker(),i&&(e._plotRect=wjcCore.getElementRect(i),t=i.getBBox(),e._plotRect.width=t.width,e._plotRect.height=t.height,e._updateMarkerSize(),e._updateLinesSize()),e._updateMarkerPosition(),e._wrapperMoveMarker=e._moveMarker.bind(e),e._attach()}_createMarker(){var t,e,i=this;t=document.createElement("div"),wjcCore.addClass(t,LineMarker._CSS_MARKER),(e=i._getContainer()).appendChild(t),i._markerContainer=e,i._marker=t,i._createChildren()}_removeMarker(){var t=this,e=t._markerContainer;e.removeChild(t._marker),t._content=null,t._hLine=null,t._vLine=null,e.hasChildNodes()||(t._chart.hostElement.removeChild(t._markerContainer),t._markerContainer=null),t._marker=null}_getContainer(){var t=this._chart.hostElement.querySelector(LineMarker._CSS_MARKER_CONTAINER);return t||(t=this._createContainer()),t}_createContainer(){var t=document.createElement("div"),e=this._chart.hostElement;return wjcCore.addClass(t,LineMarker._CSS_MARKER_CONTAINER),e.insertBefore(t,e.firstChild),t}_createChildren(){var t,e,i,s,r=this,a=r._marker;(s=document.createElement("div")).style.position="absolute",s.style.height="100%",s.style.width="100%",a.appendChild(s),r._dragEle=s,t=document.createElement("div"),wjcCore.addClass(t,LineMarker._CSS_MARKER_CONTENT),a.appendChild(t),r._markerContent=t,e=document.createElement("div"),wjcCore.addClass(e,LineMarker._CSS_MARKER_HLINE),a.appendChild(e),r._hLine=e,i=document.createElement("div"),wjcCore.addClass(i,LineMarker._CSS_MARKER_VLINE),a.appendChild(i),r._vLine=i,r._toggleElesDraggableClass(r._interaction===LineMarkerInteraction.Drag),r._resetLinesVisibility()}_toggleElesDraggableClass(t){var e=this;wjcCore.toggleClass(e._hLine,LineMarker._CSS_LINE_DRAGGABLE,t),wjcCore.toggleClass(e._vLine,LineMarker._CSS_LINE_DRAGGABLE,t),wjcCore.toggleClass(e._dragEle,LineMarker._CSS_LINE_DRAGGABLE,t&&e._dragContent&&e._lines!==LineMarkerLines.None)}_updateMarkerSize(){var t=this,e=t._plotRect,i=t._chart.hostElement,s=window.getComputedStyle(i,null),r=wjcCore.getElementRect(i);t._marker&&(t._marker.style.marginTop=e.top-r.top-(parseFloat(s.getPropertyValue("padding-top"))||0)+"px",t._marker.style.marginLeft=e.left-r.left-(parseFloat(s.getPropertyValue("padding-left"))||0)+"px")}_updateLinesSize(){var t=this,e=t._plotRect;t._hLine&&t._vLine&&(t._hLine.style.width=e.width+"px",t._vLine.style.height=e.height+"px")}_resetLinesVisibility(){var t=this;t._hLine&&t._vLine&&(t._hide(t._hLine),t._hide(t._vLine),t._lines!==LineMarkerLines.Horizontal&&t._lines!==LineMarkerLines.Both||t._show(t._hLine),t._lines!==LineMarkerLines.Vertical&&t._lines!==LineMarkerLines.Both||t._show(t._vLine))}_updateMarkerPosition(t){var e,i,s=this,r=s._plotRect,a=s._targetPoint,n=!1;s._interaction,LineMarkerInteraction.Drag;s._plot&&(e=r.left+r.width*(s._horizontalPosition||0),i=r.top+r.height*(s._verticalPosition||0),null==s._horizontalPosition&&t&&(e=t.x),null==s._verticalPosition&&t&&(i=t.y),e===a.x&&i===a.y||(n=!0),a.x=e,a.y=i,s._toggleVisibility(),s._content&&s._updateContent(),n&&s._raisePositionChanged(e,i),s._updatePositionByAlignment(!!t))}_updateContent(){var t,e=this,i=e._chart,s=e._targetPoint,r=i.hitTest(s);t=e._content.call(null,r,s),e._markerContent.innerHTML=t||""}_raisePositionChanged(t,e){this._plotRect;this.onPositionChanged(new wjcCore.Point(t,e))}_updatePositionByAlignment(t){var e=this,i=e._alignment,s=e._targetPoint,r=e._marker,a=0,n=0,h=r.clientWidth,o=r.clientHeight,l=e._plotRect;e._plot&&(!e._capturedEle||e._capturedEle&&e._capturedEle!==e._markerContent?(i===LineMarkerAlignment.Auto?(s.x+h+12>l.left+l.width&&s.x-h>=0&&(n=h),a=o,s.y-o<l.top&&(a=0)):(1==(1&i)&&(n=h),2==(2&i)&&(a=o)),e._interaction===LineMarkerInteraction.Move&&0===a&&0===n&&null==this.verticalPosition&&(n=-12)):(parseInt(e._hLine.style.top)>0&&(a=o),parseInt(e._vLine.style.left)>0&&(n=h)),r.style.left=s.x-n-l.left+"px",r.style.top=s.y-a-l.top+"px",e._hLine.style.top=a+"px",e._hLine.style.left=l.left-s.x+n+"px",e._vLine.style.top=l.top-s.y+a+"px",e._vLine.style.left=n+"px")}_getEventPoint(t){return t instanceof MouseEvent?new wjcCore.Point(t.pageX,t.pageY):new wjcCore.Point(t.changedTouches[0].pageX,t.changedTouches[0].pageY)}_pointInRect(t,e){return!(!t||!e)&&(t.x>=e.left&&t.x<=e.left+e.width&&t.y>=e.top&&t.y<=e.top+e.height)}}LineMarker._CSS_MARKER="wj-chart-linemarker",LineMarker._CSS_MARKER_HLINE="wj-chart-linemarker-hline",LineMarker._CSS_MARKER_VLINE="wj-chart-linemarker-vline",LineMarker._CSS_MARKER_CONTENT="wj-chart-linemarker-content",LineMarker._CSS_MARKER_CONTAINER="wj-chart-linemarker-container",LineMarker._CSS_LINE_DRAGGABLE="wj-chart-linemarker-draggable",LineMarker._CSS_TOUCH_DISABLED="wj-flexchart-touch-disabled",exports.LineMarker=LineMarker;class _DataPoint{constructor(t,e,i,s){this._seriesIndex=t,this._pointIndex=e,this._dataX=i,this._dataY=s}get seriesIndex(){return this._seriesIndex}get pointIndex(){return this._pointIndex}get dataX(){return this._dataX}set dataX(t){t!==this._dataX&&(this._dataX=t)}get dataY(){return this._dataY}set dataY(t){t!==this._dataY&&(this._dataY=t)}}exports._DataPoint=_DataPoint;var _MeasureOption;!function(t){t[t.X=0]="X",t[t.Y=1]="Y",t[t.XY=2]="XY"}(_MeasureOption=exports._MeasureOption||(exports._MeasureOption={}));class _RectArea{constructor(t){this._rect=t}get rect(){return this._rect}contains(t){var e=this._rect;return t.x>=e.left&&t.x<=e.right&&t.y>=e.top&&t.y<=e.bottom}pointDistance(t,e,i){var s=e.x-t.x,r=e.y-t.y;return i==_MeasureOption.X?Math.abs(s):i==_MeasureOption.Y?Math.abs(r):Math.sqrt(s*s+r*r)}distance(t){var e=_MeasureOption.XY;null===t.x?e=_MeasureOption.Y:null===t.y&&(e=_MeasureOption.X);var i=this._rect;return t.x<i.left?t.y<i.top?this.pointDistance(t,new wjcCore.Point(i.left,i.top),e):t.y>i.bottom?this.pointDistance(t,new wjcCore.Point(i.left,i.bottom),e):e==_MeasureOption.Y?0:i.left-t.x:t.x>i.right?t.y<i.top?this.pointDistance(t,new wjcCore.Point(i.right,i.top),e):t.y>i.bottom?this.pointDistance(t,new wjcCore.Point(i.right,i.bottom),e):e==_MeasureOption.Y?0:t.x-i.right:e==_MeasureOption.X?0:t.y<i.top?i.top-t.y:t.y>i.bottom?t.y-i.bottom:0}}exports._RectArea=_RectArea;class _CircleArea{constructor(t,e){this._center=t,this.setRadius(e)}setRadius(t){this._rad=t,this._rad2=t*t}get center(){return this._center}contains(t){var e=this._center.x-t.x,i=this._center.y-t.y;return e*e+i*i<=this._rad2}distance(t){var e=isNaN(t.x)?0:this._center.x-t.x,i=isNaN(t.y)?0:this._center.y-t.y,s=e*e+i*i;return s<=this._rad2?0:Math.sqrt(s)-this._rad}}exports._CircleArea=_CircleArea;class _LinesArea{constructor(t,e){this._x=[],this._y=[],this._x=t,this._y=e}contains(t){return!1}distance(t){for(var e=NaN,i=0;i<this._x.length-1;i++){var s=FlexChart._dist(t,new wjcCore.Point(this._x[i],this._y[i]),new wjcCore.Point(this._x[i+1],this._y[i+1]));(isNaN(e)||s<e)&&(e=s)}return e}}exports._LinesArea=_LinesArea;class _HitResult{}exports._HitResult=_HitResult;class _HitTester{constructor(t){this._map={},this._chart=t}add(t,e){this._map[e]&&(t.tag||(t.tag=new _DataPoint(e,NaN,NaN,NaN)),this._map[e].push(t))}clear(){this._map={};for(var t=this._chart.series,e=0;e<t.length;e++)t[e].hitTest===Series.prototype.hitTest&&(this._map[e]=new Array)}hitTest(t,e=!1){for(var i=null,s=Number.MAX_VALUE,r=this._chart.series.length-1;r>=0;r--){var a=this._map[r];if(a){for(var n=a.length-1;n>=0;n--){var h=a[n];if(!wjcCore.tryCast(h,_LinesArea)||e){var o=h.distance(t);if(o<s&&(s=o,i=h,0==s))break}}if(0==s)break}}if(i){var l=new _HitResult;return l.area=i,l.distance=s,l}return null}hitTestSeries(t,e){var i=null,s=Number.MAX_VALUE,r=this._map[e];if(r)for(var a=r.length-1;a>=0;a--){var n=r[a],h=n.distance(t);if(h<s&&(s=h,i=n,0==s))break}if(i){var o=new _HitResult;return o.area=i,o.distance=s,o}return null}}exports._HitTester=_HitTester;class _BasePlotter{constructor(){this._DEFAULT_WIDTH=2,this._DEFAULT_SYM_SIZE=10,this.clipping=!0}clear(){this.seriesCount=0,this.seriesIndex=0}_renderLabels(t,e,i,s,r){var a=i.length,n=s.dataLabel,h=n.border,o=n.offset,l=n.connectingLine;void 0===o&&(o=l?16:0),h&&(o-=2);for(var _=0;_<a;_++){var c=i[_],d=wjcCore.asType(c.tag,_DataPoint,!0);d&&this._renderLabel(t,c,d,s,n,e,o,r)}}_renderLabel(t,e,i,s,r,a,n,h){var o=null==r.position?LabelPosition.Top:r.position,l=r.border,_=r.connectingLine,c=new HitTestInfo(s,u);c._setDataPoint(i);var d=s._getLabelContent(c,r.content),u=this._getLabelPoint(a,i);if(this._getPointAndPosition(u,o,e,s),s._plotRect.contains(u)){var g=new DataLabelRenderEventArgs(t,c,u,d);if(r.onRendering&&(r.onRendering(g)?(d=g.text,u=g.point):d=null),d){var p=this._renderLabelAndBorder(t,d,o,n,u,_,2,l);if(p){var m=new _RectArea(p);m.tag=i,h.push(m)}}}}_getPointAndPosition(t,e,i,s){if(i instanceof _RectArea){var r=i;s._isRotated()?t.y=r.rect.top+.5*r.rect.height:t.x=r.rect.left+.5*r.rect.width}}_getLabelPoint(t,e){var i=t._getAxisX(),s=t._getAxisY();return new wjcCore.Point(i.convert(e.dataX),s.convert(e.dataY))}_renderLabelAndBorder(t,e,i,s,r,a,n,h){var o,l="wj-data-label",_="wj-data-label-line",c=FlexChart._CSS_DATA_LABELS;switch(i){case LabelPosition.Top:a&&t.drawLine(r.x,r.y,r.x,r.y-s,_),r.y-=n+s,o=FlexChart._renderText(t,e,r,1,2,l,c);break;case LabelPosition.Bottom:a&&t.drawLine(r.x,r.y,r.x,r.y+s,_),r.y+=n+s,o=FlexChart._renderText(t,e,r,1,0,l,c);break;case LabelPosition.Left:a&&t.drawLine(r.x,r.y,r.x-s,r.y,_),r.x-=n+s,o=FlexChart._renderText(t,e,r,2,1,l,c);break;case LabelPosition.Right:a&&t.drawLine(r.x,r.y,r.x+s,r.y,_),r.x+=n+s,o=FlexChart._renderText(t,e,r,0,1,l,c);break;case LabelPosition.Center:o=FlexChart._renderText(t,e,r,1,1,l,c)}return h&&o&&t.drawRect(o.left-n,o.top-n,o.width+2*n,o.height+2*n,"wj-data-label-border"),o}getOption(t,e){var i=this.chart.options;if(e&&(i=i?i[e]:null),i&&!wjcCore.isUndefined(i[t])&&null!==i[t])return i[t]}getNumOption(t,e){var i=this.chart.options;if(e&&(i=i?i[e]:null),i&&i[t])return wjcCore.asNumber(i[t],!0)}static cloneStyle(t,e){if(!t)return t;var i={};for(var s in t)e&&e.indexOf(s)>=0||(i[s]=t[s]);return i}isValid(t,e,i,s){return _DataInfo.isValid(t)&&_DataInfo.isValid(e)&&FlexChart._contains(this.chart._plotRect,new wjcCore.Point(t,e))}load(){}unload(){}}exports._BasePlotter=_BasePlotter;class _BarPlotter extends _BasePlotter{constructor(){super(...arguments),this.origin=0,this.width=.7,this.isVolume=!1,this._volHelper=null,this.stackPosMap={},this.stackNegMap={},this.stacking=Stacking.None}clear(){super.clear(),this.stackNegMap[this.chart.axisY._uniqueId]={},this.stackPosMap[this.chart.axisY._uniqueId]={},this._volHelper=null}load(){if(super.load(),this.isVolume){var t,e,i,s,r,a,n,h,o=null,l=null;for(a=0;a<this.chart.series.length;a++){if(t=this.chart.series[a],r=t.getDataType(1)||t.chart._xDataType,e=t._getAxisX(),i=t._getChartType(),(i=null===i||wjcCore.isUndefined(i)?this.chart._getChartType():i)===ChartType.Column){let e=this.chart?this.chart._bindingSeparator:",",i=t.binding.split(e).length-1;s=t._getBindingValues(i)}else s=i===ChartType.Candlestick?t._getBindingValues(4):null;if(r===wjcCore.DataType.Date){var _;for(n=[],h=[],a=0;a<t._getLength();a++)_=t._getItem(a)[t.bindingX].valueOf(),n.push(_),h.push({value:_,text:wjcCore.Globalize.format(new Date(_),e.format||"d")})}else n=this.dataInfo.getXVals();if(o=this.dataInfo.getMinX(),l=this.dataInfo.getMaxX(),s&&s.length>0){this._volHelper=new _VolumeHelper(s,n,o,l,r),e._customConvert=this._volHelper.convert.bind(this._volHelper),e._customConvertBack=this._volHelper.convertBack.bind(this._volHelper),h&&h.length>0&&(this._itemsSource=e.itemsSource=h);break}}}}unload(){super.unload();for(var t,e=0;e<this.chart.series.length;e++)(t=this.chart.series[e]._getAxisX())&&(t._customConvert=null,t._customConvertBack=null,t.itemsSource&&t.itemsSource==this._itemsSource&&(this._itemsSource=t.itemsSource=null))}adjustLimits(t,e){this.dataInfo=t;var i=t.getMinX(),s=t.getMaxX(),r=t.getMinY(),a=t.getMaxY(),n=t.getDeltaX();n<=0&&(n=1),!this.isVolume||this.chart._getChartType()!==ChartType.Column&&this.chart._getChartType()!==ChartType.Candlestick?this.unload():this.load();for(let t=0;t<this.chart.series.length;t++){let e=this.chart.series[t],i=e._getChartType();(i=null===i||wjcCore.isUndefined(i)?this.chart._getChartType():i)!==ChartType.Column&&i!==ChartType.Bar||this._isRange(e)&&e._getBindingValues(1).forEach(t=>{t<r?r=t:t>a&&(a=t)})}return this.rotated?(this.chart.axisY._getLogBase()||t.getDataTypeY()===wjcCore.DataType.Date||(this.origin>a?a=this.origin:this.origin<r&&(r=this.origin)),new wjcCore.Rect(r,i-.5*n,a-r,s-i+n)):(this.chart.axisY._getLogBase()||t.getDataTypeY()===wjcCore.DataType.Date||(this.origin>a?a=this.origin:this.origin<r&&(r=this.origin)),new wjcCore.Rect(i-.5*n,r,s-i+n,a-r))}_isRange(t){let e=this.chart?this.chart._bindingSeparator:",",i=(null==t.binding?"":t.binding.split(e)).length-1;return this.isVolume?2===i:1===i}plotSeries(t,e,i,s,r,a,n,h){var o=[],l=this.chart.series.indexOf(s),_=wjcCore.asType(s,SeriesBase),c=this.chart.options,d=this.width,u=0;if(a=a||0,n=n||1,c&&c.groupWidth){var g=c.groupWidth;if(wjcCore.isNumber(g)){m=wjcCore.asNumber(g);isFinite(m)&&m>0&&(u=m,d=1)}else if(wjcCore.isString(g)){var p=wjcCore.asString(g);if(p&&p.indexOf("%")>=0){p=p.replace("%","");m=parseFloat(p);isFinite(m)&&(m<0?m=0:m>100&&(m=100),u=0,d=m/100)}else{var m=parseFloat(p);isFinite(m)&&m>0&&(u=m,d=1)}}}var x=d/n,v=_._getAxisY()._uniqueId,w=this.stackNegMap[v],f=this.stackPosMap[v],C=s.getValues(0),y=s.getValues(1);let b=this._isRange(_),S=_._bindValues(null==_._cv?null==this.chart.collectionView?null:this.chart.collectionView.items:_._cv.items,_._getBinding(1)).values;if(C){if(y||(y=this.dataInfo.getXVals()),y){var M=this.dataInfo.getDeltaX();M>0&&(d*=M,x*=M)}var T=_._getSymbolFill(l),A=_._getAltSymbolFill(l)||T,L=_._getSymbolStroke(l),P=_._getAltSymbolStroke(l)||L,k=C.length;null!=y&&(k=Math.min(k,y.length));var N,I,j=this.origin,E=0,D=this.stacking!=Stacking.None,R=this.stacking==Stacking.Stacked100pc;if(void 0!==_._getChartType()&&(D=R=!1),this.rotated){j<e.actualMin?j=e.actualMin:j>e.actualMax&&(j=e.actualMax),_._isCustomAxisY()&&(D=R=!1);for(var F=e.convert(j),V=i.actualMin,X=i.actualMax,B=0;B<k;B++){var Y=y?y[B]:B,H=C[B];let r=F;if(this._getSymbolOrigin&&(r=i.convert(this._getSymbolOrigin(j,B))),b&&S&&S.length){let t=S[B];_DataInfo.isValid(t)&&(r=e.convert(t))}if(this._getSymbolStyles){var z=this._getSymbolStyles(B);T=z&&z.fill?z.fill:T,A=z&&z.fill?z.fill:A,L=z&&z.stroke?z.fill:L,P=z&&z.stroke?z.fill:P}if(N=H>0?T:A,I=H>0?L:P,t.fill=N,t.stroke=I,_DataInfo.isValid(Y)&&_DataInfo.isValid(H))if(D){tt=Y+.5*d;if(($=Y-.5*d)<V&&tt<V||$>X&&tt>X)continue;$=i.convert(Math.max($,V)),tt=i.convert(Math.min(tt,X));var G;if(R){var O=this.dataInfo.getStackedAbsSum(Y);H/=O}et=0;H>0?(et=isNaN(f[Y])?0:f[Y],G=e.convert(et),it=e.convert(et+H),f[Y]=et+H):(et=isNaN(w[Y])?0:w[Y],G=e.convert(et),it=e.convert(et+H),w[Y]=et+H),h&&o.push(new wjcCore.Point(it,i.convert(Y)));U=new wjcCore.Rect(Math.min(G,it),Math.min($,tt),Math.abs(it-G),Math.abs(tt-$));if(u>0){(K=1-u/U.height)<0&&(K=0);Z=U.top+.5*U.height;U.top+=(Z-U.top)*K,U.height=Math.min(u,U.height)}at=new _RectArea(U);this.drawSymbol(t,U,s,B,new wjcCore.Point(it,U.top+.5*U.height)),s._setPointIndex(B,E),E++,at.tag=new _DataPoint(l,B,et+H,Y),this.hitTester.add(at,l)}else{tt=Y-.5*d+(a+1)*x;if(($=Y-.5*d+a*x)<V&&tt<V||$>X&&tt>X)continue;$=i.convert(Math.max($,V)),tt=i.convert(Math.min(tt,X));var W=e.convert(H),U=new wjcCore.Rect(Math.min(W,r),Math.min($,tt),Math.abs(r-W),Math.abs(tt-$));if(h&&o.push(new wjcCore.Point(W,($+tt)/2)),u>0){var q=u/n,K=1-q/U.height;K<0&&(K=0);var Z=i.convert(Y);U.top+=(Z-U.top)*K,U.height=Math.min(q,U.height)}at=new _RectArea(U);this.drawSymbol(t,U,s,B,new wjcCore.Point(W,U.top+.5*U.height)),s._setPointIndex(B,E),E++,at.tag=new _DataPoint(l,B,H,Y),this.hitTester.add(at,l)}}}else{j<i.actualMin?j=i.actualMin:j>i.actualMax&&(j=i.actualMax);var F=i.convert(j),J=e.actualMin,Q=e.actualMax;_._isCustomAxisY()&&(D=R=!1);for(B=0;B<k;B++){let r=F;var Y=y?y[B]:B,H=C[B];if(this._getSymbolOrigin&&(r=i.convert(this._getSymbolOrigin(j,B,k))),b&&S&&S.length){let t=S[B];_DataInfo.isValid(t)&&(r=i.convert(t))}if(this._getSymbolStyles&&(T=(z=this._getSymbolStyles(B,k))&&z.fill?z.fill:T,A=z&&z.fill?z.fill:A,L=z&&z.stroke?z.stroke:L,P=z&&z.stroke?z.stroke:P),N=H>0?T:A,I=H>0?L:P,t.fill=N,t.stroke=I,_DataInfo.isValid(Y)&&_DataInfo.isValid(H))if(D){it=Y+.5*d;if((G=Y-.5*d)<J&&it<J||G>Q&&it>Q)continue;if(G=e.convert(G),it=e.convert(it),!_DataInfo.isValid(G)||!_DataInfo.isValid(it))continue;var $,tt;R&&(H/=O=this.dataInfo.getStackedAbsSum(Y));var et=0;H>0?(et=isNaN(f[Y])?0:f[Y],$=i.convert(Math.max(et,i.actualMin)),tt=i.convert(Math.max(et+H,i.actualMin)),f[Y]=et+H):(et=isNaN(w[Y])?0:w[Y],$=i.convert(et),tt=i.convert(et+H),w[Y]=et+H),h&&o.push(new wjcCore.Point(e.convert(Y),tt));U=new wjcCore.Rect(Math.min(G,it),Math.min($,tt),Math.abs(it-G),Math.abs(tt-$));if(u>0){(K=1-u/U.width)<0&&(K=0);rt=U.left+.5*U.width;U.left+=(rt-U.left)*K,U.width=Math.min(u,U.width)}at=new _RectArea(U);this.drawSymbol(t,U,s,B,new wjcCore.Point(U.left+.5*U.width,tt)),s._setPointIndex(B,E),E++,at.tag=new _DataPoint(l,B,Y,et+H),this.hitTester.add(at,l)}else{var it=Y-.5*d+(a+1)*x;if((G=Y-.5*d+a*x)<J&&it<J||G>Q&&it>Q)continue;if(G=e.convert(G),it=e.convert(it),!_DataInfo.isValid(G)||!_DataInfo.isValid(it))continue;var st=i.convert(H),U=new wjcCore.Rect(Math.min(G,it),Math.min(st,r),Math.abs(it-G),Math.abs(r-st));if(h&&o.push(new wjcCore.Point((G+it)/2,st)),u>0){(K=1-(q=u/n)/U.width)<0&&(K=0);var rt=e.convert(Y);U.left+=(rt-U.left)*K,U.width=Math.min(q,U.width)}var at=new _RectArea(U);this.drawSymbol(t,U,s,B,new wjcCore.Point(U.left+.5*U.width,st)),s._setPointIndex(B,E),E++,at.tag=new _DataPoint(l,B,Y,H),this.hitTester.add(at,l)}}}h&&o&&o.length&&h(o)}}drawSymbol(t,e,i,s,r){if(this.chart.itemFormatter){t.startGroup();var a=new HitTestInfo(this.chart,r,ChartElement.SeriesSymbol);a._setData(i,s),this.chart.itemFormatter(t,a,()=>{this.drawDefaultSymbol(t,e,i)}),t.endGroup()}else this.drawDefaultSymbol(t,e,i)}drawDefaultSymbol(t,e,i){t.drawRect(e.left,e.top,e.width,e.height,null,i.symbolStyle)}}exports._BarPlotter=_BarPlotter;class _LinePlotter extends _BasePlotter{constructor(){super(),this.hasSymbols=!1,this.hasLines=!0,this.isSpline=!1,this.stacking=Stacking.None,this.stackPos={},this.stackNeg={},this.clipping=!1}clear(){super.clear(),this.stackNeg={},this.stackPos={}}adjustLimits(t,e){this.dataInfo=t;var i=t.getMinX(),s=t.getMinY(),r=t.getMaxX(),a=t.getMaxY();if(this.isSpline&&!this.chart.axisY._getLogBase()){var n=.1*(a-s);s-=n,a+=n}return this.rotated?new wjcCore.Rect(s,i,a-s,r-i):new wjcCore.Rect(i,s,r-i,a-s)}plotSeries(t,e,i,s,r,a,n,h){var o=[],l=wjcCore.asType(s,SeriesBase),_=this.chart.series.indexOf(s),c=s.getValues(0),d=s.getValues(1);if(c){d||(d=this.dataInfo.getXVals());var u=_BasePlotter.cloneStyle(s.style,["fill"]),g=c.length,p=!0;d?g=Math.min(g,d.length):(p=!1,d=new Array(g));var m=this._DEFAULT_WIDTH,x=l._getSymbolFill(_),v=l._getAltSymbolFill(_)||x,w=l._getSymbolStroke(_),f=l._getAltSymbolStroke(_)||w,C=l._getSymbolSize();t.stroke=w,t.strokeWidth=m,t.fill=x;var y=new Array,b=new Array,S=new Array,M=this.rotated,T=this.stacking!=Stacking.None&&!l._isCustomAxisY(),A=this.stacking==Stacking.Stacked100pc&&!l._isCustomAxisY();void 0!==l._getChartType()&&(T=A=!1);for(var L=this.chart.interpolateNulls,P=!1,k=0;k<g;k++){var N=p?d[k]:k,I=c[k];if(_DataInfo.isValid(N)&&_DataInfo.isValid(I)){if(T)if(A&&(I/=this.dataInfo.getStackedAbsSum(N)),I>=0){j=isNaN(this.stackPos[N])?0:this.stackPos[N];I=this.stackPos[N]=j+I}else{var j=isNaN(this.stackNeg[N])?0:this.stackNeg[N];I=this.stackNeg[N]=j+I}var E;if(M){E=new _DataPoint(_,k,I,N);var D=e.convert(I);I=i.convert(N),N=D}else E=new _DataPoint(_,k,N,I),N=e.convert(N),I=i.convert(I);if(isNaN(N)||isNaN(I))P=!0,!0!==L&&(y.push(void 0),b.push(void 0)),S.push(!0);else{y.push(N),b.push(I),S.push(!1),h&&o.push(new wjcCore.Point(N,I));var R=new _CircleArea(new wjcCore.Point(N,I),.5*C);R.tag=E,this.hitTester.add(R,_)}}else P=!0,!0!==L&&(y.push(void 0),b.push(void 0)),S.push(!0)}var F=0;if(this.hasLines)if(t.fill=null,P&&!0!==L){for(var V=[],X=[],k=0;k<g;k++)void 0===y[k]?(V.length>1&&(this._drawLines(t,V,X,null,u,this.chart._plotrectId),this.hitTester.add(new _LinesArea(V,X),_),F++),V=[],X=[]):(V.push(y[k]),X.push(b[k]));V.length>1&&(this._drawLines(t,V,X,null,u,this.chart._plotrectId),this.hitTester.add(new _LinesArea(V,X),_),F++)}else this._drawLines(t,y,b,null,u,this.chart._plotrectId),this.hitTester.add(new _LinesArea(y,b),_),F++;if((this.hasSymbols||this.chart.itemFormatter)&&C>0){t.fill=x;for(var B=0,k=0;k<g;k++)if(!L||!S[k]){var N=y[B],I=b[B];(!1===this.hasLines||this.chart.itemFormatter)&&(t.fill=c[k]>0?x:v,t.stroke=c[k]>0?w:f),this.isValid(N,I,e,i)&&(this._drawSymbol(t,N,I,C,l,k),s._setPointIndex(k,F),F++),B++}}h&&o&&o.length&&h(o)}}_drawLines(t,e,i,s,r,a){this.isSpline?t.drawSplines(e,i,s,r,a):t.drawLines(e,i,s,r,a)}_drawSymbol(t,e,i,s,r,a){if(this.chart.itemFormatter){t.startGroup();var n=new HitTestInfo(this.chart,new wjcCore.Point(e,i),ChartElement.SeriesSymbol);n._setData(r,a),this.chart.itemFormatter(t,n,()=>{this.hasSymbols&&this._drawDefaultSymbol(t,e,i,s,r.symbolMarker,r.symbolStyle)}),t.endGroup()}else this._drawDefaultSymbol(t,e,i,s,r.symbolMarker,r.symbolStyle)}_drawDefaultSymbol(t,e,i,s,r,a){r==Marker.Dot?t.drawEllipse(e,i,.5*s,.5*s,null,a):r==Marker.Box&&t.drawRect(e-.5*s,i-.5*s,s,s,null,a)}}exports._LinePlotter=_LinePlotter;class _AreaPlotter extends _BasePlotter{constructor(){super(),this.stacking=Stacking.None,this.isSpline=!1,this.stackPos={},this.stackNeg={}}adjustLimits(t,e){this.dataInfo=t;var i=t.getMinX(),s=t.getMinY(),r=t.getMaxX(),a=t.getMaxY();if(this.isSpline){var n=.1*(a-s);this.chart.axisY._getLogBase()||(s-=n),a+=n}return this.rotated?new wjcCore.Rect(s,i,a-s,r-i):new wjcCore.Rect(i,s,r-i,a-s)}clear(){super.clear(),this.stackNeg={},this.stackPos={}}plotSeries(t,e,i,s,r,a,n,h){var o=[],l=this.chart.series.indexOf(s),_=s,c=s.getValues(0),d=s.getValues(1);if(c){var u=c.length;if(u){d||(d=this.dataInfo.getXVals());var g=!0;d?d.length<u&&(u=d.length):(g=!1,d=new Array(u));var p=new Array,m=new Array,x=new Array,v=new Array,w=this.stacking!=Stacking.None&&!_._isCustomAxisY(),f=this.stacking==Stacking.Stacked100pc&&!_._isCustomAxisY();void 0!==_._getChartType()&&(w=f=!1);for(var C=this.rotated,y=!1,b=this.chart.interpolateNulls,S=null,M=null,T=this.chart._plotRect,A=0;A<u;A++){var L=g?d[A]:A,P=c[A];if((null===S||L>S)&&(S=L),(null===M||L<M)&&(M=L),_DataInfo.isValid(L)&&_DataInfo.isValid(P)){var k=C?i.convert(L):e.convert(L);if(w){f&&(P/=this.dataInfo.getStackedAbsSum(L));var N=0;P>=0?(N=isNaN(this.stackPos[L])?0:this.stackPos[L],P=this.stackPos[L]=N+P):(N=isNaN(this.stackNeg[L])?0:this.stackNeg[L],P=this.stackNeg[L]=N+P),C?(N<e.actualMin&&(N=e.actualMin),x.push(e.convert(N)),v.push(k)):(x.push(k),N<i.actualMin&&(N=i.actualMin),v.push(i.convert(N)))}if(C){I=e.convert(P);isNaN(k)||isNaN(I)?(y=!0,w||!0===b||(p.push(void 0),m.push(void 0))):(p.push(I),m.push(k),FlexChart._contains(T,new wjcCore.Point(I,k))&&((j=new _CircleArea(new wjcCore.Point(I,k),this._DEFAULT_SYM_SIZE)).tag=new _DataPoint(l,A,P,L),this.hitTester.add(j,l)))}else{var I=i.convert(P);if(isNaN(k)||isNaN(I))y=!0,w||!0===b||(p.push(void 0),m.push(void 0));else if(p.push(k),m.push(I),FlexChart._contains(T,new wjcCore.Point(k,I))){var j=new _CircleArea(new wjcCore.Point(k,I),this._DEFAULT_SYM_SIZE);j.tag=new _DataPoint(l,A,L,P),this.hitTester.add(j,l)}}}else y=!0,w||!0===b||(p.push(void 0),m.push(void 0))}h&&p.forEach((t,e)=>{null!=t&&o.push(new wjcCore.Point(t,m[e]))});var E=this._DEFAULT_WIDTH,D=r._getColorLight(l),R=r._getColor(l),F=_BasePlotter.cloneStyle(s.style,["fill"]),V=_BasePlotter.cloneStyle(s.style,["stroke"]);if(!w&&!0!==b&&y){for(var X=[],B=[],A=0;A<u;A++)void 0===p[A]?(X.length>1&&(this.isSpline&&(X=(Y=this._convertToSpline(X,B)).xs,B=Y.ys),t.stroke=R,t.strokeWidth=E,t.fill="none",t.drawLines(X,B,null,F),this.hitTester.add(new _LinesArea(X,B),l),C?(X.push(e.convert(e.actualMin),e.convert(e.actualMin)),B.push(i.convert(i.actualMax),i.convert(i.actualMin))):(X.push(X[X.length-1],X[0]),B.push(i.convert(i.actualMin),i.convert(i.actualMin))),t.fill=D,t.stroke="none",t.drawPolygon(X,B,null,V)),X=[],B=[]):(X.push(p[A]),B.push(m[A]));X.length>1&&(this.isSpline&&(X=(Y=this._convertToSpline(X,B)).xs,B=Y.ys),t.stroke=R,t.strokeWidth=E,t.fill="none",t.drawLines(X,B,null,F),this.hitTester.add(new _LinesArea(X,B),l),C?(X.push(e.convert(e.actualMin),e.convert(e.actualMin)),B.push(i.convert(i.actualMax),i.convert(i.actualMin))):(X.push(X[X.length-1],X[0]),B.push(i.convert(i.actualMin),i.convert(i.actualMin))),t.fill=D,t.stroke="none",t.drawPolygon(X,B,null,V))}else{if(this.isSpline){var Y=this._convertToSpline(p,m);p=Y.xs,m=Y.ys}if(w){if(this.isSpline){var H=this._convertToSpline(x,v);x=H.xs,v=H.ys}p=p.concat(x.reverse()),m=m.concat(v.reverse())}else C?(p.push(e.convert(e.actualMin),e.convert(e.actualMin)),m[0]>m[m.length-1]?m.push(i.convert(S),i.convert(M)):m.push(i.convert(M),i.convert(S))):(p[0]>p[p.length-1]?p.push(e.convert(M),e.convert(S)):p.push(e.convert(S),e.convert(M)),m.push(i.convert(i.actualMin),i.convert(i.actualMin)));t.fill=D,t.stroke="none",t.drawPolygon(p,m,null,V),w?(p=p.slice(0,p.length-x.length),m=m.slice(0,m.length-v.length)):(p=p.slice(0,p.length-2),m=m.slice(0,m.length-2)),t.stroke=R,t.strokeWidth=E,t.fill="none",t.drawLines(p,m,null,F),this.hitTester.add(new _LinesArea(p,m),l)}this._drawSymbols(t,s,l),h&&o&&o.length&&h(o)}}}_convertToSpline(t,e){if(t&&e){var i=new _Spline(t,e).calculate();return{xs:i.xs,ys:i.ys}}return{xs:t,ys:e}}_drawSymbols(t,e,i){if(null!=this.chart.itemFormatter)for(var s=this.hitTester._map[i],r=0;r<s.length;r++){var a=wjcCore.tryCast(s[r],_CircleArea);if(a){var n=a.tag;t.startGroup();var h=new HitTestInfo(this.chart,a.center,ChartElement.SeriesSymbol);h._setDataPoint(n),this.chart.itemFormatter(t,h,()=>{}),t.endGroup()}}}}exports._AreaPlotter=_AreaPlotter;class _BubblePlotter extends _LinePlotter{constructor(){super(),this._MIN_SIZE=5,this._MAX_SIZE=30,this.hasLines=!1,this.hasSymbols=!0,this.clipping=!0}adjustLimits(t,e){var i=this.getNumOption("minSize","bubble");this._minSize=i||this._MIN_SIZE;var s=this.getNumOption("maxSize","bubble");this._maxSize=s||this._MAX_SIZE;for(var r=this.chart.series,a=r.length,n=NaN,h=NaN,o=0;o<a;o++){var l=r[o]._getBindingValues(1);if(l)for(var _=l.length,c=0;c<_;c++)_DataInfo.isValid(l[c])&&((isNaN(n)||l[c]<n)&&(n=l[c]),(isNaN(h)||l[c]>h)&&(h=l[c]))}this._minValue=n,this._maxValue=h;var d=super.adjustLimits(t,e),u=this.chart.axisX,g=this.chart.axisY;if(u._getLogBase()<=0){var p=(e.width-this._maxSize)/d.width;d.left-=.5*this._maxSize/p,d.width+=this._maxSize/p}if(g._getLogBase()<=0){var m=(e.height-this._maxSize)/d.height;d.top-=.5*this._maxSize/m,d.height+=this._maxSize/m}return d}_drawSymbol(t,e,i,s,r,a){if(null==this._minSize){var n=this.getNumOption("minSize","bubble");this._minSize=n||this._MIN_SIZE}if(null==this._maxSize){var h=this.getNumOption("maxSize","bubble");this._maxSize=h||this._MAX_SIZE}var o=r._getItem(a);if(o){var l=r._getBinding(1);if(l){var s=o[l];if(_DataInfo.isValid(s)){var _=this._minValue==this._maxValue?1:Math.sqrt((s-this._minValue)/(this._maxValue-this._minValue));if(s=this._minSize+(this._maxSize-this._minSize)*_,this.chart.itemFormatter){var c=new HitTestInfo(this.chart,new wjcCore.Point(e,i),ChartElement.SeriesSymbol);c._setData(r,a),t.startGroup(),this.chart.itemFormatter(t,c,()=>{this._drawDefaultSymbol(t,e,i,s,r.symbolMarker,r.symbolStyle)}),t.endGroup()}else this._drawDefaultSymbol(t,e,i,s,r.symbolMarker,r.symbolStyle);var d=this.hitTester._map[this.chart.series.indexOf(r)];if(null!=d)for(var u=d.length-1;u>=0;u--){var g=d[u];if(g.tag&&g.tag.pointIndex==a){var p=wjcCore.tryCast(g,_CircleArea);p&&p.setRadius(.5*s)}}}}}}}exports._BubblePlotter=_BubblePlotter;class _FinancePlotter extends _BasePlotter{constructor(){super(...arguments),this.isCandle=!0,this.isArms=!1,this.isEqui=!1,this.isVolume=!1,this._volHelper=null,this._symWidth=.7}clear(){super.clear(),this._volHelper=null}load(){if(super.load(),this.isVolume){var t,e,i,s,r,a,n,h,o=null,l=null;for(a=0;a<this.chart.series.length;a++){if(t=this.chart.series[a],r=t.getDataType(1)||t.chart._xDataType,e=t._getAxisX(),i=t._getChartType(),i=null===i||wjcCore.isUndefined(i)?this.chart._getChartType():i,s=i===ChartType.Column?t._getBindingValues(1):i===ChartType.Candlestick?t._getBindingValues(4):null,r===wjcCore.DataType.Date){var _;for(n=[],h=[],a=0;a<t._getLength();a++)_=t._getItem(a)[t.bindingX].valueOf(),n.push(_),h.push({value:_,text:wjcCore.Globalize.format(new Date(_),e.format||"d")})}else n=this.dataInfo.getXVals();if(o=this.dataInfo.getMinX(),l=this.dataInfo.getMaxX(),s&&s.length>0){this._volHelper=new _VolumeHelper(s,n,o,l,r),e._customConvert=this._volHelper.convert.bind(this._volHelper),e._customConvertBack=this._volHelper.convertBack.bind(this._volHelper),h&&h.length>0&&(this._itemsSource=e.itemsSource=h);break}}}}unload(){super.unload();for(var t,e=0;e<this.chart.series.length;e++)(t=this.chart.series[e]._getAxisX())&&(t._customConvert=null,t._customConvertBack=null,t.itemsSource&&t.itemsSource==this._itemsSource&&(this._itemsSource=t.itemsSource=null))}parseSymbolWidth(t){if(this._isPixel=void 0,t)if(wjcCore.isNumber(t)){var e=wjcCore.asNumber(t);isFinite(e)&&e>0&&(this._symWidth=e,this._isPixel=!0)}else if(wjcCore.isString(t)){var i=wjcCore.asString(t);if(i&&i.indexOf("%")>=0){i=i.replace("%","");s=parseFloat(i);isFinite(s)&&(s<0?s=0:s>100&&(s=100),this._symWidth=s/100,this._isPixel=!1)}else{var s=parseFloat(t);isFinite(s)&&s>0&&(this._symWidth=s,this._isPixel=!0)}}}adjustLimits(t,e){this.dataInfo=t;var i=t.getMinX(),s=t.getMinY(),r=t.getMaxX(),a=t.getMaxY(),n=t.getDeltaX(),h=this.chart._xDataType;n<=0&&(n=1);var o=this.chart.series,l=o.length,_=0;this.parseSymbolWidth(this.symbolWidth),!this.isVolume||this.chart._getChartType()!==ChartType.Column&&this.chart._getChartType()!==ChartType.Candlestick?this.unload():this.load();for(var c=0;c<l;c++){var d=o[c];if(!d._isCustomAxisY()){var u=d._getBinding(1),g=d._getBinding(2),p=d._getBinding(3),m=d._getLength();if(m){var x=d._getSymbolSize();x>_&&(_=x);for(var v=0;v<m;v++){var w=d._getItem(v);w&&[u?w[u]:null,g?w[g]:null,p?w[p]:null].forEach(t=>{_DataInfo.isValid(t)&&null!==t&&((isNaN(s)||t<s)&&(s=t),(isNaN(a)||t>a)&&(a=t))})}}}}var f=r-i,C=this.chart._plotRect;if(C&&C.width&&!this.isVolume){isNaN(x)&&(x=d._getSymbolSize()),x+=2;var y=C.width/(C.width-x)*f;i-=.5*(y-f),f=y}return h!==wjcCore.DataType.Date||!this.isVolume||this.chart._getChartType()!==ChartType.Column&&this.chart._getChartType()!==ChartType.Candlestick?this.chart._isRotated()?new wjcCore.Rect(s,i,a-s,f):new wjcCore.Rect(i,s,f,a-s):new wjcCore.Rect(i-.5*n,s,r-i+n,a-s)}plotSeries(t,e,i,s,r,a,n,h){var o=wjcCore.asType(s,SeriesBase),l=this.chart.series.indexOf(s),_=s.getValues(0),c=s.getValues(1),d=this._symWidth,u=this.chart._isRotated();if(_){if(c||(c=this.dataInfo.getXVals()),c){var g=this.dataInfo.getDeltaX();g>0&&!1===this._isPixel&&(d*=g)}var p=_.length,m=!0;c?p=Math.min(p,c.length):(m=!1,c=new Array(p));var x=this._DEFAULT_WIDTH,v=o._getSymbolFill(l),w=o._getAltSymbolFill(l)||"transparent",f=o._getSymbolStroke(l),C=o._getAltSymbolStroke(l)||f,y=void 0===this._isPixel?o._getSymbolSize():d;t.stroke=f,t.strokeWidth=x,t.fill=v;for(var b,S,M=o._getBinding(1),T=o._getBinding(2),A=o._getBinding(3),L=u?i.actualMin:e.actualMin,P=u?i.actualMax:e.actualMax,k=0,N=null,I=null,j=0;j<p;j++)if(N=o._getItem(j)){var E=m?c[j]:j;if(_DataInfo.isValid(E)&&L<=E&&E<=P){var D=_[j],R=M?N[M]:null,F=T?N[T]:null,V=A?N[A]:null;if(t.startGroup(),this.isEqui&&null!==I?I[A]!==N[A]&&(b=I[A]<N[A]?w:v,S=I[A]<N[A]?C:f):(b=F<V?w:v,S=F<V?C:f),t.fill=b,t.stroke=S,this.chart.itemFormatter){var X=new HitTestInfo(this.chart,new wjcCore.Point(e.convert(E),i.convert(D)),ChartElement.SeriesSymbol);X._setData(o,j),this.chart.itemFormatter(t,X,()=>{this._drawSymbol(t,e,i,l,j,b,y,E,D,R,F,V)})}else this._drawSymbol(t,e,i,l,j,b,y,E,D,R,F,V);t.endGroup(),s._setPointIndex(j,k),k++}I=N}}}_drawSymbol(t,e,i,s,r,a,n,h,o,l,_,c){var d,u=new _DataPoint(s,r,h,o),g=null,p=null,m=null,x=null,v=this.chart._isRotated();if(v){var w=i;i=e,e=w}if(!1===this._isPixel&&(m=e.convert(h-.5*n),x=e.convert(h+.5*n),m>x)){var f=m;m=x,x=f}h=e.convert(h),!1!==this._isPixel&&(m=h-.5*n,x=h+.5*n),this.isCandle?(_DataInfo.isValid(_)&&_DataInfo.isValid(c)&&(_=i.convert(_),c=i.convert(c),p=(g=Math.min(_,c))+Math.abs(_-c),v?(t.drawRect(g,m,p-g||1,x-m||1),d=new _RectArea(new wjcCore.Rect(g,m,p-g||1,x-m||1))):(t.drawRect(m,g,x-m||1,p-g||1),d=new _RectArea(new wjcCore.Rect(m,g,x-m||1,p-g||1))),d.tag=u,this.hitTester.add(d,s)),_DataInfo.isValid(o)&&(o=i.convert(o),null!==g&&(v?t.drawLine(p,h,o,h):t.drawLine(h,g,h,o))),_DataInfo.isValid(l)&&(l=i.convert(l),null!==p&&(v?t.drawLine(g,h,l,h):t.drawLine(h,p,h,l)))):this.isEqui?_DataInfo.isValid(o)&&_DataInfo.isValid(l)&&(o=i.convert(o),l=i.convert(l),p=(g=Math.min(o,l))+Math.abs(o-l),t.drawRect(m,g,x-m||1,p-g||1),(d=new _RectArea(new wjcCore.Rect(m,g,x-m||1,p-g||1))).tag=u,this.hitTester.add(d,s)):this.isArms?(_DataInfo.isValid(_)&&_DataInfo.isValid(c)&&(_=i.convert(_),c=i.convert(c),p=(g=Math.min(_,c))+Math.abs(_-c),t.drawRect(m,g,x-m||1,p-g||1)),_DataInfo.isValid(o)&&null!==g&&(o=i.convert(o),t.drawLine(h,g,h,o)),_DataInfo.isValid(l)&&null!==p&&(l=i.convert(l),t.drawLine(h,p,h,l)),_DataInfo.isValid(o)&&_DataInfo.isValid(l)&&(t.fill="transparent",p=(g=Math.min(o,l))+Math.abs(o-l),t.drawRect(m,g,x-m||1,p-g||1),(d=new _RectArea(new wjcCore.Rect(m,g,x-m||1,p-g||1))).tag=u,this.hitTester.add(d,s))):(_DataInfo.isValid(o)&&_DataInfo.isValid(l)&&(o=i.convert(o),l=i.convert(l),p=(g=Math.min(o,l))+Math.abs(o-l),v?(t.drawLine(l,h,o,h),d=new _RectArea(new wjcCore.Rect(g,m,p-g||1,x-m||1))):(t.drawLine(h,l,h,o),d=new _RectArea(new wjcCore.Rect(m,g,x-m||1,p-g||1))),d.tag=u,this.hitTester.add(d,s)),_DataInfo.isValid(_)&&(_=i.convert(_),v?t.drawLine(_,m,_,h):t.drawLine(m,_,h,_)),_DataInfo.isValid(c)&&(c=i.convert(c),v?t.drawLine(c,h,c,x):t.drawLine(h,c,x,c)))}}exports._FinancePlotter=_FinancePlotter;class _FunnelPlotter extends _BasePlotter{constructor(){super(...arguments),this.stacking=Stacking.None}adjustLimits(t,e){this.dataInfo=t;var i=t.getMinX(),s=t.getMinY(),r=t.getMaxX(),a=t.getMaxY();return new wjcCore.Rect(i,s,r-i,a-s)}plotSeries(t,e,i,s,r,a,n,h){var o=this.chart.series.indexOf(s);if(!(o>0)){var l,_,c,d,u,g=wjcCore.asType(s,SeriesBase),p=this.chart.options,m=s.getValues(0),x=s.getValues(1),v=this.chart._plotRect,w=p&&p.funnel&&null!=p.funnel.neckWidth?p.funnel.neckWidth:.2,f=p&&p.funnel&&null!=p.funnel.neckHeight?p.funnel.neckHeight:0,C=w*v.width,y=0,b=0,S=0,M=0,T=v.left,A=v.top,L=v.width,P=v.height;if(m){this.rotated&&(A+=v.height),C=C||1,x||(x=this.dataInfo.getXVals());var k=m.length;for(null!=x&&(k=Math.min(k,x.length)),y=0;y<k;y++)b+=m[y];var N,I,j=0;if(p&&p.funnel&&"rectangle"===p.funnel.type){f=P/k,w=L;var E;for(y=0;y<k;y++){var D=x?x[y]:y,R=m[y],F=g._getSymbolFill(y),V=g._getAltSymbolFill(y)||F,X=g._getSymbolStroke(y),B=g._getAltSymbolStroke(y)||X;if(this._getSymbolStyles&&(F=(O=this._getSymbolStyles(y,k))&&O.fill?O.fill:F,V=O&&O.fill?O.fill:V,X=O&&O.stroke?O.stroke:X,B=O&&O.stroke?O.stroke:B),N=R>0?F:V,I=R>0?X:B,t.fill=N,t.stroke=I,_DataInfo.isValid(D)&&_DataInfo.isValid(R)){E||(E=L/R);var Y=E*R;T+=(w-Y)/2,this.rotated&&(A-=f),t.drawRect(T,A,Y,f),H=new _FunnelSegment(new wjcCore.Point(T,A),Y,f,Y,f),this.rotated||(A+=f),w=Y,H.tag=new _DataPoint(o,y,D,R),this.hitTester.add(H,o),s._setPointIndex(y,j),j++}}}else for(S=v.left+v.width*(1-w)/2,M=v.top+v.height*(this.rotated?f:1-f),_=(1-w)*v.width/2/(v.height*(1-f)),!isNaN(_)&&isFinite(_)||(L=C,T=S,A=M),l=v.width*w*v.height+v.width*(1-w)/2*v.height*(1-f),y=0;y<k;y++){var H,D=x?x[y]:y,R=m[y],z=[],G=[],F=g._getSymbolFill(y),V=g._getAltSymbolFill(y)||F,X=g._getSymbolStroke(y),B=g._getAltSymbolStroke(y)||X;if(this._getSymbolStyles){var O=this._getSymbolStyles(y,k);F=O&&O.fill?O.fill:F,V=O&&O.fill?O.fill:V,X=O&&O.stroke?O.stroke:X,B=O&&O.stroke?O.stroke:B}if(N=R>0?F:V,I=R>0?X:B,t.fill=N,t.stroke=I,_DataInfo.isValid(D)&&_DataInfo.isValid(R)){var W=l*R/b;L>C?(d=this._getTrapezoidOffsetY(L,W,_),this.rotated?A-d>M?(z=[T,T+(c=_*d),T+L-c,T+L],G=[A,A-d,A-d,A],H=new _FunnelSegment(new wjcCore.Point(T,A-d),L,d,L-2*c,0,!0),L-=2*c,T+=c,A-=d):(c=_*(d=A-M),u=(W-=this._getTrapezoidArea(L,_,d))/C,z.push(T,T+c,T+c,T+c+C,T+c+C,T+L),G.push(A,A-d,A-d-u,A-d-u,A-d,A),H=new _FunnelSegment(new wjcCore.Point(T,A-d-u),L,d+u,C,u,!0),L=C,T+=c,A=A-d-u):A+d<M?(z=[T,T+(c=_*d),T+L-c,T+L],G=[A,A+d,A+d,A],H=new _FunnelSegment(new wjcCore.Point(T,A),L,d,L-2*c,0),L-=2*c,T+=c,A+=d):(c=_*(d=M-A),u=(W-=this._getTrapezoidArea(L,_,d))/C,z.push(T,T+c,T+c,T+c+C,T+c+C,T+L),G.push(A,A+d,A+d+u,A+d+u,A+d,A),H=new _FunnelSegment(new wjcCore.Point(T,A),L,d+u,C,u),L=C,T+=c,A=A+d+u),t.drawPolygon(z,G)):(u=W/C,this.rotated&&(A-=u),t.drawRect(T,A,L,u),H=new _FunnelSegment(new wjcCore.Point(T,A),C,u,C,u),this.rotated||(A+=u)),H.tag=new _DataPoint(o,y,D,R),this.hitTester.add(H,o),s._setPointIndex(y,j),j++}}}}}_getTrapezoidArea(t,e,i){var s=i*e;return s*i+(t-2*s)*i}_getTrapezoidOffsetY(t,e,i){var s=Math.pow(t/2/i,2)-e/i;return t/2/i-Math.sqrt(s>=0?s:0)}drawSymbol(t,e,i,s,r){if(this.chart.itemFormatter){t.startGroup();var a=new HitTestInfo(this.chart,r,ChartElement.SeriesSymbol);a._setData(i,s),this.chart.itemFormatter(t,a,()=>{this.drawDefaultSymbol(t,e,i)}),t.endGroup()}else this.drawDefaultSymbol(t,e,i)}drawDefaultSymbol(t,e,i){t.drawRect(e.left,e.top,e.width,e.height,null,i.symbolStyle)}_getPointAndPosition(t,e,i,s){var r=i;t.x=r.center.x,t.y=r.center.y,e=null==e?LabelPosition.Center:e}}exports._FunnelPlotter=_FunnelPlotter;class _FunnelSegment{constructor(t,e,i,s,r,a=!1){this._startPoint=t,this._width=e,this._height=i,this._neckWidth=s,this._neckHeight=r,this._center=new wjcCore.Point(this._startPoint.x+e/2,this._startPoint.y+i/2),this._offsetX=(e-s)/2,this._offsetY=i-r,this._rotated=a}contains(t){var e=this._startPoint,i=this._offsetX,s=this._offsetY;if(this._rotated){if(t.x>=e.x&&t.x<=e.x+this._width&&t.y>=e.y&&t.y<=e.y+this._height){if(t.x>=e.x+i&&t.x<=e.x+this._width-i)return!0;if(t.y<e.y+this._neckHeight)return!1;if(t.x<this._center.x)return(e.y+this._height-t.y)/(t.x-e.x)<s/i;if(t.x>this._center.x)return(e.y+this._height-t.y)/(e.x+this._width-t.x)<s/i}}else if(t.x>=e.x&&t.x<=e.x+this._width&&t.y>=e.y&&t.y<=e.y+this._height){if(t.x>=e.x+i&&t.x<=e.x+this._width-i)return!0;if(t.y>e.y+s)return!1;if(t.x<this._center.x)return(t.y-e.y)/(t.x-e.x)<s/i;if(t.x>this._center.x)return(t.y-e.y)/(e.x+this._width-t.x)<s/i}return!1}distance(t){if(this.contains(t))return 0;var e=this._startPoint,i=this._width,s=this._height,r=this._offsetX,a=this._offsetY;if(this._rotated){if(t.y>e.y+s)return t.x<e.x?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y+s-t.y,2)):t.x>e.x+i?Math.sqrt(Math.pow(t.x-e.x-i,2)+Math.pow(e.y+s-t.y,2)):t.y-e.y-s;if(t.y<e.y)return t.x<e.x+r?Math.sqrt(Math.pow(e.x+r-t.x,2)+Math.pow(t.y-e.y-s,2)):t.x>e.x+i-r?Math.sqrt(Math.pow(t.x-e.x-i+r,2)+Math.pow(t.y-e.y-s,2)):e.y-t.y;if(!(t.y<e.y+s-a))return t.x<e.x+r?Math.min(Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(t.y-e.y-s,2)),Math.sqrt(Math.pow(t.x-r/2-e.x,2)+Math.pow(t.y-s+a/2-e.y,2)),Math.sqrt(Math.pow(t.x-r-e.x,2)+Math.pow(t.y-s+a-e.y,2))):Math.min(Math.sqrt(Math.pow(t.x-i-e.x,2)+Math.pow(t.y-s-e.y,2)),Math.sqrt(Math.pow(t.x-i+r/2-e.x,2)+Math.pow(t.y-s+a/2-e.y,2)),Math.sqrt(Math.pow(t.x-i+r-e.x,2)+Math.pow(t.y-s+a-e.y,2)));if(t.x<e.x+r)return e.x+r-t.x;if(t.x>e.x+i-r)return t.x-e.x-i+r}else{if(t.y<e.y)return t.x<e.x?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):t.x>e.x+i?Math.sqrt(Math.pow(t.x-e.x-i,2)+Math.pow(e.y-t.y,2)):e.y-t.y;if(t.y>e.y+s)return t.x<e.x+r?Math.sqrt(Math.pow(e.x+r-t.x,2)+Math.pow(t.y-e.y-s,2)):t.x>e.x+i-r?Math.sqrt(Math.pow(t.x-e.x-i+r,2)+Math.pow(t.y-e.y-s,2)):t.y-e.y-s;if(!(t.y>e.y+a))return t.x<e.x+r?Math.min(Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(t.y-e.y,2)),Math.sqrt(Math.pow(t.x-r/2-e.x,2)+Math.pow(t.y-a/2-e.y,2)),Math.sqrt(Math.pow(t.x-r-e.x,2)+Math.pow(t.y-a-e.y,2))):Math.min(Math.sqrt(Math.pow(t.x-i-e.x,2)+Math.pow(t.y-e.y,2)),Math.sqrt(Math.pow(t.x-i+r/2-e.x,2)+Math.pow(t.y-a/2-e.y,2)),Math.sqrt(Math.pow(t.x-i+r-e.x,2)+Math.pow(t.y-a-e.y,2)));if(t.x<e.x+r)return e.x+r-t.x;if(t.x>e.x+i-r)return t.x-e.x-i+r}}get center(){return this._center}}exports._FunnelSegment=_FunnelSegment;class _VolumeHelper{constructor(t,e,i,s,r){this._volumes=wjcCore.asArray(t),this._xVals=wjcCore.asArray(e),this._xDataMin=wjcCore.asNumber(i,!0,!1),this._xDataMax=wjcCore.asNumber(s,!0,!1),this._xDataType=wjcCore.asEnum(r,wjcCore.DataType,!0),this._calcData=[],this._init()}convert(t,e,i){var s=void 0,r=this._calcData.length,a=-1;if(this._hasXs&&this._xDataType===wjcCore.DataType.Date){if(-1===(a=this._xVals.indexOf(t)))for(var n=0;n<this._xVals.length;n++){if(n<this._xVals.length-1&&this._xVals[n]<=t&&t<=this._xVals[n+1]){a=n;break}if(0===n&&t<=this._xVals[n]){a=n;break}if(n===this._xVals.length-1&&this._xVals[n]<=t){a=n;break}}-1===a&&(a=this._xVals.indexOf(Math.floor(t)),a=wjcCore.clamp(a,0,r-1))}else this._hasXs?-1===(a=this._xVals.indexOf(t))&&(a=this._xVals.indexOf(Math.floor(t)),a=wjcCore.clamp(a,0,r-1)):a=wjcCore.clamp(Math.round(t),0,r-1);return 0<=a&&a<r&&(this._hasXs&&(t=_VolumeHelper.convertToRange(t,0,r-1,this._xDataMin,this._xDataMax)),s=((s=this._calcData[a].value+(t-a)*this._calcData[a].width-.5*this._calcData[a].width)-(e=this._getXVolume(e)))/((i=this._getXVolume(i))-e)),s}convertBack(t,e,i){var s,r=void 0,a=this._calcData.length,n=-1;for(s=0;s<a;s++)if(this._calcData[s].x1<=t&&t<=this._calcData[s].x2||0===s&&t<=this._calcData[s].x2||s===a-1&&this._calcData[s].x1<=t){n=s;break}return 0<=n&&n<a&&(r=t/this._calcData[n].width-this._calcData[n].value/this._calcData[n].width+.5+s,this._hasXs&&(r=_VolumeHelper.convertToRange(r,this._xDataMin,this._xDataMax,0,a-1))),r}_init(){this._hasXs=null!==this._xVals&&this._xVals.length>0,this._hasXs&&!wjcCore.isNumber(this._xDataMin)&&(this._xDataMin=Math.min.apply(null,this._xVals)),this._hasXs&&!wjcCore.isNumber(this._xDataMax)&&(this._xDataMax=Math.max.apply(null,this._xVals)),this._hasXs&&(this._hasXs=wjcCore.isNumber(this._xDataMin)&&wjcCore.isNumber(this._xDataMax)),this._hasXs&&this._xDataType===wjcCore.DataType.Date&&this._fillGaps();var t=0,e=0,i=null!==this._volumes&&this._volumes.length>0?this._volumes.length:0;for(e=0;e<i;e++)t+=this._volumes[e]||0;var s,r,a=0;for(e=0;e<i;e++)s=a+(r=(this._volumes[e]||0)/t),this._calcData.push({value:s,width:r,x1:a,x2:s}),a=this._calcData[e].value}_getXVolume(t){var e=this._calcData.length,i=-1;if(this._hasXs){i=this._xVals.indexOf(t);for(var s=0;s<this._xVals.length;s++){if(s<this._xVals.length-1&&this._xVals[s]<=t&&t<=this._xVals[s+1]){i=s;break}if(0===s&&t<=this._xVals[s]){i=s;break}if(s===this._xVals.length-1&&this._xVals[s]<=t){i=s;break}}}return this._hasXs&&(t=_VolumeHelper.convertToRange(t,0,e-1,this._xDataMin,this._xDataMax)),-1===i&&(i=wjcCore.clamp(Math.round(t),0,e-1)),this._calcData[i].value+(t-i)*this._calcData[i].width-.5*this._calcData[i].width}static convertToRange(t,e,i,s,r){return e===i||s===r?0:(t-s)*(i-e)/(r-s)+e}_fillGaps(){if(!(this._xDataType!==wjcCore.DataType.Date||null===this._xVals||this._xVals.length<=0)){var t,e=this._xDataMin,i=this._xDataMax;for(t=1;e<i;t++)(e=new Date(e)).setDate(e.getDate()+1),(e=e.valueOf())!==this._xVals[t]&&(this._xVals.splice(t,0,e),this._volumes.splice(t,0,0))}}}exports._VolumeHelper=_VolumeHelper;