From 0f6ac9e6d7cc670aa22c9d306e67283763409955 Mon Sep 17 00:00:00 2001 From: hengsin Date: Sat, 18 Nov 2023 20:05:56 +0800 Subject: [PATCH] IDEMPIERE-5933 Update billboard.js to version 3.10.3 (#2112) --- org.idempiere.zk.billboard/README.md | 7 +- .../src/metainfo/zk/lang-addon.xml | 8 +- .../org/idempiere/zk/billboard/Version.java | 2 +- .../web/js/zul/billboard/css/billboard.css | 6 +- .../src/web/js/zul/billboard/ext/billboard.js | 4 +- .../web/js/zul/billboard/ext/billboard.src.js | 6268 +++++++++-------- 6 files changed, 3386 insertions(+), 2909 deletions(-) diff --git a/org.idempiere.zk.billboard/README.md b/org.idempiere.zk.billboard/README.md index 2370715ba1..36ef171898 100644 --- a/org.idempiere.zk.billboard/README.md +++ b/org.idempiere.zk.billboard/README.md @@ -2,11 +2,12 @@ 1. Wrap https://github.com/naver/billboard.js as zk component. -2. Get latest billboard.min.js and billboard.js from https://github.com/naver/billboard.js. Following Zk naming convention, rename billboard.min.js to billboard.js and rename billboard.js to billboard.src.js. +2. Get latest billboard.min.js and billboard.js from https://naver.github.io/billboard.js/#download. Following Zk naming convention, rename billboard.min.js to billboard.js and rename billboard.js to billboard.src.js. -3. Get d3 from https://d3js.org/. The current version use by billboard is v6 so the corresponding link is https://d3js.org/d3.v6.js and https://d3js.org/d3.v6.min.js. Again, following Zk naming conversion, we need to rename d3.v6.js to d3.v6.src.js and rename d3.v6.min.js to d3.v6.js. +3. Get d3 from https://d3js.org/. The current version use by billboard is v6 so the corresponding link is https://d3js.org/d3.v6.js and https://d3js.org/d3.v6.min.js. Again, following Zk naming conversion, we need to rename d3.v6.js to d3.v6.src.js + and rename d3.v6.min.js to d3.v6.js. -4. Replace billboard.css with latest billboard.css from https://github.com/naver/billboard.js. +4. Replace billboard.css with latest billboard.css from https://naver.github.io/billboard.js/#download. * Add !important to padding and text-align of .bb-tooltip th and padding of .bb-tooltip td to fix conflict with zk css * Change font-size of text.bb-chart-arcs-gauge-title from 2.7em to 1.5em. * Original: text.bb-chart-arcs-gauge-title { diff --git a/org.idempiere.zk.billboard/src/metainfo/zk/lang-addon.xml b/org.idempiere.zk.billboard/src/metainfo/zk/lang-addon.xml index cf12293a4e..f75d108997 100644 --- a/org.idempiere.zk.billboard/src/metainfo/zk/lang-addon.xml +++ b/org.idempiere.zk.billboard/src/metainfo/zk/lang-addon.xml @@ -6,7 +6,7 @@ xul/html org.idempiere.zk.billboard.Version - 3.9.0.20230713 + 3.10.3.20231118 billboard @@ -19,7 +19,7 @@ - - - + + + diff --git a/org.idempiere.zk.billboard/src/org/idempiere/zk/billboard/Version.java b/org.idempiere.zk.billboard/src/org/idempiere/zk/billboard/Version.java index 688386d15a..265c5d6bae 100644 --- a/org.idempiere.zk.billboard/src/org/idempiere/zk/billboard/Version.java +++ b/org.idempiere.zk.billboard/src/org/idempiere/zk/billboard/Version.java @@ -34,5 +34,5 @@ public class Version { * Returns the version UID.
* Must match with version-uid value in lang-addon.xml */ - public static final String UID = "3.9.0.20230713"; + public static final String UID = "3.10.3.20231118"; } diff --git a/org.idempiere.zk.billboard/src/web/js/zul/billboard/css/billboard.css b/org.idempiere.zk.billboard/src/web/js/zul/billboard/css/billboard.css index 0c3b816352..ddf248dbca 100644 --- a/org.idempiere.zk.billboard/src/web/js/zul/billboard/css/billboard.css +++ b/org.idempiere.zk.billboard/src/web/js/zul/billboard/css/billboard.css @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.0 + * @version 3.10.3 */ /*-- Chart --*/ .bb svg { @@ -102,7 +102,7 @@ opacity: .05 !important; } /*-- Region --*/ -.bb-region { +.bb-region rect { fill: steelblue; fill-opacity: .1; } @@ -169,7 +169,7 @@ height: 10px; margin-right: 6px; } .bb-tooltip.value { - text-align: right !important; } + text-align: right; } /*-- Area --*/ .bb-area { diff --git a/org.idempiere.zk.billboard/src/web/js/zul/billboard/ext/billboard.js b/org.idempiere.zk.billboard/src/web/js/zul/billboard/ext/billboard.js index c6bf10ff7b..0dc0d94be2 100644 --- a/org.idempiere.zk.billboard/src/web/js/zul/billboard/ext/billboard.js +++ b/org.idempiere.zk.billboard/src/web/js/zul/billboard/ext/billboard.js @@ -5,6 +5,6 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.0 + * @version 3.10.3 */ -!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if("function"==typeof define&&define.amd)define(["d3-axis","d3-brush","d3-drag","d3-dsv","d3-ease","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],e);else{var i="object"==typeof exports?e(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):e(t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(this,(function(t,e,i,n,a,r,s,o,l,c,d,u,h){return function(){"use strict";var g=[,,function(t){t.exports=l},function(t){t.exports=e},function(t){t.exports=d},function(t){t.exports=n},function(t){t.exports=o},function(t){t.exports=i},function(t){t.exports=u},function(t){t.exports=c},function(e){e.exports=t},function(t){t.exports=a},function(t){t.exports=s},function(t){t.exports=r},function(t){t.exports=h}],f={};function p(t){var e=f[t];if(void 0!==e)return e.exports;var i=f[t]={exports:{}};return g[t](i,i.exports,p),i.exports}p.d=function(t,e){for(var i in e)p.o(e,i)&&!p.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},p.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},p.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var v={};return function(){p.r(v),p.d(v,{bb:function(){return Xa},default:function(){return Xa}});var t={};p.r(t),p.d(t,{area:function(){return Qn},areaLineRange:function(){return ta},areaSpline:function(){return ea},areaSplineRange:function(){return ia},areaStep:function(){return na},bar:function(){return ha},bubble:function(){return ga},candlestick:function(){return fa},donut:function(){return oa},gauge:function(){return la},line:function(){return aa},pie:function(){return ca},polar:function(){return da},radar:function(){return ua},scatter:function(){return pa},spline:function(){return ra},step:function(){return sa},treemap:function(){return va}});var e={};function i(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}p.r(e),p.d(e,{selection:function(){return Da},subchart:function(){return za},zoom:function(){return Ma}});var n=p(4),a=p(2),r=void 0,s=function(){return i(this,r),"object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis||"object"==typeof global&&null!==global&&global.Object===Object&&global||"object"==typeof self&&null!==self&&self.Object===Object&&self||Function("return this")()}.bind(void 0)(),o="function"==typeof s.requestAnimationFrame,l="function"==typeof s.requestIdleCallback,c=o?s.requestAnimationFrame:function(t){return i(this,r),setTimeout(t,1)}.bind(void 0),d=o?s.cancelAnimationFrame:function(t){return i(this,r),clearTimeout(t)}.bind(void 0),u=l?s.requestIdleCallback:c,h=(l&&s.cancelIdleCallback,null==s?void 0:s.document),g={AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"},f={AREA:"initArea",AREA_LINE_RANGE:"initArea",AREA_SPLINE:"initArea",AREA_SPLINE_RANGE:"initArea",AREA_STEP:"initArea",BAR:"initBar",BUBBLE:"initCircle",CANDLESTICK:"initCandlestick",DONUT:"initArc",GAUGE:"initArc",LINE:"initLine",PIE:"initArc",POLAR:"initPolar",RADAR:"initCircle",SCATTER:"initCircle",SPLINE:"initLine",STEP:"initLine",TREEMAP:"initTreemap"},x={Area:[g.AREA,g.AREA_SPLINE,g.AREA_SPLINE_RANGE,g.AREA_LINE_RANGE,g.AREA_STEP],AreaRange:[g.AREA_SPLINE_RANGE,g.AREA_LINE_RANGE],Arc:[g.PIE,g.DONUT,g.GAUGE,g.POLAR,g.RADAR],Line:[g.LINE,g.SPLINE,g.AREA,g.AREA_SPLINE,g.AREA_SPLINE_RANGE,g.AREA_LINE_RANGE,g.STEP,g.AREA_STEP],Step:[g.STEP,g.AREA_STEP],Spline:[g.SPLINE,g.AREA_SPLINE,g.AREA_SPLINE_RANGE]};function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function _(t){var e=function(t,e){if("object"!==b(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!==b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===b(e)?e:String(e)}function m(t,e,i){return(e=_(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var y=p(3),T=void 0;function w(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function A(t){for(var e,i=1;i2?n-2:0),r=2;r/g,">"):t}function V(t,e,n,a){var r=this;if(void 0===n&&(n=[-1,1]),void 0===a&&(a=!1),t&&C(e))if(-1===e.indexOf("\n"))t.text(e);else{var s=[t.text(),e].map(function(t){return i(this,r),t.replace(/[\s\n]/g,"")}.bind(this));if(s[0]!==s[1]){var o=e.split("\n"),l=a?o.length-1:1;t.html(""),o.forEach(function(e,a){i(this,r),t.append("tspan").attr("x",0).attr("dy",(0===a?n[0]*l:n[1])+"em").text(e)}.bind(this))}}}function Y(t){var e=t.getBBox(),i=e.x,n=e.y,a=e.width,r=e.height;return[{x:i,y:n+r},{x:i,y:n},{x:i+a,y:n},{x:i+a,y:n+r}]}function H(t,e){var n,r=t&&(null==(n=t.touches||t.sourceEvent&&t.sourceEvent.touches)?void 0:n[0]),s=(0,a.pointer)(r||t,e),o=this;return s.map(function(t){return i(this,o),isNaN(t)?0:t}.bind(this))}function W(t){var e,i=t.event,n=t.$el,a=n.subchart.main||n.main;return i&&"brush"===i.type?e=i.selection:a&&(e=a.select(".bb-brush").node())&&(e=(0,y.brushSelection)(e)),e}function U(t){return!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+t.getAttribute("width")?t.rect=t.getBoundingClientRect():t.rect}function Z(t,e,i){void 0===t&&(t=!0),void 0===e&&(e=0),void 0===i&&(i=1e4);var n=s.crypto||s.msCrypto,a=n?e+n.getRandomValues(new Uint32Array(1))[0]%(i-e+1):Math.floor(Math.random()*(i-e)+e);return t?a+"":a}function q(t,e,i,n,a){if(i>n)return-1;var r=Math.floor((i+n)/2),s=t[r],o=s.x,l=s.w,c=void 0===l?0:l;return a&&(o=t[r].y,c=t[r].h),e>=o&&e<=o+c?r:e1?n-1:0),r=1;re?-1:t{=TITLE}",legend_equally:!1,legend_hide:!1,legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_interaction:!0,legend_item_dblclick:!1,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_item_tile_width:10,legend_item_tile_height:10,legend_item_tile_r:5,legend_item_tile_type:"rectangle",legend_padding:0,legend_position:"bottom",legend_show:!0,legend_usePoint:!1},Jt={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},Qt=void 0,te={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:{top:"0px",left:"50px"},tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:function(){i(this,Qt)}.bind(void 0),tooltip_onhide:function(){i(this,Qt)}.bind(void 0),tooltip_onshown:function(){i(this,Qt)}.bind(void 0),tooltip_onhidden:function(){i(this,Qt)}.bind(void 0),tooltip_order:null};function ee(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function ie(t){for(var e,i=1;i0){if(void 0===e[a-1]&&(e[a-1]={}),void 0===t)throw new Error("Source data is missing a component at ("+i+", "+a+")!");e[a-1][n]=t}}))})),e}function Te(t){var e=t[0],i=[];return t.forEach((function(t,n){if(n>0){var a={};t.forEach((function(t,i){if(void 0===t)throw new Error("Source data is missing a component at ("+n+", "+i+")!");a[e[i]]=t})),i.push(a)}})),i}function we(t,e){var i,n,a=[];if(Array.isArray(t)){i=e.x?e.value.concat(e.x):e.value,a.push(i),t.forEach((function(t){var e=i.map((function(e){var i=function(t,e){if(void 0!==t[e])return t[e];var i=e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split("."),n=t;return i.some((function(t){return!(n=n&&t in n?n[t]:void 0)})),n}(t,e);return void 0===i&&(i=null),i}));a.push(e)})),n=Te(a)}else Object.keys(t).forEach((function(e){var i=t[e].concat();null==i.unshift||i.unshift(e),a.push(i)})),n=ye(a);return n}function Ae(t,e){var n,a=this,r=t.rows(e);return 1===r.length?(n=[{}],r[0].forEach(function(t){i(this,a),n[0][t]=null}.bind(this))):n=t.parse(e),n}function Se(t){return Ae({rows:me.csvParseRows,parse:me.csvParse},t)}function ke(t){return Ae({rows:me.tsvParseRows,parse:me.tsvParse},t)}function Ce(t,e){var i=t||(null==e?void 0:e.data_keys);return null!=i&&i.x&&(e.data_x=i.x),i}var Re={convertData:function(t,e){var n=this,a=this.config,r=a.boost_useWorker,s=t;if(t.bindto&&(s={},["url","mimeType","headers","keys","json","keys","rows","columns"].forEach(function(e){i(this,n);var a="data_"+e;a in t&&(s[e]=t[a])}.bind(this))),s.url&&e)!function(t,e,i,n,a){void 0===e&&(e="csv");var r=new XMLHttpRequest,s={csv:Se,tsv:ke,json:we};r.open("GET",t),i&&Object.keys(i).forEach((function(t){r.setRequestHeader(t,i[t])})),r.onreadystatechange=function(){if(4===r.readyState){if(200!==r.status)throw new Error(t+": Something went wrong loading!");var i=r.responseText;i&&a.call(this,s[e]("json"===e?JSON.parse(i):i,n))}},r.send()}(s.url,s.mimeType,s.headers,Ce(s.keys,a),e);else if(s.json)_e(r,we,e,[ye,Te])(s.json,Ce(s.keys,a));else if(s.rows)_e(r,Te,e)(s.rows);else if(s.columns)_e(r,ye,e)(s.columns);else if(t.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets:function(t,e){var n=this,a=this,r=a.axis,s=a.config,o=a.state,l=s.data_type,c=!1,d=!1,u=!1;r&&(c=r.isCategorized(),d=r.isTimeSeries(),u=r.isCustomX());var h,g=Object.keys(t[0]||{}),f=g.length?g.filter(a.isNotX,a):[],p=g.length?g.filter(a.isX,a):[];f.forEach(function(r){var o=this;i(this,n);var l=this.getXKey(r);u||d?p.indexOf(l)>=0?h=(e&&a.data.xs[r]||[]).concat(t.map(function(t){return i(this,o),t[l]}.bind(this)).filter(S).map(function(t,e){return i(this,o),a.generateTargetX(t,r,e)}.bind(this))):s.data_x?h=this.getOtherTargetXs():$(s.data_xs)&&(h=a.getXValuesOfXKey(l,a.data.targets)):h=t.map(function(t,e){return i(this,o),e}.bind(this)),h&&(this.data.xs[r]=h)}.bind(this)),f.forEach(function(t){if(i(this,n),!this.data.xs[t])throw new Error('x is not defined for id = "'+t+'".')}.bind(this));var v=f.map(function(e,r){var l=this;i(this,n);var d=s.data_idConverter.bind(a.api)(e),h=a.getXKey(e),g=u&&c,f=g&&t.map(function(t){return i(this,l),t.x}.bind(this)).every(function(t){return i(this,l),s.axis_x_categories.indexOf(t)>-1}.bind(this)),p=t.__append__,v=null===h&&p?a.api.data.values(e).length:0;return{id:d,id_org:e,values:t.map(function(t,n){i(this,l);var c,u=t[h],x=t[e];return x=null===x||isNaN(x)||F(x)?X(x)||F(x)?x:null:+x,!g&&!o.hasRadar||0!==r||E(u)?c=a.generateTargetX(u,e,v+n):(f||0!==r||0!==n||p||(s.axis_x_categories=[]),-1===(c=s.axis_x_categories.indexOf(u))&&(c=s.axis_x_categories.length,s.axis_x_categories.push(u))),(E(x)||a.data.xs[e].length<=n)&&(c=void 0),{x:c,value:x,id:d,index:-1}}.bind(this)).filter(function(t){return i(this,l),L(t.x)}.bind(this))}}.bind(this));if(v.forEach(function(t){var e,r=this;i(this,n),s.data_xSort&&(t.values=t.values.sort(function(t,e){return i(this,r),(t.x||0===t.x?t.x:1/0)-(e.x||0===e.x?e.x:1/0)}.bind(this))),t.values.forEach(function(t,e){return i(this,r),t.index=e}.bind(this)),null==(e=a.data.xs[t.id])||e.sort(function(t,e){return i(this,r),t-e}.bind(this))}.bind(this)),o.hasNegativeValue=a.hasNegativeValueInTargets(v),o.hasPositiveValue=a.hasPositiveValueInTargets(v),l&&a.isValidChartType(l)){var x=a.mapToIds(v).filter(function(t){return i(this,n),!(t in s.data_types)||!a.isValidChartType(s.data_types[t])}.bind(this));a.setTargetType(x,l)}return v.forEach(function(t){return i(this,n),a.cache.add(t.id_org,t,!0)}.bind(this)),v}},Ee={isX:function(t){var e=this.config,n=e.data_x&&t===e.data_x,a=$(e.data_xs)&&function(t,e){var n=this,a=!1;return Object.keys(t).forEach(function(r){return i(this,n),t[r]===e&&(a=!0)}.bind(this)),a}(e.data_xs,t);return n||a},isNotX:function(t){return!this.isX(t)},isStackNormalized:function(){var t=this.config;return!(!t.data_stack_normalize||!t.data_groups.length)},isGrouped:function(t){var e=this,n=this.config.data_groups;return t?n.some(function(n){return i(this,e),n.indexOf(t)>=0&&n.length>1}.bind(this)):n.length>0},getXKey:function(t){var e=this.config;return e.data_x?e.data_x:$(e.data_xs)?e.data_xs[t]:null},getXValuesOfXKey:function(t,e){var n,a=this,r=this;return(e&&$(e)?r.mapToIds(e):[]).forEach(function(e){i(this,a),r.getXKey(e)===t&&(n=r.data.xs[e])}.bind(this)),n},getIndexByX:function(t,e){return e?e.indexOf(C(t)?t:+t):(this.filterByX(this.data.targets,t)[0]||{index:null}).index},getXValue:function(t,e){var i=this;return t in i.data.xs&&i.data.xs[t]&&S(i.data.xs[t][e])?i.data.xs[t][e]:e},getOtherTargetXs:function(){var t=Object.keys(this.data.xs);return t.length?this.data.xs[t[0]]:null},getOtherTargetX:function(t){var e=this.getOtherTargetXs();return e&&t1?e=rt(it(e=e.map(function(e){return i(this,t),e.values}.bind(this)).reduce(function(e,n){return i(this,t),e.concat(n)}.bind(this)).map(function(e){return i(this,t),e.x}.bind(this)))).map(function(e,n,r){return i(this,t),{x:e,index:a?r.length-n-1:n}}.bind(this)):n&&(e=e[0].values.concat()),e},mapToIds:function(t){var e=this;return t.map(function(t){return i(this,e),t.id}.bind(this))},mapToTargetIds:function(t){return t?X(t)?t.concat():[t]:this.mapToIds(this.data.targets)},hasTarget:function(t,e){for(var i,n=this.mapToIds(t),a=0;i=n[a];a++)if(i===e)return!0;return!1},isTargetToShow:function(t){return this.state.hiddenTargetIds.indexOf(t)<0},isLegendToShow:function(t){return this.state.hiddenLegendIds.indexOf(t)<0},filterTargetsToShow:function(t){var e=this,n=this;return(t||n.data.targets).filter(function(t){return i(this,e),n.isTargetToShow(t.id)}.bind(this))},mapTargetsToUniqueXs:function(t){var e=this,n=this.axis,a=[];return null!=t&&t.length&&(a=it(nt(t.map(function(t){var n=this;return i(this,e),t.values.map(function(t){return i(this,n),+t.x}.bind(this))}.bind(this)))),a=null!=n&&n.isTimeSeries()?a.map(function(t){return i(this,e),new Date(+t)}.bind(this)):a.map(Number)),rt(a)},addTargetIds:function(t,e){var n=this,a=this.state;(X(e)?e:[e]).forEach(function(e){i(this,n),a[t].indexOf(e)<0&&a[t].push(e)}.bind(this))},removeTargetIds:function(t,e){var n=this,a=this.state;(X(e)?e:[e]).forEach(function(e){i(this,n);var r=a[t].indexOf(e);r>=0&&a[t].splice(r,1)}.bind(this))},addHiddenTargetIds:function(t){this.addTargetIds("hiddenTargetIds",t)},removeHiddenTargetIds:function(t){this.removeTargetIds("hiddenTargetIds",t)},addHiddenLegendIds:function(t){this.addTargetIds("hiddenLegendIds",t)},removeHiddenLegendIds:function(t){this.removeTargetIds("hiddenLegendIds",t)},getValuesAsIdKeyed:function(t){var e=this,n=this,a=n.state.hasAxis,r={},s=n.isMultipleX(),o=s?n.mapTargetsToUniqueXs(t).map(function(t){return i(this,e),C(t)?t:+t}.bind(this)):null;return t.forEach(function(t){var l=this;i(this,e);var c=[];t.values.filter(function(t){var e=t.value;return i(this,l),S(e)||null===e}.bind(this)).forEach(function(t){i(this,l);var e=t.value;null!==e&&n.isCandlestickType(t)&&(e=X(e)?e.slice(0,4):[e.open,e.high,e.low,e.close]),X(e)?c.push.apply(c,e):F(e)&&"high"in e?c.push.apply(c,Object.values(e)):n.isBubbleZType(t)?c.push(a&&n.getBubbleZData(e,"y")):s?c[n.getIndexByX(t.x,o)]=e:c.push(e)}.bind(this)),r[t.id]=c}.bind(this)),r},checkValueInTargets:function(t,e){for(var i,n=Object.keys(t),a=0;a1},hasNegativeValueInTargets:function(t){var e=this;return this.checkValueInTargets(t,function(t){return i(this,e),t<0}.bind(this))},hasPositiveValueInTargets:function(t){var e=this;return this.checkValueInTargets(t,function(t){return i(this,e),t>0}.bind(this))},orderTargets:function(t){var e=[].concat(t),i=this.getSortCompareFn();return i&&e.sort(i),e},getSortCompareFn:function(t){var e=this;void 0===t&&(t=!1);var n,a=this.config.data_order,r=/asc/i.test(a),s=/desc/i.test(a);if(r||s){var o=function(t,n){return i(this,e),t+Math.abs(n.value)}.bind(this);n=function(n,a){i(this,e);var s="values"in n?n.values.reduce(o,0):n.value,l="values"in a?a.values.reduce(o,0):a.value;return t?r?s-l:l-s:r?l-s:s-l}.bind(this)}else k(a)&&(n=a.bind(this.api));return n||null},filterByX:function(t,e){var n=this;return nt(t.map(function(t){return i(this,n),t.values}.bind(this))).filter(function(t){return i(this,n),t.x-e==0}.bind(this))},filterRemoveNull:function(t){var e=this;return t.filter(function(t){return i(this,e),S(this.getBaseValue(t))}.bind(this))},filterByXDomain:function(t,e){var n=this;return t.map(function(t){var a=this;return i(this,n),{id:t.id,id_org:t.id_org,values:t.values.filter(function(t){return i(this,a),e[0]<=t.x&&t.x<=e[1]}.bind(this))}}.bind(this))},hasDataLabel:function(){var t=this.config.data_labels;return O(t)&&t||z(t)&&$(t)},getDataIndexFromEvent:function(t){var e=this.config,i=this.state,n=i.inputType,a=i.eventReceiver,r=a.coords,s=a.rect,o=e.axis_rotated,l="touch"===n&&t.changedTouches?t.changedTouches[0]:t;return q(r,o?l.clientY-s.top:l.clientX-s.left,0,r.length-1,o)},getDataLabelLength:function(t,e,n){var a=this,r=this,s=[0,0];return r.$el.chart.select("svg").selectAll(".dummy").data([t,e]).enter().append("text").text(function(t){return i(this,a),r.dataLabelFormat(t.id)(t)}.bind(this)).each((function(t,e){s[e]=1.3*this.getBoundingClientRect()[n]})).remove(),s},isNoneArc:function(t){return this.hasTarget(this.data.targets,t.id)},isArc:function(t){return"data"in t&&this.hasTarget(this.data.targets,t.data.id)},findSameXOfValues:function(t,e){var i,n=t[e].x,a=[];for(i=e-1;i>=0&&n===t[i].x;i--)a.push(t[i]);for(i=e;i=0&&n?n[a]:void 0}return n?n[e]:n},setRatioForGroupedData:function(t){var e=this,n=this;if(n.config.data_groups.length&&t.some(function(t){return i(this,e),n.isGrouped(t.id)}.bind(this))){var a=function(t){return i(this,e),n.getRatio("index",t,!0)}.bind(this);t.forEach(function(t){i(this,e),"values"in t?t.values.forEach(a):a(t)}.bind(this))}},getRatio:function(t,e,n){var a=this;void 0===n&&(n=!1);var r=this,s=r.config,o=r.state,l=r.api,c=0;if(e&&l.data.shown().length)if(c=e.ratio||e.value,"arc"===t)if(r.pie.padAngle()())c=e.value/r.getTotalDataSum(!0);else{var d=s.gauge_fullCircle?r.getArcLength():-2*r.getGaugeStartAngle(),u=r.hasType("gauge")?d:2*Math.PI;c=(e.endAngle-e.startAngle)/u}else if("index"===t){var h=l.data.values.bind(l),g=this.getTotalPerIndex();if(o.hiddenTargetIds.length){var f=h(o.hiddenTargetIds,!1);f.length&&(f=f.reduce(function(t,e){var n=this;return i(this,a),t.map(function(t,a){return i(this,n),(R(t)?t:0)+e[a]}.bind(this))}.bind(this)),g=g.map(function(t,e){return i(this,a),t-f[e]}.bind(this)))}var p=g[e.index];e.ratio=R(e.value)&&g&&p?e.value/p:0,c=e.ratio}else if("radar"===t)c=parseFloat(Math.max(e.value,0)+"")/o.current.dataMax*s.radar_size_ratio;else if("bar"===t){var v=r.getYScaleById.bind(r)(e.id).domain().reduce(function(t,e){return i(this,a),e-t}.bind(this));c=0===v?0:Math.abs(e.value)/v}else"treemap"===t&&(c/=r.getTotalDataSum(!0));return n&&c?100*c:c},updateDataIndexByX:function(t){var e=this,n=t.reduce(function(t,n,a){return i(this,e),t[+n.x]=a,t}.bind(this),{});this.data.targets.forEach(function(t){var a=this;i(this,e),t.values.forEach(function(t,e){i(this,a);var r=n[+t.x];void 0===r&&(r=e),t.index=r}.bind(this))}.bind(this))},isBubbleZType:function(t){return this.isBubbleType(t)&&(F(t.value)&&("z"in t.value||"y"in t.value)||X(t.value)&&t.value.length>=2)},isBarRangeType:function(t){var e=this,n=t.value;return this.isBarType(t)&&X(n)&&n.length>=2&&n.every(function(t){return i(this,e),R(t)}.bind(this))},getDataById:function(t){var e,i=this.cache.get(t)||this.api.data(t);return null!=(e=null==i?void 0:i[0])?e:i}};function Le(t,e){void 0===e&&(e=!1);var i=this.api;e&&this.api.flush(!0),null==t||t.call(i)}var Oe={load:function(t,e){var n=this,a=this,r=a.data,s=e.append,o=t;o&&(e.filter&&(o=o.filter(e.filter)),(e.type||e.types)&&o.forEach(function(t){var r;i(this,n);var s=(null==(r=e.types)?void 0:r[t.id])||e.type;a.setTargetType(t.id,s)}.bind(this)),r.targets.forEach(function(t){i(this,n);for(var e=0;e=0?Gt.focused:"")},classDefocused:function(t){return" "+(this.state.defocusedTargetIds.indexOf(t.id)>=0?Gt.defocused:"")},getTargetSelectorSuffix:function(t){return(t||0===t?"-"+t:"").replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g,"-")},selectorTarget:function(t,e,i){void 0===e&&(e=""),void 0===i&&(i="");var n=this.getTargetSelectorSuffix(t);return e+"."+(Gt.target+n)+" "+i+", "+e+"."+(Gt.circles+n)+" "+i},selectorTargets:function(t,e){var n=this,a=t||[];return a.length?a.map(function(t){return i(this,n),this.selectorTarget(t,e)}.bind(this)):null},selectorLegend:function(t){return"."+(Gt.legendItem+this.getTargetSelectorSuffix(t))},selectorLegends:function(t){var e=this;return null!=t&&t.length?t.map(function(t){return i(this,e),this.selectorLegend(t)}.bind(this)):null}},ze=p(6),Me=function(t,e,n){i(this,undefined);var r=(0,a.select)(t.cloneNode(!0));return r.attr("id",n).insert("rect",":first-child").attr("width",r.attr("width")).attr("height",r.attr("height")).style("fill",e),{id:n,node:r.node()}}.bind(void 0);var $e=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],Xe={generateColor:function(){var t=this,e=this,n=e.$el,a=e.config,r=a.data_colors,s=a.data_color,o=[],l=$(a.color_pattern)?a.color_pattern:(0,ze.scaleOrdinal)(function(t){var e=this,n=re,a=h.body,r=a[n];if(!r){var s=t.classed(wt.colorPattern,!0).style("background-image");t.classed(wt.colorPattern,!1),s.indexOf(";")>-1&&(r=s.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(function(t){return i(this,e),t.trim().replace(/[\"'\s]/g,"")}.bind(this)).filter(Boolean),a[n]=r)}return r}(n.chart)||$e).range(),c=l;if(k(a.color_tiles)){var d=a.color_tiles.bind(e.api)(),u=l.map(function(n,a){i(this,t);var r=n.replace(/[#\(\)\s,]/g,""),s=e.state.datetimeId+"-pattern-"+r+"-"+a;return Me(d[a%d.length],n,s)}.bind(this));l=u.map(function(e){return i(this,t),"url(#"+e.id+")"}.bind(this)),e.patterns=u}return function(t){var i,n,d=t.id||(null==(i=t.data)?void 0:i.id)||t,u=e.isTypeOf(d,["line","spline","step"])||!a.data_types[d];return k(r[d])?n=r[d].bind(e.api)(t):r[d]?n=r[d]:(o.indexOf(d)<0&&o.push(d),n=u?c[o.indexOf(d)%c.length]:l[o.indexOf(d)%l.length],r[d]=n),k(s)?s.bind(e.api)(n,t):n}},generateLevelColor:function(){var t=this.config,e=t.color_pattern,i=t.color_threshold,n="value"===i.unit,a=i.max||100,r=i.values&&i.values.length?i.values:[];return $(i)?function(t){for(var i=n?t:100*t/a,s=e[e.length-1],o=0,l=r.length;o')}.bind(this))}},getGradienColortUrl:function(t){return"url(#"+this.state.datetimeId+"-gradient"+this.getTargetSelectorSuffix(t)+")"},updateLinearGradient:function(){var t=this,e=this,n=e.config,a=e.data.targets,r=e.state.datetimeId,s=e.$el.defs;a.forEach(function(a){var o=this;i(this,t);var l=r+"-gradient"+e.getTargetSelectorSuffix(a.id),c=e.isAreaType(a)?"area":e.isBarType(a)&&"bar",d=n.axis_rotated;if(c&&s.select("#"+l).empty()){var u=e.color(a),h=n[c+"_linearGradient"],g=h.x,f=void 0===g?d?[1,0]:[0,0]:g,p=h.y,v=void 0===p?d?[0,0]:[0,1]:p,x=h.stops,b=void 0===x?[[0,u,1],[1,u,0]]:x,_=s.append("linearGradient").attr("id",""+l).attr("x1",f[0]).attr("x2",f[1]).attr("y1",v[0]).attr("y2",v[1]);b.forEach(function(t){i(this,o);var n=k(t[1])?t[1].bind(e.api)(a.id):t[1];_.append("stop").attr("offset",t[0]).attr("stop-color",n||u).attr("stop-opacity",t[2])}.bind(this))}}.bind(this))},setOverColor:function(t,e){var n=this,a=this,r=a.config,s=a.$el.main,o=r.color_onover,l=t?o:a.color;F(l)?l=function(t){var e=t.id;return i(this,n),e in o?o[e]:a.color(e)}.bind(this):C(l)?l=function(){return i(this,n),o}.bind(this):k(o)&&(l=l.bind(a.api)),s.selectAll(F(e)?"."+xt.arc+a.getTargetSelectorSuffix(e.id):"."+Mt.shape+"-"+e).style("fill",l)}},Fe={getYDomainMinMax:function(t,e){var n=this,a=this,r=a.axis,s=a.config,o="min"===e,l=s.data_groups,c=a.mapToIds(t),d=a.getValuesAsIdKeyed(t);if(l.length>0){var u=a["has"+(o?"Negative":"Positive")+"ValueInTargets"](t);l.forEach(function(t){var e=this;i(this,n);var a=t.filter(function(t){return i(this,e),c.indexOf(t)>=0}.bind(this));if(a.length){var s=a[0],l=r.getId(s);u&&d[s]&&(d[s]=d[s].map(function(t){return i(this,e),(o?t<0:t>0)?t:0}.bind(this))),a.filter(function(t,n){return i(this,e),n>0}.bind(this)).forEach(function(t){var n=this;if(i(this,e),d[t]){var a=r.getId(t);d[t].forEach(function(t,e){i(this,n);var r=+t;a!==l||u&&(o?r>0:r<0)||(d[s][e]+=r)}.bind(this))}}.bind(this))}}.bind(this))}return st(e,Object.keys(d).map(function(t){return i(this,n),st(e,d[t])}.bind(this)))},isHiddenTargetWithYDomain:function(t){var e=this,n=this;return n.state.hiddenTargetIds.some(function(a){return i(this,e),n.axis.getId(a)===t}.bind(this))},getYDomain:function(t,e,n){var a=this,r=this,s=r.axis,o=r.config,l=r.scale,c="axis_"+e;if(r.isStackNormalized())return[0,100];var d=(null==l?void 0:l[e])&&"log"===l[e].type,u=t.filter(function(t){return i(this,a),s.getId(t.id)===e}.bind(this)),h=n?r.filterByXDomain(u,n):u;if(0===h.length)return r.isHiddenTargetWithYDomain(e)?l[e].domain():"y2"===e?l.y.domain():r.getYDomain(t,"y2",n);var f=o[c+"_min"],p=o[c+"_max"],v=o[c+"_center"],b=o[c+"_inverted"],_=r.hasDataLabel()&&o.axis_rotated,m=r.hasDataLabel()&&!o.axis_rotated,y=r.getYDomainMinMax(h,"min"),T=r.getYDomainMinMax(h,"max"),w=[g.BAR,g.BUBBLE,g.SCATTER].concat(x.Line).some(function(t){i(this,a);var e=t.indexOf("area")>-1?"area":t;return r.hasType(t,h,!0)&&o[e+"_zerobased"]}.bind(this));y=S(f)?f:S(p)?y<=p?y:p-10:y,T=S(p)?p:S(f)?f<=T?T:f+10:T,isNaN(y)&&(y=0),isNaN(T)&&(T=y),y===T&&(y<0?T=0:y=0);var A=y>=0&&T>=0,k=y<=0&&T<=0;(S(f)&&A||S(p)&&k)&&(w=!1),w&&(A&&(y=0),k&&(T=0));var C=Math.abs(T-y),R={top:.1*C,bottom:.1*C};if(L(v)){var E=Math.max(Math.abs(y),Math.abs(T));T=v+E,y=v-E}if(_){var O=D(l.y.range()),P=r.getDataLabelLength(y,T,"width").map(function(t){return i(this,a),t/O}.bind(this));["bottom","top"].forEach(function(t,e){i(this,a),R[t]+=C*(P[e]/(1-P[0]-P[1]))}.bind(this))}else if(m){var I=r.getDataLabelLength(y,T,"height");["bottom","top"].forEach(function(t,e){i(this,a),R[t]+=r.convertPixelToScale("y",I[e],C)}.bind(this))}R=r.getResettedPadding(R);var z=o[c+"_padding"];$(z)&&["bottom","top"].forEach(function(t){i(this,a),R[t]=s.getPadding(z,t,R[t],C)}.bind(this)),w&&(A&&(R.bottom=y),k&&(R.top=-T));var M=d?[y,T].map(function(t){return i(this,a),t<0?0:t}.bind(this)):[y-R.bottom,T+R.top];return b?M.reverse():M},getXDomainMinMax:function(t,e){var n,a=this,r=this.config["axis_x_"+e],s=st(e,t.map(function(t){var n=this;return i(this,a),st(e,t.values.map(function(t){return i(this,n),t.x}.bind(this)))}.bind(this))),o=F(r)?r.value:r;return o=L(o)&&null!=(n=this.axis)&&n.isTimeSeries()?dt.bind(this)(o):o,F(r)&&r.fit&&("min"===e&&os)&&(o=void 0),L(o)?o:s},getXDomainPadding:function(t,e){var i,n=this,a=n.axis,r=n.config.axis_x_padding,s=a.isTimeSeries()&&e,o=D(t);if(a.isCategorized()||s)i=0;else if(n.hasType("bar")){var l=n.getMaxDataCount();i=l>1?o/(l-1)/2:.5}else i=n.getResettedPadding(.01*o);var c=R(r)?{left:r,right:r}:r,d=c.left,u=void 0===d?i:d,h=c.right,g=void 0===h?i:h;if("px"===r.unit){var f=Math.abs(o+.2*o);u=a.getPadding(r,"left",i,f),g=a.getPadding(r,"right",i,f)}else{var p=o+u+g;if(s&&p){var v=o/e/p;u=u/p/v,g=g/p/v}}return{left:u,right:g}},getXDomain:function(t){var e=this,i=e.axis,n=e.config,a=e.scale.x,r=n.axis_x_inverted,s=[e.getXDomainMinMax(t,"min"),e.getXDomainMinMax(t,"max")],o=s[0],l=void 0===o?0:o,c=s[1],d=void 0===c?0:c;if("log"!==a.type){var u=i.isCategorized(),h=i.isTimeSeries(),g=e.getXDomainPadding(s),f=s[0],p=s[1];f-p!=0||u||(h?(f=new Date(.5*f.getTime()),p=new Date(1.5*p.getTime())):(f=0===f?1:.5*f,p=0===p?-1:1.5*p)),(f||0===f)&&(l=h?new Date(f.getTime()-g.left):f-g.left),(p||0===p)&&(d=h?new Date(p.getTime()+g.right):p+g.right)}return r?[d,l]:[l,d]},updateXDomain:function(t,e,i,n,a){var r,s=this,o=s.config,l=s.org,c=s.scale,d=c.x,u=c.subX,h=o.zoom_enabled;i&&(d.domain(a||rt(s.getXDomain(t),!o.axis_x_inverted)),l.xDomain=d.domain(),h&&s.zoom.updateScaleExtent(),u.domain(d.domain()),null==(r=s.brush)||r.scale(u));if(e){var g=a||!s.brush||K(s)?l.xDomain:W(s).map(u.invert);d.domain(g),h&&s.zoom.updateScaleExtent()}return n&&d.domain(s.trimXDomain(d.orgDomain())),d.domain()},trimXDomain:function(t){var e=this.config.axis_x_inverted,i=this.getZoomDomain(),n=i[0],a=i[1];return(e?t[0]>=n:t[0]<=n)&&(t[0]=n,t[1]=+t[1]+(n-t[0])),(e?t[1]<=a:t[1]>=a)&&(t[0]=+t[0]-(t[1]-a),t[1]=a),t},getZoomDomain:function(){var t=this.config,e=this.org.xDomain,i=e[0],n=e[1];return L(t.zoom_x_min)&&(i=st("min",[i,t.zoom_x_min])),L(t.zoom_x_max)&&(n=st("max",[n,t.zoom_x_max])),[i,n]},convertPixelToScale:function(t,e,i){var n=this.config,a=this.state,r=n.axis_rotated;return i*(e/a["x"===t?r?"height":"width":r?"width":"height"])}};function Be(t,e,i){var n=t.config,a="axis_"+e+"_tick_format";return(n[a]?n[a]:t.defaultValueFormat).call(t.api,i)}var Ne={yFormat:function(t){return Be(this,"y",t)},y2Format:function(t){return Be(this,"y2",t)},getDefaultValueFormat:function(){var t=this,e=t.defaultArcValueFormat,i=t.yFormat,n=t.y2Format,a=t.hasArcType(null,["gauge","polar","radar"]);return function(r,s,o){return(a?e:t.axis&&"y2"===t.axis.getId(o)?n:i).call(t,r,s)}},defaultValueFormat:function(t){return S(t)?+t:""},defaultArcValueFormat:function(t,e){return(100*e).toFixed(1)+"%"},defaultPolarValueFormat:function(t){return""+t},dataLabelFormat:function(t){var e=this,n=this.config.data_labels,a=function(t){return i(this,e),S(t)?+t:""}.bind(this),r=a;return k(n.format)?r=n.format:z(n.format)&&(r=n.format[t]?!0===n.format[t]?a:n.format[t]:function(){return i(this,e),""}.bind(this)),r.bind(this.api)}};function Ge(t){var e=this,i=e.getDataById(t);return e.levelColor?e.levelColor(i.values[0].value):e.color(i)}var je={initLegend:function(){var t=this,e=t.config,i=t.$el;t.legendItemTextBox={},t.state.legendHasRendered=!1,e.legend_show?(e.legend_contents_bindto||(i.legend=t.$el.svg.append("g").classed(kt.legend,!0).attr("transform",t.getTranslate("legend"))),t.updateLegend()):t.state.hiddenLegendIds=t.mapToIds(t.data.targets)},updateLegend:function(t,e,i){var n,a=this,r=a.config,s=a.state,o=a.scale,l=a.$el,c=e||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};c.withTransition=B(c,"withTransition",!0),c.withTransitionForTransform=B(c,"withTransitionForTransform",!0),r.legend_contents_bindto&&r.legend_contents_template?a.updateLegendTemplate():s.hasTreemap||a.updateLegendElement(t||a.mapToIds(a.data.targets),c,i),null==(n=l.legend)||n.selectAll("."+kt.legendItem).classed(kt.legendItemHidden,(function(t){var e=!a.isTargetToShow(t);return e&&(this.style.opacity=null),e})),a.updateScales(!1,!o.zoom),a.updateSvgSize(),a.transformAll(c.withTransitionForTransform,i),s.legendHasRendered=!0},updateLegendTemplate:function(){var t=this,e=this,n=e.config,r=e.$el,s=(0,a.select)(n.legend_contents_bindto),o=n.legend_contents_template;if(!s.empty()){var l=e.mapToIds(e.data.targets),c=[],d="";l.forEach(function(n){i(this,t);var a=k(o)?o.bind(e.api)(n,e.color(n),e.api.data(n)[0].values):ct(o,{COLOR:e.color(n),TITLE:n});a&&(c.push(n),d+=a)}.bind(this));var u=s.html(d).selectAll((function(){return this.childNodes})).data(c);e.setLegendItem(u),r.legend=s}},updateSizeForLegend:function(t){var e=this,i=e.config,n=e.state,a=n.isLegendTop,r=n.isLegendLeft,s=n.isLegendRight,o=n.isLegendInset,l=n.current,c=t.width,d=t.height,u={top:a?e.getCurrentPaddingTop()+i.legend_inset_y+5.5:l.height-d-e.getCurrentPaddingBottom()-i.legend_inset_y,left:r?e.getCurrentPaddingLeft()+i.legend_inset_x+.5:l.width-c-e.getCurrentPaddingRight()-i.legend_inset_x+.5};e.state.margin3={top:s?0:o?u.top:l.height-d,right:NaN,bottom:0,left:s?l.width-c:o?u.left:0}},transformLegend:function(t){var e=this,i=e.$el.legend;(0,e.$T)(i,t).attr("transform",e.getTranslate("legend"))},updateLegendStep:function(t){this.state.legendStep=t},updateLegendItemWidth:function(t){this.state.legendItemWidth=t},updateLegendItemHeight:function(t){this.state.legendItemHeight=t},updateLegendItemColor:function(t,e){var i=this.$el.legend;i&&i.select("."+kt.legendItem+"-"+t+" line").style("stroke",e)},getLegendWidth:function(){var t=this.state,e=t.current.width,i=t.isLegendRight,n=t.isLegendInset,a=t.legendItemWidth,r=t.legendStep;return this.config.legend_show?i||n?a*(r+1):e:0},getLegendHeight:function(){var t,e=this,i=e.state,n=i.current,a=i.isLegendRight,r=i.legendItemHeight,s=i.legendStep,o="fit"===(null==(t=e.config.padding)?void 0:t.mode);return e.config.legend_show?a?n.height:(o?10:Math.max(20,r))*(s+1):0},opacityForUnfocusedLegend:function(t){return t.classed(kt.legendItemHidden)?null:"0.3"},toggleFocusLegend:function(t,e){var n=this,r=this,s=r.$el.legend,o=r.$T,l=r.mapToTargetIds(t);s&&o(s.selectAll("."+kt.legendItem).filter(function(t){return i(this,n),l.indexOf(t)>=0}.bind(this)).classed(Et.legendItemFocused,e)).style("opacity",(function(){return e?null:r.opacityForUnfocusedLegend.call(r,(0,a.select)(this))}))},revertLegend:function(){var t=this.$el.legend,e=this.$T;t&&e(t.selectAll("."+kt.legendItem).classed(Et.legendItemFocused,!1)).style("opacity",null)},showLegend:function(t){var e=this,i=e.config,n=e.$el,a=e.$T;i.legend_show||(i.legend_show=!0,n.legend?n.legend.style("visibility",null):e.initLegend(),e.state.legendHasRendered||e.updateLegend()),e.removeHiddenLegendIds(t),a(n.legend.selectAll(e.selectorLegends(t)).style("visibility",null)).style("opacity",null)},hideLegend:function(t){var e=this,i=e.config,n=e.$el.legend;i.legend_show&&M(t)&&(i.legend_show=!1,n.style("visibility","hidden")),e.addHiddenLegendIds(t),n.selectAll(e.selectorLegends(t)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox:function(t,e){var i,n=this,a=n.cache,r=n.state,s=ce;return t&&((i=!r.redrawing&&a.get(s)||{})[t]||(i[t]=n.getTextRect(e,kt.legendItem),a.add(s,i)),i=i[t]),i},setLegendItem:function(t){var e=this,n=this,r=n.$el,s=n.api,o=n.config,l=n.state,c="touch"===l.inputType,d=n.hasType("gauge"),u=o.boost_useCssRule,h=o.legend_item_interaction;t.attr("class",(function(t){var e=(0,a.select)(this);return(!e.empty()&&e.attr("class")||"")+n.generateClass(kt.legendItem,t)})).style("visibility",function(t){return i(this,e),n.isLegendToShow(t)?null:"hidden"}.bind(this)),o.interaction_enabled&&(u&&[["."+kt.legendItem,"cursor:pointer"],["."+kt.legendItem+" text","pointer-events:none"],["."+kt.legendItemPoint+" text","pointer-events:none"],["."+kt.legendItemTile,"pointer-events:none"],["."+kt.legendItemEvent,"fill-opacity:0"]].forEach(function(t){i(this,e);var a=t[0],s=t[1];n.setCssRule(!1,a,[s])(r.legend)}.bind(this)),t.on(h.dblclick?"dblclick":"click",h||k(o.legend_item_onclick)?function(t,e){if(!N(o.legend_item_onclick,s,e)){var i=t.altKey,r=t.target;"dblclick"===t.type||i?l.hiddenTargetIds.length&&-1===r.parentNode.getAttribute("class").indexOf(kt.legendItemHidden)?s.show():(s.hide(),s.show(e)):(s.toggle(e),(0,a.select)(this).classed(Et.legendItemFocused,!1))}c&&n.hideTooltip()}:null),c||t.on("mouseout",h||k(o.legend_item_onout)?function(t,e){N(o.legend_item_onout,s,e)||((0,a.select)(this).classed(Et.legendItemFocused,!1),d&&n.undoMarkOverlapped(n,"."+St.gaugeValue),n.api.revert())}:null).on("mouseover",h||k(o.legend_item_onover)?function(t,e){N(o.legend_item_onover,s,e)||((0,a.select)(this).classed(Et.legendItemFocused,!0),d&&n.markOverlapped(e,n,"."+St.gaugeValue),!l.transiting&&n.isTargetToShow(e)&&s.focus(e))}:null),!t.empty()&&t.on("click mouseout mouseover")&&t.style("cursor",n.getStylePropValue("pointer")))},updateLegendElement:function(t,e){var n,a,r,s=this,o=this,l=o.config,c=o.state,d=o.$el.legend,u=o.$T,h="circle"!==l.legend_item_tile_type,g=l.legend_item_tile_r,f={width:h?l.legend_item_tile_width:2*g,height:h?l.legend_item_tile_height:2*g},p={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:f.width+5,totalLength:0},v={offsets:{},widths:{},heights:{},margins:[0],steps:{}},x=t.filter(function(t){return i(this,s),!L(l.data_names[t])||null!==l.data_names[t]}.bind(this)),b=e.withTransition,_=o.getUpdateLegendPositions(x,p,v);c.isLegendInset&&(p.step=l.legend_inset_step?l.legend_inset_step:x.length,o.updateLegendStep(p.step)),c.isLegendRight?(n=function(t){return i(this,s),p.max.width*v.steps[t]}.bind(this),a=function(t){return i(this,s),v.margins[v.steps[t]]+v.offsets[t]}.bind(this)):c.isLegendInset?(n=function(t){return i(this,s),p.max.width*v.steps[t]+10}.bind(this),a=function(t){return i(this,s),v.margins[v.steps[t]]+v.offsets[t]}.bind(this)):(n=function(t){return i(this,s),v.margins[v.steps[t]]+v.offsets[t]}.bind(this),a=function(t){return i(this,s),p.max.height*v.steps[t]}.bind(this));var m={xText:function(t,e){return i(this,s),n(t,e)+4+f.width}.bind(this),xRect:function(t,e){return i(this,s),n(t,e)}.bind(this),x1Tile:function(t,e){return i(this,s),n(t,e)-2}.bind(this),x2Tile:function(t,e){return i(this,s),n(t,e)-2+f.width}.bind(this),yText:function(t,e){return i(this,s),a(t,e)+9}.bind(this),yRect:function(t,e){return i(this,s),a(t,e)-5}.bind(this),yTile:function(t,e){return i(this,s),a(t,e)+4}.bind(this)};o.generateLegendItem(x,f,_,m),r=d.select("."+kt.legendBackground+" rect"),c.isLegendInset&&p.max.width>0&&0===r.size()&&(r=d.insert("g","."+kt.legendItem).attr("class",kt.legendBackground).append("rect")),u(d.selectAll("text").data(x).text(function(t){return i(this,s),L(l.data_names[t])?l.data_names[t]:t}.bind(this)).each((function(t,e){_(this,t,e)})),b).attr("x",m.xText).attr("y",m.yText),u(d.selectAll("rect."+kt.legendItemEvent).data(x),b).attr("width",function(t){return i(this,s),v.widths[t]}.bind(this)).attr("height",function(t){return i(this,s),v.heights[t]}.bind(this)).attr("x",m.xRect).attr("y",m.yRect),o.updateLegendItemPos(x,b,m),r&&u(r,b).attr("height",o.getLegendHeight()-12).attr("width",p.max.width*(p.step+1)+10),o.updateLegendItemWidth(p.max.width),o.updateLegendItemHeight(p.max.height),o.updateLegendStep(p.step)},getUpdateLegendPositions:function(t,e,n){var a=this,r=a.config,s=a.state,o=s.isLegendRight||s.isLegendInset;return function(l,c,d){var u,h=this,g=d===t.length-1,f=a.getLegendItemTextBox(c,l),p=f.width+e.tileWidth+(g&&!o?0:e.padding.right)+r.legend_padding,v=f.height+e.padding.top,x=o?v:p,b=o?a.getLegendHeight():a.getLegendWidth(),_=function(t,i){i||(u=(b-e.totalLength-x)/2)=e.max.width)&&(e.max.width=p),(!e.max.height||v>=e.max.height)&&(e.max.height=v);var m=o?e.max.height:e.max.width;r.legend_equally?(Object.keys(n.widths).forEach(function(t){return i(this,h),n.widths[t]=e.max.width}.bind(this)),Object.keys(n.heights).forEach(function(t){return i(this,h),n.heights[t]=e.max.height}.bind(this)),(u=(b-m*t.length)/2)1&&d&&(o&&(f+=d*o),g>2?f-=(g-1)*d/2:2===g&&(f-=d/2)),f}.bind(this)},getShapeY:function(t){var e=this,n=this,a=n.isStackNormalized();return function(r){i(this,e);var s=r.value;return R(r)?s=r:a?s=n.getRatio("index",r,!0):n.isBubbleZType(r)?s=n.getBubbleZData(r.value,"y"):n.isBarRangeType(r)&&(s=s[1]),n.getYScaleById(r.id,t)(s)}.bind(this)},getShapeYMin:function(t){var e=this,i=e.axis.getId(t),n=e.scale[i].domain()[0],a=e.config["axis_"+i+"_inverted"];return!e.isGrouped(t)&&!a&&n>0?n:0},getShapeOffsetData:function(t){var e=this,n=this,a=n.orderTargets(n.filterTargetsToShow(n.data.targets.filter(t,n))),r=n.isStackNormalized(),s=a.map(function(t){var a=this;i(this,e);var s=t.values,o={};n.isStepType(t)&&(s=n.convertValuesToStep(s));var l=s.reduce(function(t,e){i(this,a);var s=+e.x;return t[s]=e,o[s]=r?n.getRatio("index",e,!0):e.value,t}.bind(this),{});return{id:t.id,rowValues:s,rowValueMapByXValue:l,values:o}}.bind(this));return{indexMapByTargetId:a.reduce(function(t,n,a){var r=n.id;return i(this,e),t[r]=a,t}.bind(this),{}),shapeOffsetTargets:s}},getShapeOffset:function(t,e,n){var a=this,r=this,s=r.getShapeOffsetData(t),o=s.shapeOffsetTargets,l=s.indexMapByTargetId,c=r.config.data_groupsZeroAs;return function(t,s){var d=this;i(this,a);var u=t.id,h=t.value,g=t.x,f=r.getIndices(e,t),p=r.getYScaleById(u,n);if(r.isBarRangeType(t))return p(h[0]);var v=+g,x=p("zero"===c?0:r.getShapeYMin(u)),b=x;return o.filter(function(t){return i(this,d),t.id!==u&&f[t.id]===f[u]}.bind(this)).forEach(function(t){i(this,d);var e=t.id,n=t.rowValueMapByXValue,a=t.rowValues,r=t.values;if(l[e]=0&&R(g))(0!==h||("positive"===c&&g>0||"negative"===c&&g<0))&&(b+=p(g)-x)}}.bind(this)),b}.bind(this)},getBarW:function(t,e,n){var a=this,r=this,s=r.config,o=r.org,l=r.scale,c=r.getMaxDataCount(),d="bar"===t&&s.data_groups.length,u=t+"_width",h=l.zoom&&!r.axis.isCategorized()?o.xDomain.map(function(t){return i(this,a),l.zoom(t)}.bind(this)).reduce(function(t,e){return i(this,a),Math.abs(t)+e}.bind(this))/c:e.tickInterval(c),g=function(t){i(this,a);var e=t?s[u][t]:s[u],r=t?e.ratio:s[u+"_ratio"],o=t?e.max:s[u+"_max"],l=R(e)?e:n?h*r/n:0;return o&&l>o?o:l}.bind(this),f=g();return!d&&z(s[u])&&(f={_$width:f,_$total:[]},r.filterTargetsToShow(r.data.targets).forEach(function(t){i(this,a),s[u][t.id]&&(f[t.id]=g(t.id),f._$total.push(f[t.id]||f._$width))}.bind(this))),f},getShapeByIndex:function(t,e,n){var a=this,r=this.$el,s=S(e)?"-"+e:"",o=r[t];return o=o&&!o.empty()?o.filter(function(t){return i(this,a),!n||t.id===n}.bind(this)).filter(function(t){return i(this,a),!S(e)||t.index===e}.bind(this)):(n?r.main.selectAll("."+Gt[t+"s"]+this.getTargetSelectorSuffix(n)):r.main).selectAll("."+Gt[t]+s)},isWithinShape:function(t,e){var i,n=this,r=(0,a.select)(t);return n.isTargetToShow(e.id)?null!=n.hasValidPointType&&n.hasValidPointType(t.nodeName)?i=n.isStepType(e)?n.isWithinStep(t,n.getYScaleById(e.id)(e.value)):n.isWithinCircle(t,n.isBubbleType(e)?1.5*n.pointSelectR(e):0):"path"===t.nodeName&&(i=!r.classed(Gt.bar)||n.isWithinBar(t)):i=!1,i},getInterpolate:function(t){var e=this.getInterpolateType(t);return{basis:Ue.curveBasis,"basis-closed":Ue.curveBasisClosed,"basis-open":Ue.curveBasisOpen,bundle:Ue.curveBundle,cardinal:Ue.curveCardinal,"cardinal-closed":Ue.curveCardinalClosed,"cardinal-open":Ue.curveCardinalOpen,"catmull-rom":Ue.curveCatmullRom,"catmull-rom-closed":Ue.curveCatmullRomClosed,"catmull-rom-open":Ue.curveCatmullRomOpen,"monotone-x":Ue.curveMonotoneX,"monotone-y":Ue.curveMonotoneY,natural:Ue.curveNatural,"linear-closed":Ue.curveLinearClosed,linear:Ue.curveLinear,step:Ue.curveStep,"step-after":Ue.curveStepAfter,"step-before":Ue.curveStepBefore}[e]},getInterpolateType:function(t){var e=this,i=e.config,n=i.spline_interpolation_type,a=e.isInterpolationType(n)?n:"cardinal";return e.isSplineType(t)?a:e.isStepType(t)?i.line_step_type:"linear"},isWithinBar:function(t){var e=H(this.state.event,t),i=Y(t),n=i[0],a=i[1],r=Math.min(n.x,a.x),s=Math.min(n.y,a.y),o=this.config.bar_sensitivity,l=t.getBBox(),c=l.width,d=l.height;return r-o0?i:320/(t.hasType("gauge")&&!e.gauge_fullCircle?2:1)},getCurrentPaddingTop:function(){var t=this,e=t.config,i=t.state.hasAxis,n=t.$el,a=i?e.axis_y2_axes.length:0,r=S(e.padding_top)?e.padding_top:0;return n.title&&n.title.node()&&(r+=t.getTitlePadding()),a&&e.axis_rotated&&(r+=t.getHorizontalAxisHeight("y2")*a),r},getCurrentPaddingBottom:function(){var t=this,e=t.config,i=t.state.hasAxis,n=e.axis_rotated?"y":"x",a=i?e["axis_"+n+"_axes"].length:0;return(S(e.padding_bottom)?e.padding_bottom:0)+(a?t.getHorizontalAxisHeight(n)*a:0)},getCurrentPaddingLeft:function(t){var e,i=this,n=i.config,a=i.state.hasAxis,r=n.axis_rotated,s="fit"===(null==(e=n.padding)?void 0:e.mode),o=r?"x":"y",l=a?n["axis_"+o+"_axes"].length:0,c=a?i.getAxisWidthByAxisId(o,t):0;s||(c=P(c));var d=n["axis_"+o+"_inner"]||!n["axis_"+o+"_show"]?0:c;return S(n.padding_left)?d=n.padding_left+(s&&r?c:0):a&&r&&(d=n.axis_x_show?s?c:Math.max(c,40):1),a&&(s||n["axis_"+o+"_inner"])&&n["axis_"+o+"_label"].text&&(d+=i.axis.getAxisLabelPosition("y").isOuter?20:0),d+c*l},getCurrentPaddingRight:function(t){var e,i;void 0===t&&(t=!1);var n=this,a=n.config,r=n.state.hasAxis,s=a.axis_rotated,o="fit"===(null==(e=a.padding)?void 0:e.mode),l=o?2:10,c=n.state.isLegendRight?n.getLegendWidth()+20:0,d=r?a.axis_y2_axes.length:0,u=null!=(i=n.axis)&&i.getAxisLabelPosition("y2").isOuter?20:0,h=t?n.axis.getXAxisTickTextY2Overflow(l):0,g=r&&!a.axis_y2_inner?n.getAxisWidthByAxisId("y2"):1;o||(g=P(g));var f=s?0:Math.max(g+c,h);return S(a.padding_right)?f=a.padding_right+(o&&(s||!a.axis_y2_show?l:f))+(r&&!o?1:0):n.axis&&s?f=l+c:!n.axis||a.axis_y2_show&&!a.axis_y2_inner||(f=Math.max((o&&!a.axis_y2_show?2:1)+c+u,h)),r&&!s&&o&&a.axis_y2_show&&!a.axis_y2_inner&&a.axis_y2_label.text&&(f+=u),f+g*d},getParentRectValue:function(t){for(var e="offset"+Q(t),i=this.$el.chart.node(),n=0;n<30&&i&&"BODY"!==i.tagName;){try{n=i.getBoundingClientRect()[t]}catch(t){e in i&&(n=i[e])}i=i.parentNode}var a=h.body[e];return n>a&&(n=a),n},getParentWidth:function(){return this.getParentRectValue("width")},getParentHeight:function(){var t=this.$el.chart.style("height"),e=0;return t&&(e=/px$/.test(t)?parseInt(t,10):this.getParentRectValue("height")),e},getSvgLeft:function(t){var e=this,i=e.config,n=e.$el,a=i.axis_rotated||!i.axis_rotated&&!i.axis_y_inner,r=i.axis_rotated?_t.axisX:_t.axisY,s=n.main.select("."+r).node(),o=s&&a?s.getBoundingClientRect():{right:0},l=n.chart.node().getBoundingClientRect(),c=e.hasArcType(),d=o.right-l.left-(c?0:e.getCurrentPaddingLeft(t));return d>0?d:0},updateDimension:function(t){var e,i=this,n=i.config,a=i.state.hasAxis,r=i.$el;a&&!t&&i.axis.x&&n.axis_rotated&&(null==(e=i.axis.subX)||e.create(r.axis.subX));i.updateScales(t),i.updateSvgSize(),i.transformAll(!1)},updateSvgSize:function(){var t=this,e=t.state,i=e.clip,n=e.current,a=e.hasAxis,r=e.width,s=e.height,o=t.$el.svg;if(o.attr("width",n.width).attr("height",n.height),a){var l=o.select("."+$t.brush+" .overlay"),c={width:0,height:0};l.size()&&(c.width=+l.attr("width"),c.height=+l.attr("height")),o.selectAll(["#"+i.id,"#"+i.idGrid]).select("rect").attr("width",r).attr("height",s),o.select("#"+i.idXAxis).select("rect").call(t.setXAxisClipPath.bind(t)),o.select("#"+i.idYAxis).select("rect").call(t.setYAxisClipPath.bind(t)),i.idSubchart&&o.select("#"+i.idSubchart).select("rect").attr("width",r).attr("height",c.height)}},getCurrentPadding:function(){var t=this;return{top:t.getCurrentPaddingTop(),bottom:t.getCurrentPaddingBottom(),left:t.getCurrentPaddingLeft(),right:t.getCurrentPaddingRight()}},getResettedPadding:function(t){var e=this,n=this.config,a=R(t),r=a?0:{};return!1===n.padding?a||Object.keys(t).forEach(function(a){i(this,e),r[a]=M(n.data_labels)||!1===n.data_labels||"top"!==a?0:t[a]}.bind(this)):r=t,r},updateSizes:function(t){var e,i=this,n=i.config,a=i.state,r=i.$el.legend,s=n.axis_rotated,o=i.hasArcType()||a.hasTreemap,l="fit"===(null==(e=n.padding)?void 0:e.mode);t||i.setContainerSize();var c={width:r?i.getLegendWidth():0,height:r?i.getLegendHeight():0};!o&&n.axis_x_show&&n.axis_x_tick_autorotate&&i.updateXAxisTickClip();var d=a.isLegendRight||a.isLegendInset?0:c.height,u=s||o?0:i.getHorizontalAxisHeight("x"),h=n.subchart_axis_x_show&&n.subchart_axis_x_tick_text_show?u:30,g=n.subchart_show&&!o?n.subchart_size_height+h:0,f=i.hasType("gauge")&&n.arc_needle_show&&!n.gauge_fullCircle&&!n.gauge_label_show?10:0,p=i.getCurrentPadding();if(a.margin=!o&&s?{top:i.getHorizontalAxisHeight("y2")+p.top,right:o?0:i.getCurrentPaddingRight(!0),bottom:i.getHorizontalAxisHeight("y")+d+p.bottom,left:g+(o?0:p.left)}:{top:(l?0:4)+p.top,right:o?0:i.getCurrentPaddingRight(!0),bottom:f+u+g+d+p.bottom,left:o?0:p.left},a.margin=i.getResettedPadding(a.margin),a.margin2=s?{top:a.margin.top,right:NaN,bottom:20+d,left:i.state.rotatedPadding.left}:{top:a.current.height-g-d,right:NaN,bottom:h+d,left:a.margin.left},a.margin3={top:0,right:NaN,bottom:0,left:0},null==i.updateSizeForLegend||i.updateSizeForLegend(c),a.width=a.current.width-a.margin.left-a.margin.right,a.height=a.current.height-a.margin.top-a.margin.bottom,a.width<0&&(a.width=0),a.height<0&&(a.height=0),a.width2=s?a.margin.left-a.rotatedPadding.left-a.rotatedPadding.right:a.width,a.height2=s?a.height:a.current.height-a.margin2.top-a.margin2.bottom,a.width2<0&&(a.width2=0),a.height2<0&&(a.height2=0),i.hasArcType()){var v=i.hasType("gauge"),x=n.legend_show&&a.isLegendRight;a.arcWidth=a.width-(x?c.width+10:0),a.arcHeight=a.height-(x&&!v?0:10),v&&!n.gauge_fullCircle&&(a.arcHeight+=a.height-i.getPaddingBottomForGauge()),null==i.updateRadius||i.updateRadius()}a.isLegendRight&&o&&(a.margin3.left=a.arcWidth/2+1.1*a.radiusExpanded)}},Ke={setCssRule:function(t,e,n,a){var r=this,s=this,o=s.config,l=s.state,c=l.cssRule,d=l.style;return o.boost_useCssRule?function(o){var l=this;i(this,r),o.each(function(r){var o=this;i(this,l);var u=a&&(null==a?void 0:a.call(s,r)),h=(t?"."+(Mt.shapes+s.getTargetSelectorSuffix(r.id)):"")+e;e in c&&d.sheet.deleteRule(c[h]),s.state.cssRule[h]=function(t,e,n){var a=this,r=t.rootSelctor,s=t.sheet,o=r+" "+function(t){return i(this,a),t.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,".")}.bind(this)(e)+" {"+n.join(";")+"}";return s[s.insertRule?"insertRule":"addRule"](o,s.cssRules.length)}(d,h,n.filter(Boolean).map(function(t){return i(this,o),C(u)&&-1===t.indexOf(":")?t+": "+u:t||""}.bind(this)))}.bind(this))}.bind(this):function(){i(this,r)}.bind(this)},getStylePropValue:function(t){return this.config.boost_useCssRule?null:k(t)?t.bind(this):t}};function Je(t,e,i,n,a){var r,s=t.value,o=this.isCandlestickType(t),l=R(s)&&s<0||o&&!(null!=(r=this.getCandlestickData(t))&&r._isUp),c=e.x,d=e.y;return n?"start"===i?(c+=l?0:8,d+=4):"middle"===i?(c+=8,d-=8):"end"===i&&(l&&(c-=8),d+=4):("start"===i?(c+=4,l&&(d+=16)):"middle"===i?d-=8:"end"===i&&(c-=4,l&&(d+=16)),a&&(d+=l?-17:o?13:7)),{x:c,y:d}}function Qe(t,e){var i,n=this.config.data_labels_position,a=t.id,r=t.index,s=t.value;return null!=(i=k(n)?n.bind(this.api)(e,s,a,r,this.$el.text):(a in n?n[a]:n)[e])?i:0}var ti={opacityForText:function(t){var e=this;return e.isBarType(t)&&!e.meetsLabelThreshold(Math.abs(e.getRatio("bar",t)),"bar")?"0":e.hasDataLabel?null:"0"},initText:function(){var t=this.$el;t.main.select("."+vt.chart).append("g").attr("class",Xt.chartTexts).style("pointer-events",t.treemap?"none":null)},updateTargetsForText:function(t){var e=this,n=this,a=n.getChartClass("Text"),r=n.getClass("texts","id"),s=n.classFocus.bind(n);n.$el.main.select("."+Xt.chartTexts).selectAll("."+Xt.chartText).data(t).attr("class",function(t){return i(this,e),(""+a(t)+s(t)).trim()}.bind(this)).enter().append("g").style("opacity","0").attr("class",a).call(n.setCssRule(!0," ."+Xt.text,["fill","pointer-events:none"],n.updateTextColor)).append("g").attr("class",r)},updateText:function(){var t=this,e=this,n=e.$el,r=e.$T,s=e.config,o=e.axis,l=e.getClass("text","index"),c=s.data_labels.centered,d=n.main.selectAll("."+Xt.texts).selectAll("."+Xt.text).data(e.labelishData.bind(e));r(d.exit()).style("fill-opacity","0").remove(),n.text=d.enter().append("text").merge(d).attr("class",l).attr("text-anchor",function(n){i(this,t);var a=s["axis_"+(null==o?void 0:o.getId(n.id))+"_inverted"]?n.value>0:n.value<0;if(e.isCandlestickType(n)){var r=e.getCandlestickData(n);a=!(null!=r&&r._isUp)}else if(e.isTreemapType(n))return c?"middle":"start";return s.axis_rotated?a?"end":"start":"middle"}.bind(this)).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each((function(t,i,n){var r=(0,a.select)(this),s=t.value;if(e.isBubbleZType(t))s=e.getBubbleZData(s,"z");else if(e.isCandlestickType(t)){var o=e.getCandlestickData(t);o&&(s=o.close)}s=e.isTreemapType(t)?e.treemapDataLabelFormat(t)(r):e.dataLabelFormat(t.id)(s,t.id,i,n),R(s)?this.textContent=s:V(r,s)}))},updateTextColor:function(t){var e,i=this,n=i.config,a=n.data_labels_colors,r=i.isArcType(t)&&!i.isRadarType(t)||i.isTreemapType(t)?null:i.color(t);if(C(a))e=a;else if(F(a)){e=a[(t.data||t).id]}else k(a)&&(e=a.bind(i.api)(r,t));if(i.isCandlestickType(t)&&!k(a)){var s=i.getCandlestickData(t);if(null==s||!s._isUp){var o=n.candlestick_color_down;e=F(o)?o[t.id]:o}}return e||r},updateTextBacgroundColor:function(t){var e=this,i=e.$el,n=e.config.data_labels_backgroundColors,a="";if(C(n)||F(n)){var r=C(n)?"":e.getTargetSelectorSuffix("id"in t?t.id:t.data.id),s=i.defs.select(["filter[id*='labels-bg","']"].join(r));s.size()&&(a="url(#"+s.attr("id")+")")}return a||null},redrawText:function(t,e,i,n){var a=this,r=a.$T,s=a.axis,o=a.config,l=a.state.hasTreemap,c=Z(!0),d=o.axis_rotated,u=o.data_labels.rotate,h=function(t){var e="middle";return t>0&&t<=170?e="end":t>190&&t<=360&&(e="start"),e}(u),g=u?"rotate("+u+")":"";return a.$el.text.style("fill",a.getStylePropValue(a.updateTextColor)).attr("filter",a.updateTextBacgroundColor.bind(a)).style("fill-opacity",i?0:a.opacityForText.bind(a)).each((function(i,f){var p=r(l&&this.childElementCount?this.parentNode:this,!(!n||!this.getAttribute("x")),c),v=o["axis_"+(null==s?void 0:s.getId(i.id))+"_inverted"],x={x:t.bind(this)(i,f),y:e.bind(this)(i,f)};u&&(x=Je.bind(a)(i,x,h,d,v),p.attr("text-anchor",h)),this.childElementCount||u?p.attr("transform","translate("+x.x+" "+x.y+") "+g):p.attr("x",x.x).attr("y",x.y)})),!0},getTextRect:function(t,e){var n=this,r=this,s=t.node?t.node():t;/text/i.test(s.tagName)||(s=s.querySelector("text"));var o=s.textContent,l=ge+"-"+o.replace(/\W/g,"_"),c=r.cache.get(l);return c||(r.$el.svg.append("text").style("visibility","hidden").style("font",(0,a.select)(s).style("font")).classed(e,!0).text(o).call(function(t){i(this,n),c=U(t.node())}.bind(this)).remove(),r.cache.add(l,c)),c},generateXYForText:function(t,e){var n=this,a=this,r=a.state,s=r.hasRadar,o=r.hasTreemap,l=Object.keys(t),c={},d=e?a.getXForText:a.getYForText;return s&&l.push("radar"),o&&l.push("treemap"),l.forEach(function(e){i(this,n),c[e]=a["generateGet"+Q(e)+"Points"](t[e],!1)}.bind(this)),function(t,e){var i=(a.isAreaType(t)?"area":a.isBarType(t)&&"bar")||a.isCandlestickType(t)&&"candlestick"||a.isRadarType(t)&&"radar"||a.isTreemapType(t)&&"treemap"||"line";return d.call(a,c[i](t,e),t,this)}},getCenteredTextPos:function(t,e,i,n){var a=this,r=a.config,s=r.axis_rotated,o=a.isBarType(t),l=a.isTreemapType(t);if(r.data_labels.centered&&(o||l)){var c=U(i);if(o){var d=t.value>=0;if(s){var u=(d?e[1][1]-e[0][1]:e[0][1]-e[1][1])/2+c.width/2;return d?-u-3:u+2}var h=(d?e[0][1]-e[1][1]:e[1][1]-e[0][1])/2+c.height/2;return d?h:-h-2}if(l)return"x"===n?(e[1][0]-e[0][0])/2:(e[1][1]-e[0][1])/2+c.height/2}return 0},getXForText:function(t,e,i){var n,a=this,r=a.config,s=a.state,o=r.axis_rotated,l=a.isTreemapType(e),c=t[0][0];if(a.isCandlestickType(e))o?c=null!=(n=a.getCandlestickData(e))&&n._isUp?t[2][2]+4:t[2][1]-4:c+=(t[1][0]-c)/2;else if(l)c+=r.data_labels.centered?0:5;else if(o){var d=r["axis_"+a.axis.getId(e.id)+"_inverted"],u=a.isBarType(e)?4:6,h=e.value;c=t[2][1],d?c-=u*(h>0?1:-1):c+=u*(h<0?-1:1)}else c=a.hasType("bar")?(t[2][0]+t[0][0])/2:c;if(null===e.value)if(c>s.width){var g=U(i).width;c=s.width-g}else c<0&&(c=4);return(o||l)&&(c+=a.getCenteredTextPos(e,t,i,"x")),c+Qe.call(this,e,"x")},getYForText:function(t,e,i){var n,a=this,r=a.axis,s=a.config,o=a.state,l=s.axis_rotated,c=s["axis_"+(null==r?void 0:r.getId(e.id))+"_inverted"],d=a.isBarType(e),u=a.isTreemapType(e),h=s.point_r,g=U(i),f=e.value,p=3;if(a.isCandlestickType(e))f=a.getCandlestickData(e),l?(n=t[0][0],n+=(t[1][0]-n)/2+p):(n=f&&f._isUp?t[2][2]-p:t[2][1]+4*p,c&&(n+=15*(f._isUp?1:-1)));else if(u)n=t[0][1]+(s.data_labels.centered?0:g.height+5);else if(l)n=(t[0][0]+t[2][0]+.6*g.height)/2;else if(n=t[2][1],R(h)&&h>5&&(a.isLineType(e)||a.isScatterType(e))&&(p+=s.point_r/2.3),f<0||0===f&&!o.hasPositiveValue&&o.hasNegativeValue)n+=c?d?-3:-5:g.height+(d?-p:p);else{var v=2*-p;d?v=-p:a.isBubbleType(e)&&(v=p),c&&(v=d?10:15),n+=v}if(null===e.value&&!l){var x=g.height;no.height&&(n=o.height-4)}return l&&!u||(n+=a.getCenteredTextPos(e,t,i,"y")),n+Qe.call(this,e,"y")},markOverlapped:function(t,e,n){var r=this,s=e.$el.arcs.selectAll(n),o=s.filter(function(e){return i(this,r),e.data.id!==t}.bind(this)),l=s.filter(function(e){return i(this,r),e.data.id===t}.bind(this)),c=et(l.node()),d=function(t,e){return i(this,r),Math.sqrt(Math.pow(t,2)+Math.pow(e,2))}.bind(this);l.node()&&o.each((function(){var t=et(this),e=(0,a.select)(this),i=d(c.e,c.f)>d(t.e,t.f)?l:e,n=Math.ceil(Math.abs(c.e-t.e))=(this.config[e+"_label_threshold"]||0)}};function ei(t,e){void 0===t&&(t="left");var i=R(e);return t.indexOf("center")>-1?i?e/2:"middle":t.indexOf("right")>-1?i?e:"end":i?0:"start"}var ii={initTitle:function(){var t=this.config,e=this.$el;t.title_text&&(e.title=e.svg.append("g"),V(e.title.append("text").style("text-anchor",ei(t.title_position)).attr("class",Xt.title),t.title_text,[.3,1.5]))},redrawTitle:function(){var t=this,e=t.config,i=t.state.current,n=t.$el.title;if(n){var a=t.yForTitle.call(t);/g/i.test(n.node().tagName)?n.attr("transform","translate("+ei(e.title_position,i.width)+", "+a+")"):n.attr("x",t.xForTitle.call(t)).attr("y",a)}},xForTitle:function(){var t,e=this,i=e.config,n=e.state.current,a=i.title_position||"left",r=e.getTextRect(e.$el.title,Xt.title).width;return/(right|center)/.test(a)?(t=n.width-r,a.indexOf("right")>=0?t=n.width-r-i.title_padding.right:a.indexOf("center")>=0&&(t=(n.width-r)/2)):t=i.title_padding.left||0,t},yForTitle:function(){var t=this;return(t.config.title_padding.top||0)+t.getTextRect(t.$el.title,Xt.title).height},getTitlePadding:function(){return this.yForTitle()+(this.config.title_padding.bottom||0)}},ni={initTooltip:function(){var t=this,e=t.config,i=t.$el;i.tooltip=(0,a.select)(e.tooltip_contents.bindto),i.tooltip.empty()&&(i.tooltip=i.chart.append("div").attr("class",Ft.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),t.bindTooltipResizePos()},initShowTooltip:function(){var t=this,e=this,n=e.config,a=e.$el,r=e.state,s=r.hasAxis,o=r.hasRadar;if(n.tooltip_init_show){var l,c,d=!(s&&o);if(null!=(l=e.axis)&&l.isTimeSeries()&&C(n.tooltip_init_x)){var u,h,g=e.data.targets[0];for(n.tooltip_init_x=dt.call(e,n.tooltip_init_x),u=0;(h=g.values[u])&&h.x-n.tooltip_init_x!=0;u++);n.tooltip_init_x=u}var f=e.data.targets.map(function(a){i(this,t);var r=d?0:n.tooltip_init_x;return e.addName(a.values[r])}.bind(this));d&&(f=[f[n.tooltip_init_x]]),a.tooltip.html(e.getTooltipHTML(f,null==(c=e.axis)?void 0:c.getXAxisTickFormat(),e.getDefaultValueFormat(),e.color)),n.tooltip_contents.bindto||a.tooltip.style("top",n.tooltip_init_position.top).style("left",n.tooltip_init_position.left).style("display",null)}},getTooltipHTML:function(){var t=this,e=t.api,i=t.config;return k(i.tooltip_contents)?i.tooltip_contents.bind(e).apply(void 0,arguments):t.getTooltipContent.apply(t,arguments)},getTooltipContent:function(t,e,n,a){var r=this,s=this,o=s.api,l=s.config,c=s.state,d=s.$el,u=["title","name","value"].map(function(t){i(this,r);var e=l["tooltip_format_"+t];return k(e)?e.bind(o):e}.bind(this)),h=u[0],g=u[1],f=u[2];h=h||e,g=g||function(t){return i(this,r),t}.bind(this),f=f||(c.hasTreemap||s.isStackNormalized()?function(t,e){return i(this,r),(100*e).toFixed(2)+"%"}.bind(this):n);var p=l.tooltip_order,v=function(t){return i(this,r),s.axis&&s.isBubbleZType(t)?s.getBubbleZData(t.value,"z"):s.getBaseValue(t)}.bind(this),x=s.levelColor?function(t){return i(this,r),s.levelColor(t.value)}.bind(this):function(t){return i(this,r),a(t)}.bind(this),b=l.tooltip_contents,_=b.template,m=s.mapToTargetIds();if(null===p&&l.data_groups.length){var y=s.orderTargets(s.data.targets).map(function(t){return i(this,r),t.id}.bind(this)).reverse();t.sort(function(t,e){i(this,r);var n=t?t.value:null,a=e?e.value:null;return n>0&&a>0&&(n=t.id?y.indexOf(t.id):null,a=e.id?y.indexOf(e.id):null),n-a}.bind(this))}else/^(asc|desc)$/.test(p)?t.sort(function(t,e){i(this,r);var n=t?v(t):null,a=e?v(e):null;return"asc"===p?n-a:a-n}.bind(this)):k(p)&&t.sort(p.bind(o));var T,w,A,C,R,L=s.getTooltipContentTemplate(_),O=t.length,P=function(){var e=this;if(!(w=t[R])||!v(w)&&0!==v(w))return"continue";if(E(T)){var n=(c.hasAxis||c.hasRadar)&&j(h?h(w.x):w.x);T=ct(L[0],{CLASS_TOOLTIP:Ft.tooltip,TITLE:S(n)?_?n:''+n+"":""})}if(!w.ratio&&d.arcs&&(A=["arc",s.$el.arcs.select("path."+xt.arc+"-"+w.id).data()[0]],w.ratio=s.getRatio.apply(s,A)),A=[w.ratio,w.id,w.index,t],C=j(f.apply(void 0,[v(w)].concat(A))),s.isAreaRangeType(w)){var a=["high","low"].map(function(t){return i(this,e),j(f.apply(void 0,[s.getRangedData(w,t)].concat(A)))}.bind(this)),r=a[0],o=a[1];C="Mid: "+C+" High: "+r+" Low: "+o}else if(s.isCandlestickType(w)){var l=["open","high","low","close","volume"].map(function(t){return i(this,e),j(f.apply(void 0,[s.getRangedData(w,t,"candlestick")].concat(A)))}.bind(this)),u=l[0],p=l[1],y=l[2],k=l[3],O=l[4];C="Open: "+u+" High: "+p+" Low: "+y+" Close: "+k+(O?" Volume: "+O:"")}else if(s.isBarRangeType(w)){var P=w.value,I=P[0],D=P[1];C=f(I)+" ~ "+f(D)}if(void 0!==C){if(null===w.name)return"continue";var z=j(g.apply(void 0,[w.name].concat(A))),M=x(w),$={CLASS_TOOLTIP_NAME:Ft.tooltipName+s.getTargetSelectorSuffix(w.id),COLOR:_||!s.patterns?M:'',NAME:z,VALUE:C};if(_&&F(b.text)){var X=m.indexOf(w.id);Object.keys(b.text).forEach(function(t){i(this,e),$[t]=b.text[t][X]}.bind(this))}T+=ct(L[1],$)}};for(R=0;R"},getTooltipContentTemplate:function(t){return(t||'\n\t\t\t\t{=TITLE}\n\t\t\t\t{{\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}}\n\t\t\t
'+(this.patterns?"{=COLOR}":'')+'{=NAME}{=VALUE}
').replace(/(\r?\n|\t)/g,"").split(/{{(.*)}}/)},tooltipPosition:function(t,e,n,a){var r=this,s=this,o=s.config,l=s.scale,c=s.state,d=c,u=d.width,h=d.height,g=d.current,f=d.isLegendRight,p=d.inputType,v=d.event,x=s.hasType("gauge")&&!o.gauge_fullCircle,b=c.hasTreemap,_=o.axis_rotated,m=s.getSvgLeft(!0),y=m+g.width-s.getCurrentPaddingRight(),T=s.getCurrentPaddingLeft(!0),w=H(v,a),A=w[0],S=w[1];if(s.hasArcType())"touch"===p||s.hasType("radar")||(S+=x?h:h/2,A+=(u-(f?s.getLegendWidth():0))/2);else if(!b){var k=l.x(t[0].x);_?(S=k+20,A+=m,y-=m):(S-=5,A=m+T+20+(l.zoom?A:k))}(A+e+15>y&&(A-=_?e-T:e+(b?0:T)),S+n>g.height)&&(S-=x?3*n:n+(b?0:30));var C={top:S,left:A};return Object.keys(C).forEach(function(t){i(this,r),C[t]<0&&(C[t]=0)}.bind(this)),C},showTooltip:function(t,e){var n=this,a=this,r=a.config,s=a.scale,o=a.state,l=a.$el.tooltip,c=r.tooltip_contents.bindto,d=t.filter(function(t){return i(this,n),t&&S(a.getBaseValue(t))}.bind(this));if(l&&0!==d.length&&r.tooltip_show){var u=l.datum(),h=u||{},g=h.width,f=void 0===g?0:g,p=h.height,v=void 0===p?0:p,x=JSON.stringify(t);if(!u||u.current!==x){var b=t.concat().sort()[0].index;N(r.tooltip_onshow,a.api,t),l.html(a.getTooltipHTML(t,a.axis?a.axis.getXAxisTickFormat():a.categoryName.bind(a),a.getDefaultValueFormat(),a.color)).style("display",null).style("visibility",null).datum(u={index:b,current:x,width:f=l.property("offsetWidth"),height:v=l.property("offsetHeight")}),N(r.tooltip_onshown,a.api,t),a._handleLinkedCharts(!0,b)}if(!c){var _,m,y=(null==(_=r.tooltip_position)?void 0:_.bind(a.api))||a.tooltipPosition.bind(a),T=H(o.event,e),w={x:T[0],y:T[1]},A=null==(m=t.filter(Boolean))?void 0:m.shift();s.x&&A&&"x"in A&&(w.xAxis=s.x(A.x));var k=y(d,f,v,e,w);["top","left"].forEach(function(t){i(this,n);var e=k[t];l.style(t,e+"px"),"left"!==t||u.xPosInPercent||(u.xPosInPercent=e/o.current.width*100)}.bind(this))}}},bindTooltipResizePos:function(){var t=this,e=this,n=e.resizeFunction,a=e.state,r=e.$el.tooltip;n.add(function(){if(i(this,t),"block"===r.style("display")){var e=a.current,n=r.datum(),s=n.width,o=n.xPosInPercent,l=e.width/100*o,c=e.width-(l+s);c<0&&(l+=c),r.style("left",l+"px")}}.bind(this))},hideTooltip:function(t){var e=this,i=e.api,n=e.config,a=e.$el.tooltip;if(a&&"none"!==a.style("display")&&(!n.tooltip_doNotHide||t)){var r=JSON.parse(a.datum().current);N(n.tooltip_onhide,i,r),a.style("display","none").style("visibility","hidden").datum(null),N(n.tooltip_onhidden,i,r)}},_handleLinkedCharts:function(t,e){var n=this,a=this,r=a.charts,s=a.config,o=a.state.event;if(null!=o&&o.isTrusted&&s.tooltip_linked&&r.length>1){var l=s.tooltip_linked_name;r.filter(function(t){return i(this,n),t!==a.api}.bind(this)).forEach(function(a){i(this,n);var r=a.internal,s=r.config,o=r.$el,c=s.tooltip_linked,d=s.tooltip_linked_name,u=h.body.contains(o.chart.node());if(c&&l===d&&u){var g=o.tooltip.data()[0],f=e!==(null==g?void 0:g.index);try{a.tooltip[t&&f?"show":"hide"]({index:e})}catch(t){}}}.bind(this))}}},ai={getTranslate:function(t,e){void 0===e&&(e=0);var i,n,a=this,r=a.config,s=a.state,o=r.axis_rotated,l=0;if(e&&/^(x|y2?)$/.test(t)&&(l=a.getAxisSize(t)*e),"main"===t)i=I(s.margin.left),n=I(s.margin.top);else if("context"===t)i=I(s.margin2.left),n=I(s.margin2.top);else if("legend"===t)i=s.margin3.left,n=s.margin3.top;else if("x"===t)i=o?-l:0,n=o?0:s.height+l;else if("y"===t)i=o?0:-l,n=o?s.height+l:0;else if("y2"===t)i=o?0:s.width+l,n=o&&l?1-l:0;else if("subX"===t)i=0,n=o?0:s.height2;else if("arc"===t)i=s.arcWidth/2,n=s.arcHeight/2;else if("polar"===t)i=s.arcWidth/2,n=s.arcHeight/2;else if("radar"===t){var c=a.getRadarSize()[0];i=s.width/2-c,n=I(s.margin.top)}return"translate("+i+", "+n+")"},transformMain:function(t,e){var i=this,n=i.$el.main,a=i.$T,r=null!=e&&e.axisX?e.axisX:a(n.select("."+_t.axisX),t),s=null!=e&&e.axisY?e.axisY:a(n.select("."+_t.axisY),t),o=null!=e&&e.axisY2?e.axisY2:a(n.select("."+_t.axisY2),t);a(n,t).attr("transform",i.getTranslate("main")),r.attr("transform",i.getTranslate("x")),s.attr("transform",i.getTranslate("y")),o.attr("transform",i.getTranslate("y2")),n.select("."+xt.chartArcs).attr("transform",i.getTranslate("arc"))},transformAll:function(t,e){var i=this,n=i.config,a=i.state,r=a.hasAxis,s=a.hasTreemap,o=i.$el;s||i.transformMain(t,e),r&&n.subchart_show&&i.transformContext(t,e),o.legend&&i.transformLegend(t)}},ri={isValidChartType:function(t){return!!(t&&Object.values(g).indexOf(t)>-1)},setTargetType:function(t,e){var n=this,a=this,r=a.config,s=a.state.withoutFadeIn;a.mapToTargetIds(t).forEach(function(t){i(this,n),s[t]=e===r.data_types[t],r.data_types[t]=e}.bind(this)),t||(r.data_type=e)},updateTypesElements:function(){var t=this,e=this,n=e.state.current;Object.keys(g).forEach(function(a){i(this,t);var r=g[a],s=e.hasType(r,null,!0),o=n.types.indexOf(r);-1===o&&s?n.types.push(r):o>-1&&!s&&n.types.splice(o,1)}.bind(this)),e.setChartElements()},hasType:function(t,e,n){var a,r=this;void 0===n&&(n=!1);var s=this,o=s.config,l=s.state.current,c=o.data_types,d=e||s.data.targets,u=!1;return!n&&(null==(a=l.types)?void 0:a.indexOf(t))>-1?u=!0:null!=d&&d.length?d.forEach(function(e){i(this,r);var n=c[e.id];(n===t||!n&&"line"===t)&&(u=!0)}.bind(this)):Object.keys(c).length?Object.keys(c).forEach(function(e){i(this,r),c[e]===t&&(u=!0)}.bind(this)):u=o.data_type===t,u},hasTypeOf:function(t,e,n){var a=this;return void 0===n&&(n=[]),t in x&&!x[t].filter(function(t){return i(this,a),-1===n.indexOf(t)}.bind(this)).every(function(t){return i(this,a),!this.hasType(t,e)}.bind(this))},isTypeOf:function(t,e){var i=C(t)?t:t.id,n=this.config.data_types[i]||this.config.data_type;return X(e)?e.indexOf(n)>=0:n===e},hasPointType:function(){var t=this;return t.hasTypeOf("Line")||t.hasType("bubble")||t.hasType("scatter")},hasArcType:function(t,e){return this.hasTypeOf("Arc",t,e)},hasMultiArcGauge:function(){return this.hasType("gauge")&&"multi"===this.config.gauge_type},isLineType:function(t){var e=C(t)?t:t.id;return!this.config.data_types[e]||this.isTypeOf(e,x.Line)},isStepType:function(t){return this.isTypeOf(t,x.Step)},isSplineType:function(t){return this.isTypeOf(t,x.Spline)},isAreaType:function(t){return this.isTypeOf(t,x.Area)},isAreaRangeType:function(t){return this.isTypeOf(t,x.AreaRange)},isBarType:function(t){return this.isTypeOf(t,"bar")},isBubbleType:function(t){return this.isTypeOf(t,"bubble")},isCandlestickType:function(t){return this.isTypeOf(t,"candlestick")},isScatterType:function(t){return this.isTypeOf(t,"scatter")},isTreemapType:function(t){return this.isTypeOf(t,"treemap")},isPieType:function(t){return this.isTypeOf(t,"pie")},isGaugeType:function(t){return this.isTypeOf(t,"gauge")},isDonutType:function(t){return this.isTypeOf(t,"donut")},isPolarType:function(t){return this.isTypeOf(t,"polar")},isRadarType:function(t){return this.isTypeOf(t,"radar")},isArcType:function(t){return this.isPieType(t)||this.isDonutType(t)||this.isGaugeType(t)||this.isPolarType(t)||this.isRadarType(t)},isCirclePoint:function(t){var e=this.config,i=e.point_pattern;return"circle"===(null==t?void 0:t.tagName)||"circle"===e.point_type&&(!i||X(i)&&0===i.length)},lineData:function(t){return this.isLineType(t)?[t]:[]},arcData:function(t){return this.isArcType(t.data)?[t]:[]},labelishData:function(t){var e=this;return this.isBarType(t)||this.isLineType(t)||this.isScatterType(t)||this.isBubbleType(t)||this.isCandlestickType(t)||this.isRadarType(t)||this.isTreemapType(t)?t.values.filter(function(t){return i(this,e),R(t.value)||!!t.value}.bind(this)):[]},barLineBubbleData:function(t){return this.isBarType(t)||this.isLineType(t)||this.isBubbleType(t)?t.values:[]},isInterpolationType:function(t){return["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"].indexOf(t)>=0}},si=function(){function t(t){this.api=void 0,this.config=void 0,this.cache=void 0,this.$el=void 0,this.state=void 0,this.charts=void 0,this.data={xs:{},targets:[]},this.axis=void 0,this.scale={x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null},this.org={xScale:null,xDomain:null},this.color=void 0,this.patterns=void 0,this.levelColor=void 0,this.point=void 0,this.brush=void 0,this.format={extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null};var e=this;e.api=t,e.config=new ne,e.cache=new fe;var i=new Vt;e.$el=i.getStore("element"),e.state=i.getStore("state"),e.$T=e.$T.bind(e)}var e=t.prototype;return e.$T=function(t,e,i){var n=this.config,r=this.state,s=n.transition_duration,o=n.subchart_show,l=t;l&&("tagName"in l&&(l=(0,a.select)(l)),l=(!1!==e&&s||e)&&(!r.zooming||r.dragging)&&!r.resizing&&r.rendered&&!o?l.transition(i).duration(s):l);return l},e.beforeInit=function(){var t=this;t.callPluginHook("$beforeInit"),N(t.config.onbeforeinit,t.api)},e.afterInit=function(){var t=this;t.callPluginHook("$afterInit"),N(t.config.onafterinit,t.api)},e.init=function(){var t=this,e=t.config,i=t.state,n=t.$el,r=e.boost_useCssRule;if(gt(t),i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!t.hasArcType()&&!i.hasTreemap,i.datetimeId="bb-"+ +new Date*Z(),r){var s=h.createElement("style");s.type="text/css",h.head.appendChild(s),i.style={rootSelctor:"."+i.datetimeId,sheet:s.sheet},n.style=s}var o={element:e.bindto,classname:"bb"};F(e.bindto)&&(o.element=e.bindto.element||"#chart",o.classname=e.bindto.classname||o.classname),n.chart=k(o.element.node)?e.bindto.element:(0,a.select)(o.element||[]),n.chart.empty()&&(n.chart=(0,a.select)(h.body.appendChild(h.createElement("div")))),n.chart.html("").classed(o.classname,!0).classed(i.datetimeId,r).style("position","relative"),t.initParams(),t.initToRender()},e.initToRender=function(t){var e=this,n=this,a=n.config,r=n.state,o=n.$el.chart,l=function(){return i(this,e),"none"===o.style("display")||"hidden"===o.style("visibility")}.bind(this),c=a.render.lazy||l(),d=s.MutationObserver;c&&d&&!1!==a.render.observe&&!t&&new d(function(t,a){i(this,e),l()||(a.disconnect(),r.rendered||n.initToRender(!0))}.bind(this)).observe(o.node(),{attributes:!0,attributeFilter:["class","style"]}),c&&!t||n.convertData(a,function(t){i(this,e),n.initWithData(t),n.afterInit()}.bind(this))},e.initParams=function(){var t=this,e=this,a=e.config,r=e.format,o=e.state,l=a.axis_rotated;if(e.color=e.generateColor(),e.levelColor=e.generateLevelColor(),!1===a.padding&&(a.axis_x_show=!1,a.axis_y_show=!1,a.axis_y2_show=!1,a.subchart_show=!1),e.hasPointType()&&(e.point=e.generatePoint()),o.hasAxis){e.initClip(),r.extraLineClasses=e.generateExtraLineClass(),r.dataTime=a.data_xLocaltime?n.timeParse:n.utcParse,r.axisTime=a.axis_x_localtime?n.timeFormat:n.utcFormat;var c=e.config.zoom_enabled&&"drag"===e.config.zoom_type;r.defaultAxisTime=function(n){i(this,t);var a=e.scale,s=a.x,o=a.zoom,l=c?o:o&&s.orgDomain().toString()!==o.domain().toString(),d=(n.getMilliseconds()?".%L":n.getSeconds()&&".:%S")||n.getMinutes()&&"%I:%M"||n.getHours()&&"%I %p"||1!==n.getDate()&&"%b %d"||l&&1===n.getDate()&&"%b'%y"||n.getMonth()&&"%-m/%-d"||"%Y";return r.axisTime(d)(n)}.bind(this)}o.isLegendRight="right"===a.legend_position,o.isLegendInset="inset"===a.legend_position,o.isLegendTop="top-left"===a.legend_inset_anchor||"top-right"===a.legend_inset_anchor,o.isLegendLeft="top-left"===a.legend_inset_anchor||"bottom-left"===a.legend_inset_anchor,o.rotatedPadding.top=e.getResettedPadding(o.rotatedPadding.top),o.rotatedPadding.right=l&&!a.axis_x_show?0:30,o.inputType=function(t,e){var n=this,a=s.DocumentTouch,r=s.matchMedia,o=s.navigator,l=!1;if(e)if(o&&"maxTouchPoints"in o)l=o.maxTouchPoints>0;else if("ontouchmove"in s||a&&h instanceof a)l=!0;else if(null!=r&&r("(pointer:coarse)").matches)l=!0;else{var c=o.userAgent;l=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(c)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(c)}return(t&&["any-hover:hover","any-pointer:fine"].some(function(t){return i(this,n),null==r?void 0:r("("+t+")").matches}.bind(this))?"mouse":l&&"touch")||"mouse"}(a.interaction_inputType_mouse,a.interaction_inputType_touch)},e.initWithData=function(t){var e=this,n=this,a=n.config,r=n.scale,s=n.state,o=n.$el,l=n.org,c=s,d=c.hasAxis,u=c.hasTreemap,h=a.interaction_enabled,g=n.hasType("polar");if(d&&(n.axis=n.getAxisInstance(),a.zoom_enabled&&n.initZoom()),n.data.xs={},n.data.targets=n.convertDataToTargets(t),a.data_filter&&(n.data.targets=n.data.targets.filter(a.data_filter.bind(n.api))),a.data_hide&&n.addHiddenTargetIds(!0===a.data_hide?n.mapToIds(n.data.targets):a.data_hide),a.legend_hide&&n.addHiddenLegendIds(!0===a.legend_hide?n.mapToIds(n.data.targets):a.legend_hide),n.updateSizes(),n.updateScales(!0),d){var f=r.x,p=r.y,v=r.y2,x=r.subX,b=r.subY,_=r.subY2;f&&(f.domain(rt(n.getXDomain(n.data.targets),!a.axis_x_inverted)),x.domain(f.domain()),l.xDomain=f.domain()),p&&(p.domain(n.getYDomain(n.data.targets,"y")),b.domain(p.domain())),v&&(v.domain(n.getYDomain(n.data.targets,"y2")),_&&_.domain(v.domain()))}if(o.svg=o.chart.append("svg").style("overflow","hidden").style("display","block"),h&&s.inputType){var m="touch"===s.inputType,y=a.onclick,T=a.onover,w=a.onout;o.svg.on("click",(null==y?void 0:y.bind(n.api))||null).on(m?"touchstart":"mouseenter",(null==T?void 0:T.bind(n.api))||null).on(m?"touchend":"mouseleave",(null==w?void 0:w.bind(n.api))||null)}a.svg_classname&&o.svg.attr("class",a.svg_classname);var A=k(a.color_tiles)&&n.patterns;(d||A||g||u||a.data_labels_backgroundColors)&&(o.defs=o.svg.append("defs"),d&&["id","idXAxis","idYAxis","idGrid"].forEach(function(t){i(this,e),n.appendClip(o.defs,s.clip[t])}.bind(this)),n.generateDataLabelBackgroundColorFilter(),A&&n.patterns.forEach(function(t){var n=this;return i(this,e),o.defs.append(function(){return i(this,n),t.node}.bind(this))}.bind(this))),n.updateSvgSize(),n.bindResize();var S,C=o.svg.append("g").classed(vt.main,!0).attr("transform",u?null:n.getTranslate("main"));(o.main=C,a.subchart_show&&n.initSubchart(),a.tooltip_show&&n.initTooltip(),a.title_text&&n.initTitle(),!u&&a.legend_show&&n.initLegend(),a.data_empty_label_text&&C.append("text").attr("class",Xt.text+" "+vt.empty).attr("text-anchor","middle").attr("dominant-baseline","middle"),d&&(a.regions.length&&n.initRegion(),a.clipPath||n.axis.init()),C.append("g").classed(vt.chart,!0).attr("clip-path",d?s.clip.path:null),n.callPluginHook("$init"),n.initChartElements(),d)&&(h&&(null==n.initEventRect||n.initEventRect()),n.initGrid(),a.clipPath&&(null==(S=n.axis)||S.init()));if(n.updateTargets(n.data.targets),n.updateDimension(),N(a.oninit,n.api),n.setBackground(),n.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),a.data_onmin||a.data_onmax){var R=n.getMinMaxData();N(a.data_onmin,n.api,R.min),N(a.data_onmax,n.api,R.max)}a.tooltip_show&&n.initShowTooltip(),s.rendered=!0},e.initChartElements=function(){var t=this,e=this,n=e.state,a=n.hasAxis,r=n.hasRadar,s=n.hasTreemap,o=[];if(a){var l=["bar","bubble","candlestick","line"];e.config.bar_front&&l.push(l.shift()),l.forEach(function(n){i(this,t);var a=Q(n);("line"===n&&e.hasTypeOf(a)||e.hasType(n))&&o.push(a)}.bind(this))}else if(s)o.push("Treemap");else{var c=e.hasType("polar");r||o.push("Arc","Pie"),e.hasType("gauge")?o.push("Gauge"):r?o.push("Radar"):c&&o.push("Polar")}o.forEach(function(n){i(this,t),e["init"+n]()}.bind(this)),$(e.config.data_labels)&&!e.hasArcType(null,["radar"])&&e.initText()},e.setChartElements=function(){var t=this.$el,e=t.chart,i=t.svg,n=t.defs,a=t.main,r=t.tooltip,s=t.legend,o=t.title,l=t.grid,c=t.needle,d=t.arcs,u=t.circle,h=t.bar,g=t.candlestick,f=t.line,p=t.area,v=t.text;this.api.$={chart:e,svg:i,defs:n,main:a,tooltip:r,legend:s,title:o,grid:l,arc:d,circles:u,bar:{bars:h},candlestick:g,line:{lines:f,areas:p},needle:c,text:{texts:v}}},e.setBackground=function(){var t=this,e=t.config.background,i=t.state,n=t.$el.svg;if($(e)){var a=n.select("g").insert(e.imgUrl?"image":"rect",":first-child");e.imgUrl?a.attr("href",e.imgUrl):e.color&&a.style("fill",e.color).attr("clip-path",i.clip.path),a.attr("class",e.class||null).attr("width","100%").attr("height","100%")}},e.updateTargets=function(t){var e=this,n=this,a=n.state,r=a.hasAxis,s=a.hasRadar,o=a.hasTreemap,l=function(a){return i(this,e),n["updateTargetsFor"+a](t.filter(n["is"+a+"Type"].bind(n)))}.bind(this);if(n.updateTargetsForText(t),r)["bar","candlestick","line"].forEach(function(t){i(this,e);var a=Q(t);("line"===t&&n.hasTypeOf(a)||n.hasType(t))&&l(a)}.bind(this)),n.updateTargetsForSubchart&&n.updateTargetsForSubchart(t);else if(n.hasArcType(t)){var c="Arc";s?c="Radar":n.hasType("polar")&&(c="Polar"),l(c)}else o&&l("Treemap");var d=n.hasType("bubble")||n.hasType("scatter");d&&(null==n.updateTargetForCircle||n.updateTargetForCircle()),n.filterTargetsToShowAtInit(d)},e.filterTargetsToShowAtInit=function(t){var e=this;void 0===t&&(t=!1);var n=this,a=n.$el.svg,r=n.$T,s="."+vt.target;t&&(s+=", ."+Tt.chartCircles+" > ."+Tt.circles),r(a.selectAll(s).filter(function(t){return i(this,e),n.isTargetToShow(t.id)}.bind(this))).style("opacity",null)},e.getWithOption=function(t){var e=this,n={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};return Object.keys(n).forEach(function(a){i(this,e);var r=n[a];C(r)&&(r=n[r]),n[a]=B(t,"with"+a,r)}.bind(this)),n},e.initialOpacity=function(t){var e=this.state.withoutFadeIn;return null!==this.getBaseValue(t)&&e[t.id]?null:"0"},e.bindResize=function(){var t=this,e=this,n=e.config,a=e.state,r=function(t){var e,n=this,a=[],r=function(){var n=this;r.clear(),!1===t?u(function(){var t=this;i(this,n),a.forEach(function(e){return i(this,t),e()}.bind(this))}.bind(this),{timeout:200}):e=pe(function(){var t=this;i(this,n),a.forEach(function(e){return i(this,t),e()}.bind(this))}.bind(this),R(t)?t:200)};return r.clear=function(){i(this,n),e&&(ve(e),e=null)}.bind(this),r.add=function(t){return i(this,n),a.push(t)}.bind(this),r.remove=function(t){return i(this,n),a.splice(a.indexOf(t),1)}.bind(this),r}(n.resize_timer),o=[];o.push(function(){return i(this,t),N(n.onresize,e.api)}.bind(this)),n.resize_auto&&o.push(function(){i(this,t),a.resizing=!0,n.legend_show&&(e.updateSizes(),e.updateLegend()),e.api.flush(!1)}.bind(this)),o.push(function(){i(this,t),N(n.onresized,e.api),a.resizing=!1}.bind(this)),o.forEach(function(e){return i(this,t),r.add(e)}.bind(this)),e.resizeFunction=r,s.addEventListener("resize",e.resizeFunction=r)},e.callPluginHook=function(t){for(var e=this,n=arguments.length,a=Array(n>1?n-1:0),r=1;r\n\t\t\t\n\t\t\t\t'+v+"\n\t\t\t\t"+f.replace(/(url\()[^#]+/g,"$1")+"\n\t\t\t").replace("/\n/g","%0A");return"data:image/svg+xml;base64,"+ui(x)}function gi(t){var e=this,n=t.getBoundingClientRect(),a=n.left,r=n.top,o=function(t){return i(this,e),t.textContent||t.childElementCount}.bind(this),l=[];return tt(t.querySelectorAll("text")).filter(o).forEach(function(t){var n=this;i(this,e);var c=function(t){var e;i(this,n);var o=s.getComputedStyle(t),l=o.fill,c=o.fontFamily,d=o.fontSize,u=o.textAnchor,h=o.transform,g=function(t,e){var i=e.top,n=e.left,a=t.getBBox(),r=a.x,s=a.y,o=t.getScreenCTM(),l=o.a,c=o.b,d=o.c,u=o.d,h=o.e,g=o.f,f=t.getBoundingClientRect(),p=f.width,v=f.height;return{x:l*r+d*s+h-n,y:c*r+u*s+g-i+(v-Math.round(v/4)),width:p,height:v}}(t,{left:a,top:r}),f=g.x,p=g.y,v=g.width,x=g.height;return(e={})[t.textContent]={x:f,y:p,width:v,height:x,fill:l,fontFamily:c,fontSize:d,textAnchor:u,transform:h},e}.bind(this);if(t.childElementCount>1)return tt(t.querySelectorAll("tspan")).filter(o).forEach(function(t){i(this,n),l.push(c(t))}.bind(this)),[];l.push(c(t))}.bind(this)),l}var fi={export:function(t,e){var n=this,a=this.internal,r=a.state,s=a.$el,o=s.chart,l=s.svg,c=r.current,d=c.width,u=c.height,g=at({width:d,height:u,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},t),f=hi(o.node(),g,{width:d,height:u}),p=g.preserveFontStyle?gi(l.node()):[];if(e&&k(e)){var v=new Image;v.crossOrigin="Anonymous",v.onload=function(){i(this,n);var t=h.createElement("canvas"),a=t.getContext("2d");t.width=g.width||d,t.height=g.height||u,a.drawImage(v,0,0),p.length&&(!function(t,e){var n=this;e.forEach(function(e){var a=this;i(this,n),Object.keys(e).forEach(function(n){var r=this;i(this,a);var s=e[n],o=s.x,l=s.y,c=s.width,d=s.height,u=s.fill,h=s.fontFamily,g=s.fontSize,f=s.transform;if(t.save(),t.font=g+" "+h,t.fillStyle=u,"none"===f)t.fillText(n,o,l);else{var p=f.replace(/(matrix|\(|\))/g,"").split(",");p.splice(4).every(function(t){return i(this,r),0==+t}.bind(this))?(p.push(o+c-c/4),p.push(l-d+d/3)):(p.push(o),p.push(l)),t.transform.apply(t,p),t.fillText(n,0,0)}t.restore()}.bind(this))}.bind(this))}(a,p),p.length=0),e.bind(this)(t.toDataURL(g.mimeType))}.bind(this),v.src=f}return f}},pi={focus:function(t){var e=this,n=this.internal,a=n.state,r=n.mapToTargetIds(t),s=n.$el.svg.selectAll(n.selectorTargets(r.filter(n.isTargetToShow,n)));this.revert(),this.defocus(),s.classed(Et.focused,!0).classed(Et.defocused,!1),n.hasArcType()&&!a.hasRadar&&(n.expandArc(r),n.hasType("gauge")&&n.markOverlapped(t,n,"."+St.gaugeValue)),n.toggleFocusLegend(r,!0),a.focusedTargetIds=r,a.defocusedTargetIds=a.defocusedTargetIds.filter(function(t){return i(this,e),r.indexOf(t)<0}.bind(this))},defocus:function(t){var e=this,n=this.internal,a=n.state,r=n.mapToTargetIds(t);n.$el.svg.selectAll(n.selectorTargets(r.filter(n.isTargetToShow,n))).classed(Et.focused,!1).classed(Et.defocused,!0),n.hasArcType(null,["polar"])&&(n.unexpandArc(r),n.hasType("gauge")&&n.undoMarkOverlapped(n,"."+St.gaugeValue)),n.toggleFocusLegend(r,!1),a.focusedTargetIds=a.focusedTargetIds.filter(function(t){return i(this,e),r.indexOf(t)<0}.bind(this)),a.defocusedTargetIds=r},revert:function(t){var e=this.internal,i=e.config,n=e.state,r=e.$el,s=e.mapToTargetIds(t);r.svg.selectAll(e.selectorTargets(s)).classed(Et.focused,!1).classed(Et.defocused,!1),e.hasArcType(null,["polar"])&&e.unexpandArc(s),i.legend_show&&(e.showLegend(s.filter(e.isLegendToShow.bind(e))),r.legend.selectAll(e.selectorLegends(s)).filter((function(){return(0,a.select)(this).classed(Et.legendItemFocused)})).classed(Et.legendItemFocused,!1)),n.focusedTargetIds=[],n.defocusedTargetIds=[]}},vi={legend:{show:function(t){var e=this.internal;e.showLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})},hide:function(t){var e=this.internal;e.hideLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})}}},xi={load:function(t){var e=this,n=this.internal,a=n.config;t.xs&&n.addXs(t.xs),"names"in t&&this.data.names(t.names),"classes"in t&&Object.keys(t.classes).forEach(function(n){i(this,e),a.data_classes[n]=t.classes[n]}.bind(this)),"categories"in t&&n.axis.isCategorized()&&(a.axis_x_categories=t.categories),"axes"in t&&Object.keys(t.axes).forEach(function(n){i(this,e),a.data_axes[n]=t.axes[n]}.bind(this)),"colors"in t&&Object.keys(t.colors).forEach(function(n){i(this,e),a.data_colors[n]=t.colors[n]}.bind(this)),"unload"in t&&!1!==t.unload?n.unload(n.mapToTargetIds(!0===t.unload?null:t.unload),function(){var a=this;i(this,e),u(function(){return i(this,a),n.loadFromArgs(t)}.bind(this))}.bind(this)):(n.api.tooltip.hide(),n.loadFromArgs(t))},unload:function(t){var e=this,n=this.internal,a=t||{};X(a)?a={ids:a}:C(a)&&(a={ids:[a]});var r=n.mapToTargetIds(a.ids);n.unload(r,function(){i(this,e),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.cache.remove(r),Le.call(n,a.done,a.resizeAfter)}.bind(this))}};function bi(t,e,n){var a=this,r=this.internal,s=r.mapToTargetIds(e),o=r.state.hiddenTargetIds.map(function(t){return i(this,a),s.indexOf(t)>-1&&t}.bind(this)).filter(Boolean);r.state.toggling=!0,r[(t?"remove":"add")+"HiddenTargetIds"](s);var l=r.$el.svg.selectAll(r.selectorTargets(s)),c=t?null:"0";t&&o.length&&(l.style("display",null),N(r.config.data_onshown,this,o)),r.$T(l).style("opacity",c,"important").call(G,function(){i(this,a),t||0!==o.length||(l.style("display","none"),N(r.config.data_onhidden,this,s)),l.style("opacity",c)}.bind(this)),n.withLegend&&r[(t?"show":"hide")+"Legend"](s),r.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),r.state.toggling=!1}var _i={show:function(t,e){void 0===e&&(e={}),bi.call(this,!0,t,e)},hide:function(t,e){void 0===e&&(e={}),bi.call(this,!1,t,e)},toggle:function(t,e){var n=this;void 0===e&&(e={});var a=this.internal,r={show:[],hide:[]};a.mapToTargetIds(t).forEach(function(t){return i(this,n),r[a.isTargetToShow(t)?"hide":"show"].push(t)}.bind(this)),r.show.length&&this.show(r.show,e),r.hide.length&&setTimeout(function(){return i(this,n),this.hide(r.hide,e)}.bind(this),0)}},mi={show:function(t){var e,n,a=this,r=this.internal,s=r.$el,o=r.config,l=r.state,c=l.eventReceiver,d=l.hasTreemap,u=l.inputType;if(t.mouse&&(n=t.mouse),t.data){var h=t.data,g=r.getYScaleById(h.id)(h.value);d&&h.id?c.rect=s.main.select(""+r.selectorTarget(h.id,void 0,"rect")):r.isMultipleX()?n=[r.xx(h),g]:(o.tooltip_grouped||(n=[0,g]),e=S(h.index)?h.index:r.getIndexByX(h.x))}else L(t.x)?e=r.getIndexByX(t.x):L(t.index)&&(e=t.index);("mouse"===u?["mouseover","mousemove"]:["touchstart"]).forEach(function(t){i(this,a),r.dispatchEvent(t,e,n)}.bind(this))},hide:function(){var t=this,e=this.internal,n=e.state.inputType,a=e.$el.tooltip,r=null==a?void 0:a.datum();if(r){var s=JSON.parse(r.current)[0].index;("mouse"===n?["mouseout"]:["touchend"]).forEach(function(n){i(this,t),e.dispatchEvent(n,s)}.bind(this))}"touch"===n&&e.callOverOutForTouch(),e.hideTooltip(!0),null==e.hideGridFocus||e.hideGridFocus(),null==e.unexpandCircles||e.unexpandCircles(),null==e.expandBarTypeShapes||e.expandBarTypeShapes(!1)}},yi={tooltip:mi},Ti=function t(e){this.plugins=[],this.internal=void 0;var n=new si(this);this.internal=n,function t(e,n,a){var r=this;Object.keys(e).forEach(function(s){i(this,r);var o=k(e[s]),l=n!==a,c=$(e[s]),d=c&&Object.keys(e[s]).length>0;n[s]=o&&(!l&&d||l)?e[s].bind(a):c&&!o?{}:e[s],d&&t(e[s],n[s],a)}.bind(this))}(t.prototype,this,this),oi.call(n,e),n.beforeInit(),n.init()};function wi(t,e,n){var a=this,r=t.config,s=function(t,n){i(this,a);var s=R(n)?n:!1===n?void 0:null;null!==s&&(r["axis_"+t+"_"+e]=s)}.bind(this);L(n)&&(z(n)?Object.keys(n).forEach(function(t){i(this,a),s(t,n[t])}.bind(this)):(R(n)||!1===n)&&["y","y2"].forEach(function(t){i(this,a),s(t,n)}.bind(this)),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function Ai(t,e){var i=t.config;return{x:i["axis_x_"+e],y:i["axis_y_"+e],y2:i["axis_y2_"+e]}}J(Ti.prototype,[li,{color:function(t){return this.internal.color(t)}},di,fi,pi,vi,xi,_i,yi]);var Si={labels:function(t){var e,n=this,a=this.internal;return t&&(Object.keys(t).forEach(function(e){i(this,n),a.axis.setLabelText(e,t[e])}.bind(this)),a.axis.updateLabels()),["x","y","y2"].forEach(function(t){i(this,n);var r=a.axis.getLabelText(t);r&&(e||(e={}),e[t]=r)}.bind(this)),e},min:function(t){var e=this.internal;return S(t)||!1===t?wi(e,"min",t):Ai(e,"min")},max:function(t){var e=this.internal;return S(t)||!1===t?wi(e,"max",t):Ai(e,"max")},range:function(t){var e=this.axis;if(!arguments.length)return{max:e.max(),min:e.min()};var i=t.min,n=t.max;L(n)&&e.max(n),L(i)&&e.min(i)}},ki={axis:Si};function Ci(t,e){var i=this.internal,n=i.config,a=n.transition_duration&&ut(),r="grid_"+e+"_lines";return t?(n[r]=t,i.updateGrid(),i.redrawGrid(a),n[r]):n[r]}function Ri(t,e){return Ci.bind(this)(this.internal.config["grid_"+e+"_lines"].concat(t||[]),e)}function Ei(t,e){this.internal.removeGridLines(t,e)}var Li=function(t){return Ci.bind(this)(t,"x")};J(Li,{add:function(t){return Ri.bind(this)(t,"x")},remove:function(t){return Ei.bind(this)(t,!0)}});var Oi=function(t){return Ci.bind(this)(t,"y")};J(Oi,{add:function(t){return Ri.bind(this)(t,"y")},remove:function(t){return Ei.bind(this)(t,!1)}});var Pi={xgrids:Li,ygrids:Oi},Ii={groups:function(t){var e=this.internal,i=e.config;return E(t)||(i.data_groups=t,e.redraw()),i.data_groups}};function Di(t,e){void 0===e&&(e=!1);var i=this.internal,n=i.config,a=n.transition_duration&&ut();return t?(n.regions=e?n.regions.concat(t):t,i.updateRegion(),i.redrawRegion(a),e?n.regions:t):n.regions}var zi=function(t){return Di.bind(this)(t)};J(zi,{add:function(t){return Di.bind(this)(t,!0)},remove:function(t){var e=this,n=this.internal,a=n.config,r=n.$T,s=t||{},o=B(s,"classes",[Dt.region]),l=n.$el.main.select("."+Dt.regions).selectAll(o.map(function(t){return i(this,e),"."+t}.bind(this)));return r(l).style("opacity","0").remove(),l=a.regions,Object.keys(s).length?(l=l.filter(function(t){var n=this;i(this,e);var a=!1;return!t.class||(t.class.split(" ").forEach(function(t){i(this,n),o.indexOf(t)>=0&&(a=!0)}.bind(this)),!a)}.bind(this)),a.regions=l):a.regions=[],l}});var Mi={regions:zi},$i={x:function(t){var e=this.internal,i=e.axis,n=e.data,a=i.isCustomX()&&i.isCategorized();return X(t)&&(a?this.categories(t):(e.updateTargetX(n.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),a?this.categories():n.xs},xs:function(t){var e=this.internal;return F(t)&&(e.updateTargetXs(e.data.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),e.data.xs}},Xi={flow:function(t){var e,n=this,a=this.internal;(t.json||t.rows||t.columns)&&a.convertData(t,function(r){i(this,n),e=r,function(){var n,r,s,o=this,l=0,c=0;if(a.state.redrawing||!e||!ut())return;var d=[],u=a.getMaxDataCount(),h=a.convertDataToTargets(e,!0),g=a.axis.isTimeSeries();a.data.targets.forEach(function(t){i(this,o);for(var e=!1,n=0;n1?f.values[f.values.length-1].x-p.x:p.x-a.getXDomain(a.data.targets)[0]:1,n=[p.x-r,p.x]);n&&a.updateXDomain(null,!0,!0,!1,n),a.updateTargets(a.data.targets),a.redraw({flow:{index:p.index,length:l,duration:S(t.duration)?t.duration:a.config.transition_duration,done:t.done,orgDataCount:u},withLegend:!0,withTransition:u>1,withTrimXDomain:!1,withUpdateXAxis:!0})}()}.bind(this))}},Fi=p(10),Bi=function(){function t(t){this.owner=void 0,this.config=void 0,this.scale=void 0;var e=He(),i=t.config,n=t.params;this.owner=t,this.config=i,this.scale=e,!i.noTransition&&n.config.transition_duration||(i.withoutTransition=!0),i.range=this.scaleExtent((n.orgXScale||e).range())}t.getSizeFor1Char=function(t){var e=this,n={w:5.5,h:11.5};return t.empty()||t.select("text").text("0").call(function(t){i(this,e);try{var a=t.node().getBBox(),r=a.width,s=a.height;r&&s&&(n.w=r,n.h=s)}catch(t){}finally{t.text("")}}.bind(this)),this.getSizeFor1Char=function(){return i(this,e),n}.bind(this),n};var e=t.prototype;return e.getTickTransformSetter=function(t){var e=this,n=this.config,a="x"===t?function(t){return i(this,e),"translate("+(t+n.tickOffset)+",0)"}.bind(this):function(t){return i(this,e),"translate(0,"+t+")"}.bind(this);return function(t,n){var r=this;i(this,e),t.attr("transform",function(t){return i(this,r),S(t)?a(Math.ceil(n(t))):null}.bind(this))}.bind(this)},e.scaleExtent=function(t){var e=t[0],i=t[t.length-1];return e0?s:1,o]).range(t.range());l=u.ticks();for(var h=o.toFixed().length;l.length>15;h--)l=u.ticks(h);l.splice(0,1,s),l.splice(l.length-1,1,o)}l=l.map(function(t){return i(this,n),C(t)&&R(t)&&!isNaN(t)&&Math.round(10*t)/10||t}.bind(this))}else{for(var g=Math.ceil(s);g0&&l[0]>0&&l.unshift(l[0]-(l[1]-l[0]))}return l},e.copyScale=function(){var t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t},e.textFormatted=function(t){var e=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+(t+"").replace(/0+\d$/,""):t,n=e?e(i):i;return L(n)?n:""},e.transitionise=function(t){var e=this.config,i=t;if(e.withoutTransition)i=t.interrupt();else if(e.transition||!this.owner.params.noTransition)try{i=t.transition(e.transition)}catch(t){}return i},t}(),Ni=function(){function t(t){void 0===t&&(t={}),this.helper=void 0,this.config=void 0,this.params=void 0,this.g=void 0,this.generatedTicks=void 0;var e={innerTickSize:6,outerTickSize:t.outerTick?6:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:9,tickOffset:0,tickPadding:3,tickValues:null,transition:null,noTransition:t.noTransition};e.tickLength=Math.max(e.innerTickSize,0)+e.tickPadding,this.config=e,this.params=t,this.helper=new Bi(this)}var e=t.prototype;return e.create=function(t){var e=this,n=e.config,r=e.helper,s=e.params,o=r.scale,l=n.orient,c=this.splitTickText.bind(e),d=/^(left|right)$/.test(l),u=/^(top|bottom)$/.test(l),h=r.getTickTransformSetter(u?"x":"y"),g=h===r.axisX?"y":"x",f=/^(top|left)$/.test(l)?-1:1,p=s.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():r.scaleExtent((s.orgXScale||o).range());var v,x=n.innerTickSize,b=n.tickLength,_=n.range,m=s.id,y=m&&/^(x|y|y2)$/.test(m)?s.config["axis_"+m+"_tick_text_position"]:{x:0,y:0},T="subX"===m?"subchart_axis_x":"axis_"+m,w=s.config[T+"_show"],A=!!w&&s.config[T+"_tick_show"],S=!!w&&s.config[T+"_tick_text_show"];t.each((function(){var t=this,m=(0,a.select)(this),T=this.__chart__||o,w=r.copyScale();v=m,this.__chart__=w,n.tickOffset=s.isCategory?Math.ceil((w(1)-w(0))/2):0;var k=m.selectAll(".domain").data([0]);if(k.enter().append("path").attr("class","domain").merge(k).attr("d",function(){i(this,t);var e=n.outerTickSize*f;return u?"M"+_[0]+","+e+"V0H"+_[1]+"V"+e:"M"+e+","+_[0]+"H0V"+_[1]+"H"+e}.bind(this)),A||S){var C=n.tickValues||r.generateTicks(w,d);e.generatedTicks=C;var E=m.selectAll(".tick").data(C,w),L=E.enter().insert("g",".domain").attr("class","tick"),O=E.exit().remove();E=L.merge(E),A&&L.append("line"),S&&L.append("text");var P=Bi.getSizeFor1Char(E),I=[],D=E.select("text").selectAll("tspan").data(function(e,n){var a=this;i(this,t);var o=s.tickMultiline?c(e,w,C,d,P.w):X(r.textFormatted(e))?r.textFormatted(e).concat():[r.textFormatted(e)];return I[n]=o.length,o.map(function(t){return i(this,a),{index:n,splitted:t}}.bind(this))}.bind(this));D.exit().remove(),(D=D.enter().append("tspan").merge(D).text(function(e){return i(this,t),e.splitted}.bind(this))).attr("x",u?0:b*f).attr("dx",function(){i(this,t);var e=0;return/(top|bottom)/.test(l)&&p&&(e=8*Math.sin(Math.PI*(p/180))*("top"===l?-1:1)),e+(y.x||0)}.bind(this)()).attr("dy",function(e,n){i(this,t);var a=0;return"top"!==l&&(a=P.h,0===n&&(a=d?-((I[e.index]-1)*(P.h/2)-3):0===y.y?".71em":0)),R(a)&&y.y?a+y.y:a||".71em"}.bind(this));var z=E.select("line"),M=E.select("text");if(L.select("line").attr(g+"2",x*f),L.select("text").attr(g,b*f),e.setTickLineTextPosition(z,M),s.tickTitle){var $=M.select("title");($.empty()?M.append("title"):$).text(function(e){return i(this,t),s.tickTitle[e]}.bind(this))}if(w.bandwidth){var F=w,B=F.bandwidth()/2;T=function(e){return i(this,t),F(e)+B}.bind(this),w=T}else T.bandwidth?T=w:h(O,w);E=s.owner.state.flowing?r.transitionise(E):s.owner.$T(E),h(L,T),h(E.style("opacity",null),w)}})),this.g=v},e.getGeneratedTicks=function(t){var e,n=this,a=(null==(e=this.generatedTicks)?void 0:e.length)-1,r=this.generatedTicks;if(a>t){var s=Math.round(a/t+.1);r=this.generatedTicks.map(function(t,e){return i(this,n),e%s==0?t:null}.bind(this)).filter(function(t){return i(this,n),null!==t}.bind(this)).splice(0,t)}return r},e.getTickXY=function(){var t=this.config,e={x:0,y:0};return this.params.isCategory&&(e.x=t.tickCentered?0:t.tickOffset,e.y=t.tickCentered?t.tickOffset:0),e},e.getTickSize=function(t){var e=this.helper.scale,i=this.config,n=i,a=n.innerTickSize,r=n.range,s=e(t)+(i.tickCentered?0:i.tickOffset);return r[0]0?0:1]:"middle"}.bind(this),h=function(t){return i(this,n),t?"rotate("+t+")":null}.bind(this),g=function(t){return i(this,n),t?11.5-2.5*(t/("bottom"===o?15:23))*(t>0?1:-1):l}.bind(this);switch(o){case"bottom":t.attr("x1",a.x).attr("x2",a.x).attr("y2",this.getTickSize.bind(this)),e.attr("x",0).attr("y",g(d)).style("text-anchor",u(d)).attr("transform",h(d));break;case"top":t.attr("x2",0).attr("y2",-s),e.attr("x",0).attr("y",2*-g(d)).style("text-anchor",u(d)).attr("transform",h(d));break;case"left":t.attr("x2",-s).attr("y1",a.y).attr("y2",a.y),e.attr("x",-l).attr("y",c).style("text-anchor","end");break;case"right":t.attr("x2",s).attr("y2",0),e.attr("x",l).attr("y",0).style("text-anchor","start")}},e.splitTickText=function(t,e,i,n,a){var r=this.params,s=this.helper.textFormatted(t),o=C(s)&&s.indexOf("\n")>-1?s.split("\n"):[];if(o.length)return o;if(X(s))return s;var l=r.tickWidth;return(!l||l<=0)&&(l=n?95:r.isCategory?Math.ceil(r.isInverted?e(i[0])-e(i[1]):e(i[1])-e(i[0]))-12:110),function t(e,i){for(var n,r,s,o=1;o=0||i.hasRadar},e.isCustomX=function(){var t=this.owner.config;return!this.isTimeSeries()&&(t.data_x||$(t.data_xs))},e.isTimeSeries=function(t){return void 0===t&&(t="x"),"timeseries"===this.owner.config["axis_"+t+"_type"]},e.isLog=function(t){return void 0===t&&(t="x"),"log"===this.owner.config["axis_"+t+"_type"]},e.isTimeSeriesY=function(){return this.isTimeSeries("y")},e.getAxisType=function(t){void 0===t&&(t="x");var e="linear";return this.isTimeSeries(t)?e=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(e="log"),e},e.init=function(){var t=this,e=this.owner,n=e.config,a=e.$el,r=a.main,s=a.axis,o=e.state.clip,l=n.axis_rotated,c=["x","y"];n.axis_y2_show&&c.push("y2"),c.forEach(function(a){var c=this;i(this,t);var d=this.getAxisClassName(a),u=_t["axis"+a.toUpperCase()+"Label"];s[a]=r.append("g").attr("class",d).attr("clip-path",function(){i(this,c);var t=null;return"x"===a?t=o.pathXAxis:"y"===a&&(t=o.pathYAxis),t}.bind(this)).attr("transform",e.getTranslate(a)).style("visibility",n["axis_"+a+"_show"]?null:"hidden"),s[a].append("text").attr("class",u).attr("transform",["rotate(-90)",null]["x"===a?+!l:+l]).style("text-anchor",function(){return i(this,c),this.textAnchorForAxisLabel(a)}.bind(this)),this.generateAxes(a)}.bind(this))},e.setOrient=function(){var t=this.owner.config,e=t.axis_rotated,i=t.axis_y_inner,n=t.axis_y2_inner;this.orient={x:e?"left":"bottom",y:e?i?"top":"bottom":i?"right":"left",y2:e?n?"bottom":"top":n?"left":"right",subX:e?"left":"bottom"}},e.generateAxes=function(t){var e,n=this,a=this.owner,r=a.config,s=[],o=r["axis_"+t+"_axes"],l=r.axis_rotated;"x"===t?e=l?Fi.axisLeft:Fi.axisBottom:"y"===t?e=l?Fi.axisBottom:Fi.axisLeft:"y2"===t&&(e=l?Fi.axisTop:Fi.axisRight),o.length&&o.forEach(function(r){var o=this;i(this,n);var l=r.tick||{},c=a.scale[t].copy();r.domain&&c.domain(r.domain),s.push(e(c).ticks(l.count).tickFormat(k(l.format)?l.format.bind(a.api):function(t){return i(this,o),t}.bind(this)).tickValues(l.values).tickSizeOuter(!1===l.outer?0:6))}.bind(this)),this.axesList[t]=s},e.updateAxes=function(){var t=this,e=this.owner,n=e.config,a=e.$el.main,r=e.$T;Object.keys(this.axesList).forEach(function(s){var o=this;i(this,t);var l=n["axis_"+s+"_axes"],c=e.scale[s].copy(),d=c.range();this.axesList[s].forEach(function(t,u){var h=this;i(this,o);var g=t.scale().range();d.every(function(t,e){return i(this,h),t===g[e]}.bind(this))||t.scale().range(d);var f=this.getAxisClassName(s)+"-"+(u+1),p=a.select("."+f.replace(/\s/,"."));p.empty()?p=a.append("g").attr("class",f).style("visibility",n["axis_"+s+"_show"]?null:"hidden").call(t):(l[u].domain&&c.domain(l[u].domain),r(p).call(t.scale(c))),p.attr("transform",e.getTranslate(s,u+1))}.bind(this))}.bind(this))},e.setAxis=function(t,e,i,n){var a=this.owner;"subX"!==t&&(this.tick[t]=this.getTickValues(t)),this[t]=this.getAxis(t,e,i,!("x"!==t||!(a.scale.zoom||a.config.subchart_show||a.state.resizing))||n)},e.getAxis=function(t,e,n,a,r){var s,o=this,l=this.owner,c=l.config,d=/^(x|subX)$/.test(t),u=d?"x":t,h=d&&this.isCategorized(),g=this.orient[t],f=r?0:l.getAxisTickRotate(u);if(d)s="subX"===t?l.format.subXAxisTick:l.format.xAxisTick;else{var p=c["axis_"+t+"_tick_format"];k(p)&&(s=p.bind(l.api))}var v=this.tick[u],x=at({outerTick:n,noTransition:a,config:c,id:t,tickTextRotate:f,owner:l},d&&{isCategory:h,isInverted:c.axis_x_inverted,tickMultiline:c.axis_x_tick_multiline,tickWidth:c.axis_x_tick_width,tickTitle:h&&c.axis_x_tick_tooltip&&l.api.categories(),orgXScale:l.scale.x});d||(x.tickStepSize=c["axis_"+u+"_tick_stepSize"]);var b=new Ni(x).scale(d&&l.scale.zoom||e).orient(g);if(d&&this.isTimeSeries()&&v&&!k(v)){var _=dt.bind(l);v=v.map(function(t){return i(this,o),_(t)}.bind(this))}else!d&&this.isTimeSeriesY()&&(b.ticks(c.axis_y_tick_time_value),v=null);v&&b.tickValues(v),b.tickFormat(s||!d&&l.isStackNormalized()&&function(t){return i(this,o),t+"%"}.bind(this)),h&&(b.tickCentered(c.axis_x_tick_centered),M(c.axis_x_tick_culling)&&(c.axis_x_tick_culling=!1));var m=c["axis_"+u+"_tick_count"];return m&&b.ticks(m),b},e.updateXAxisTickValues=function(t,e){var i,n=this.owner,a=n.config,r=a.axis_x_tick_fit,s=a.axis_x_tick_count;if((r||s&&r)&&(i=n.mapTargetsToUniqueXs(t),this.isCategorized()&&s>i.length&&(s=i.length),i=this.generateTickValues(i,s,this.isTimeSeries())),e)e.tickValues(i);else if(this.x){var o;this.x.tickValues(i),null==(o=this.subX)||o.tickValues(i)}return i},e.getId=function(t){var e=this.owner,i=e.config,n=e.scale,a=i.data_axes[t];return a&&n[a]||(a="y"),a},e.getXAxisTickFormat=function(t){var e,n=this,a=this.owner,r=a.config,s=a.format,o=t&&r.subchart_axis_x_tick_format||r.axis_x_tick_format,l=this.isTimeSeries(),c=this.isCategorized();return o?k(o)?e=o.bind(a.api):l&&(e=function(t){return i(this,n),t?s.axisTime(o)(t):""}.bind(this)):e=l?s.defaultAxisTime:c?a.categoryName:function(t){return i(this,n),t<0?t.toFixed(0):t}.bind(this),k(e)?function(t){return i(this,n),e.apply(a,c?[t,a.categoryName(t)]:[t])}.bind(this):e},e.getTickValues=function(t){var e=this.owner,i=e.config["axis_"+t+"_tick_values"],n=e[t+"Axis"];return(k(i)?i.call(e.api):i)||(n?n.tickValues():void 0)},e.getLabelOptionByAxisId=function(t){return this.owner.config["axis_"+t+"_label"]},e.getLabelText=function(t){var e=this.getLabelOptionByAxisId(t);return C(e)?e:e?e.text:null},e.setLabelText=function(t,e){var i=this.owner.config,n=this.getLabelOptionByAxisId(t);C(n)?i["axis_"+t+"_label"]=e:n&&(n.text=e)},e.getLabelPosition=function(t,e){var n=this,a=this.owner.config.axis_rotated,r=this.getLabelOptionByAxisId(t),s=z(r)&&r.position?r.position:e[+!a],o=function(t){return i(this,n),!!~s.indexOf(t)}.bind(this);return{isInner:o("inner"),isOuter:o("outer"),isLeft:o("left"),isCenter:o("center"),isRight:o("right"),isTop:o("top"),isMiddle:o("middle"),isBottom:o("bottom")}},e.getAxisLabelPosition=function(t){return this.getLabelPosition(t,"x"===t?["inner-top","inner-right"]:["inner-right","inner-top"])},e.getLabelPositionById=function(t){return this.getAxisLabelPosition(t)},e.xForAxisLabel=function(t){var e=this.owner,i=e.state,n=i.width,a=i.height,r=this.getAxisLabelPosition(t),s=r.isMiddle?-a/2:0;return this.isHorizontal(e,"x"!==t)?s=r.isLeft?0:r.isCenter?n/2:n:r.isBottom&&(s=-a),s},e.dxForAxisLabel=function(t){var e=this.owner,i=this.getAxisLabelPosition(t),n=i.isBottom?"0.5em":"0";return this.isHorizontal(e,"x"!==t)?n=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(n="-0.5em"),n},e.textAnchorForAxisLabel=function(t){var e=this.owner,i=this.getAxisLabelPosition(t),n=i.isMiddle?"middle":"end";return this.isHorizontal(e,"x"!==t)?n=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(n="start"),n},e.dyForAxisLabel=function(t){var e,i=this.owner,n=i.config,a=n.axis_rotated,r=this.getAxisLabelPosition(t).isInner,s=n["axis_"+t+"_tick_rotate"]?i.getHorizontalAxisHeight(t):0,o=this.getMaxTickWidth(t);if("x"===t){var l=n.axis_x_height;e=a?r?"1.2em":-25-o:r?"-0.5em":l?l-10:s?s-10:"3em"}else e={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],e=a?r?e[0]:s?s*("y2"===t?-1:1)-e[1]:e[2]:r?e[3]:(e[4]+(n["axis_"+t+"_inner"]?0:o+e[4]))*("y"===t?-1:1);return e},e.getMaxTickWidth=function(t,e){var n=this,a=this.owner,r=a.config,s=a.state.current,o=a.$el,l=o.svg,c=o.chart,d=s.maxTickWidths[t],u=0;if(e||!r["axis_"+t+"_show"]||d.size>0&&0===a.filterTargetsToShow().length)return d.size;if(l){var h=/^y2?$/.test(t),g=a.filterTargetsToShow(a.data.targets),f=a.scale[t].copy().domain(a["get"+(h?"Y":"X")+"Domain"](g,t)),p=f.domain(),v=p[0]===p[1]&&p.every(function(t){return i(this,n),t>0}.bind(this)),x=X(d.domain)&&d.domain[0]===d.domain[1]&&d.domain.every(function(t){return i(this,n),t>0}.bind(this));if(v||x)return d.size;d.domain=p,h||d.ticks.splice(0);var b=this.getAxis(t,f,!1,!1,!0),_=r["axis_"+t+"_tick_count"];!r["axis_"+t+"_tick_values"]&&_&&b.tickValues(this.generateTickValues(p,_,h?this.isTimeSeriesY():this.isTimeSeries())),h||this.updateXAxisTickValues(g,b);var m=c.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0");b.create(m),m.selectAll("text").each((function(t,e){var i=this.getBoundingClientRect().width;u=Math.max(u,i),h||(d.ticks[e]=i)})),m.remove()}return u>0&&(d.size=u),d.size},e.getXAxisTickTextY2Overflow=function(t){var e=this.owner,i=e.axis,n=e.config,a=e.state,r=e.getAxisTickRotate("x");if((i.isCategorized()||i.isTimeSeries())&&n.axis_x_tick_fit&&!n.axis_x_tick_culling&&!n.axis_x_tick_multiline&&r>0&&r<90){var s=a.current.width-e.getCurrentPaddingLeft(),o=this.getXAxisTickMaxOverflow(r,s-t),l=Math.max(0,o)+t;return Math.min(l,s/2)}return 0},e.getXAxisTickMaxOverflow=function(t,e){for(var i=this.owner,n=i.axis,a=i.config,r=i.state,s=n.isTimeSeries(),o=r.current.maxTickWidths.x.ticks,l=o.length,c=r.axis.x.padding,d=c.left,u=c.right,h=0,g=l-(s&&a.axis_x_tick_fit?.5:0),f=0;f2){var o,l=this.isCategorized(),c=s-2,d=t[0],u=t[t.length-1];r=[d];for(var h=0;h=f)&&(e=!0,t.preventDefault())}.bind(this);l.on("touchstart",function(t){i(this,n),s.event=t,a.updateEventRect()}.bind(this)).on("touchstart.eventRect touchmove.eventRect",function(t){if(i(this,n),s.event=t,!l.empty()&&l.classed(Rt.eventRect)){if(s.dragging||s.flowing||a.hasArcType()||t.touches.length>1)return;p(t),d(l.node())}else u()}.bind(this),!0).on("touchend.eventRect",function(t){i(this,n),s.event=t,!l.empty()&&l.classed(Rt.eventRect)&&(a.hasArcType()||!a.toggleShape||s.cancelClick)&&s.cancelClick&&(s.cancelClick=!1)}.bind(this),!0),c.on("touchstart",function(t){i(this,n),s.event=t;var e=t.target;e&&e!==l.node()&&u()}.bind(this))},updateEventRect:function(t,e){var n=this;void 0===e&&(e=!1);var a=this.state,r=this.$el,s=a,o=s.eventReceiver,l=s.width,c=s.height,d=s.rendered,u=s.resizing,h=t||r.eventRect,g=function(){i(this,n),o&&(o.rect=h.node().getBoundingClientRect())}.bind(this);(!d||u||e)&&(h.attr("x",0).attr("y",0).attr("width",l).attr("height",c),d&&!e||h.classed(Rt.eventRect,!0)),g()},updateEventRectData:function(){var t,e,n,a,r=this,s=this,o=s.config,l=s.scale,c=s.state,d=l.zoom||l.x,u=o.axis_rotated;if(s.isMultipleX())t=0,e=0,n=c.width,a=c.height;else{var h,g;if(s.axis.isCategorized())h=s.getEventRectWidth(),g=function(t){return i(this,r),d(t.x)-h/2}.bind(this);else{var f=function(t){var e=t.index;return i(this,r),{prev:s.getPrevX(e),next:s.getNextX(e)}}.bind(this);h=function(t){var e=this;i(this,r);var n,a=f(t),s=d.domain();return null===a.prev&&null===a.next?n=u?c.height:c.width:null===a.prev?n=(d(a.next)+d(t.x))/2:null===a.next?n=d(s[1])-(d(a.prev)+d(t.x))/2:(Object.keys(a).forEach(function(t,n){var r;i(this,e),a[t]=null!=(r=a[t])?r:s[n]}.bind(this)),n=Math.max(0,(d(a.next)-d(a.prev))/2)),n}.bind(this),g=function(t){i(this,r);var e=f(t);return null===e.prev&&null===e.next?0:null===e.prev?d(d.domain()[0]):(d(t.x)+d(e.prev))/2}.bind(this)}t=u?0:g,e=u?g:0,n=u?c.width:h,a=u?h:c.height}var p=c.eventReceiver,v=function(t,e){return i(this,r),k(t)?t(e):t}.bind(this);p.coords.splice(p.data.length),p.data.forEach(function(s,o){i(this,r),p.coords[o]={x:v(t,s),y:v(e,s),w:v(n,s),h:v(a,s)}}.bind(this))},selectRectForMultipleXs:function(t){var e=this,n=this,a=n.config,r=n.state,s=n.filterTargetsToShow(n.data.targets);if(!r.dragging&&!n.hasArcType(s)){var o=H(r.event,t),l=n.findClosestFromTargets(s,o);if(!r.mouseover||l&&l.id===r.mouseover.id||(a.data_onout.call(n.api,r.mouseover),r.mouseover=void 0),l){var c=(n.isBubbleType(l)||n.isScatterType(l)||!a.tooltip_grouped?[l]:n.filterByX(s,l.x)).map(function(t){return i(this,e),n.addName(t)}.bind(this));n.showTooltip(c,t),n.setExpand(l.index,l.id,!0),n.showGridFocus(c),(n.isBarType(l.id)||n.dist(l,o)-1?s.data[a]:null}.bind(this);o.on("mouseover",function(t){i(this,e),r.event=t,n.updateEventRect()}.bind(this)).on("mousemove",(function(t){var e=l(t);if(r.event=t,e){var i=e.index,c=a.line_step_type;if(a.line_step_tooltipMatch&&n.hasType("step")&&/^step\-(before|after)$/.test(c)){var d=n.scale.zoom||n.scale.x,u=n.axis.xs[i],h=d.invert(H(t,this)[0]);"step-after"===c&&hu&&(i+=1)}r.dragging||r.flowing||n.hasArcType()||a.tooltip_grouped&&i===s.currentIdx||(i!==s.currentIdx&&(n.setOverOut(!1,s.currentIdx),s.currentIdx=i),-1===i?n.unselectRect():n.selectRectForSingle(this,o,i),n.setOverOut(-1!==i,i))}})).on("mouseout",function(t){i(this,e),r.event=t,a&&!n.hasArcType()&&-1!==s.currentIdx&&(n.unselectRect(),n.setOverOut(!1,s.currentIdx),s.currentIdx=-1)}.bind(this))}return o},clickHandlerForSingleX:function(t,e){var i=e,n=i.config,a=i.state,r=i.$el.main;if(!t||i.hasArcType()||a.cancelClick)a.cancelClick&&(a.cancelClick=!1);else{var s=t.index;r.selectAll("."+Mt.shape+"-"+s).each((function(t){(n.data_selection_grouped||i.isWithinShape(this,t))&&(null==i.toggleShape||i.toggleShape(this,t,s),n.data_onclick.bind(i.api)(t,this))}))}},generateEventRectsForMultipleXs:function(t){var e=this,n=this,a=n.state;t.on("click",(function(t){a.event=t,n.clickHandlerForMultipleXS.bind(this)(n)})),"mouse"===a.inputType&&t.on("mouseover mousemove",(function(t){a.event=t,n.selectRectForMultipleXs(this)})).on("mouseout",function(t){i(this,e),a.event=t,n.config&&!n.hasArcType()&&n.unselectRect()}.bind(this))},clickHandlerForMultipleXS:function(t){var e=t,i=e.config,n=e.state,a=e.filterTargetsToShow(e.data.targets);if(!e.hasArcType(a)){var r=H(n.event,this),s=e.findClosestFromTargets(a,r);s&&(e.isBarType(s.id)||e.dist(s,r)1&&(a=a[n[1]]),null!=(e=a)&&e.size()&&(l[t]=a)}.bind(this)),e.hideGridFocus(),e.setFlowList(l,t)}},setFlowList:function(t,e){var n,a=this,r=this,s=e.flow,o=e.targets,l=s,c=l.duration,d=void 0===c?e.duration:c,u=l.index,h=l.length,g=l.orgDataCount,f=r.getFlowTransform(o,g,u,h),p=xe();p.add(Object.keys(t).map(function(e){var s=this;return i(this,a),n=t[e].transition().ease(Yi.easeLinear).duration(d),n="axis.x"===e?n.call(function(t){i(this,s),r.axis.x.setTransition(t).create(t)}.bind(this)):"region.list"===e?n.filter(r.isRegionOnX).attr("transform",f):n.attr("transform",f)}.bind(this))),n.call(p,function(){i(this,a),r.cleanUpFlow(t,e)}.bind(this))},cleanUpFlow:function(t,e){var n=this,a=this,r=a.config,s=a.state,o=a.$el.svg,l=r.axis_rotated,c=e.flow,d=e.shape,u=e.xv,h=d.pos,g=h.cx,f=h.cy,p=h.xForText,v=h.yForText,x=c,b=x.done,_=void 0===b?function(){i(this,n)}.bind(this):b,m=x.length;m&&(["circle","text","shape","eventRect"].forEach(function(t){i(this,n);for(var e=[],a=0;a=0?"":h.URL.split("#")[0])+"#"+t+")"},appendClip:function(t,e){e&&t.append("clipPath").attr("id",e).append("rect")},setXAxisClipPath:function(t){var e=this.config,i=this.state,n=i.margin,a=i.width,r=i.height,s=e.axis_rotated,o=Math.max(30,n.left)-(s?0:20),l=s?-(1+o):-(o-1),c=-Math.max(15,n.top),d=s?n.left+20:a+10+o,u=(s?n.top+r+10:n.bottom)+20;t.attr("x",l).attr("y",c).attr("width",d).attr("height",u)},setYAxisClipPath:function(t){var e,i=this.config,n=this.state,a=n.margin,r=n.width,s=n.height,o=i.axis_rotated,l=Math.max(30,a.left)-(o?20:0),c=i.axis_y_inner,d=c&&!o?i.axis_y_label.text?-20:-1:o?-(1+l):-(l-1),u=-(o?20:a.top),h=(o?r+15+l:a.left+20)+(c?20:0),g=(o?a.bottom+("fit"===(null==(e=i.padding)?void 0:e.mode)?10:0):a.top+s)+10;t.attr("x",d).attr("y",u).attr("width",h).attr("height",g)},updateXAxisTickClip:function(){var t=this,e=t.config,i=t.state,n=i.clip,a=i.xAxisHeight,r=t.$el.defs,s=t.getHorizontalAxisHeight("x");if(r&&!n.idXAxisTickTexts){var o=n.id+"-xaxisticktexts";t.appendClip(r,o),n.pathXAxisTickTexts=t.getClipPath(n.idXAxisTickTexts),n.idXAxisTickTexts=o}!e.axis_x_tick_multiline&&t.getAxisTickRotate("x")&&s!==a&&(t.setXAxisTickClipWidth(),t.setXAxisTickTextClipPathWidth()),t.state.xAxisHeight=s},setXAxisTickClipWidth:function(){var t=this,e=t.config,i=t.state.current.maxTickWidths,n=t.getAxisTickRotate("x");if(!e.axis_x_tick_multiline&&n){var a=Math.sin(Math.PI/180*Math.abs(n));i.x.clipPath=(t.getHorizontalAxisHeight("x")-20)/a}else i.x.clipPath=null},setXAxisTickTextClipPathWidth:function(){var t=this.state,e=t.clip,i=t.current,n=this.$el.svg;n&&n.select("#"+e.idXAxisTickTexts+" rect").attr("width",i.maxTickWidths.x.clipPath).attr("height",30)}},Ui=void 0,Zi=function(t){return i(this,Ui),S(t.position)||"end"}.bind(void 0),qi=function(t){return i(this,Ui),"start"===t.position?4:"middle"===t.position?0:-4}.bind(void 0);function Ki(t,e,n){var a=this;return function(r){i(this,a);var s=t?0:e;return"start"===r.position?s=t?-n:0:"middle"===r.position&&(s=(t?-n:e)/2),s}.bind(this)}function Ji(t,e){"grid"===e&&t.each((function(){var t=this,e=(0,a.select)(this);["x1","x2","y1","y2"].forEach(function(n){return i(this,t),e.attr(n,Math.ceil(+e.attr(n)))}.bind(this))}))}var Qi={hasGrid:function(){var t=this,e=this.config;return["x","y"].some(function(n){return i(this,t),e["grid_"+n+"_show"]||e["grid_"+n+"_lines"].length}.bind(this))},initGrid:function(){var t=this;t.hasGrid()&&t.initGridLines(),t.initFocusGrid()},initGridLines:function(){var t=this,e=t.config,i=t.state.clip,n=t.$el;(e.grid_x_lines.length||e.grid_y_lines.length)&&(n.gridLines.main=n.main.insert("g","."+vt.chart+(e.grid_lines_front?" + *":"")).attr("clip-path",i.pathGrid).attr("class",Lt.grid+" "+Lt.gridLines),n.gridLines.main.append("g").attr("class",Lt.xgridLines),n.gridLines.main.append("g").attr("class",Lt.ygridLines),n.gridLines.x=(0,a.selectAll)([]))},updateXGrid:function(t){var e=this,n=this,r=n.config,s=n.scale,o=n.state,l=n.$el,c=l.main,d=l.grid,u=r.axis_rotated,h=n.generateGridData(r.grid_x_type,s.x),g=n.axis.isCategorized()?n.axis.x.tickOffset():0,f=function(t){return i(this,e),(s.zoom||s.x)(t)+g*(u?-1:1)}.bind(this);o.xgridAttr=u?{x1:0,x2:o.width,y1:f,y2:f}:{x1:f,x2:f,y1:0,y2:o.height},d.x=c.select("."+Lt.xgrids).selectAll("."+Lt.xgrid).data(h),d.x.exit().remove(),d.x=d.x.enter().append("line").attr("class",Lt.xgrid).merge(d.x),t||d.x.each((function(){var t=this,e=(0,a.select)(this);Object.keys(o.xgridAttr).forEach(function(n){var a=this;i(this,t),e.attr(n,o.xgridAttr[n]).style("opacity",function(){return i(this,a),e.attr(u?"y1":"x1")===(u?o.height:0)?"0":null}.bind(this))}.bind(this))}))},updateYGrid:function(){var t=this,e=this,n=e.axis,a=e.config,r=e.scale,s=e.state,o=e.$el,l=o.grid,c=o.main,d=a.axis_rotated,u=function(e){return i(this,t),Math.ceil(r.y(e))}.bind(this),h=n.y.getGeneratedTicks(a.grid_y_ticks)||e.scale.y.ticks(a.grid_y_ticks);l.y=c.select("."+Lt.ygrids).selectAll("."+Lt.ygrid).data(h),l.y.exit().remove(),l.y=l.y.enter().append("line").attr("class",Lt.ygrid).merge(l.y),l.y.attr("x1",d?u:0).attr("x2",d?u:s.width).attr("y1",d?0:u).attr("y2",d?s.height:u),Ji(l.y,"grid")},updateGrid:function(){var t=this,e=t.$el,i=e.grid;e.gridLines.main||t.initGridLines(),i.main.style("visibility",t.hasArcType()?"hidden":null),t.hideGridFocus(),t.updateXGridLines(),t.updateYGridLines()},updateXGridLines:function(){var t=this,e=this,n=e.config,a=e.$el,r=a.gridLines,s=a.main,o=e.$T,l=n.axis_rotated;n.grid_x_show&&e.updateXGrid();var c=s.select("."+Lt.xgridLines).selectAll("."+Lt.xgridLine).data(n.grid_x_lines);o(c.exit()).style("opacity","0").remove();var d=c.enter().append("g");d.append("line").style("opacity","0"),d.append("text").attr("transform",l?null:"rotate(-90)").attr("dy",-5).style("opacity","0"),o((c=d.merge(c)).attr("class",function(e){return i(this,t),(Lt.xgridLine+" "+(e.class||"")).trim()}.bind(this)).select("text").attr("text-anchor",Zi).attr("dx",qi)).text(function(e){return i(this,t),e.text}.bind(this)).style("opacity",null),r.x=c},updateYGridLines:function(){var t=this,e=this,n=e.config,a=e.state,r=a.width,s=a.height,o=e.$el,l=e.$T,c=n.axis_rotated;n.grid_y_show&&e.updateYGrid();var d=o.main.select("."+Lt.ygridLines).selectAll("."+Lt.ygridLine).data(n.grid_y_lines);l(d.exit()).style("opacity","0").remove();var u=d.enter().append("g");u.append("line").style("opacity","0"),u.append("text").attr("transform",c?"rotate(-90)":"").style("opacity","0"),d=u.merge(d);var h=e.yv.bind(e);l(d.attr("class",function(e){return i(this,t),(Lt.ygridLine+" "+(e.class||"")).trim()}.bind(this)).select("line")).attr("x1",c?h:0).attr("x2",c?h:r).attr("y1",c?0:h).attr("y2",c?s:h).style("opacity",null),l(d.select("text").attr("text-anchor",Zi).attr("dx",qi)).attr("dy",-5).attr("x",Ki(c,r,s)).attr("y",h).text(function(e){return i(this,t),e.text}.bind(this)).style("opacity",null),o.gridLines.y=d},redrawGrid:function(t){var e=this,n=this,a=n.config.axis_rotated,r=n.state,s=r.width,o=r.height,l=n.$el.gridLines,c=n.$T,d=n.xv.bind(n),u=l.x.select("line"),h=l.x.select("text");return u=c(u,t).attr("x1",a?0:d).attr("x2",a?s:d).attr("y1",a?d:0).attr("y2",a?d:o),h=c(h,t).attr("x",Ki(!a,s,o)).attr("y",d).text(function(t){return i(this,e),t.text}.bind(this)),[u.style("opacity",null),h.style("opacity",null)]},initFocusGrid:function(){var t=this,e=t.config,i=t.state.clip,n=t.$el,a=e.grid_front,r="."+(a&&n.gridLines.main?Lt.gridLines:vt.chart)+(a?" + *":""),s=n.main.insert("g",r).attr("clip-path",i.pathGrid).attr("class",Lt.grid);n.grid.main=s,e.grid_x_show&&s.append("g").attr("class",Lt.xgrids),e.grid_y_show&&s.append("g").attr("class",Lt.ygrids),e.interaction_enabled&&e.grid_focus_show&&(s.append("g").attr("class",Et.xgridFocus).append("line").attr("class",Et.xgridFocus),e.grid_focus_y&&!e.tooltip_grouped&&s.append("g").attr("class",Et.ygridFocus).append("line").attr("class",Et.ygridFocus))},showGridFocus:function(t){var e=this,n=this,r=n.config,s=n.state,o=s.width,l=s.height,c=r.axis_rotated,d=n.$el.main.selectAll("line."+Et.xgridFocus+", line."+Et.ygridFocus),u=(t||[d.datum()]).filter(function(t){return i(this,e),t&&S(n.getBaseValue(t))}.bind(this));if(r.tooltip_show&&0!==u.length&&!n.hasType("bubble")&&!n.hasArcType()){var h=r.grid_focus_edge&&!r.tooltip_grouped,g=n.xx.bind(n);d.style("visibility",null).data(u.concat(u)).each((function(t){var e,r=this,s=(0,a.select)(this),d={x:g(t),y:n.getYScaleById(t.id)(t.value)};if(s.classed(Et.xgridFocus))e=c?[null,d.x,h?d.y:o,d.x]:[d.x,h?d.y:null,d.x,l];else{var u="y2"===n.axis.getId(t.id);e=c?[d.y,h&&!u?d.x:null,d.y,h&&u?d.x:l]:[h&&u?d.x:null,d.y,h&&!u?d.x:o,d.y]}["x1","y1","x2","y2"].forEach(function(t,n){return i(this,r),s.attr(t,e[n])}.bind(this))})),Ji(d,"grid"),null==n.showCircleFocus||n.showCircleFocus(t)}},hideGridFocus:function(){var t=this,e=t.state,i=e.inputType,n=e.resizing,a=t.$el.main;"mouse"!==i&&n||(a.selectAll("line."+Et.xgridFocus+", line."+Et.ygridFocus).style("visibility","hidden"),null==t.hideCircleFocus||t.hideCircleFocus())},updateGridFocus:function(){var t=this,e=t.state,i=e.inputType,n=e.width,a=e.height,r=e.resizing,s=t.$el.grid.main.select("line."+Et.xgridFocus);if("touch"===i)s.empty()?r&&(null==t.showCircleFocus||t.showCircleFocus()):t.showGridFocus();else{var o=t.config.axis_rotated;s.attr("x1",o?0:-10).attr("x2",o?n:-10).attr("y1",o?-10:0).attr("y2",o?-10:a)}return!0},generateGridData:function(t,e){var n=this,a=this.$el.main.select("."+_t.axisX).selectAll(".tick").size(),r=[];if("year"===t)for(var s=this.getXDomain().map(function(t){return i(this,n),t.getFullYear()}.bind(this)),o=s[0],l=s[1],c=o;c<=l;c++)r.push(new Date(c+"-01-01 00:00:00"));else(r=e.ticks(10)).length>a&&(r=r.filter(function(t){return i(this,n),(t+"").indexOf(".")<0}.bind(this)));return r},getGridFilterToRemove:function(t){var e=this;return t?function(n){var a=this;i(this,e);var r=!1;return(X(t)?t.concat():[t]).forEach(function(t){i(this,a),("value"in t&&n.value===t.value||"class"in t&&n.class===t.class)&&(r=!0)}.bind(this)),r}.bind(this):function(){return i(this,e),!0}.bind(this)},removeGridLines:function(t,e){var n=this,a=this,r=a.config,s=a.$T,o=a.getGridFilterToRemove(t),l=function(t){return i(this,n),!o(t)}.bind(this),c=e?Lt.xgridLines:Lt.ygridLines,d=e?Lt.xgridLine:Lt.ygridLine;s(a.$el.main.select("."+c).selectAll("."+d).filter(o)).style("opacity","0").remove();var u="grid_"+(e?"x":"y")+"_lines";r[u]=r[u].filter(l)}},tn={initRegion:function(){var t=this.$el;t.region.main=t.main.insert("g",":first-child").attr("clip-path",this.state.clip.path).attr("class",Dt.regions)},updateRegion:function(){var t=this,e=t.config,i=t.$el.region,n=t.$T;i.main||t.initRegion(),i.main.style("visibility",t.hasArcType()?"hidden":null);var a=i.main.selectAll("."+Dt.region).data(e.regions);n(a.exit()).style("opacity","0").remove();var r=a.enter().append("g");r.append("rect").style("fill-opacity","0"),i.list=r.merge(a).attr("class",t.classRegion.bind(t))},redrawRegion:function(t){var e=this,n=this,r=n.$el.region,s=n.$T,o=r.list.select("rect");return[(o=s(o,t).attr("x",n.regionX.bind(n)).attr("y",n.regionY.bind(n)).attr("width",n.regionWidth.bind(n)).attr("height",n.regionHeight.bind(n))).style("fill-opacity",function(t){return i(this,e),S(t.opacity)?t.opacity:null}.bind(this)).on("end",(function(){(0,a.select)(this.parentNode).selectAll("rect:not([x])").remove()}))]},getRegionXY:function(t,e){var i=this,n=i.config,a=i.scale,r=n.axis_rotated,s="x"===t,o="start",l=0;return"y"===e.axis||"y2"===e.axis?(s||(o="end"),(s?r:!r)&&o in e&&(l=(0,a[e.axis])(e[o]))):(s?!r:r)&&o in e&&(l=(a.zoom||a.x)(i.axis.isTimeSeries()?dt.call(i,e[o]):e[o])),l},regionX:function(t){return this.getRegionXY("x",t)},regionY:function(t){return this.getRegionXY("y",t)},getRegionSize:function(t,e){var i=this,n=i.config,a=i.scale,r=i.state,s=n.axis_rotated,o="width"===t,l=i[o?"regionX":"regionY"](e),c="end",d=r[t];return"y"===e.axis||"y2"===e.axis?(o||(c="start"),(o?s:!s)&&c in e&&(d=(0,a[e.axis])(e[c]))):(o?!s:s)&&c in e&&(d=(a.zoom||a.x)(i.axis.isTimeSeries()?dt.call(i,e[c]):e[c])),ds.height/2&&(f=s.height/2)),f+(n.axis.getLabelPositionById(t).isInner?0:10)+("y2"!==t||d?0:-10)},getEventRectWidth:function(){var t=this.config,e=this.axis,i=t.axis_x_inverted,n=e.x.tickInterval();return Math.max(0,i?Math.abs(n):n)},getAxisTickRotate:function(t){var e=this,i=e.axis,n=e.config,a=e.state,r=e.$el,s=n["axis_"+t+"_tick_rotate"];if("x"===t){var o=i.isCategorized()||i.isTimeSeries();if(n.axis_x_tick_fit&&o){var l=n.axis_x_tick_count,c=a.current.maxTickWidths.x.ticks.length,d=0;if(l?d=l>c?c:l:c&&(d=c),d!==a.axis.x.tickCount){var u=e.data.targets;a.axis.x.padding=e.getXDomainPadding([e.getXDomainMinMax(u,"min"),e.getXDomainMinMax(u,"max")],d)}a.axis.x.tickCount=d}r.svg&&n.axis_x_tick_fit&&!n.axis_x_tick_multiline&&!n.axis_x_tick_culling&&n.axis_x_tick_autorotate&&o&&(s=e.needToRotateXAxisTickTexts()?n.axis_x_tick_rotate:0)}return s},needToRotateXAxisTickTexts:function(){var t=this,e=t.state,i=e.axis,n=e.current.width-t.getCurrentPaddingLeft(!1)-t.getCurrentPaddingRight(),a=i.x.tickCount+i.x.padding.left+i.x.padding.right;return t.axis.getMaxTickWidth("x")>(a?n/a:0)}},nn={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:"indexed",axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_culling_lines:!0,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},an={axis_y2_show:!1,axis_y2_type:"indexed",axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_culling_lines:!0,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]};function rn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function sn(t){for(var e,i=1;i1&&(n.axis_x_categories[t]=e,i.redraw()),n.axis_x_categories[t]},categories:function(t){var e=this.internal,i=e.config;return arguments.length?(i.axis_x_categories=t,e.redraw(),i.axis_x_categories):i.axis_x_categories}},Xi,Pi,Ii,Mi,$i],cn=[Gi,Wi,Vi,Hi,Qi,tn,en],dn=[{data_xs:{},data_xFormat:"%Y-%m-%d",data_xLocaltime:!0,data_xSort:!0,data_axes:{},data_regions:{},data_stack_normalize:!1},on,{grid_x_show:!1,grid_x_type:"tick",grid_x_lines:[],grid_y_show:!1,grid_y_lines:[],grid_y_ticks:void 0,grid_focus_edge:!1,grid_focus_show:!0,grid_focus_y:!1,grid_front:!1,grid_lines_front:!0}],un=p(12);function hn(t){void 0===t&&(t=0);var e=this,i=e.config,n=e.state,a=e.hasMultiArcGauge(),r=n.gaugeArcWidth/e.filterTargetsToShow(e.data.targets).length,s=t?Math.min(n.radiusExpanded*t-n.radius,.8*r-100*(1-t)):0;return{inner:function(t){var i=e.getRadius(t).innerRadius;return a?n.radius-r*(t.index+1):R(i)?i:0},outer:function(i){var o,l=e.getRadius(i).outerRadius;if(a)o=n.radius-r*i.index+s;else if(e.hasType("polar")&&!t)o=e.getPolarOuterRadius(i,l);else if(o=l,t){var c=n.radiusExpanded;n.radius!==l&&(c-=Math.abs(n.radius-l)),o=c*t}return o},corner:function(t,n){var a=i.arc_cornerRadius_ratio,r=void 0===a?0:a,s=i.arc_cornerRadius,o=void 0===s?0:s,l=t.data.id,c=t.value;return r?r*n:R(o)?o:o.call(e.api,l,c,n)}}}function gn(t){return function(e){var i=(0,un.interpolate)(this._current,e);return this._current=e,function(e){var n=i(e);return t(n)}}}var fn={initPie:function(){var t=this,e=this,n=e.config,a=n.data_type,r=n[a+"_padding"],s=n[a+"_startingAngle"]||0,o=(r?.01*r:n[a+"_padAngle"])||0;e.pie=(0,Ue.pie)().startAngle(s).endAngle(s+2*Math.PI).padAngle(o).value(function(e){var n=this;return i(this,t),e.values.reduce(function(t,e){return i(this,n),t+e.value}.bind(this),0)}.bind(this)).sort(e.getSortCompareFn.bind(e)(!0))},updateRadius:function(){var t=this,e=t.config,i=t.state,n=e[e.data_type+"_padding"],a=e.gauge_width||e.donut_width,r=t.filterTargetsToShow(t.data.targets).length*e.gauge_arcs_minWidth;i.radiusExpanded=Math.min(i.arcWidth,i.arcHeight)/2*(t.hasMultiArcGauge()&&e.gauge_label_show?.85:1),i.radius=.95*i.radiusExpanded,i.innerRadiusRatio=a?(i.radius-a)/i.radius:.6,i.gaugeArcWidth=a||(r<=i.radius-i.innerRadius?i.radius-i.innerRadius:r<=i.radius?r:i.radius);var s=e.pie_innerRadius||(n?n*(i.innerRadiusRatio+.1):0);i.outerRadius=e.pie_outerRadius,i.innerRadius=t.hasType("donut")||t.hasType("gauge")?i.radius*i.innerRadiusRatio:s},getRadius:function(t){var e=null==t?void 0:t.data,i=this.state,n=i.innerRadius,a=i.outerRadius;return!R(n)&&e&&(n=n[e.id]||0),F(a)&&e&&e.id in a?a=a[e.id]:R(a)||(a=this.state.radius),{innerRadius:n,outerRadius:a}},updateArc:function(){var t=this;t.updateRadius(),t.svgArc=t.getSvgArc(),t.svgArcExpanded=t.getSvgArcExpanded()},getArcLength:function(){var t=3.6*this.config.gauge_arcLength,e=t/360*2;return t<-360?e=-2:t>360&&(e=2),e*Math.PI},getGaugeStartAngle:function(){var t=this.config,e=t.gauge_fullCircle,i=-1*Math.PI/2,n=Math.PI/2,a=t.gauge_startingAngle;return!e&&a<=i?a=i:!e&&a>=n?a=n:(a>Math.PI||a<-1*Math.PI)&&(a=Math.PI),a},updateAngle:function(t){var e=this,n=this,a=n.config,r=n.state,s=n.pie,o=t,l=!1;if(!a)return null;var c=n.getGaugeStartAngle(),d=a.gauge_fullCircle?n.getArcLength():-2*c;if(o.data&&n.isGaugeType(o.data)&&!n.hasMultiArcGauge()){var u=a.gauge_min,h=a.gauge_max,g=n.getTotalDataSum(r.rendered);s=s.startAngle(c).endAngle(d*((g-u)/(h-u))+c)}if(s(n.filterTargetsToShow()).forEach(function(t,n){var a;i(this,e),l||t.data.id!==(null==(a=o.data)?void 0:a.id)||(l=!0,(o=t).index=n)}.bind(this)),isNaN(o.startAngle)&&(o.startAngle=0),isNaN(o.endAngle)&&(o.endAngle=o.startAngle),o.data&&n.hasMultiArcGauge()){var f=a.gauge_min,p=a.gauge_max,v=o.value1){var c,d=n.getRadius(t).outerRadius;n.hasType("polar")&&(d=n.getPolarOuterRadius(t,d));var u=this.svgArc.centroid(s).map(function(t){return i(this,e),isNaN(t)?0:t}.bind(this)),h=u[0],g=u[1],f=Math.sqrt(h*h+g*g),p=null==(c=["donut","pie","polar"].filter(n.hasType.bind(n)).map(function(t){return i(this,e),a[t+"_label_ratio"]}.bind(this)))?void 0:c[0];o="translate("+h*(p=p?k(p)?p.bind(n.api)(t,d,f):p:d&&(f?(36/d>.375?1.175-36/d:.8)*d/f:0))+","+g*p+")"}return o},convertToArcData:function(t){return this.addName({id:"data"in t?t.data.id:t.id,value:t.value,ratio:this.getRatio("arc",t),index:t.index})},textForArcLabel:function(t){var e=this,i=e.hasType("gauge");e.shouldShowArcLabel()&&t.style("fill",e.updateTextColor.bind(e)).attr("filter",e.updateTextBacgroundColor.bind(e)).each((function(t){var n,r=(0,a.select)(this),s=e.updateAngle(t),o=e.getRatio("arc",s);if(e.meetsLabelThreshold(o,null==(n=["donut","gauge","pie","polar"].filter(e.hasType.bind(e)))?void 0:n[0])){var l=(s||t).value;V(r,(e.getArcLabelFormat()||e.defaultArcValueFormat)(l,o,t.data.id).toString(),[-1,1],i)}else r.text("")}))},expandArc:function(t){var e=this,n=this,r=n.state.transiting,s=n.$el;if(r)var o=setInterval(function(){i(this,e),r||(clearInterval(o),s.legend.selectAll("."+Et.legendItemFocused).size()>0&&n.expandArc(t))}.bind(this),10);else{var l=n.mapToTargetIds(t);s.svg.selectAll(n.selectorTargets(l,"."+xt.chartArc)).each((function(t){if(n.shouldExpand(t.data.id)){var e=n.getExpandConfig(t.data.id,"duration"),i=n.getSvgArcExpanded(n.getExpandConfig(t.data.id,"rate"));(0,a.select)(this).selectAll("path").transition().duration(e).attrTween("d",gn(n.svgArcExpanded.bind(n))).transition().duration(2*e).attrTween("d",gn(i.bind(n)))}}))}},unexpandArc:function(t){var e=this,n=this,a=n.state.transiting,r=n.$el.svg;if(!a){var s=n.mapToTargetIds(t);r.selectAll(n.selectorTargets(s,"."+xt.chartArc)).selectAll("path").transition().duration(function(t){return i(this,e),n.getExpandConfig(t.data.id,"duration")}.bind(this)).attrTween("d",gn(n.svgArc.bind(n))),r.selectAll(""+xt.arc).style("opacity",null)}},getExpandConfig:function(t,e){var i,n=this,a=n.config;return n.isDonutType(t)?i="donut":n.isGaugeType(t)?i="gauge":n.isPieType(t)&&(i="pie"),i?a[i+"_expand_"+e]:{duration:50,rate:.98}[e]},shouldExpand:function(t){var e=this,i=e.config;return e.isDonutType(t)&&i.donut_expand||e.isGaugeType(t)&&i.gauge_expand||e.isPieType(t)&&i.pie_expand},shouldShowArcLabel:function(){var t=this,e=this,n=e.config;return["donut","gauge","pie","polar"].some(function(a){return i(this,t),e.hasType(a)&&n[a+"_label_show"]}.bind(this))},getArcLabelFormat:function(){var t=this,e=this,n=e.config,a=function(e){return i(this,t),e}.bind(this);return["donut","gauge","pie","polar"].filter(e.hasType.bind(e)).forEach(function(e){i(this,t),a=n[e+"_label_format"]}.bind(this)),k(a)?a.bind(e.api):a},updateTargetsForArc:function(t){var e=this,n=this,a=n.$el,r=n.hasType("gauge"),s=n.getChartClass("Arc"),o=n.getClass("arcs",!0),l=n.classFocus.bind(n),c=a.main.select("."+xt.chartArcs),d=c.selectAll("."+xt.chartArc).data(n.pie(t)).attr("class",function(t){return i(this,e),s(t)+l(t.data)}.bind(this)),u=d.enter().append("g").attr("class",s).call(this.setCssRule(!1,"."+xt.chartArcs+" text",["pointer-events:none","text-anchor:middle"]));u.append("g").attr("class",o).merge(d),u.append("text").attr("dy",r&&!n.hasMultiTargets()?"-.1em":".35em").style("opacity","0").style("text-anchor",n.getStylePropValue("middle")).style("pointer-events",n.getStylePropValue("none")),a.text=c.selectAll("."+vt.target+" text")},initArc:function(){var t=this,e=t.$el;e.arcs=e.main.select("."+vt.chart).append("g").attr("class",xt.chartArcs).attr("transform",t.getTranslate("arc")),t.setArcTitle()},setArcTitle:function(t){var e=this,i=t||e.getArcTitle(),n=e.hasType("gauge");if(i){var a=n?St.chartArcsGaugeTitle:xt.chartArcsTitle,r=e.$el.arcs.select("."+a);r.empty()&&(r=e.$el.arcs.append("text").attr("class",a).style("text-anchor","middle")),n&&r.attr("dy","-0.3em"),V(r,i,n?void 0:[-.6,1.35],!0)}},getArcTitle:function(){var t=this,e=t.hasType("donut")?"donut":t.hasType("gauge")&&"gauge";return e?t.config[e+"_title"]:""},getArcTitleWithNeedleValue:function(){var t=this,e=t.config,i=t.state,n=t.getArcTitle();if(n&&t.config.arc_needle_show&&/{=[A-Z_]+}/.test(n)){var a=i.current.needle;return R(a)||(a=e.arc_needle_value),ct(n,{NEEDLE_VALUE:R(a)?a:0})}return!1},redrawArc:function(t,e,n){var r=this,s=this,o=s.config,l=s.state,c=s.$el.main,d=o.interaction_enabled,u=d&&o.data_selection_isselectable,h=c.selectAll("."+xt.arcs).selectAll("."+xt.arc).data(s.arcData.bind(s));h.exit().transition().duration(e).style("opacity","0").remove(),h=h.enter().append("path").attr("class",s.getClass("arc",!0)).style("fill",function(t){return i(this,r),s.color(t.data)}.bind(this)).style("cursor",function(t){return i(this,r),null!=u&&null!=u.bind&&u.bind(s.api)(t)?"pointer":null}.bind(this)).style("opacity","0").each((function(t){s.isGaugeType(t.data)&&(t.startAngle=o.gauge_startingAngle,t.endAngle=o.gauge_startingAngle),this._current=t})).merge(h),s.hasType("gauge")&&(s.updateGaugeMax(),s.hasMultiArcGauge()&&s.redrawMultiArcGauge()),h.attr("transform",function(t){return i(this,r),!s.isGaugeType(t.data)&&n?"scale(0)":""}.bind(this)).style("opacity",(function(t){return t===this._current?"0":null})).each(function(){i(this,r),l.transiting=!0}.bind(this)).transition().duration(t).attrTween("d",(function(t){var e=this,n=s.updateAngle(t);if(!n)return function(){return i(this,e),"M 0 0"}.bind(this);isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);var a=(0,un.interpolate)(this._current,n);return this._current=a(0),function(e){var i=a(e);return i.data=t.data,s.getArc(i,!0)}})).attr("transform",n?"scale(1)":"").style("fill",function(t){var e;return i(this,r),s.levelColor?(e=s.levelColor(t.data.values[0].value),o.data_colors[t.data.id]=e):e=s.color(t.data),e}.bind(this)).style("opacity",null).call(G,(function(){if(s.levelColor){var t=(0,a.select)(this),e=t.datum();s.updateLegendItemColor(e.data.id,t.style("fill"))}l.transiting=!1,N(o.onrendered,s.api)})),d&&s.bindArcEvent(h),s.hasType("polar")&&s.redrawPolar(),s.hasType("gauge")&&s.redrawBackgroundArcs(),o.arc_needle_show&&s.redrawNeedle(),s.redrawArcText(t)},redrawNeedle:function(){var t=this,e=this,n=e.$el,a=e.config,r=e.state,s=r.hiddenTargetIds,o=(r.radius-1)/100*a.arc_needle_length,l=s.length!==e.data.targets.length,c=e.$el.arcs.select("."+xt.needle),d=a.arc_needle_path,u=a.arc_needle_bottom_width/2,h=a.arc_needle_top_width/2,g=a.arc_needle_top_rx,f=a.arc_needle_top_ry,p=a.arc_needle_bottom_len,v=a.arc_needle_bottom_rx,x=a.arc_needle_bottom_ry,b=e.getNeedleAngle(),_=function(){i(this,t);var n=e.getArcTitleWithNeedleValue();n&&e.setArcTitle(n)}.bind(this);if(_(),c.empty()&&(c=n.arcs.append("path").classed(xt.needle,!0),n.needle=c,n.needle.updateHelper=function(r,s){var o=this;void 0===s&&(s=!1),i(this,t),"none"!==n.needle.style("display")&&e.$T(n.needle).style("transform","rotate("+e.getNeedleAngle(r)+"deg)").call(G,function(){i(this,o),s&&(a.arc_needle_value=r),_()}.bind(this))}.bind(this)),l){var m=k(d)?d.call(e,o):"M-"+u+" "+p+" A"+v+" "+x+" 0 0 0 "+u+" "+p+" L"+h+" -"+o+" A"+g+" "+f+" 0 0 0 -"+h+" -"+o+" L-"+u+" "+p+" Z";e.$T(c).attr("d",m).style("fill",a.arc_needle_color).style("display",null).style("transform","rotate("+b+"deg)")}else c.style("display","none")},getNeedleAngle:function(t){var e=this,i=e.config,n=e.state,a=e.getArcLength(),r=e.hasType("gauge"),s=e.getTotalDataSum(!0),o=L(t)?t:i.arc_needle_value,l=i[i.data_type+"_startingAngle"]||0,c=0;if(R(o)||(o=r&&1===e.data.targets.length?s:0),n.current.needle=o,r){l=e.getGaugeStartAngle();var d=i.gauge_fullCircle?a:-2*l,u=i.gauge_min;c=d*((o-u)/(i.gauge_max-u))}else c=a*(o/s);return(l+c)*(180/Math.PI)},redrawBackgroundArcs:function(){var t=this,e=this,n=e.config,a=e.state,r=e.hasMultiArcGauge(),s=n.gauge_fullCircle,o=0===e.filterTargetsToShow(e.data.targets).length&&!!n.data_empty_label_text,l=e.getGaugeStartAngle(),c=s?l+e.getArcLength():-1*l,d=e.$el.arcs.select((r?"g":"")+"."+xt.chartArcsBackground);if(r){var u=0;(d=d.selectAll("path."+xt.chartArcsBackground).data(e.data.targets)).enter().append("path").attr("class",function(e,n){return i(this,t),xt.chartArcsBackground+" "+xt.chartArcsBackground+"-"+n}.bind(this)).merge(d).style("fill",n.gauge_background||null).attr("d",function(r){var s=r.id;if(i(this,t),o||a.hiddenTargetIds.indexOf(s)>=0)return"M 0 0";var d={data:[{value:n.gauge_max}],startAngle:l,endAngle:c,index:u++};return e.getArc(d,!0,!0)}.bind(this)),d.exit().remove()}else d.attr("d",o?"M 0 0":function(){i(this,t);var a={data:[{value:n.gauge_max}],startAngle:l,endAngle:c};return e.getArc(a,!0,!0)}.bind(this))},bindArcEvent:function(t){var e=this,n=this,r=n.config,s=n.state,o="touch"===s.inputType,l="mouse"===s.inputType;function c(t,e,i){n.expandArc(i),n.api.focus(i),n.toggleFocusLegend(i,!0),n.showTooltip([e],t)}function d(t){var e=(null==t?void 0:t.id)||void 0;n.unexpandArc(e),n.api.revert(),n.revertLegend(),n.hideTooltip()}if(t.on("click",(function(t,e,i){var a,s=n.updateAngle(e);s&&(a=n.convertToArcData(s),null==n.toggleShape||n.toggleShape(this,a,i),r.data_onclick.bind(n.api)(a,this))})),l&&t.on("mouseover",(function(t,e){var i;if(!s.transiting){s.event=t;var a=n.updateAngle(e),r=a?n.convertToArcData(a):null;c(this,r,(null==(i=r)?void 0:i.id)||void 0),n.setOverOut(!0,r)}})).on("mouseout",function(t,a){if(i(this,e),!s.transiting){s.event=t;var r=n.updateAngle(a),o=r?n.convertToArcData(r):null;d(),n.setOverOut(!1,o)}}.bind(this)).on("mousemove",(function(t,e){var i=n.updateAngle(e),a=i?n.convertToArcData(i):null;s.event=t,n.showTooltip([a],this)})),o&&n.hasArcType()&&!n.radars){var u=function(t){i(this,e);var n=t.changedTouches[0];return(0,a.select)(h.elementFromPoint(n.clientX,n.clientY))}.bind(this);n.$el.svg.on("touchstart touchmove",(function(t){var e,i;if(!s.transiting){s.event=t;var a=u(t).datum(),r=null!=(e=a)&&e.data&&a.data.id?n.updateAngle(a):null,o=r?n.convertToArcData(r):null,l=(null==(i=o)?void 0:i.id)||void 0;n.callOverOutForTouch(o),E(l)?d():c(this,o,l)}}))}},redrawArcText:function(t){var e,n=this,a=this,r=a.config,s=a.state,o=a.$el,l=o.main,c=o.arcs,d=a.hasType("gauge"),u=a.hasMultiArcGauge();if(d&&1===a.data.targets.length&&r.gauge_title||(e=l.selectAll("."+xt.chartArc).select("text").style("opacity","0").attr("class",function(t){return i(this,n),a.isGaugeType(t.data)?St.gaugeValue:null}.bind(this)).call(a.textForArcLabel.bind(a)).attr("transform",a.transformForArcLabel.bind(a)).style("font-size",function(t){return i(this,n),a.isGaugeType(t.data)&&1===a.data.targets.length&&!u?Math.round(s.radius/5)+"px":null}.bind(this)).transition().duration(t).style("opacity",function(t){return i(this,n),a.isTargetToShow(t.data.id)&&a.isArcType(t.data)?null:"0"}.bind(this)),u&&e.attr("dy","-.1em")),l.select("."+xt.chartArcsTitle).style("opacity",a.hasType("donut")||d?null:"0"),d){var h,g=r.gauge_fullCircle;g&&(null==(h=e)||h.attr("dy",""+(u?0:Math.round(s.radius/14)))),r.gauge_label_show&&(c.select("."+St.chartArcsGaugeUnit).attr("dy",(g?1.5:.75)+"em").text(r.gauge_units),c.select("."+St.chartArcsGaugeMin).attr("dx",-1*(s.innerRadius+(s.radius-s.innerRadius)/(g?1:2))+"px").attr("dy","1.2em").text(a.textForGaugeMinMax(r.gauge_min,!1)),g||c.select("."+St.chartArcsGaugeMax).attr("dx",s.innerRadius+(s.radius-s.innerRadius)/2+"px").attr("dy","1.2em").text(a.textForGaugeMinMax(r.gauge_max,!0)))}}},pn={initArea:function(t){var e=this.config;t.insert("g","."+(e.area_front?Tt.circles:Ct.lines)).attr("class",this.getClass("areas",!0))},updateAreaColor:function(t){var e=this;return e.config.area_linearGradient?e.getGradienColortUrl(t.id):e.color(t)},updateArea:function(t,e){void 0===e&&(e=!1);var i=this,n=i.config,r=i.state,s=i.$el,o=i.$T,l=e?s.subchart:s;n.area_linearGradient&&i.updateLinearGradient();var c=l.main.selectAll("."+bt.areas).selectAll("."+bt.area).data(i.lineData.bind(i));o(c.exit(),t).style("opacity","0").remove(),l.area=c.enter().append("path").attr("class",i.getClass("area",!0)).style("fill",i.updateAreaColor.bind(i)).style("opacity",(function(){return r.orgAreaOpacity=(0,a.select)(this).style("opacity"),"0"})).merge(c),c.style("opacity",r.orgAreaOpacity),i.setRatioForGroupedData(l.area.data())},redrawArea:function(t,e,n){var a=this;void 0===n&&(n=!1);var r=this,s=(n?this.$el.subchart:this.$el).area,o=r.state.orgAreaOpacity;return[r.$T(s,e,Z()).attr("d",t).style("fill",r.updateAreaColor.bind(r)).style("opacity",function(t){return i(this,a),(r.isAreaRangeType(t)?o/1.75:o)+""}.bind(this))]},generateDrawArea:function(t,e){var n=this,a=this,r=a.config,s=r.line_connectNull,o=r.axis_rotated,l=a.generateGetAreaPoints(t,e),c=a.getYScaleById.bind(a),d=function(t){return i(this,n),(e?a.subxx:a.xx).call(a,t)}.bind(this),u=function(t,r){return i(this,n),a.isGrouped(t.id)?l(t,r)[0][1]:c(t.id,e)(a.isAreaRangeType(t)?a.getRangedData(t,"high"):a.getShapeYMin(t.id))}.bind(this),h=function(t,r){return i(this,n),a.isGrouped(t.id)?l(t,r)[1][1]:c(t.id,e)(a.isAreaRangeType(t)?a.getRangedData(t,"low"):t.value)}.bind(this);return function(t){var e=this;i(this,n);var l,c=s?a.filterRemoveNull(t.values):t.values,g=0,f=0;if(a.isAreaType(t)){var p=(0,Ue.area)();p=o?p.y(d).x0(u).x1(h):p.x(d).y0(r.area_above?0:r.area_below?a.state.height:u).y1(h),s||(p=p.defined(function(t){return i(this,e),null!==a.getBaseValue(t)}.bind(this))),a.isStepType(t)&&(c=a.convertValuesToStep(c)),l=p.curve(a.getCurve(t))(c)}else c[0]&&(g=a.scale.x(c[0].x),f=a.getYScaleById(t.id)(c[0].value)),l=o?"M "+f+" "+g:"M "+g+" "+f;return l||"M 0 0"}.bind(this)},generateGetAreaPoints:function(t,e){var i=this,n=i.config,a=i.getShapeX(0,t,e),r=i.getShapeY(!!e),s=i.getShapeOffset(i.isAreaType,t,e),o=i.getYScaleById.bind(i);return function(t,l){var c=o.call(i,t.id,e)(i.getShapeYMin(t.id)),d=s(t,l)||c,u=a(t),h=t.value,g=r(t);return n.axis_rotated&&(h>0&&g0?function(){return i(this,n),l}.bind(this):R(c)?function(t){return i(this,n),t*c}.bind(this):null;return function(t,e){i(this,n);var l=s(t,e),c=+o,u=+!c,h=t.value<0,g=r["axis_"+a.axis.getId(t.id)+"_inverted"],f=!g&&h||g&&!h,p=["",""],v=0,x=a.isGrouped(t.id),b=!(!d||!x)&&a.isStackingRadiusData(t);if(d){var _=o?u:c,m=l[2][_]-l[0][_],y="a"+(v=!x||b?d(m):0)+","+v+" "+(f?"1 0 0":"0 0 1")+" ";p[+!o]=""+y+v+","+v,p[+o]=""+y+[-v,v][o?"sort":"reverse"](),f&&p.reverse()}var T=o?"H"+(l[1][c]+(f?v:-v))+" "+p[0]+"V"+(l[2][u]-v)+" "+p[1]+"H"+l[3][c]:"V"+(l[1][u]+(f?-v:v))+" "+p[0]+"H"+(l[2][c]-v)+" "+p[1]+"V"+l[3][u];return"M"+l[0][c]+","+l[0][u]+T+"z"}.bind(this)},isStackingRadiusData:function(t){var e=this,n=this,a=n.$el,r=n.config,s=n.data,o=n.state,l=t.id,c=t.index,d=t.value;if(o.hiddenTargetIds.indexOf(l)>-1){var u=a.bar.filter(function(t){return i(this,e),t.id===l&&t.value===d}.bind(this));return!u.empty()&&/a\d+/i.test(u.attr("d"))}var h=r.data_groups.find(function(t){return i(this,e),t.indexOf(l)>-1}.bind(this)),g=n.orderTargets(n.filterTargetsToShow(s.targets.filter(n.isBarType,n))).filter(function(t){return i(this,e),h.indexOf(t.id)>-1}.bind(this)).map(function(t){var n=this;return i(this,e),t.values.filter(function(t){return i(this,n),t.index===c&&(R(d)&&d>0?t.value>0:t.value<0)}.bind(this))[0]}.bind(this)).filter(Boolean).map(function(t){return i(this,e),t.id}.bind(this));return 0!==d&&g.indexOf(l)===g.length-1},generateGetBarPoints:function(t,e){var n=this,a=this,r=a.config,s=e?a.axis.subX:a.axis.x,o=a.getIndicesMax(t)+1,l=a.getBarW("bar",s,o),c=a.getShapeX(l,t,!!e),d=a.getShapeY(!!e),u=a.getShapeOffset(a.isBarType,t,!!e),h=a.getYScaleById.bind(a);return function(t,s){i(this,n);var o=t.id,g=h.call(a,o,e)(a.getShapeYMin(o)),f=u(t,s)||g,p=R(l)?l:l[t.id]||l._$width,v=r["axis_"+a.axis.getId(o)+"_inverted"],x=t.value,b=c(t),_=d(t);r.axis_rotated&&!v&&(x>0&&_0&&b.start=e.open),e||null}},_n={initGauge:function(){var t=this,e=this,n=e.config,a=e.$el.arcs,r=function(e){i(this,t),a.append("text").attr("class",e).style("text-anchor","middle").style("pointer-events","none")}.bind(this);if(e.hasType("gauge")){var s=e.hasMultiArcGauge();a.append(s?"g":"path").attr("class",xt.chartArcsBackground).style("fill",!s&&n.gauge_background||null),n.gauge_units&&r(St.chartArcsGaugeUnit),n.gauge_label_show&&(r(St.chartArcsGaugeMin),n.gauge_fullCircle||r(St.chartArcsGaugeMax))}},updateGaugeMax:function(){var t=this,e=t.config,i=t.state,n=t.hasMultiArcGauge()?t.getMinMaxData().max[0].value:t.getTotalDataSum(i.rendered);n+e.gauge_min*(e.gauge_min>0?-1:1)>e.gauge_max&&(e.gauge_max=n-e.gauge_min)},redrawMultiArcGauge:function(){var t=this,e=this,n=e.config,r=e.state,s=e.$el,o=e.state.hiddenTargetIds,l=s.main.selectAll("."+xt.arcs).selectAll("."+xt.arcLabelLine).data(e.arcData.bind(e));l.enter().append("rect").attr("class",function(e){return i(this,t),xt.arcLabelLine+" "+vt.target+" "+vt.target+"-"+e.data.id}.bind(this)).merge(l).style("fill",function(n){return i(this,t),e.levelColor?e.levelColor(n.data.values[0].value):e.color(n.data)}.bind(this)).style("display",n.gauge_label_show?null:"none").each((function(t){var i=0,n=0,s=0,l="";if(o.indexOf(t.data.id)<0){var c=e.updateAngle(t),d=r.gaugeArcWidth/e.filterTargetsToShow(e.data.targets).length*(c.index+1),u=c.endAngle-Math.PI/2,h=r.radius-d,g=u-(0===h?0:1/h);i=r.radiusExpanded-r.radius+d,n=Math.cos(g)*h,s=Math.sin(g)*h,l="rotate("+180*u/Math.PI+", "+n+", "+s+")"}(0,a.select)(this).attr("x",n).attr("y",s).attr("width",i).attr("height",2).attr("transform",l).style("stroke-dasharray","0, "+(i+2)+", 0")}))},textForGaugeMinMax:function(t,e){var i=this.config.gauge_label_extents;return k(i)?i.bind(this.api)(t,e):t},getGaugeLabelHeight:function(){var t=this.config;return this.config.gauge_label_show&&!t.gauge_fullCircle?20:0},getPaddingBottomForGauge:function(){return this.getGaugeLabelHeight()*(this.config.gauge_label_show?2:2.5)}},mn={initBubble:function(){var t=this.config;this.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength:function(){var t=this,e=t.state,i=e.width,n=e.height,a=ae,r=t.cache.get(a);return r||t.cache.add(a,r=st("min",[i,n])),r},getBubbleR:function(t){var e=this,n=this,a=n.config.bubble_maxR;k(a)?a=a.bind(n.api)(t):R(a)||(a=n.getBaseLength()/(2*n.getMaxDataCount())+12);var r=st("max",n.getMinMaxData().max.map(function(t){return i(this,e),n.isBubbleZType(t)?n.getBubbleZData(t.value,"y"):F(t.value)?t.value.mid:t.value}.bind(this))),s=a*a*Math.PI,o=(n.isBubbleZType(t)?n.getBubbleZData(t.value,"z"):t.value)*(s/r);return Math.sqrt(o/Math.PI)},getBubbleZData:function(t,e){return F(t)?t[e]:t["y"===e?0:1]}},yn={initLine:function(){var t=this.$el;t.line=t.main.select("."+vt.chart).append("g").attr("class",Ct.chartLines).call(this.setCssRule(!1,"."+Ct.chartLines,["pointer-events:none"]))},updateTargetsForLine:function(t){var e=this,n=this,a=n.$el,r=a.area,s=a.line,o=a.main,l=n.getChartClass("Line"),c=n.getClass("lines",!0),d=n.classFocus.bind(n);s||n.initLine();var u=t.filter(function(t){return i(this,e),!(n.isScatterType(t)||n.isBubbleType(t))}.bind(this)),h=o.select("."+Ct.chartLines).selectAll("."+Ct.chartLine).data(u).attr("class",function(t){return i(this,e),l(t)+d(t)}.bind(this)),g=h.enter().append("g").attr("class",l).style("opacity","0").style("pointer-events",n.getStylePropValue("none"));if(g.append("g").attr("class",c),n.hasTypeOf("Area")){var f=(!r&&g.empty()?h:g).filter(n.isAreaType.bind(n));n.initArea(f)}n.updateTargetForCircle(u,g)},updateLine:function(t,e){var n=this;void 0===e&&(e=!1);var a=this,r=a.format.extraLineClasses,s=a.$el,o=a.$T,l=e?s.subchart:s,c=l.main.selectAll("."+Ct.lines).selectAll("."+Ct.line).data(a.lineData.bind(a));o(c.exit(),t).style("opacity","0").remove(),l.line=c.enter().append("path").attr("class",function(t){return i(this,n),a.getClass("line",!0)(t)+" "+(r(t)||"")}.bind(this)).style("stroke",a.color).merge(c).style("opacity",a.initialOpacity.bind(a)).style("shape-rendering",function(t){return i(this,n),a.isStepType(t)?"crispEdges":""}.bind(this)).attr("transform",null)},redrawLine:function(t,e,i){void 0===i&&(i=!1);var n=this.$el;return[(0,this.$T)((i?n.subchart:n).line,e,Z()).attr("d",t).style("stroke",this.color).style("opacity",null)]},getCurve:function(t){var e=this,n=this;return n.config.axis_rotated&&n.isStepType(t)?function(a){i(this,e);var r=n.getInterpolate(t)(a);return r.orgPoint=r.point,r.pointRotated=function(t,e){1===this._point&&(this._point=2);var i=this._y*(1-this._t)+e*this._t;this._context.lineTo(this._x,i),this._context.lineTo(t,i),this._x=t,this._y=e},r.point=function(t,e){0===this._point?this.orgPoint(t,e):this.pointRotated(t,e)},r}.bind(this):n.getInterpolate(t)},generateDrawLine:function(t,e){var n=this,a=this,r=a.config,s=a.scale,o=r.line_connectNull,l=r.axis_rotated,c=a.generateGetLinePoints(t,e),d=a.getYScaleById.bind(a),u=function(t){return i(this,n),(e?a.subxx:a.xx).call(a,t)}.bind(this),h=function(t,r){return i(this,n),a.isGrouped(t.id)?c(t,r)[0][1]:d(t.id,e)(a.getBaseValue(t))}.bind(this),g=(0,Ue.line)();g=l?g.x(h).y(u):g.x(u).y(h),o||(g=g.defined(function(t){return i(this,n),null!==a.getBaseValue(t)}.bind(this)));var f=e?s.subX:s.x;return function(t){i(this,n);var c,u=d(t.id,e),h=o?a.filterRemoveNull(t.values):t.values,p=0,v=0;if(a.isLineType(t)){var x=r.data_regions[t.id];x?c=a.lineWithRegions(h,s.zoom||f,u,x):(a.isStepType(t)&&(h=a.convertValuesToStep(h)),c=g.curve(a.getCurve(t))(h))}else h[0]&&(p=f(h[0].x),v=u(h[0].value)),c=l?"M "+v+" "+p:"M "+p+" "+v;return c||"M 0 0"}.bind(this)},lineWithRegions:function(t,e,n,a){var r,s,o,l,c=this,d=this,u=d.config.axis_rotated,h=d.axis.isTimeSeries(),g=[];if(L(a))for(var f,p=function(t,e){return i(this,c),E(t)?e:h?dt.call(d,t):t}.bind(this),v=0;f=a[v];v++){var x=p(f.start,t[0].x),b=p(f.end,t[t.length-1].x),_=f.style||{dasharray:"2 2"};g[v]={start:x,end:b,style:_}}for(var m,y=u?function(t){return i(this,c),n(t.value)}.bind(this):function(t){return i(this,c),e(t.x)}.bind(this),T=u?function(t){return i(this,c),e(t.x)}.bind(this):function(t){return i(this,c),n(t.value)}.bind(this),w=function(t){return i(this,c),"M"+t[0][0]+","+t[0][1]+"L"+t[1][0]+","+t[1][1]}.bind(this),A=h?function(t,a,r,l){i(this,c);var d=t.x.getTime(),h=a.x-t.x,g=new Date(d+h*r),f=new Date(d+h*(r+l)),p=u?[[n(s(r)),e(g)],[n(s(r+o)),e(f)]]:[[e(g),n(s(r))],[e(f),n(s(r+o))]];return w(p)}.bind(this):function(t,a,o,l){i(this,c);var d=u?[[n(s(o),!0),e(r(o))],[n(s(o+l),!0),e(r(o+l))]]:[[e(r(o),!0),n(s(o))],[e(r(o+l),!0),n(s(o+l))]];return w(d)}.bind(this),k={x:d.axis.getAxisType("x"),y:d.axis.getAxisType("y")},C="",R=0;m=t[R];R++){var O=t[R-1],P=O&&S(O.value);_=d.isWithinRegions(m.x,g);if(S(m.value))if(!E(g)&&_&&P){if(P){try{_=_.dasharray.split(" ")}catch(t){_="2 2".split(" ")}r=He(k.x,O.x,m.x),s=He(k.y,O.value,m.value);var I=e(m.x)-e(O.x),D=n(m.value)-n(O.value),z=Math.sqrt(Math.pow(I,2)+Math.pow(D,2));l=(o=_[0]/z)*_[1];for(var M=o;M<=1;M+=l)C+=A(O,m,M,o),M+l>=1&&(C+=A(O,m,1,0))}}else C+=(R&&P?"L":"M")+y(m)+","+T(m)}return C},isWithinRegions:function(t,e){for(var i,n=0;i=e[n];n++)if(i.start-1?"0":null})),c&&h.forEach(function(t){var e=this;i(this,n),l.main.selectAll("."+zt.selectedCircles+r.getTargetSelectorSuffix(t.id)).selectAll(""+zt.selectedCircle).each(function(n){i(this,e),n.value=t.values[n.index].value}.bind(this))}.bind(this))}},updateCircle:function(t){var e=this;void 0===t&&(t=!1);var n=this,a=n.config,r=n.state,s=n.$el,o=a.point_focus_only,l=t?s.subchart:s;if(a.point_show&&!r.toggling){var c=l.main.selectAll("."+Tt.circles).selectAll("."+Tt.circle).data(function(t){return i(this,e),n.isLineType(t)&&n.shouldDrawPointsForLine(t)||n.isBubbleType(t)||n.isRadarType(t)||n.isScatterType(t)?o?[t.values[0]]:t.values:[]}.bind(this));c.exit().remove(),c.enter().filter(Boolean).append(n.point("create",this,n.pointR.bind(n),n.getStylePropValue(n.color))),l.circle=l.main.selectAll("."+Tt.circles+" ."+Tt.circle).style("stroke",n.getStylePropValue(n.color)).style("opacity",n.initialOpacityForCircle.bind(n))}},redrawCircle:function(t,e,i,n,a){void 0===a&&(a=!1);var r=this,s=r.state.rendered,o=r.$el,l=r.$T,c=a?o.subchart:o,d=c.main.selectAll("."+zt.selectedCircle);if(!r.config.point_show)return[];var u=r.point("update",r,t,e,r.getStylePropValue(r.color),i,n,d),h=r.isCirclePoint()?"c":"",g=Z(),f=r.opacityForCircle.bind(r),p=[];return c.circle.each((function(t){var e=u.bind(this)(t);e=l(e,i||!s,g).style("opacity",f),p.push(e)})),[p,l(d,i).attr(h+"x",t).attr(h+"y",e)]},showCircleFocus:function(t){var e=this,n=e.config,r=e.state,s=r.hasRadar,o=r.resizing,l=r.toggling,c=r.transiting,d=e.$el.circle;if(!1===c&&n.point_focus_only&&d){var u=(s?e.radarCircleX:e.circleX).bind(e),h=(s?e.radarCircleY:e.circleY).bind(e),g=l||E(t),f=e.point("update",e,u,h,e.getStylePropValue(e.color),!o&&g);t&&(d=d.filter((function(e){var n=this,r=null==t.filter?void 0:t.filter(function(t){return i(this,n),t.id===e.id}.bind(this));return!!r.length&&(0,a.select)(this).datum(r[0])}))),d.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each((function(t){var i=t.id,n=t.index,a=t.value,r="hidden";S(a)&&(f.bind(this)(t),e.expandCircles(n,i),r=""),this.style.visibility=r}))}},hideCircleFocus:function(){var t=this,e=t.config,i=t.$el.circle;e.point_focus_only&&i&&(t.unexpandCircles(),i.style("visibility","hidden"))},circleX:function(t){return this.xx(t)},updateCircleY:function(t){var e=this;void 0===t&&(t=!1);var n=this,a=n.generateGetLinePoints(n.getShapeIndices(n.isLineType),t);return function(r,s){i(this,e);var o=r.id;return n.isGrouped(o)?a(r,s)[0][1]:n.getYScaleById(o,t)(n.getBaseValue(r))}.bind(this)},expandCircles:function(t,e,i){var n=this,r=n.pointExpandedR.bind(n);i&&n.unexpandCircles();var s=n.getShapeByIndex("circle",t,e).classed(vt.EXPANDED,!0),o=r(s)/n.config.point_r,l=1-o;n.isCirclePoint()?s.attr("r",r):s.each((function(){var t=(0,a.select)(this);if("circle"===this.tagName)t.attr("r",r);else{var e=this.getBBox(),i=e.width,n=e.height,s=l*(+t.attr("x")+i/2),c=l*(+t.attr("y")+n/2);t.attr("transform","translate("+s+" "+c+") scale("+o+")")}}))},unexpandCircles:function(t){var e=this,i=e.pointR.bind(e),n=e.getShapeByIndex("circle",t).filter((function(){return(0,a.select)(this).classed(vt.EXPANDED)})).classed(vt.EXPANDED,!1);if(n.attr("r",i),!e.isCirclePoint()){var r=i(n)/e.config.point_r;n.attr("transform",1!==r?"scale("+r+")":null)}},pointR:function(t){var e=this,i=e.config.point_r,n=i;return e.isBubbleType(t)?n=e.getBubbleR(t):k(i)&&(n=i.bind(e.api)(t)),t.r=n,n},pointExpandedR:function(t){var e=this,i=e.config,n=e.isBubbleType(t)?1.15:1.75;return i.point_focus_expand_enabled?i.point_focus_expand_r||e.pointR(t)*n:e.pointR(t)},pointSelectR:function(t){var e=this.config.point_select_r;return k(e)?e(t):e||4*this.pointR(t)},isWithinCircle:function(t,e){var i=H(this.state.event,t),n=(0,a.select)(t),r=this.isCirclePoint(t)?"c":"",s=+n.attr(r+"x"),o=+n.attr(r+"y");if(!s&&!o&&1===t.nodeType){var l=U(t);s=l.x,o=l.y}return Math.sqrt(Math.pow(s-i[0],2)+Math.pow(o-i[1],2))<(e||this.config.point_sensitivity)},insertPointInfoDefs:function(t,e){var n,r=this,s=function(t,e){i(this,r);for(var n,a=t.attributes,s=0;n=a[s];s++)n=n.name,e.setAttribute(n,t.getAttribute(n))}.bind(this),o=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement,l=h.createElementNS(a.namespaces.svg,o.nodeName.toLowerCase());if(l.id=e,l.style.fill="inherit",l.style.stroke="inherit",s(o,l),null!=(n=o.childNodes)&&n.length){var c=(0,a.select)(l);"innerHTML"in l?c.html(o.innerHTML):tt(o.childNodes).forEach(function(t){i(this,r),s(t,c.append(t.tagName).node())}.bind(this))}this.$el.defs.node().appendChild(l)},pointFromDefs:function(t){return this.$el.defs.select("#"+t)},updatePointClass:function(t){var e=this,i=e.$el.circle,n=!1;return(F(t)||i)&&(n=!0===t?i.each((function(t){var i=e.getClass("circle",!0)(t);this.getAttribute("class").indexOf(vt.EXPANDED)>-1&&(i+=" "+vt.EXPANDED),this.setAttribute("class",i)})):e.getClass("circle",!0)(t)),n},generateGetLinePoints:function(t,e){var n=this,a=this,r=a.config,s=a.getShapeX(0,t,e),o=a.getShapeY(e),l=a.getShapeOffset(a.isLineType,t,e),c=a.getYScaleById.bind(a);return function(t,d){i(this,n);var u=c.call(a,t.id,e)(a.getShapeYMin(t.id)),h=l(t,d)||u,g=s(t),f=o(t);r.axis_rotated&&(t.value>0&&f2?o-2:0),c=2;ci&&(i=e),i}var Sn={initPolar:function(){var t=this,e=t.$el.arcs,i=t.config,n=i.polar_level_text_show,a=i.polar_level_text_backgroundColor;e.levels=e.append("g").attr("class",Pt),n&&a&&t.generateDataLabelBackgroundColorFilter(a)},getPolarOuterRadius:function(t,e){var i,n=An(this);return(null!=(i=null==t?void 0:t.data.values[0].value)?i:0)/n*e},updateTargetsForPolar:function(t){this.updateTargetsForArc(t)},redrawPolar:function(){this.config.polar_level_show&&this.updatePolarLevel()},updatePolarLevel:function(){var t=this,e=this,n=e.config,a=e.state,r=e.$el.arcs.levels,s=n.polar_level_depth,o=An(e),l=ot(0,s),c=a.radius,d=l.map(function(e){return i(this,t),c*((e+1)/s)}.bind(this)),u=(n.polar_level_text_format||function(){}).bind(e.api),h=r.selectAll("."+Ot).data(l);h.exit().remove();var g=h.enter().append("g").attr("class",function(e,n){return i(this,t),Ot+" "+Ot+"-"+n}.bind(this));if(g.append("circle"),g.merge(h).selectAll("circle").style("visibility",n.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",function(e){return i(this,t),d[e]}.bind(this)),n.polar_level_text_show){var f=n.polar_level_text_backgroundColor,p="#"+a.datetimeId+"-labels-bg"+e.getTargetSelectorSuffix(f);g.append("text").style("text-anchor","middle"),g.merge(h).selectAll("text").attr("dy",function(e){return i(this,t),5-d[e]}.bind(this)).attr("filter",f?"url("+p+")":null).text(function(e){return i(this,t),u(o/l.length*(e+1))}.bind(this))}}};var kn=de,Cn={initRadar:function(){var t=this,e=t.config,i=t.state.current,n=t.$el;t.hasType("radar")&&(n.radar=n.main.select("."+vt.chart).append("g").attr("class",It.chartRadars),n.radar.levels=n.radar.append("g").attr("class",Pt),n.radar.axes=n.radar.append("g").attr("class",_t.axis),n.radar.shapes=n.radar.append("g").attr("class",Mt.shapes),i.dataMax=e.radar_axis_max||t.getMinMaxData().max[0].value)},getRadarSize:function(){var t=this.config,e=this.state,i=e.arcWidth,n=e.arcHeight,a=t.axis_x_categories.length<4?-20:10,r=(Math.min(i,n)-a)/2;return[r,r]},updateTargetsForRadar:function(t){var e=this,n=this.config;M(n.axis_x_categories)&&(n.axis_x_categories=ot(0,st("max",t.map(function(t){return i(this,e),t.values.length}.bind(this))))),this.generateRadarPoints()},getRadarPosition:function(t,e,n,a){var r=this,s=this.config,o=this.getRadarSize(),l=o[0],c=o[1],d=s.axis_x_categories.length,u=s.radar_direction_clockwise,h=tt(t).map(function(o){return i(this,r),function(t,e,i,n,a,r){var s=t&&n>0?i-n:n,o=2*Math.PI;return a*(1-r*("x"===e?Math.sin:Math.cos)(s*o/i))}(u,o,d,e,L(n)?n:"x"===t?l:c,R(a)?a:s.radar_size_ratio)}.bind(this));return 1===h.length?h[0]:h},generateRadarPoints:function(){var t=this,e=this,n=e.data.targets,a=e.getRadarSize(),r=a[0],s=a[1],o=e.cache.get(kn)||{},l=o._size;(!l||l.width!==r&&l.height!==s)&&(n.forEach(function(n){var a=this;i(this,t),o[n.id]=n.values.map(function(t,n){return i(this,a),e.getRadarPosition(["x","y"],n,void 0,e.getRatio("radar",t))}.bind(this))}.bind(this)),o._size={width:r,height:s},e.cache.add(kn,o))},redrawRadar:function(){var t=this,e=t.$el,i=e.radar,n=e.main,a=t.getTranslate("radar");a&&(i.attr("transform",a),n.select("."+Xt.chartTexts).attr("transform",a),t.generateRadarPoints(),t.updateRadarLevel(),t.updateRadarAxes(),t.updateRadarShape())},generateGetRadarPoints:function(){var t=this,e=this.cache.get(kn);return function(n,a){i(this,t);var r=e[n.id][a];return[r,r,r,r]}.bind(this)},updateRadarLevel:function(){var t=this,e=this,n=e.config,a=e.state,r=e.$el.radar,s=e.getRadarSize(),o=s[0],l=s[1],c=n.radar_level_depth,d=n.axis_x_categories.length,u=n.radar_level_text_show,h=r.levels,g=ot(0,c),f=n.radar_size_ratio*Math.min(o,l),p=g.map(function(e){return i(this,t),f*((e+1)/c)}.bind(this)),v=(n.radar_level_text_format||function(){}).bind(e.api),x=g.map(function(n){var a=this;i(this,t);var r=p[n];return ot(0,d).map(function(t){return i(this,a),e.getRadarPosition(["x","y"],t,r,1).join(",")}.bind(this)).join(" ")}.bind(this)),b=h.selectAll("."+Ot).data(g);b.exit().remove();var _=b.enter().append("g").attr("class",function(e,n){return i(this,t),Ot+" "+Ot+"-"+n}.bind(this));_.append("polygon").style("visibility",n.radar_level_show?null:"hidden"),u&&(h.select("text").empty()&&h.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(function(){return i(this,t),v(0)}.bind(this)),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(function(e){return i(this,t),v(a.current.dataMax/g.length*(e+1))}.bind(this))),_.merge(b).attr("transform",function(e){return i(this,t),"translate("+(o-p[e])+", "+(l-p[e])+")"}.bind(this)).selectAll("polygon").attr("points",function(e){return i(this,t),x[e]}.bind(this)),u&&h.selectAll("text").attr("x",function(e){return i(this,t),E(e)?o:x[e].split(",")[0]}.bind(this)).attr("y",function(e){return i(this,t),E(e)?l:0}.bind(this))},updateRadarAxes:function(){var t=this,e=this,n=e.config,r=e.$el.radar,s=e.getRadarSize(),o=s[0],l=s[1],c=n.axis_x_categories,d=r.axes.selectAll("g").data(c);d.exit().remove();var u=d.enter().append("g").attr("class",function(e,n){return i(this,t),_t.axis+"-"+n}.bind(this));if(n.radar_axis_line_show&&u.append("line"),n.radar_axis_text_show&&u.append("text"),d=u.merge(d),n.radar_axis_line_show&&d.select("line").attr("x1",o).attr("y1",l).attr("x2",function(n,a){return i(this,t),e.getRadarPosition("x",a)}.bind(this)).attr("y2",function(n,a){return i(this,t),e.getRadarPosition("y",a)}.bind(this)),n.radar_axis_text_show){var h=n.radar_axis_text_position,g=h.x,f=void 0===g?0:g,p=h.y,v=void 0===p?0:p;d.select("text").style("text-anchor","middle").attr("dy",".5em").call(function(e){i(this,t),e.each((function(t){V((0,a.select)(this),t+"",[-.6,1.2])}))}.bind(this)).datum(function(e,n){return i(this,t),{index:n}}.bind(this)).attr("transform",(function(t){E(this.width)&&(this.width=this.getBoundingClientRect().width/2);var i=e.getRadarPosition("x",t.index,void 0,1),n=Math.round(e.getRadarPosition("y",t.index,void 0,1));return i>o?i+=this.width+f:Math.round(i)l?(n/2===l&&"tspan"===this.firstChild.tagName&&this.firstChild.setAttribute("dy","0em"),n+=v):n=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ln(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i=0,p=!i||i.indexOf(h)>=0,v=o.classed(zt.SELECTED);o.classed(Ct.line)||o.classed(bt.area)||(t?f&&p&&c(s)&&!v?g(!0,o.classed(zt.SELECTED,!0),s,h):L(n)&&n&&v&&g(!1,o.classed(zt.SELECTED,!1),s,h):f&&p&&c(s)&&v&&g(!1,o.classed(zt.SELECTED,!1),s,h))}))}var ba={selected:function(t){var e=this,n=this.internal,r=[];return n.$el.main.selectAll("."+(Mt.shapes+n.getTargetSelectorSuffix(t))).selectAll("."+Mt.shape).filter((function(){return(0,a.select)(this).classed(zt.SELECTED)})).each(function(t){return i(this,e),r.push(t)}.bind(this)),r},select:function(t,e,i){var n=this.internal;xa.bind(n)(!0,t,e,i)},unselect:function(t,e){var i=this.internal;xa.bind(i)(!1,t,e)}},_a={subchart:{show:function(){var t=this.internal,e=t.$el.subchart,i=t.config,n=i.subchart_show;if(!n){var a,r;t.unbindZoomEvent(),i.subchart_show=!n,e.main||t.initSubchart();var s,o=e.main.selectAll("."+vt.target);if(t.data.targets.length!==o.size())t.updateSizes(),t.updateTargetsForSubchart(t.data.targets),o=null==(s=e.main)?void 0:s.selectAll("."+vt.target);null==(a=o)||a.style("opacity",null),null==(r=e.main)||r.style("display",null),this.resize()}},hide:function(){var t=this.internal,e=t.$el.subchart.main,i=t.config;i.subchart_show&&"none"!==(null==e?void 0:e.style("display"))&&(i.subchart_show=!1,e.style("display","none"),this.resize())},toggle:function(){var t=this.internal.config;this.subchart[t.subchart_show?"hide":"show"]()}}},ma=p(14);var ya=function(t){var e=this,n=this.internal,a=n.$el,r=n.axis,s=n.config,o=n.org,l=n.scale,c=s.axis_rotated,d=s.axis_x_inverted,u=r.isCategorized(),h=t;if(s.zoom_enabled&&h){r.isTimeSeries()&&(h=h.map(function(t){return i(this,e),dt.bind(n)(t)}.bind(this)));var g=function(t,e,n,a){var r=this;void 0===a&&(a=!1);var s=n[0],o=n[1];return t.every(function(n,l){var c=this;return i(this,r),(0===l?a?+n<=s:+n>=s:a?+n>=o:+n<=o)&&!t.every(function(t,n){return i(this,c),t===e[n]}.bind(this))}.bind(this))}(h,n.getZoomDomain(!0),n.getZoomDomain(),d);if(g){if(u&&(h=h.map(function(t,n){return i(this,e),+t+(0===n?0:1)}.bind(this))),n.api.tooltip.hide(),s.subchart_show){var f=l.zoom||l.x;n.brush.getSelection().call(n.brush.move,h.map(f))}else{var p,v=u?l.x.orgScale():o.xScale||l.x,x=[-v(h[0]),0],b=(p=ma.zoomIdentity.scale(v.range()[1]/(v(h[1])-v(h[0])))).translate.apply(p,c?x.reverse():x);a.eventRect.call(n.zoom.transform,b)}n.setZoomResetButton()}}else h=l.zoom?l.zoom.domain():l.x.orgDomain();return h};J(ya,{enable:function(t){var e=this.internal,i=e.config;/^(drag|wheel)$/.test(t)&&(i.zoom_type=t),i.zoom_enabled=!!t,e.zoom?!1===t&&e.bindZoomEvent(!1):(e.initZoom(),e.bindZoomEvent()),e.updateAndRedraw()},max:function(t){var e=this.internal,i=e.config,n=e.org.xDomain;return(0===t||t)&&(i.zoom_x_max=st("max",[n[1],t])),i.zoom_x_max},min:function(t){var e=this.internal,i=e.config,n=e.org.xDomain;return(0===t||t)&&(i.zoom_x_min=st("min",[n[0],t])),i.zoom_x_min},range:function(t){var e=this.zoom;if(F(t)){var i=t.min,n=t.max;L(i)&&e.min(i),L(n)&&e.max(n)}return{min:e.min(),max:e.max()}}});var Ta={zoom:ya,unzoom:function(){var t=this.internal,e=t.config,i=t.$el,n=i.eventRect,a=i.zoomResetBtn;t.scale.zoom&&(e.subchart_show?t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(ma.zoomIdentity),t.updateZoom(!0),null==a||a.style("display","none"),(0,ma.zoomTransform)(n.node())!==ma.zoomIdentity&&t.zoom.transform(n,ma.zoomIdentity))}},wa={drag:function(t){var e=this,n=this,r=n.config,s=n.state,o=n.$el.main,l=r.data_selection_grouped,c=r.interaction_enabled&&r.data_selection_isselectable;if(!n.hasArcType()&&r.data_selection_enabled&&(!r.zoom_enabled||n.zoom.altDomain)&&r.data_selection_multiple){var d=s.dragStart||[0,0],u=d[0],h=d[1],g=t[0],f=t[1],p=Math.min(u,g),v=Math.max(u,g),x=l?s.margin.top:Math.min(h,f),b=l?s.height:Math.max(h,f);o.select("."+At.dragarea).attr("x",p).attr("y",x).attr("width",v-p).attr("height",b-x),o.selectAll("."+Mt.shapes).selectAll("."+Mt.shape).filter(function(t){return i(this,e),null==c?void 0:c.bind(n.api)(t)}.bind(this)).each((function(t,e){var i,r=(0,a.select)(this),s=r.classed(zt.SELECTED),o=r.classed(At.INCLUDED),l=!1;if(r.classed(Tt.circle)){var c=1*+r.attr("cx"),d=1*+r.attr("cy");i=n.togglePoint,l=p0?n:a]}.bind(this))),c&&a[1].reverse(),this.extent(a),this.update()},r.brush.getSelection=function(){return i(this,n),l.main?l.main.select("."+Gt.brush):(0,a.select)([])}.bind(this)},initSubchart:function(){var t=this,e=this,n=e.config,a=e.state,r=a.clip,s=a.hasAxis,o=e.$el,l=o.defs,c=o.svg,d=o.subchart,u=o.axis;if(s){var h=n.subchart_show?null:"hidden",g=r.id+"-subchart",f=e.getClipPath(g);r.idSubchart=g,e.appendClip(l,g),e.initBrush(),d.main=c.append("g").classed(Gt.subchart,!0).attr("transform",e.getTranslate("context"));var p=d.main;p.style("visibility",h),p.append("g").attr("clip-path",f).attr("class",Gt.chart),["bar","line","bubble","candlestick","scatter"].forEach(function(n){i(this,t);var a=Q(/^(bubble|scatter)$/.test(n)?"circle":n);if(e.hasType(n)||e.hasTypeOf(a)){var r=p.select("."+Gt.chart),s=Gt["chart"+a+"s"];r.select("."+s).empty()&&r.append("g").attr("class",s)}}.bind(this));var v=p.append("g").attr("clip-path",f).attr("class",Gt.brush).call(e.brush);n.subchart_showHandle&&e.addBrushHandle(v),u.subX=p.append("g").attr("class",Gt.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",n.axis_rotated?"":r.pathXAxis).style("visibility",n.subchart_axis_x_show?h:"hidden")}},addBrushHandle:function(t){var e=this,n=this.config,a=n.axis_rotated,r=n.subchart_init_range,s=a?["M 5.2491724,29.749209 a 6,6 0 0 0 -5.50000003,-6.5 H -5.7508276 a 6,6 0 0 0 -6.0000004,6.5 z m -5.00000003,-2 H -6.7508276 m 6.99999997,-2 H -6.7508276Z","M 5.2491724,23.249172 a 6,-6 0 0 1 -5.50000003,6.5 H -5.7508276 a 6,-6 0 0 1 -6.0000004,-6.5 z m -5.00000003,2 H -6.7508276 m 6.99999997,2 H -6.7508276Z"]:["M 0 18 A 6 6 0 0 0 -6.5 23.5 V 29 A 6 6 0 0 0 0 35 Z M -2 23 V 30 M -4 23 V 30Z","M 0 18 A 6 6 0 0 1 6.5 23.5 V 29 A 6 6 0 0 1 0 35 Z M 2 23 V 30 M 4 23 V 30Z"];this.brush.handle=t.selectAll(".handle--custom").data(a?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class","handle--custom").attr("cursor",(a?"ns":"ew")+"-resize").attr("d",function(t){return i(this,e),s[+/[se]/.test(t.type)]}.bind(this)).attr("display",r?null:"none")},updateTargetsForSubchart:function(t){var e=this,n=this,a=n.config,r=n.state,s=n.$el.subchart.main;a.subchart_show&&(["bar","line","bubble","candlestick","scatter"].filter(function(t){return i(this,e),n.hasType(t)||n.hasTypeOf(Q(t))}.bind(this)).forEach(function(a){i(this,e);var r=/^(bubble|scatter)$/.test(a),o=Q(r?"circle":a),l=n.getChartClass(o,!0),c=n.getClass(r?"circles":a+"s",!0),d=s.select("."+Gt["chart"+o+"s"]);if(r){var u=d.selectAll("."+Gt.circles).data(t.filter(n["is"+Q(a)+"Type"].bind(n))).attr("class",c);u.exit().remove(),u.enter().append("g").attr("class",c)}else{var h=d.selectAll("."+Gt["chart"+o]).attr("class",l).data(t.filter(n["is"+o+"Type"].bind(n))),g=h.enter().append("g").style("opacity","0").attr("class",l).append("g").attr("class",c);h.exit().remove(),"line"===a&&n.hasTypeOf("Area")&&g.append("g").attr("class",n.getClass("areas",!0))}}.bind(this)),s.selectAll("."+Gt.brush+" rect").attr(a.axis_rotated?"width":"height",a.axis_rotated?r.width2:r.height2))},redrawSubchart:function(t,e,n){var a,r=this,s=this,o=s.config,l=s.$el.subchart.main,c=s.state,d=!!e;if((l.style("visibility",o.subchart_show?null:"hidden"),o.subchart_show)&&("zoom"===(null==(a=c.event)?void 0:a.type)&&s.brush.update(),t)){var u=o.subchart_init_range;if(K(s)||s.brush.update(),Object.keys(n.type).forEach(function(t){i(this,r);var e=Q(t),a=s["generateDraw"+e](n.indices[t],!0);s["update"+e](d,!0),s["redraw"+e](a,d,!0)}.bind(this)),s.hasType("bubble")||s.hasType("scatter")){var h=n.pos.cx,g=s.updateCircleY(!0);s.updateCircle(!0),s.redrawCircle(h,g,d,void 0,!0)}!c.rendered&&u&&s.brush.move(s.brush.getSelection(),u.map(s.scale.x))}},redrawForBrush:function(){var t=this,e=t.config,i=e.subchart_onbrush,n=e.zoom_rescale,a=t.scale;t.redraw({withTransition:!1,withY:n,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),i.bind(t.api)(a.x.orgDomain())},transformContext:function(t,e){var i=this,n=i.$el.subchart,a=i.$T,r=null!=e&&e.axisSubX?e.axisSubX:a(n.main.select("."+Gt.axisX),t);n.main.attr("transform",i.getTranslate("context")),r.attr("transform",i.getTranslate("subX"))},getExtent:function(){var t=this,e=this,n=e.config,a=e.scale,r=n.axis_x_extent;if(r)if(k(r))r=r.bind(e.api)(e.getXDomain(e.data.targets),a.subX);else if(e.axis.isTimeSeries()&&r.every(isNaN)){var s=dt.bind(e);r=r.map(function(e){return i(this,t),a.subX(s(e))}.bind(this))}return r}},Ra={initZoom:function(){var t=this;t.scale.zoom=null,t.generateZoom(),t.initZoomBehaviour()},bindZoomEvent:function(t){void 0===t&&(t=!0);var e=this,i=e.config;i.zoom_enabled&&t?i.subchart_show||e.bindZoomOnEventRect():!1===t&&(e.api.unzoom(),e.unbindZoomEvent())},generateZoom:function(){var t=this,e=this,n=e.config,a=e.org,r=e.scale,s=(0,ma.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));s.orgScaleExtent=function(){i(this,t);var a=n.zoom_extent||[1,10];return[a[0],Math.max(e.getMaxDataCount()/a[1],a[1])]}.bind(this),s.updateScaleExtent=function(){var t=D(e.scale.x.orgDomain())/D(e.getZoomDomain()),i=this.orgScaleExtent();return this.scaleExtent([i[0]*t,i[1]*t]),this},s.updateTransformScale=function(s,o){var l;i(this,t);var c=n.axis_rotated;null==(l=a.xScale)||l.range(r.x.range());var d=s[c?"rescaleY":"rescaleX"](a.xScale||r.x),u=e.trimXDomain(d.domain()),h=n.zoom_rescale;if(d.domain(u,a.xDomain),o){var g=d(r.x.domain()[0]),f=c?s.x:g,p=c?g:s.y;e.$el.eventRect.property("__zoom",ma.zoomIdentity.translate(f,p).scale(s.k))}e.state.xTickOffset||(e.state.xTickOffset=e.axis.x.tickOffset()),r.zoom=e.getCustomizedXScale(d),e.axis.x.scale(r.zoom),h&&(a.xScale||(a.xScale=r.x.copy()),r.x.domain(u))}.bind(this),s.getDomain=function(){i(this,t);var n=r[r.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(n[1]-=2),n}.bind(this),e.zoom=s},onZoomStart:function(t){var e=this,i=t.sourceEvent;i&&(e.zoom.startEvent=i,e.state.zooming=!0,N(e.config.zoom_onzoomstart,e.api,t))},onZoom:function(t){var e=this,n=this,a=n.config,r=n.scale,s=n.state,o=n.org,l=t.sourceEvent,c=(null==t?void 0:t.transform)===ma.zoomIdentity;if(!(!a.zoom_enabled||0===n.filterTargetsToShow(n.data.targets).length||!r.zoom&&(null==l?void 0:l.type.indexOf("touch"))>-1&&1===(null==l?void 0:l.touches.length))){t.sourceEvent&&(s.zooming=!0);var d="mousemove"===(null==l?void 0:l.type),u=(null==l?void 0:l.wheelDelta)<0,h=t.transform;!d&&u&&r.x.domain().every(function(t,n){return i(this,e),t!==o.xDomain[n]}.bind(this))&&r.x.domain(o.xDomain),n.zoom.updateTransformScale(h,"wheel"===a.zoom_type&&l);var g=a.transition_duration>0&&!a.subchart_show&&(s.dragging||c||!t.sourceEvent);n.redraw({withTransition:g,withY:a.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),n.state.cancelClick=d,c||N(a.zoom_onzoom,n.api,n.zoom.getDomain())}},onZoomEnd:function(t){var e,i,n,a=this,r=a.config,s=a.state,o=a.zoom.startEvent,l=null==t?void 0:t.sourceEvent,c=(null==t?void 0:t.transform)===ma.zoomIdentity;(null==(e=o)?void 0:e.type.indexOf("touch"))>-1&&(o=o.changedTouches[0],l=null==(i=l)||null==(n=i.changedTouches)?void 0:n[0]);"drag"===r.zoom_type&&l&&o.clientX===l.clientX&&o.clientY===l.clientY||(a.redrawEventRect(),a.updateZoom(),s.zooming=!1,!c&&(l||s.dragging)&&N(r.zoom_onzoomend,a.api,a.zoom.getDomain()))},updateZoom:function(t){var e=this,i=e.scale,n=i.subX,a=i.x,r=i.zoom;if(r){var s=r.domain(),o=n.domain(),l=.015,c=e.config.axis_x_inverted?(s[0]>=o[0]||s[0]+l>=o[0])&&(o[1]>=s[1]||o[1]>=s[1]+l):(s[0]<=o[0]||s[0]-l<=o[0])&&(o[1]<=s[1]||o[1]<=s[1]-l);(t||c)&&(e.axis.x.scale(n),a.domain(n.orgDomain()),e.scale.zoom=null)}},bindZoomOnEventRect:function(){var t=this,e=this,n=e.config,a=e.$el.eventRect,r="drag"===n.zoom_type?e.zoomBehaviour:e.zoom;e.$el.svg.on("wheel",function(){i(this,t)}.bind(this)),a.call(r).on("dblclick.zoom",null)},initZoomBehaviour:function(){var t,e=this,n=this,a=n.config,r=n.state,s=a.axis_rotated,o=0,l=0,c={axis:s?"y":"x",attr:s?"height":"width",index:s?1:0};n.zoomBehaviour=(0,Pe.drag)().clickDistance(4).on("start",(function(e){r.event=e,n.setDragStatus(!0),n.unselectRect(),t||(t=n.$el.main.append("rect").attr("clip-path",r.clip.path).attr("class",Nt.zoomBrush).attr("width",s?r.width:0).attr("height",s?0:r.height)),o=H(e,this)[c.index],l=o,t.attr(c.axis,o).attr(c.attr,0),n.onZoomStart(e)})).on("drag",(function(e){l=H(e,this)[c.index],t.attr(c.axis,Math.min(o,l)).attr(c.attr,Math.abs(l-o))})).on("end",function(a){var s=this;i(this,e);var d=n.scale.zoom||n.scale.x;if(r.event=a,t.attr(c.axis,0).attr(c.attr,0),o>l){var u=[l,o];o=u[0],l=u[1]}o<0&&(l+=Math.abs(o),o=0),o!==l&&n.api.zoom([o,l].map(function(t){return i(this,s),d.invert(t)}.bind(this))),n.setDragStatus(!1)}.bind(this))},setZoomResetButton:function(){var t=this,e=t.config,i=t.$el,n=e.zoom_resetButton;n&&"drag"===e.zoom_type&&(i.zoomResetBtn?i.zoomResetBtn.style("display",null):i.zoomResetBtn=t.$el.chart.append("div").classed(vt.button,!0).append("span").on("click",(function(){k(n.onclick)&&n.onclick.bind(t.api)(this),t.api.unzoom()})).classed(Nt.buttonZoomReset,!0).text(n.text||"Reset Zoom"))}},Ea=void 0,La={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:function(){return i(this,Ea),!0}.bind(void 0),data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:function(){i(this,Ea)}.bind(void 0),data_onunselected:function(){i(this,Ea)}.bind(void 0)},Oa={subchart_show:!1,subchart_showHandle:!1,subchart_size_height:60,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_format:void 0,subchart_axis_x_tick_text_show:!0,subchart_init_range:void 0,subchart_onbrush:function(){i(this,undefined)}.bind(void 0)},Pa={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_privileged:!1,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0},Ia=void 0,Da=function(){var t=this;return i(this,Ia),J(si.prototype,ka),J(Ti.prototype,ba),ne.setOptions([La]),(Da=function(){return i(this,t),!0}.bind(this))()}.bind(void 0),za=function(){var t=this;return i(this,Ia),J(si.prototype,Ca),J(Ti.prototype,_a),ne.setOptions([Oa]),(za=function(){return i(this,t),!0}.bind(this))()}.bind(void 0),Ma=function(){var t=this;return i(this,Ia),J(si.prototype,Ra),J(Ti.prototype,Ta),ne.setOptions([Pa]),(Ma=function(){return i(this,t),!0}.bind(this))()}.bind(void 0),$a={},Xa={version:"3.9.0",generate:function(t){var e=at({},$a,t),i=new Ti(e);return i.internal.charts=this.instance,this.instance.push(i),i},defaults:function(t){return F(t)&&($a=t),$a},instance:[],plugin:{}},Fa=void 0;Object.keys(t).forEach(function(e){return i(this,Fa),t[e]()}.bind(void 0)),Object.keys(e).forEach(function(t){return i(this,Fa),e[t]()}.bind(void 0))}(),v}()})); \ No newline at end of file +!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom"));else if("function"==typeof define&&define.amd)define(["d3-axis","d3-brush","d3-drag","d3-dsv","d3-ease","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","d3-time-format","d3-transition","d3-zoom"],e);else{var i="object"==typeof exports?e(require("d3-axis"),require("d3-brush"),require("d3-drag"),require("d3-dsv"),require("d3-ease"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("d3-time-format"),require("d3-transition"),require("d3-zoom")):e(t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3,t.d3);for(var n in i)("object"==typeof exports?exports:t)[n]=i[n]}}(this,(function(t,e,i,n,s,a,r,o,c,l,d,u,h){return function(){"use strict";var g=[,,function(t){t.exports=c},function(t){t.exports=e},function(t){t.exports=d},function(t){t.exports=n},function(t){t.exports=o},function(t){t.exports=i},function(t){t.exports=u},function(t){t.exports=l},function(e){e.exports=t},function(t){t.exports=s},function(t){t.exports=r},function(t){t.exports=a},function(t){t.exports=h}],f={};function p(t){var e=f[t];if(void 0!==e)return e.exports;var i=f[t]={exports:{}};return g[t](i,i.exports,p),i.exports}p.d=function(t,e){for(var i in e)p.o(e,i)&&!p.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},p.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},p.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var x={};return function(){p.r(x),p.d(x,{bb:function(){return Bs},default:function(){return Bs}});var t={};p.r(t),p.d(t,{area:function(){return ts},areaLineRange:function(){return es},areaSpline:function(){return is},areaSplineRange:function(){return ns},areaStep:function(){return ss},bar:function(){return gs},bubble:function(){return fs},candlestick:function(){return ps},donut:function(){return cs},gauge:function(){return ls},line:function(){return as},pie:function(){return ds},polar:function(){return us},radar:function(){return hs},scatter:function(){return xs},spline:function(){return rs},step:function(){return os},treemap:function(){return bs}});var e={};function i(t,e){if(t!==e)throw new TypeError("Cannot instantiate an arrow function")}p.r(e),p.d(e,{selection:function(){return Ms},subchart:function(){return Xs},zoom:function(){return $s}});var n=p(4),s=p(2);const a="object"==typeof globalThis&&null!==globalThis&&globalThis.Object===Object&&globalThis||"object"==typeof global&&null!==global&&global.Object===Object&&global||"object"==typeof self&&null!==self&&self.Object===Object&&self||Function("return this")(),r=null==a?void 0:a.document,o=function(t){var e=this;const n="function"==typeof(null==t?void 0:t.requestAnimationFrame)&&"function"==typeof(null==t?void 0:t.cancelAnimationFrame),s="function"==typeof(null==t?void 0:t.requestIdleCallback)&&"function"==typeof(null==t?void 0:t.cancelIdleCallback),a=function(t){return i(this,e),setTimeout(t,1)}.bind(this),r=function(t){return i(this,e),clearTimeout(t)}.bind(this);return[n?t.requestAnimationFrame:a,n?t.cancelAnimationFrame:r,s?t.requestIdleCallback:a,s?t.cancelIdleCallback:r]}(a),c=o[0],l=(o[1],o[2]),d=(o[3],{AREA:"area",AREA_LINE_RANGE:"area-line-range",AREA_SPLINE:"area-spline",AREA_SPLINE_RANGE:"area-spline-range",AREA_STEP:"area-step",BAR:"bar",BUBBLE:"bubble",CANDLESTICK:"candlestick",DONUT:"donut",GAUGE:"gauge",LINE:"line",PIE:"pie",POLAR:"polar",RADAR:"radar",SCATTER:"scatter",SPLINE:"spline",STEP:"step",TREEMAP:"treemap"}),u={AREA:"initArea",AREA_LINE_RANGE:"initArea",AREA_SPLINE:"initArea",AREA_SPLINE_RANGE:"initArea",AREA_STEP:"initArea",BAR:"initBar",BUBBLE:"initCircle",CANDLESTICK:"initCandlestick",DONUT:"initArc",GAUGE:"initArc",LINE:"initLine",PIE:"initArc",POLAR:"initPolar",RADAR:"initCircle",SCATTER:"initCircle",SPLINE:"initLine",STEP:"initLine",TREEMAP:"initTreemap"},h={Area:[d.AREA,d.AREA_SPLINE,d.AREA_SPLINE_RANGE,d.AREA_LINE_RANGE,d.AREA_STEP],AreaRange:[d.AREA_SPLINE_RANGE,d.AREA_LINE_RANGE],Arc:[d.PIE,d.DONUT,d.GAUGE,d.POLAR,d.RADAR],Line:[d.LINE,d.SPLINE,d.AREA,d.AREA_SPLINE,d.AREA_SPLINE_RANGE,d.AREA_LINE_RANGE,d.STEP,d.AREA_STEP],Step:[d.STEP,d.AREA_STEP],Spline:[d.SPLINE,d.AREA_SPLINE,d.AREA_SPLINE_RANGE]};function g(t){return g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},g(t)}function f(t){var e=function(t,e){if("object"!==g(t)||null===t)return t;var i=t[Symbol.toPrimitive];if(void 0!==i){var n=i.call(t,e||"default");if("object"!==g(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===g(e)?e:String(e)}function b(t,e,i){return(e=f(e))in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}var m=p(3),_=void 0;function v(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function y(t){for(var e,i=1;i2?n-2:0),a=2;a/gi,">"):t}function N(t,e,n,s){var a=this;if(void 0===n&&(n=[-1,1]),void 0===s&&(s=!1),t&&A(e))if(-1===e.indexOf("\n"))t.text(e);else{const r=[t.text(),e].map(function(t){return i(this,a),t.replace(/[\s\n]/g,"")}.bind(this));if(r[0]!==r[1]){const r=e.split("\n"),o=s?r.length-1:1;t.html(""),r.forEach(function(e,s){i(this,a),t.append("tspan").attr("x",0).attr("dy",(0===s?n[0]*o:n[1])+"em").text(e)}.bind(this))}}}function j(t){const e=t.getBBox(),i=e.x,n=e.y,s=e.width,a=e.height;return[{x:i,y:n+a},{x:i,y:n},{x:i+s,y:n},{x:i+s,y:n+a}]}function G(t,e){var n,a=this;const r=t&&(null==(n=t.touches||t.sourceEvent&&t.sourceEvent.touches)?void 0:n[0]);let o=[0,0];try{o=(0,s.pointer)(r||t,e)}catch(t){}return o.map(function(t){return i(this,a),isNaN(t)?0:t}.bind(this))}function V(t){const e=t.event,i=t.$el,n=i.subchart.main||i.main;let s;return e&&"brush"===e.type?s=e.selection:n&&(s=n.select(".bb-brush").node())&&(s=(0,m.brushSelection)(s)),s}function Y(t){return!("rect"in t)||"rect"in t&&t.hasAttribute("width")&&t.rect.width!==+t.getAttribute("width")?t.rect=t.getBoundingClientRect():t.rect}function H(t,e,i){void 0===t&&(t=!0),void 0===e&&(e=0),void 0===i&&(i=1e4);const n=a.crypto||a.msCrypto,s=n?e+n.getRandomValues(new Uint32Array(1))[0]%(i-e+1):Math.floor(Math.random()*(i-e)+e);return t?s+"":s}function U(t,e,i,n,s){if(i>n)return-1;const a=Math.floor((i+n)/2);let r=t[a],o=r.x,c=r.w,l=void 0===c?0:c;return s&&(o=t[a].y,l=t[a].h),e>=o&&e<=o+l?a:e1?n-1:0),a=1;ae?-1:t{=TITLE}",legend_equally:!1,legend_hide:!1,legend_inset_anchor:"top-left",legend_inset_x:10,legend_inset_y:0,legend_inset_step:void 0,legend_item_interaction:!0,legend_item_dblclick:!1,legend_item_onclick:void 0,legend_item_onover:void 0,legend_item_onout:void 0,legend_item_tile_width:10,legend_item_tile_height:10,legend_item_tile_r:5,legend_item_tile_type:"rectangle",legend_padding:0,legend_position:"bottom",legend_show:!0,legend_usePoint:!1},Zt={title_text:void 0,title_padding:{top:0,right:0,bottom:0,left:0},title_position:"center"},qt=void 0,Kt={tooltip_show:!0,tooltip_doNotHide:!1,tooltip_grouped:!0,tooltip_format_title:void 0,tooltip_format_name:void 0,tooltip_format_value:void 0,tooltip_position:void 0,tooltip_contents:{},tooltip_init_show:!1,tooltip_init_x:0,tooltip_init_position:void 0,tooltip_linked:!1,tooltip_linked_name:"",tooltip_onshow:function(){i(this,qt)}.bind(void 0),tooltip_onhide:function(){i(this,qt)}.bind(void 0),tooltip_onshown:function(){i(this,qt)}.bind(void 0),tooltip_onhidden:function(){i(this,qt)}.bind(void 0),tooltip_order:null};function Jt(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function Qt(t){for(var e,i=1;i0){if(void 0===e[s-1]&&(e[s-1]={}),void 0===t)throw new Error("Source data is missing a component at ("+i+", "+s+")!");e[s-1][n]=t}}))})),e}function _e(t){const e=t[0],i=[];return t.forEach((function(t,n){if(n>0){const s={};t.forEach((function(t,i){if(void 0===t)throw new Error("Source data is missing a component at ("+n+", "+i+")!");s[e[i]]=t})),i.push(s)}})),i}function ve(t,e){const i=[];let n,s;if(Array.isArray(t)){const a=function(t,e){if(void 0!==t[e])return t[e];const i=e.replace(/\[(\w+)\]/g,".$1").replace(/^\./,"").split(".");let n=t;return i.some((function(t){return!(n=n&&t in n?n[t]:void 0)})),n};n=e.x?e.value.concat(e.x):e.value,i.push(n),t.forEach((function(t){const e=n.map((function(e){let i=a(t,e);return void 0===i&&(i=null),i}));i.push(e)})),s=_e(i)}else Object.keys(t).forEach((function(e){const n=t[e].concat();null==n.unshift||n.unshift(e),i.push(n)})),s=me(i);return s}function ye(t,e){var n=this;const s=t.rows(e);let a;return 1===s.length?(a=[{}],s[0].forEach(function(t){i(this,n),a[0][t]=null}.bind(this))):a=t.parse(e),a}function Te(t){return ye({rows:be.csvParseRows,parse:be.csvParse},t)}function we(t){return ye({rows:be.tsvParseRows,parse:be.tsvParse},t)}function Ae(t,e){const i=t||(null==e?void 0:e.data_keys);return null!=i&&i.x&&(e.data_x=i.x),i}var Se={convertData:function(t,e){var n=this;const s=this.config,a=s.boost_useWorker;let r=t;if(t.bindto&&(r={},["url","mimeType","headers","keys","json","keys","rows","columns"].forEach(function(e){i(this,n);const s="data_"+e;s in t&&(r[e]=t[s])}.bind(this))),r.url&&e)!function(t,e,i,n,s){void 0===e&&(e="csv");const a=new XMLHttpRequest,r={csv:Te,tsv:we,json:ve};a.open("GET",t),i&&Object.keys(i).forEach((function(t){a.setRequestHeader(t,i[t])})),a.onreadystatechange=function(){if(4===a.readyState){if(200!==a.status)throw new Error(t+": Something went wrong loading!");{const t=a.responseText;t&&s.call(this,r[e]("json"===e?JSON.parse(t):t,n))}}},a.send()}(r.url,r.mimeType,r.headers,Ae(r.keys,s),e);else if(r.json)xe(a,ve,e,[me,_e])(r.json,Ae(r.keys,s));else if(r.rows)xe(a,_e,e)(r.rows);else if(r.columns)xe(a,me,e)(r.columns);else if(t.bindto)throw Error("url or json or rows or columns is required.")},convertDataToTargets:function(t,e){var n=this;const s=this,a=s.axis,r=s.config,o=s.state,c=r.data_type;let l=!1,d=!1,u=!1;a&&(l=a.isCategorized(),d=a.isTimeSeries(),u=a.isCustomX());const h=Object.keys(t[0]||{}),g=h.length?h.filter(s.isNotX,s):[],f=h.length?h.filter(s.isX,s):[];let p;g.forEach(function(a){var o=this;i(this,n);const c=this.getXKey(a);u||d?f.indexOf(c)>=0?p=(e&&s.data.xs[a]||[]).concat(t.map(function(t){return i(this,o),t[c]}.bind(this)).filter(T).map(function(t,e){return i(this,o),s.generateTargetX(t,a,e)}.bind(this))):r.data_x?p=this.getOtherTargetXs():D(r.data_xs)&&(p=s.getXValuesOfXKey(c,s.data.targets)):p=t.map(function(t,e){return i(this,o),e}.bind(this)),p&&(this.data.xs[a]=p)}.bind(this)),g.forEach(function(t){if(i(this,n),!this.data.xs[t])throw new Error('x is not defined for id = "'+t+'".')}.bind(this));const x=g.map(function(e,a){var c=this;i(this,n);const d=r.data_idConverter.bind(s.api)(e),h=s.getXKey(e),g=u&&l,f=g&&t.map(function(t){return i(this,c),t.x}.bind(this)).every(function(t){return i(this,c),r.axis_x_categories.indexOf(t)>-1}.bind(this)),p=t.__append__,x=null===h&&p?s.api.data.values(e).length:0;return{id:d,id_org:e,values:t.map(function(t,n){i(this,c);const l=t[h];let u,b=t[e];return b=null===b||isNaN(b)||M(b)?z(b)||M(b)?b:null:+b,!g&&!o.hasRadar||0!==a||k(l)?u=s.generateTargetX(l,e,x+n):(f||0!==a||0!==n||p||(r.axis_x_categories=[]),u=r.axis_x_categories.indexOf(l),-1===u&&(u=r.axis_x_categories.length,r.axis_x_categories.push(l))),(k(b)||s.data.xs[e].length<=n)&&(u=void 0),{x:u,value:b,id:d,index:-1}}.bind(this)).filter(function(t){return i(this,c),C(t.x)}.bind(this))}}.bind(this));if(x.forEach(function(t){var e,a=this;i(this,n),r.data_xSort&&(t.values=t.values.sort(function(t,e){i(this,a);return(t.x||0===t.x?t.x:1/0)-(e.x||0===e.x?e.x:1/0)}.bind(this))),t.values.forEach(function(t,e){return i(this,a),t.index=e}.bind(this)),null==(e=s.data.xs[t.id])||e.sort(function(t,e){return i(this,a),t-e}.bind(this))}.bind(this)),o.hasNegativeValue=s.hasNegativeValueInTargets(x),o.hasPositiveValue=s.hasPositiveValueInTargets(x),c&&s.isValidChartType(c)){const t=s.mapToIds(x).filter(function(t){return i(this,n),!(t in r.data_types)||!s.isValidChartType(r.data_types[t])}.bind(this));s.setTargetType(t,c)}return x.forEach(function(t){return i(this,n),s.cache.add(t.id_org,t,!0)}.bind(this)),x}},ke={isX:function(t){const e=this.config,n=e.data_x&&t===e.data_x,s=D(e.data_xs)&&function(t,e){var n=this;let s=!1;return Object.keys(t).forEach(function(a){return i(this,n),t[a]===e&&(s=!0)}.bind(this)),s}(e.data_xs,t);return n||s},isNotX:function(t){return!this.isX(t)},isStackNormalized:function(){const t=this.config;return!(!t.data_stack_normalize||!t.data_groups.length)},isGrouped:function(t){var e=this;const n=this.config.data_groups;return t?n.some(function(n){return i(this,e),n.indexOf(t)>=0&&n.length>1}.bind(this)):n.length>0},getXKey:function(t){const e=this.config;return e.data_x?e.data_x:D(e.data_xs)?e.data_xs[t]:null},getXValuesOfXKey:function(t,e){var n=this;const s=this;let a;return(e&&D(e)?s.mapToIds(e):[]).forEach(function(e){i(this,n),s.getXKey(e)===t&&(a=s.data.xs[e])}.bind(this)),a},getIndexByX:function(t,e){return e?e.indexOf(A(t)?t:+t):(this.filterByX(this.data.targets,t)[0]||{index:null}).index},getXValue:function(t,e){const i=this;return t in i.data.xs&&i.data.xs[t]&&T(i.data.xs[t][e])?i.data.xs[t][e]:e},getOtherTargetXs:function(){const t=Object.keys(this.data.xs);return t.length?this.data.xs[t[0]]:null},getOtherTargetX:function(t){const e=this.getOtherTargetXs();return e&&t1?(e=e.map(function(e){return i(this,t),e.values}.bind(this)).reduce(function(e,n){return i(this,t),e.concat(n)}.bind(this)).map(function(e){return i(this,t),e.x}.bind(this)),e=it(Q(e)).map(function(e,n,a){return i(this,t),{x:e,index:s?a.length-n-1:n}}.bind(this))):n&&(e=e[0].values.concat()),e},mapToIds:function(t){var e=this;return t.map(function(t){return i(this,e),t.id}.bind(this))},mapToTargetIds:function(t){return t?z(t)?t.concat():[t]:this.mapToIds(this.data.targets)},hasTarget:function(t,e){const i=this.mapToIds(t);for(let t,n=0;t=i[n];n++)if(t===e)return!0;return!1},isTargetToShow:function(t){return this.state.hiddenTargetIds.indexOf(t)<0},isLegendToShow:function(t){return this.state.hiddenLegendIds.indexOf(t)<0},filterTargetsToShow:function(t){var e=this;const n=this;return(t||n.data.targets).filter(function(t){return i(this,e),n.isTargetToShow(t.id)}.bind(this))},mapTargetsToUniqueXs:function(t){var e=this;const n=this.axis;let s=[];return null!=t&&t.length&&(s=Q(tt(t.map(function(t){var n=this;return i(this,e),t.values.map(function(t){return i(this,n),+t.x}.bind(this))}.bind(this)))),s=null!=n&&n.isTimeSeries()?s.map(function(t){return i(this,e),new Date(+t)}.bind(this)):s.map(Number)),it(s)},addTargetIds:function(t,e){var n=this;const s=this.state;(z(e)?e:[e]).forEach(function(e){i(this,n),s[t].indexOf(e)<0&&s[t].push(e)}.bind(this))},removeTargetIds:function(t,e){var n=this;const s=this.state;(z(e)?e:[e]).forEach(function(e){i(this,n);const a=s[t].indexOf(e);a>=0&&s[t].splice(a,1)}.bind(this))},addHiddenTargetIds:function(t){this.addTargetIds("hiddenTargetIds",t)},removeHiddenTargetIds:function(t){this.removeTargetIds("hiddenTargetIds",t)},addHiddenLegendIds:function(t){this.addTargetIds("hiddenLegendIds",t)},removeHiddenLegendIds:function(t){this.removeTargetIds("hiddenLegendIds",t)},getValuesAsIdKeyed:function(t){var e=this;const n=this,s=n.state.hasAxis,a={},r=n.isMultipleX(),o=r?n.mapTargetsToUniqueXs(t).map(function(t){return i(this,e),A(t)?t:+t}.bind(this)):null;return t.forEach(function(t){var c=this;i(this,e);const l=[];t.values.filter(function(t){let e=t.value;return i(this,c),T(e)||null===e}.bind(this)).forEach(function(t){i(this,c);let e=t.value;null!==e&&n.isCandlestickType(t)&&(e=z(e)?e.slice(0,4):[e.open,e.high,e.low,e.close]),z(e)?l.push.apply(l,e):M(e)&&"high"in e?l.push.apply(l,Object.values(e)):n.isBubbleZType(t)?l.push(s&&n.getBubbleZData(e,"y")):r?l[n.getIndexByX(t.x,o)]=e:l.push(e)}.bind(this)),a[t.id]=l}.bind(this)),a},checkValueInTargets:function(t,e){const i=Object.keys(t);let n;for(let s=0;s1},hasNegativeValueInTargets:function(t){var e=this;return this.checkValueInTargets(t,function(t){return i(this,e),t<0}.bind(this))},hasPositiveValueInTargets:function(t){var e=this;return this.checkValueInTargets(t,function(t){return i(this,e),t>0}.bind(this))},orderTargets:function(t){const e=[].concat(t),i=this.getSortCompareFn();return i&&e.sort(i),e},getSortCompareFn:function(t){var e=this;void 0===t&&(t=!1);const n=this,s=n.config.data_order,a=/asc/i.test(s),r=/desc/i.test(s);let o;if(a||r){const n=function(t,n){return i(this,e),t+Math.abs(n.value)}.bind(this);o=function(s,r){i(this,e);const o="values"in s?s.values.reduce(n,0):s.value,c="values"in r?r.values.reduce(n,0):r.value;return t?a?o-c:c-o:a?c-o:o-c}.bind(this)}else w(s)&&(o=s.bind(n.api));return o||null},filterByX:function(t,e){var n=this;return tt(t.map(function(t){return i(this,n),t.values}.bind(this))).filter(function(t){return i(this,n),t.x-e==0}.bind(this))},filterRemoveNull:function(t){var e=this;return t.filter(function(t){return i(this,e),T(this.getBaseValue(t))}.bind(this))},filterByXDomain:function(t,e){var n=this;return t.map(function(t){var s=this;return i(this,n),{id:t.id,id_org:t.id_org,values:t.values.filter(function(t){return i(this,s),e[0]<=t.x&&t.x<=e[1]}.bind(this))}}.bind(this))},hasDataLabel:function(){const t=this.config.data_labels;return R(t)&&t||P(t)&&D(t)},getDataIndexFromEvent:function(t){const e=this.config,i=this.state,n=i.hasRadar,a=i.inputType,r=i.eventReceiver,o=r.coords,c=r.rect;let l;if(n){let e=t.target;/tspan/i.test(e.tagName)&&(e=e.parentNode);const i=(0,s.select)(e).datum();l=i&&1===Object.keys(i).length?i.index:void 0}else{const i=e.axis_rotated,n="touch"===a&&t.changedTouches?t.changedTouches[0]:t;l=U(o,i?n.clientY-c.top:n.clientX-c.left,0,o.length-1,i)}return l},getDataLabelLength:function(t,e,n){var s=this;const a=this,r=[0,0];return a.$el.chart.select("svg").selectAll(".dummy").data([t,e]).enter().append("text").text(function(t){return i(this,s),a.dataLabelFormat(t.id)(t)}.bind(this)).each((function(t,e){r[e]=1.3*this.getBoundingClientRect()[n]})).remove(),r},isNoneArc:function(t){return this.hasTarget(this.data.targets,t.id)},isArc:function(t){return"data"in t&&this.hasTarget(this.data.targets,t.data.id)},findSameXOfValues:function(t,e){const i=t[e].x,n=[];let s;for(s=e-1;s>=0&&i===t[s].x;s--)n.push(t[s]);for(s=e;s=0&&a?a[t]:void 0}}return a&&e?a[e]:a},setRatioForGroupedData:function(t){var e=this;const n=this;if(n.config.data_groups.length&&t.some(function(t){return i(this,e),n.isGrouped(t.id)}.bind(this))){const s=function(t){return i(this,e),n.getRatio("index",t,!0)}.bind(this);t.forEach(function(t){i(this,e),"values"in t?t.values.forEach(s):s(t)}.bind(this))}},getRatio:function(t,e,n){var s=this;void 0===n&&(n=!1);const a=this,r=a.config,o=a.state,c=a.api;let l=0;if(e&&c.data.shown().length)if(l=e.ratio||e.value,"arc"===t)if(a.pie.padAngle()())l=e.value/a.getTotalDataSum(!0);else{const t=r.gauge_fullCircle?a.getArcLength():-2*a.getGaugeStartAngle(),i=a.hasType("gauge")?t:2*Math.PI;l=(e.endAngle-e.startAngle)/i}else if("index"===t){const t=c.data.values.bind(c);let n=this.getTotalPerIndex();if(o.hiddenTargetIds.length){let e=t(o.hiddenTargetIds,!1);e.length&&(e=e.reduce(function(t,e){var n=this;return i(this,s),t.map(function(t,s){return i(this,n),(S(t)?t:0)+e[s]}.bind(this))}.bind(this)),n=n.map(function(t,n){return i(this,s),t-e[n]}.bind(this)))}const a=n[e.index];e.ratio=S(e.value)&&n&&a?e.value/a:0,l=e.ratio}else if("radar"===t)l=parseFloat(Math.max(e.value,0)+"")/o.current.dataMax*r.radar_size_ratio;else if("bar"===t){const n=a.getYScaleById.bind(a)(e.id).domain().reduce(function(t,e){return i(this,s),e-t}.bind(this));l=0===n?0:Math.abs(a.getRangedData(e,null,t)/n)}else"treemap"===t&&(l/=a.getTotalDataSum(!0));return n&&l?100*l:l},updateDataIndexByX:function(t){var e=this;const n=t.reduce(function(t,n,s){return i(this,e),t[+n.x]=s,t}.bind(this),{});this.data.targets.forEach(function(t){var s=this;i(this,e),t.values.forEach(function(t,e){i(this,s);let a=n[+t.x];void 0===a&&(a=e),t.index=a}.bind(this))}.bind(this))},isBubbleZType:function(t){return this.isBubbleType(t)&&(M(t.value)&&("z"in t.value||"y"in t.value)||z(t.value)&&t.value.length>=2)},isBarRangeType:function(t){var e=this;const n=t.value;return this.isBarType(t)&&z(n)&&n.length>=2&&n.every(function(t){return i(this,e),S(t)}.bind(this))},getDataById:function(t){var e;const i=this.cache.get(t)||this.api.data(t);return null!=(e=null==i?void 0:i[0])?e:i}};function Ce(t,e){void 0===e&&(e=!1);const i=this.api;e&&this.api.flush(!0),null==t||t.call(i)}var Re={load:function(t,e){var n=this;const s=this,a=s.data,r=e.append;let o=t;o&&(e.filter&&(o=o.filter(e.filter)),(e.type||e.types)&&o.forEach(function(t){var a;i(this,n);const r=(null==(a=e.types)?void 0:a[t.id])||e.type;s.setTargetType(t.id,r)}.bind(this)),a.targets.forEach(function(t){i(this,n);for(let e=0;e=0?Ft.focused:"")},classDefocused:function(t){return" "+(this.state.defocusedTargetIds.indexOf(t.id)>=0?Ft.defocused:"")},getTargetSelectorSuffix:function(t){return(t||0===t?"-"+t:"").replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g,"-")},selectorTarget:function(t,e,i){void 0===e&&(e=""),void 0===i&&(i="");const n=this.getTargetSelectorSuffix(t);return e+"."+(Ft.target+n)+" "+i+", "+e+"."+(Ft.circles+n)+" "+i},selectorTargets:function(t,e){var n=this;const s=t||[];return s.length?s.map(function(t){return i(this,n),this.selectorTarget(t,e)}.bind(this)):null},selectorLegend:function(t){return"."+(Ft.legendItem+this.getTargetSelectorSuffix(t))},selectorLegends:function(t){var e=this;return null!=t&&t.length?t.map(function(t){return i(this,e),this.selectorLegend(t)}.bind(this)):null}},Pe=p(6);const Ie=function(t,e,n){i(this,undefined);const a=(0,s.select)(t.cloneNode(!0));return a.attr("id",n).insert("rect",":first-child").attr("width",a.attr("width")).attr("height",a.attr("height")).style("fill",e),{id:n,node:a.node()}}.bind(void 0);const De=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"];var ze={generateColor:function(){var t=this;const e=this,n=e.$el,s=e.config,a=s.data_colors,o=s.data_color,c=[];let l=D(s.color_pattern)?s.color_pattern:(0,Pe.scaleOrdinal)(function(t){var e=this;const n=ie,s=r.body;let a=s[n];if(!a){const r=t.classed(vt.colorPattern,!0).style("background-image");t.classed(vt.colorPattern,!1),r.indexOf(";")>-1&&(a=r.replace(/url[^#]*|["'()]|(\s|%20)/g,"").split(";").map(function(t){return i(this,e),t.trim().replace(/[\"'\s]/g,"")}.bind(this)).filter(Boolean),s[n]=a)}return a}(n.chart)||De).range();const d=l;if(w(s.color_tiles)){const n=s.color_tiles.bind(e.api)(),a=l.map(function(s,a){i(this,t);const r=s.replace(/[#\(\)\s,]/g,""),o=e.state.datetimeId+"-pattern-"+r+"-"+a;return Ie(n[a%n.length],s,o)}.bind(this));l=a.map(function(e){return i(this,t),"url(#"+e.id+")"}.bind(this)),e.patterns=a}return function(t){var i;const n=t.id||(null==(i=t.data)?void 0:i.id)||t,r=e.isTypeOf(n,["line","spline","step"])||!s.data_types[n];let u;return w(a[n])?u=a[n].bind(e.api)(t):a[n]?u=a[n]:(c.indexOf(n)<0&&c.push(n),u=r?d[c.indexOf(n)%d.length]:l[c.indexOf(n)%l.length],a[n]=u),w(o)?o.bind(e.api)(u,t):u}},generateLevelColor:function(){const t=this.config,e=t.color_pattern,i=t.color_threshold,n="value"===i.unit,s=i.max||100,a=i.values&&i.values.length?i.values:[];return D(i)?function(t){const i=n?t:100*t/s;let r=e[e.length-1];for(let t=0,n=a.length;t')}.bind(this))}},getGradienColortUrl:function(t){return"url(#"+this.state.datetimeId+"-gradient"+this.getTargetSelectorSuffix(t)+")"},updateLinearGradient:function(){var t=this;const e=this,n=e.config,s=e.data.targets,a=e.state.datetimeId,r=e.$el.defs;s.forEach(function(s){var o=this;i(this,t);const c=a+"-gradient"+e.getTargetSelectorSuffix(s.id),l=e.hasPointType()&&n.point_radialGradient,d=e.isAreaType(s)?"area":e.isBarType(s)&&"bar";if((l||d)&&r.select("#"+c).empty()){const t=e.color(s),a={defs:null,stops:[]};if(l){const e=l,i=e.cx,n=void 0===i?.3:i,s=e.cy,o=void 0===s?.3:s,d=e.r,u=void 0===d?.7:d,h=e.stops,g=void 0===h?[[.1,t,0],[.9,t,1]]:h;a.stops=g,a.defs=r.append("radialGradient").attr("id",""+c).attr("cx",n).attr("cy",o).attr("r",u)}else{const e=n.axis_rotated,i=n[d+"_linearGradient"],s=i.x,o=void 0===s?e?[1,0]:[0,0]:s,l=i.y,u=void 0===l?e?[0,0]:[0,1]:l,h=i.stops,g=void 0===h?[[0,t,1],[1,t,0]]:h;a.stops=g,a.defs=r.append("linearGradient").attr("id",""+c).attr("x1",o[0]).attr("x2",o[1]).attr("y1",u[0]).attr("y2",u[1])}a.stops.forEach(function(n){i(this,o);const r=n[0],c=n[1],l=n[2],d=w(c)?c.bind(e.api)(s.id):c;a.defs&&a.defs.append("stop").attr("offset",r).attr("stop-color",d||t).attr("stop-opacity",l)}.bind(this))}}.bind(this))},setOverColor:function(t,e){var n=this;const s=this,a=s.config,r=s.$el.main,o=a.color_onover;let c=t?o:s.color;M(c)?c=function(t){let e=t.id;return i(this,n),e in o?o[e]:s.color(e)}.bind(this):A(c)?c=function(){return i(this,n),o}.bind(this):w(o)&&(c=c.bind(s.api)),r.selectAll(M(e)?"."+ft.arc+s.getTargetSelectorSuffix(e.id):"."+It.shape+"-"+e).style("fill",c)}},Me={getYDomainMinMax:function(t,e){var n=this;const s=this,a=s.axis,r=s.config,o="min"===e,c=r.data_groups,l=s.mapToIds(t),d=s.getValuesAsIdKeyed(t);if(c.length>0){const e=s["has"+(o?"Negative":"Positive")+"ValueInTargets"](t);c.forEach(function(t){var s=this;i(this,n);const r=t.filter(function(t){return i(this,s),l.indexOf(t)>=0}.bind(this));if(r.length){const t=r[0],n=a.getId(t);e&&d[t]&&(d[t]=d[t].map(function(t){return i(this,s),(o?t<0:t>0)?t:0}.bind(this))),r.filter(function(t,e){return i(this,s),e>0}.bind(this)).forEach(function(r){var c=this;if(i(this,s),d[r]){const s=a.getId(r);d[r].forEach(function(a,r){i(this,c);const l=+a;s!==n||e&&(o?l>0:l<0)||(d[t][r]+=l)}.bind(this))}}.bind(this))}}.bind(this))}return nt(e,Object.keys(d).map(function(t){return i(this,n),nt(e,d[t])}.bind(this)))},isHiddenTargetWithYDomain:function(t){var e=this;const n=this;return n.state.hiddenTargetIds.some(function(s){return i(this,e),n.axis.getId(s)===t}.bind(this))},getYDomain:function(t,e,n){var s=this;const a=this,r=a.axis,o=a.config,c=a.scale,l="axis_"+e;if(a.isStackNormalized())return[0,100];const u=(null==c?void 0:c[e])&&"log"===c[e].type,g=t.filter(function(t){return i(this,s),r.getId(t.id)===e}.bind(this)),f=n?a.filterByXDomain(g,n):g;if(0===f.length)return a.isHiddenTargetWithYDomain(e)?c[e].domain():"y2"===e?c.y.domain():a.getYDomain(t,"y2",n);const p=o[l+"_min"],x=o[l+"_max"],b=o[l+"_center"],m=o[l+"_inverted"],_=a.hasDataLabel()&&o.axis_rotated,v=a.hasDataLabel()&&!o.axis_rotated;let y=a.getYDomainMinMax(f,"min"),w=a.getYDomainMinMax(f,"max"),A=[d.BAR,d.BUBBLE,d.SCATTER].concat(h.Line).some(function(t){i(this,s);const e=t.indexOf("area")>-1?"area":t;return a.hasType(t,f,!0)&&o[e+"_zerobased"]}.bind(this));y=T(p)?p:T(x)?y<=x?y:x-10:y,w=T(x)?x:T(p)?p<=w?w:p+10:w,isNaN(y)&&(y=0),isNaN(w)&&(w=y),y===w&&(y<0?w=0:y=0);const S=y>=0&&w>=0,k=y<=0&&w<=0;(T(p)&&S||T(x)&&k)&&(A=!1),A&&(S&&(y=0),k&&(w=0));const R=Math.abs(w-y);let E={top:.1*R,bottom:.1*R};if(C(b)){const t=Math.max(Math.abs(y),Math.abs(w));w=b+t,y=b-t}if(_){const t=L(c.y.range()),e=a.getDataLabelLength(y,w,"width").map(function(e){return i(this,s),e/t}.bind(this));["bottom","top"].forEach(function(t,n){i(this,s),E[t]+=R*(e[n]/(1-e[0]-e[1]))}.bind(this))}else if(v){const t=a.getDataLabelLength(y,w,"height");["bottom","top"].forEach(function(e,n){i(this,s),E[e]+=a.convertPixelToScale("y",t[n],R)}.bind(this))}E=a.getResettedPadding(E);const O=o[l+"_padding"];D(O)&&["bottom","top"].forEach(function(t){i(this,s),E[t]=r.getPadding(O,t,E[t],R)}.bind(this)),A&&(S&&(E.bottom=y),k&&(E.top=-w));const P=u?[y,w].map(function(t){return i(this,s),t<0?0:t}.bind(this)):[y-E.bottom,w+E.top];return m?P.reverse():P},getXDomainMinMax:function(t,e){var n,s=this;const a=this.config["axis_x_"+e],r=nt(e,t.map(function(t){var n=this;return i(this,s),nt(e,t.values.map(function(t){return i(this,n),t.x}.bind(this)))}.bind(this)));let o=M(a)?a.value:a;return o=C(o)&&null!=(n=this.axis)&&n.isTimeSeries()?ot.bind(this)(o):o,M(a)&&a.fit&&("min"===e&&or)&&(o=void 0),C(o)?o:r},getXDomainPadding:function(t,e){const i=this,n=i.axis,s=i.config.axis_x_padding,a=n.isTimeSeries()&&e,r=L(t);let o;if(n.isCategorized()||a)o=0;else if(i.hasType("bar")){const t=i.getMaxDataCount();o=t>1?r/(t-1)/2:.5}else o=i.getResettedPadding(.01*r);let c=S(s)?{left:s,right:s}:s,l=c.left,d=void 0===l?o:l,u=c.right,h=void 0===u?o:u;if("px"===s.unit){const t=Math.abs(r+.2*r);d=n.getPadding(s,"left",o,t),h=n.getPadding(s,"right",o,t)}else{const t=r+d+h;if(a&&t){const i=r/e/t;d=d/t/i,h=h/t/i}}return{left:d,right:h}},getXDomain:function(t){const e=this,i=e.axis,n=e.config,s=e.scale.x,a=n.axis_x_inverted,r=[e.getXDomainMinMax(t,"min"),e.getXDomainMinMax(t,"max")];let o=r[0],c=void 0===o?0:o,l=r[1],d=void 0===l?0:l;if("log"!==s.type){const t=i.isCategorized(),n=i.isTimeSeries(),s=e.getXDomainPadding(r);let a=r[0],o=r[1];a-o!=0||t||(n?(a=new Date(.5*a.getTime()),o=new Date(1.5*o.getTime())):(a=0===a?1:.5*a,o=0===o?-1:1.5*o)),(a||0===a)&&(c=n?new Date(a.getTime()-s.left):a-s.left),(o||0===o)&&(d=n?new Date(o.getTime()+s.right):o+s.right)}return a?[d,c]:[c,d]},updateXDomain:function(t,e,i,n,s){const a=this,r=a.config,o=a.org,c=a.scale,l=c.x,d=c.subX,u=r.zoom_enabled;var h;i&&(l.domain(s||it(a.getXDomain(t),!r.axis_x_inverted)),o.xDomain=l.domain(),d.domain(l.domain()),null==(h=a.brush)||h.scale(d));if(e){const t=s||!a.brush||W(a)?o.xDomain:V(a).map(d.invert);l.domain(t)}return(i||e)&&u&&a.zoom.updateScaleExtent(),n&&l.domain(a.trimXDomain(l.orgDomain())),l.domain()},trimXDomain:function(t){const e=this.config.axis_x_inverted,i=this.getZoomDomain(),n=i[0],s=i[1];return(e?t[0]>=n:t[0]<=n)&&(t[1]=+t[1]+(n-t[0]),t[0]=n),(e?t[1]<=s:t[1]>=s)&&(t[0]=+t[0]-(t[1]-s),t[1]=s),t},getZoomDomain:function(t,e){void 0===t&&(t="zoom"),void 0===e&&(e=!1);const i=this,n=i.config,s=i.scale,a=i.org;let r=e&&s[t]?s[t].domain():a.xDomain,o=r[0],c=r[1];return"zoom"===t&&(C(n.zoom_x_min)&&(o=nt("min",[o,n.zoom_x_min])),C(n.zoom_x_max)&&(c=nt("max",[c,n.zoom_x_max]))),[o,c]},convertPixelToScale:function(t,e,i){const n=this.config,s=this.state,a=n.axis_rotated;let r;return r="x"===t?a?"height":"width":a?"width":"height",i*(e/s[r])},withinRange:function(t,e,n){var s=this;const a=this.config.axis_x_inverted,r=n,o=r[0],c=r[1];if(Array.isArray(t)){const n=[].concat(t);if(a&&n.reverse(),n[0]=o:a?+n>=c:+n<=c)&&!t.every(function(t,n){return i(this,l),t===e[n]}.bind(this))}.bind(this))}return!1}};function Xe(t,e,i){const n=t.config,s="axis_"+e+"_tick_format";return(n[s]?n[s]:t.defaultValueFormat).call(t.api,i)}var $e={yFormat:function(t){return Xe(this,"y",t)},y2Format:function(t){return Xe(this,"y2",t)},getDefaultValueFormat:function(){const t=this,e=t.defaultArcValueFormat,i=t.yFormat,n=t.y2Format,s=t.hasArcType(null,["gauge","polar","radar"]);return function(a,r,o){return(s?e:t.axis&&"y2"===t.axis.getId(o)?n:i).call(t,a,r)}},defaultValueFormat:function(t){return z(t)?t.join("~"):T(t)?+t:""},defaultArcValueFormat:function(t,e){return(100*e).toFixed(1)+"%"},defaultPolarValueFormat:function(t){return""+t},dataLabelFormat:function(t){var e=this;const n=this.config.data_labels,s=function(t){i(this,e);let n=t;return z(t)?n=t.join("~"):M(t)&&(n=Object.values(t).join("~")),n}.bind(this);let a=s;return w(n.format)?a=n.format:P(n.format)&&(a=n.format[t]?!0===n.format[t]?s:n.format[t]:function(){return i(this,e),""}.bind(this)),a.bind(this.api)}};function Fe(t){const e=this,i=e.getDataById(t);return e.levelColor?e.levelColor(i.values[0].value):e.color(i)}var Be={initLegend:function(){const t=this,e=t.config,i=t.$el;t.legendItemTextBox={},t.state.legendHasRendered=!1,e.legend_show?(e.legend_contents_bindto||(i.legend=t.$el.svg.append("g").classed(wt.legend,!0).attr("transform",t.getTranslate("legend"))),t.updateLegend()):t.state.hiddenLegendIds=t.mapToIds(t.data.targets)},updateLegend:function(t,e,i){var n;const s=this,a=s.config,r=s.state,o=s.scale,c=s.$el,l=e||{withTransform:!1,withTransitionForTransform:!1,withTransition:!1};l.withTransition=X(l,"withTransition",!0),l.withTransitionForTransform=X(l,"withTransitionForTransform",!0),a.legend_contents_bindto&&a.legend_contents_template?s.updateLegendTemplate():r.hasTreemap||s.updateLegendElement(t||s.mapToIds(s.data.targets),l,i),null==(n=c.legend)||n.selectAll("."+wt.legendItem).classed(wt.legendItemHidden,(function(t){const e=!s.isTargetToShow(t);return e&&(this.style.opacity=null),e})),s.updateScales(!1,!o.zoom),s.updateSvgSize(),s.transformAll(l.withTransitionForTransform,i),r.legendHasRendered=!0},updateLegendTemplate:function(){var t=this;const e=this,n=e.config,a=e.$el,r=(0,s.select)(n.legend_contents_bindto),o=n.legend_contents_template;if(!r.empty()){const n=e.mapToIds(e.data.targets),s=[];let c="";n.forEach(function(n){i(this,t);const a=w(o)?o.bind(e.api)(n,e.color(n),e.api.data(n)[0].values):rt(o,{COLOR:e.color(n),TITLE:n});a&&(s.push(n),c+=a)}.bind(this));const l=r.html(c).selectAll((function(){return this.childNodes})).data(s);e.setLegendItem(l),a.legend=r}},updateSizeForLegend:function(t){const e=this,i=e.config,n=e.state,s=n.isLegendTop,a=n.isLegendLeft,r=n.isLegendRight,o=n.isLegendInset,c=n.current,l=t.width,d=t.height,u={top:s?e.getCurrentPaddingByDirection("top")+i.legend_inset_y+5.5:c.height-d-e.getCurrentPaddingByDirection("bottom")-i.legend_inset_y,left:a?e.getCurrentPaddingByDirection("left")+i.legend_inset_x+.5:c.width-l-e.getCurrentPaddingByDirection("right")-i.legend_inset_x+.5};e.state.margin3={top:r?0:o?u.top:c.height-d,right:NaN,bottom:0,left:r?c.width-l:o?u.left:0}},transformLegend:function(t){const e=this,i=e.$el.legend;(0,e.$T)(i,t).attr("transform",e.getTranslate("legend"))},updateLegendStep:function(t){this.state.legendStep=t},updateLegendItemWidth:function(t){this.state.legendItemWidth=t},updateLegendItemHeight:function(t){this.state.legendItemHeight=t},updateLegendItemColor:function(t,e){const i=this.$el.legend;i&&i.select("."+wt.legendItem+"-"+t+" line").style("stroke",e)},getLegendWidth:function(){const t=this.state,e=t.current.width,i=t.isLegendRight,n=t.isLegendInset,s=t.legendItemWidth,a=t.legendStep;return this.config.legend_show?i||n?s*(a+1):e:0},getLegendHeight:function(){var t;const e=this,i=e.state,n=i.current,s=i.isLegendRight,a=i.legendItemHeight,r=i.legendStep,o="fit"===(null==(t=e.config.padding)?void 0:t.mode);return e.config.legend_show?s?n.height:(o?10:Math.max(20,a))*(r+1):0},opacityForUnfocusedLegend:function(t){return t.classed(wt.legendItemHidden)?null:"0.3"},toggleFocusLegend:function(t,e){var n=this;const a=this,r=a.$el.legend,o=a.$T,c=a.mapToTargetIds(t);r&&o(r.selectAll("."+wt.legendItem).filter(function(t){return i(this,n),c.indexOf(t)>=0}.bind(this)).classed(kt.legendItemFocused,e)).style("opacity",(function(){return e?null:a.opacityForUnfocusedLegend.call(a,(0,s.select)(this))}))},revertLegend:function(){const t=this.$el.legend,e=this.$T;t&&e(t.selectAll("."+wt.legendItem).classed(kt.legendItemFocused,!1)).style("opacity",null)},showLegend:function(t){const e=this,i=e.config,n=e.$el,s=e.$T;i.legend_show||(i.legend_show=!0,n.legend?n.legend.style("visibility",null):e.initLegend(),e.state.legendHasRendered||e.updateLegend()),e.removeHiddenLegendIds(t),s(n.legend.selectAll(e.selectorLegends(t)).style("visibility",null)).style("opacity",null)},hideLegend:function(t){const e=this,i=e.config,n=e.$el.legend;i.legend_show&&I(t)&&(i.legend_show=!1,n.style("visibility","hidden")),e.addHiddenLegendIds(t),n.selectAll(e.selectorLegends(t)).style("opacity","0").style("visibility","hidden")},getLegendItemTextBox:function(t,e){const i=this,n=i.cache,s=i.state;let a;const r=re;return t&&(a=!s.redrawing&&n.get(r)||{},a[t]||(a[t]=i.getTextRect(e,wt.legendItem),n.add(r,a)),a=a[t]),a},setLegendItem:function(t){var e=this;const n=this,a=n.$el,r=n.api,o=n.config,c=n.state,l="touch"===c.inputType,d=n.hasType("gauge"),u=o.boost_useCssRule,h=o.legend_item_interaction;t.attr("class",(function(t){const e=(0,s.select)(this);return(!e.empty()&&e.attr("class")||"")+n.generateClass(wt.legendItem,t)})).style("visibility",function(t){return i(this,e),n.isLegendToShow(t)?null:"hidden"}.bind(this)),o.interaction_enabled&&(u&&[["."+wt.legendItem,"cursor:pointer"],["."+wt.legendItem+" text","pointer-events:none"],["."+wt.legendItemPoint+" text","pointer-events:none"],["."+wt.legendItemTile,"pointer-events:none"],["."+wt.legendItemEvent,"fill-opacity:0"]].forEach(function(t){i(this,e);const s=t[0],r=t[1];n.setCssRule(!1,s,[r])(a.legend)}.bind(this)),t.on(h.dblclick?"dblclick":"click",h||w(o.legend_item_onclick)?function(t,e){if(!$(o.legend_item_onclick,r,e)){const i=t.altKey,n=t.target;"dblclick"===t.type||i?c.hiddenTargetIds.length&&-1===n.parentNode.getAttribute("class").indexOf(wt.legendItemHidden)?r.show():(r.hide(),r.show(e)):(r.toggle(e),(0,s.select)(this).classed(kt.legendItemFocused,!1))}l&&n.hideTooltip()}:null),l||t.on("mouseout",h||w(o.legend_item_onout)?function(t,e){$(o.legend_item_onout,r,e)||((0,s.select)(this).classed(kt.legendItemFocused,!1),d&&n.undoMarkOverlapped(n,"."+Tt.gaugeValue),n.api.revert())}:null).on("mouseover",h||w(o.legend_item_onover)?function(t,e){$(o.legend_item_onover,r,e)||((0,s.select)(this).classed(kt.legendItemFocused,!0),d&&n.markOverlapped(e,n,"."+Tt.gaugeValue),!c.transiting&&n.isTargetToShow(e)&&r.focus(e))}:null),!t.empty()&&t.on("click mouseout mouseover")&&t.style("cursor",n.getStylePropValue("pointer")))},updateLegendElement:function(t,e){var n=this;const s=this,a=s.config,r=s.state,o=s.$el.legend,c=s.$T,l="circle"!==a.legend_item_tile_type,d=a.legend_item_tile_r,u={width:l?a.legend_item_tile_width:2*d,height:l?a.legend_item_tile_height:2*d},h={padding:{top:4,right:10},max:{width:0,height:0},posMin:10,step:0,tileWidth:u.width+5,totalLength:0},g={offsets:{},widths:{},heights:{},margins:[0],steps:{}};let f,p,x;const b=t.filter(function(t){return i(this,n),!C(a.data_names[t])||null!==a.data_names[t]}.bind(this)),m=e.withTransition,_=s.getUpdateLegendPositions(b,h,g);r.isLegendInset&&(h.step=a.legend_inset_step?a.legend_inset_step:b.length,s.updateLegendStep(h.step)),r.isLegendRight?(f=function(t){return i(this,n),h.max.width*g.steps[t]}.bind(this),p=function(t){return i(this,n),g.margins[g.steps[t]]+g.offsets[t]}.bind(this)):r.isLegendInset?(f=function(t){return i(this,n),h.max.width*g.steps[t]+10}.bind(this),p=function(t){return i(this,n),g.margins[g.steps[t]]+g.offsets[t]}.bind(this)):(f=function(t){return i(this,n),g.margins[g.steps[t]]+g.offsets[t]}.bind(this),p=function(t){return i(this,n),h.max.height*g.steps[t]}.bind(this));const v={xText:function(t,e){return i(this,n),f(t,e)+4+u.width}.bind(this),xRect:function(t,e){return i(this,n),f(t,e)}.bind(this),x1Tile:function(t,e){return i(this,n),f(t,e)-2}.bind(this),x2Tile:function(t,e){return i(this,n),f(t,e)-2+u.width}.bind(this),yText:function(t,e){return i(this,n),p(t,e)+9}.bind(this),yRect:function(t,e){return i(this,n),p(t,e)-5}.bind(this),yTile:function(t,e){return i(this,n),p(t,e)+4}.bind(this)};s.generateLegendItem(b,u,_,v),x=o.select("."+wt.legendBackground+" rect"),r.isLegendInset&&h.max.width>0&&0===x.size()&&(x=o.insert("g","."+wt.legendItem).attr("class",wt.legendBackground).append("rect"));c(o.selectAll("text").data(b).text(function(t){return i(this,n),C(a.data_names[t])?a.data_names[t]:t}.bind(this)).each((function(t,e){_(this,t,e)})),m).attr("x",v.xText).attr("y",v.yText);c(o.selectAll("rect."+wt.legendItemEvent).data(b),m).attr("width",function(t){return i(this,n),g.widths[t]}.bind(this)).attr("height",function(t){return i(this,n),g.heights[t]}.bind(this)).attr("x",v.xRect).attr("y",v.yRect),s.updateLegendItemPos(b,m,v),x&&c(x,m).attr("height",s.getLegendHeight()-12).attr("width",h.max.width*(h.step+1)+10),s.updateLegendItemWidth(h.max.width),s.updateLegendItemHeight(h.max.height),s.updateLegendStep(h.step)},getUpdateLegendPositions:function(t,e,n){const s=this,a=s.config,r=s.state,o=r.isLegendRight||r.isLegendInset;return function(c,l,d){var u=this;const h=d===t.length-1,g=s.getLegendItemTextBox(l,c),f=g.width+e.tileWidth+(h&&!o?0:e.padding.right)+a.legend_padding,p=g.height+e.padding.top,x=o?p:f,b=o?s.getLegendHeight():s.getLegendWidth();let m;const _=function(t,i){i||(m=(b-e.totalLength-x)/2,m=e.max.width)&&(e.max.width=f),(!e.max.height||p>=e.max.height)&&(e.max.height=p);const v=o?e.max.height:e.max.width;a.legend_equally?(Object.keys(n.widths).forEach(function(t){return i(this,u),n.widths[t]=e.max.width}.bind(this)),Object.keys(n.heights).forEach(function(t){return i(this,u),n.heights[t]=e.max.height}.bind(this)),m=(b-v*t.length)/2,m1&&d&&(o&&(f+=d*o),g>2?f-=(g-1)*d/2:2===g&&(f-=d/2)),f}.bind(this)},getShapeY:function(t){var e=this;const n=this,s=n.isStackNormalized();return function(a){i(this,e);let r=a.value;return S(a)?r=a:n.isAreaRangeType(a)?r=n.getBaseValue(a,"mid"):s?r=n.getRatio("index",a,!0):n.isBubbleZType(a)?r=n.getBubbleZData(a.value,"y"):n.isBarRangeType(a)&&(r=r[1]),n.getYScaleById(a.id,t)(r)}.bind(this)},getShapeYMin:function(t){const e=this,i=e.axis.getId(t),n=e.scale[i].domain()[0],s=e.config["axis_"+i+"_inverted"];return!e.isGrouped(t)&&!s&&n>0?n:0},getShapeOffsetData:function(t){var e=this;const n=this,s=n.orderTargets(n.filterTargetsToShow(n.data.targets.filter(t,n))),a=n.isStackNormalized(),r=s.map(function(t){var s=this;i(this,e);let r=t.values;const o={};n.isStepType(t)&&(r=n.convertValuesToStep(r));const c=r.reduce(function(t,e){i(this,s);const r=+e.x;return t[r]=e,o[r]=a?n.getRatio("index",e,!0):e.value,t}.bind(this),{});return{id:t.id,rowValues:r,rowValueMapByXValue:c,values:o}}.bind(this));return{indexMapByTargetId:s.reduce(function(t,n,s){let a=n.id;return i(this,e),t[a]=s,t}.bind(this),{}),shapeOffsetTargets:r}},getShapeOffset:function(t,e,n){var s=this;const a=this,r=a.getShapeOffsetData(t),o=r.shapeOffsetTargets,c=r.indexMapByTargetId,l=a.config.data_groupsZeroAs;return function(t,r){var d=this;i(this,s);const u=t.id,h=t.value,g=t.x,f=a.getIndices(e,t),p=a.getYScaleById(u,n);if(a.isBarRangeType(t))return p(h[0]);const x=+g,b=p("zero"===l?0:a.getShapeYMin(u));let m=b;return o.filter(function(t){return i(this,d),t.id!==u&&f[t.id]===f[u]}.bind(this)).forEach(function(t){i(this,d);const e=t.id,n=t.rowValueMapByXValue,s=t.rowValues,a=t.values;if(c[e]=0&&S(t)){(0!==h||("positive"===l&&t>0||"negative"===l&&t<0))&&(m+=p(t)-b)}}}.bind(this)),m}.bind(this)},circleY:function(t,e){const i=this,n=t.id;let s;return i.isGrouped(n)&&(s=He.bind(i)(t)),s?s(t,e)[0][1]:i.getYScaleById(n)(i.getBaseValue(t))},getBarW:function(t,e,n){var s=this;const a=this,r=a.config,o=a.org,c=a.scale,l=a.getMaxDataCount(),d="bar"===t&&r.data_groups.length,u=t+"_width",h=c.zoom&&!a.axis.isCategorized()?o.xDomain.map(function(t){return i(this,s),c.zoom(t)}.bind(this)).reduce(function(t,e){return i(this,s),Math.abs(t)+e}.bind(this))/l:e.tickInterval(l),g=function(t){i(this,s);const e=t?r[u][t]:r[u],a=t?e.ratio:r[u+"_ratio"],o=t?e.max:r[u+"_max"],c=S(e)?e:n?h*a/n:0;return o&&c>o?o:c}.bind(this);let f=g();return!d&&P(r[u])&&(f={_$width:f,_$total:[]},a.filterTargetsToShow(a.data.targets).forEach(function(t){i(this,s),r[u][t.id]&&(f[t.id]=g(t.id),f._$total.push(f[t.id]||f._$width))}.bind(this))),f},getShapeByIndex:function(t,e,n){var s=this;const a=this,r=a.$el,o=T(e)?"-"+e:"";let c=r[t];return c=c&&!c.empty()?c.filter(function(t){return i(this,s),!n||t.id===n}.bind(this)).filter(function(t){return i(this,s),!T(e)||t.index===e}.bind(this)):(n?r.main.selectAll("."+Ft[t+"s"]+a.getTargetSelectorSuffix(n)):r.main).selectAll("."+Ft[t]+o),c},isWithinShape:function(t,e){const i=this,n=(0,s.select)(t);let a;return i.isTargetToShow(e.id)?null!=i.hasValidPointType&&i.hasValidPointType(t.nodeName)?a=i.isStepType(e)?i.isWithinStep(t,i.getYScaleById(e.id)(e.value)):i.isWithinCircle(t,i.isBubbleType(e)?1.5*i.pointSelectR(e):0):"path"===t.nodeName&&(a=!n.classed(Ft.bar)||i.isWithinBar(t)):a=!1,a},getInterpolate:function(t){const e=this.getInterpolateType(t);return{basis:Ye.curveBasis,"basis-closed":Ye.curveBasisClosed,"basis-open":Ye.curveBasisOpen,bundle:Ye.curveBundle,cardinal:Ye.curveCardinal,"cardinal-closed":Ye.curveCardinalClosed,"cardinal-open":Ye.curveCardinalOpen,"catmull-rom":Ye.curveCatmullRom,"catmull-rom-closed":Ye.curveCatmullRomClosed,"catmull-rom-open":Ye.curveCatmullRomOpen,"monotone-x":Ye.curveMonotoneX,"monotone-y":Ye.curveMonotoneY,natural:Ye.curveNatural,"linear-closed":Ye.curveLinearClosed,linear:Ye.curveLinear,step:Ye.curveStep,"step-after":Ye.curveStepAfter,"step-before":Ye.curveStepBefore}[e]},getInterpolateType:function(t){const e=this,i=e.config,n=i.spline_interpolation_type,s=e.isInterpolationType(n)?n:"cardinal";return e.isSplineType(t)?s:e.isStepType(t)?i.line_step_type:"linear"},isWithinBar:function(t){const e=G(this.state.event,t),i=j(t),n=i[0],s=i[1],a=Math.min(n.x,s.x),r=Math.min(n.y,s.y),o=this.config.bar_sensitivity,c=t.getBBox(),l=c.width,d=c.height;return a-o0?i:320/(t.hasType("gauge")&&!e.gauge_fullCircle?2:1)},getParentRectValue:function(t){const e="offset"+q(t);let i=this.$el.chart.node(),n=0;for(;n<30&&i&&"BODY"!==i.tagName;){try{n=i.getBoundingClientRect()[t]}catch(t){e in i&&(n=i[e])}i=i.parentNode}const s=r.body[e];return n>s&&(n=s),n},getParentWidth:function(){return this.getParentRectValue("width")},getParentHeight:function(){const t=this.$el.chart.style("height");let e=0;return t&&(e=/px$/.test(t)?parseInt(t,10):this.getParentRectValue("height")),e},getSvgLeft:function(t){const e=this,i=e.config,n=e.state.hasAxis,s=e.$el,a=i.axis_rotated,r=a||!a&&!i.axis_y_inner,o=a?xt.axisX:xt.axisY,c=s.main.select("."+o).node(),l=n&&i["axis_"+(a?"x":"y")+"_label"];let d=0;if(n&&(A(l)||A(l.text)||/^inner-/.test(null==l?void 0:l.position))){const t=s.main.select("."+o+"-label");t.empty()||(d=t.node().getBoundingClientRect().left)}const u=c&&r?c.getBoundingClientRect():{right:0},h=s.chart.node().getBoundingClientRect().left+d,g=e.hasArcType(),f=u.right-h-(g?0:e.getCurrentPaddingByDirection("left",t));return f>0?f:0},updateDimension:function(t){const e=this,i=e.config,n=e.state.hasAxis,s=e.$el;var a;n&&!t&&e.axis.x&&i.axis_rotated&&(null==(a=e.axis.subX)||a.create(s.axis.subX));e.updateScales(t),e.updateSvgSize(),e.transformAll(!1)},updateSvgSize:function(){const t=this,e=t.state,i=e.clip,n=e.current,s=e.hasAxis,a=e.width,r=e.height,o=t.$el.svg;if(o.attr("width",n.width).attr("height",n.height),s){const e=o.select("."+Dt.brush+" .overlay"),n={width:0,height:0};e.size()&&(n.width=+e.attr("width"),n.height=+e.attr("height")),o.selectAll(["#"+i.id,"#"+i.idGrid]).select("rect").attr("width",a).attr("height",r),o.select("#"+i.idXAxis).select("rect").call(t.setXAxisClipPath.bind(t)),o.select("#"+i.idYAxis).select("rect").call(t.setYAxisClipPath.bind(t)),i.idSubchart&&o.select("#"+i.idSubchart).select("rect").attr("width",a).attr("height",n.height)}},getCurrentPaddingByDirection:function(t,e,i){var n;void 0===e&&(e=!1),void 0===i&&(i=!1);const s=this,a=s.config,r=s.$el,o=s.state.hasAxis,c=a.axis_rotated,l="fit"===(null==(n=a.padding)?void 0:n.mode),d=S(a["padding_"+t])?a["padding_"+t]:void 0,u=o?{top:c?"y2":null,bottom:c?"y":"x",left:c?"x":"y",right:c?null:"y2"}[t]:null,h=/^(left|right)$/.test(t),g=u&&a["axis_"+u+"_inner"],f=u&&a["axis_"+u+"_show"],p=u?a["axis_"+u+"_axes"].length:0;let x=u?h?s.getAxisWidthByAxisId(u,e):s.getHorizontalAxisHeight(u):0;let b=0;!l&&h&&(x=E(x));let m=o&&h&&(g||k(d)&&!f)?0:l?(f?x:0)+(null!=d?d:0):k(d)?x:d;return h&&o?(u&&(l||g)&&a["axis_"+u+"_label"].text&&(m+=s.axis.getAxisLabelPosition(u).isOuter?20:0),"right"===t?(m+=c?!l&&k(d)?10:2:!f||g?l?2:1:0,m+=i?s.axis.getXAxisTickTextY2Overflow(20):0):"left"===t&&c&&k(d)&&(m=a.axis_x_show?l?x:Math.max(x,40):1)):"top"===t?(r.title&&r.title.node()&&(m+=s.getTitlePadding()),b=c&&!g?p:0):"bottom"===t&&o&&c&&!f&&(m+=1),m+x*p-b},getCurrentPadding:function(t){var e=this;void 0===t&&(t=!1);const n=this,s=["top","bottom","left","right"].map(function(s){return i(this,e),n.getCurrentPaddingByDirection(s,null,t)}.bind(this));return{top:s[0],bottom:s[1],left:s[2],right:s[3]}},getResettedPadding:function(t){var e=this;const n=this.config,s=S(t);let a=s?0:{};return!1===n.padding?s||Object.keys(t).forEach(function(s){i(this,e),a[s]=I(n.data_labels)||!1===n.data_labels||"top"!==s?0:t[s]}.bind(this)):a=t,a},updateSizes:function(t){var e;const i=this,n=i.config,s=i.state,a=i.$el.legend,r=n.axis_rotated,o=i.hasArcType()||s.hasTreemap,c="fit"===(null==(e=n.padding)?void 0:e.mode);t||i.setContainerSize();const l={width:a?i.getLegendWidth():0,height:a?i.getLegendHeight():0};!o&&n.axis_x_show&&n.axis_x_tick_autorotate&&i.updateXAxisTickClip();const d=n.legend_show&&s.isLegendRight?i.getLegendWidth()+(c?0:20):0,u=!n.legend_show||s.isLegendRight||s.isLegendInset?0:l.height,h=r||o?0:i.getHorizontalAxisHeight("x"),g=n.subchart_axis_x_show&&n.subchart_axis_x_tick_text_show?h:30,f=n.subchart_show&&!o?n.subchart_size_height+g:0,p=i.hasType("gauge")&&n.arc_needle_show&&!n.gauge_fullCircle&&!n.gauge_label_show?10:0,x=i.getCurrentPadding(!0);if(s.margin=!o&&r?{top:x.top,right:o?0:x.right+d,bottom:u+x.bottom,left:f+(o?0:x.left)}:{top:(c?0:4)+x.top,right:o?0:x.right+d,bottom:p+f+u+x.bottom,left:o?0:x.left},s.margin=i.getResettedPadding(s.margin),s.margin2=r?{top:s.margin.top,right:NaN,bottom:20+u,left:i.state.rotatedPadding.left}:{top:s.current.height-f-u,right:NaN,bottom:g+u,left:s.margin.left},s.margin3={top:0,right:NaN,bottom:0,left:0},null==i.updateSizeForLegend||i.updateSizeForLegend(l),s.width=s.current.width-s.margin.left-s.margin.right,s.height=s.current.height-s.margin.top-s.margin.bottom,s.width<0&&(s.width=0),s.height<0&&(s.height=0),s.width2=r?s.margin.left-s.rotatedPadding.left-s.rotatedPadding.right:s.width,s.height2=r?s.height:s.current.height-s.margin2.top-s.margin2.bottom,s.width2<0&&(s.width2=0),s.height2<0&&(s.height2=0),i.hasArcType()){const t=i.hasType("gauge"),e=n.legend_show&&s.isLegendRight;s.arcWidth=s.width-(e?l.width+10:0),s.arcHeight=s.height-(e&&!t?0:10),t&&!n.gauge_fullCircle&&(s.arcHeight+=s.height-i.getPaddingBottomForGauge()),null==i.updateRadius||i.updateRadius()}s.isLegendRight&&o&&(s.margin3.left=s.arcWidth/2+1.1*s.radiusExpanded)}},Ze={setCssRule:function(t,e,n,s){var a=this;const r=this,o=r.config,c=r.state,l=c.cssRule,d=c.style;return o.boost_useCssRule?function(o){var c=this;i(this,a),o.each(function(a){var o=this;i(this,c);const u=s&&(null==s?void 0:s.call(r,a)),h=(t?"."+(It.shapes+r.getTargetSelectorSuffix(a.id)):"")+e;e in l&&d.sheet.deleteRule(l[h]),r.state.cssRule[h]=function(t,e,n){var s=this;const a=t.rootSelctor,r=t.sheet,o=a+" "+function(t){return i(this,s),t.replace(/\s?(bb-)/g,".$1").replace(/\.+/g,".")}.bind(this)(e)+" {"+n.join(";")+"}";return r[r.insertRule?"insertRule":"addRule"](o,r.cssRules.length)}(d,h,n.filter(Boolean).map(function(t){return i(this,o),A(u)&&-1===t.indexOf(":")?t+": "+u:t||""}.bind(this)))}.bind(this))}.bind(this):function(){i(this,a)}.bind(this)},getStylePropValue:function(t){return this.config.boost_useCssRule?null:w(t)?t.bind(this):t}};function qe(t,e,i,n,s){var a;const r=t.value,o=this.isCandlestickType(t),c=S(r)&&r<0||o&&!(null!=(a=this.getCandlestickData(t))&&a._isUp);let l=e.x,d=e.y;return n?"start"===i?(l+=c?0:8,d+=4):"middle"===i?(l+=8,d-=8):"end"===i&&(c&&(l-=8),d+=4):("start"===i?(l+=4,c&&(d+=16)):"middle"===i?d-=8:"end"===i&&(l-=4,c&&(d+=16)),s&&(d+=c?-17:o?13:7)),{x:l,y:d}}function Ke(t,e){var i;const n=this.config.data_labels_position,s=t.id,a=t.index,r=t.value;return null!=(i=w(n)?n.bind(this.api)(e,r,s,a,this.$el.text):(s in n?n[s]:n)[e])?i:0}var Je={opacityForText:function(t){const e=this;return e.isBarType(t)&&!e.meetsLabelThreshold(Math.abs(e.getRatio("bar",t)),"bar")?"0":e.hasDataLabel?null:"0"},initText:function(){const t=this.$el;t.main.select("."+gt.chart).append("g").attr("class",zt.chartTexts).style("pointer-events",t.treemap?"none":null)},updateTargetsForText:function(t){var e=this;const n=this,s=n.getChartClass("Text"),a=n.getClass("texts","id"),r=n.classFocus.bind(n);n.$el.main.select("."+zt.chartTexts).selectAll("."+zt.chartText).data(t).attr("class",function(t){return i(this,e),(""+s(t)+r(t)).trim()}.bind(this)).enter().append("g").style("opacity","0").attr("class",s).call(n.setCssRule(!0," ."+zt.text,["fill","pointer-events:none"],n.updateTextColor)).append("g").attr("class",a)},updateText:function(){var t=this;const e=this,n=e.$el,a=e.$T,r=e.config,o=e.axis,c=e.getClass("text","index"),l=r.data_labels.centered,d=n.main.selectAll("."+zt.texts).selectAll("."+zt.text).data(e.labelishData.bind(e));a(d.exit()).style("fill-opacity","0").remove(),n.text=d.enter().append("text").merge(d).attr("class",c).attr("text-anchor",function(n){i(this,t);let s=r["axis_"+(null==o?void 0:o.getId(n.id))+"_inverted"]?n.value>0:n.value<0;if(e.isCandlestickType(n)){const t=e.getCandlestickData(n);s=!(null!=t&&t._isUp)}else if(e.isTreemapType(n))return l?"middle":"start";return r.axis_rotated?s?"end":"start":"middle"}.bind(this)).style("fill",e.getStylePropValue(e.updateTextColor)).style("fill-opacity","0").each((function(t,i,n){const a=(0,s.select)(this);let r=t.value;if(e.isBubbleZType(t))r=e.getBubbleZData(r,"z");else if(e.isCandlestickType(t)){const i=e.getCandlestickData(t);i&&(r=i.close)}r=e.isTreemapType(t)?e.treemapDataLabelFormat(t)(a):e.dataLabelFormat(t.id)(r,t.id,t.index,n),S(r)?this.textContent=r:N(a,r)}))},updateTextColor:function(t){const e=this,i=e.config,n=i.data_labels_colors,s=e.isArcType(t)&&!e.isRadarType(t)||e.isTreemapType(t)?null:e.color(t);let a;if(A(n))a=n;else if(M(n)){a=n[(t.data||t).id]}else w(n)&&(a=n.bind(e.api)(s,t));if(e.isCandlestickType(t)&&!w(n)){const n=e.getCandlestickData(t);if(null==n||!n._isUp){const e=i.candlestick_color_down;a=M(e)?e[t.id]:e}}return a||s},updateTextBackgroundColor:function(t){const e=this,i=e.$el,n=e.config.data_labels_backgroundColors;let s="";if(A(n)||M(n)){const a=A(n)?"":e.getTargetSelectorSuffix("id"in t?t.id:t.data.id),r=i.defs.select(["filter[id*='labels-bg","']"].join(a));r.size()&&(s="url(#"+r.attr("id")+")")}return s||null},redrawText:function(t,e,i,n){const s=this,a=s.$T,r=s.axis,o=s.config,c=s.state.hasTreemap,l=H(!0),d=o.axis_rotated,u=o.data_labels.rotate,h=function(t){let e="middle";return t>0&&t<=170?e="end":t>190&&t<=360&&(e="start"),e}(u),g=u?"rotate("+u+")":"";return s.$el.text.style("fill",s.getStylePropValue(s.updateTextColor)).attr("filter",s.updateTextBackgroundColor.bind(s)).style("fill-opacity",i?0:s.opacityForText.bind(s)).each((function(i,f){const p=a(c&&this.childElementCount?this.parentNode:this,!(!n||!this.getAttribute("x")),l),x=o["axis_"+(null==r?void 0:r.getId(i.id))+"_inverted"];let b={x:t.bind(this)(i,f),y:e.bind(this)(i,f)};u&&(b=qe.bind(s)(i,b,h,d,x),p.attr("text-anchor",h)),this.childElementCount||u?p.attr("transform","translate("+b.x+" "+b.y+") "+g):p.attr("x",b.x).attr("y",b.y)})),!0},getTextRect:function(t,e){var n=this;const a=this;let r=t.node?t.node():t;/text/i.test(r.tagName)||(r=r.querySelector("text"));const o=r.textContent,c=de+"-"+o.replace(/\W/g,"_");let l=a.cache.get(c);return l||(a.$el.svg.append("text").style("visibility","hidden").style("font",(0,s.select)(r).style("font")).classed(e,!0).text(o).call(function(t){i(this,n),l=Y(t.node())}.bind(this)).remove(),a.cache.add(c,l)),l},generateXYForText:function(t,e){var n=this;const s=this,a=s.state,r=a.hasRadar,o=a.hasTreemap,c=Object.keys(t),l={},d=e?s.getXForText:s.getYForText;return r&&c.push("radar"),o&&c.push("treemap"),c.forEach(function(e){i(this,n),l[e]=s["generateGet"+q(e)+"Points"](t[e],!1)}.bind(this)),function(t,e){const i=(s.isAreaType(t)?"area":s.isBarType(t)&&"bar")||s.isCandlestickType(t)&&"candlestick"||s.isRadarType(t)&&"radar"||s.isTreemapType(t)&&"treemap"||"line";return d.call(s,l[i](t,e),t,this)}},getCenteredTextPos:function(t,e,i,n){const s=this,a=s.config,r=a.axis_rotated,o=s.isBarType(t),c=s.isTreemapType(t);if(a.data_labels.centered&&(o||c)){const a=Y(i);if(o){const i=s.getRangedData(t,null,"bar")>=0;if(r){const t=(i?e[1][1]-e[0][1]:e[0][1]-e[1][1])/2+a.width/2;return i?-t-3:t+2}{const t=(i?e[0][1]-e[1][1]:e[1][1]-e[0][1])/2+a.height/2;return i?t:-t-2}}if(c)return"x"===n?(e[1][0]-e[0][0])/2:(e[1][1]-e[0][1])/2+a.height/2}return 0},getXForText:function(t,e,i){const n=this,s=n.config,a=s.axis_rotated,r=n.isTreemapType(e);let o=t[0][0];var c;if(n.isCandlestickType(e))a?o=null!=(c=n.getCandlestickData(e))&&c._isUp?t[2][2]+4:t[2][1]-4:o+=(t[1][0]-o)/2;else if(r)o+=s.data_labels.centered?0:5;else if(a){const i=s["axis_"+n.axis.getId(e.id)+"_inverted"],a=n.isBarType(e)?4:6,r=e.value;o=t[2][1],i?o-=a*(r>0?1:-1):o+=a*(r<0?-1:1)}else o=n.hasType("bar")?(t[2][0]+t[0][0])/2:o;return(a||r)&&(o+=n.getCenteredTextPos(e,t,i,"x")),o+Ke.call(this,e,"x")},getYForText:function(t,e,i){const n=this,s=n.axis,a=n.config,r=n.state,o=a.axis_rotated,c=a["axis_"+(null==s?void 0:s.getId(e.id))+"_inverted"],l=n.isBarType(e),d=n.isTreemapType(e),u=a.point_r,h=Y(i);let g,f=e.value,p=3;if(n.isCandlestickType(e))f=n.getCandlestickData(e),o?(g=t[0][0],g+=(t[1][0]-g)/2+p):(g=f&&f._isUp?t[2][2]-p:t[2][1]+4*p,c&&(g+=15*(f._isUp?1:-1)));else if(d)g=t[0][1]+(a.data_labels.centered?0:h.height+5);else if(o)g=(t[0][0]+t[2][0]+.6*h.height)/2;else if(g=t[2][1],S(u)&&u>5&&(n.isLineType(e)||n.isScatterType(e))&&(p+=a.point_r/2.3),f<0||0===f&&!r.hasPositiveValue&&r.hasNegativeValue)g+=c?l?-3:-5:h.height+(l?-p:p);else{let t=2*-p;l?t=-p:n.isBubbleType(e)&&(t=p),c&&(t=l?10:15),g+=t}return o&&!d||(g+=n.getCenteredTextPos(e,t,i,"y")),g+Ke.call(this,e,"y")},markOverlapped:function(t,e,n){var a=this;const r=e.$el.arcs.selectAll(n),o=r.filter(function(e){return i(this,a),e.data.id!==t}.bind(this)),c=r.filter(function(e){return i(this,a),e.data.id===t}.bind(this)),l=J(c.node()),d=function(t,e){return i(this,a),Math.sqrt(Math.pow(t,2)+Math.pow(e,2))}.bind(this);c.node()&&o.each((function(){const t=J(this),e=(0,s.select)(this),i=d(l.e,l.f)>d(t.e,t.f)?c:e,n=Math.ceil(Math.abs(l.e-t.e))=(this.config[e+"_label_threshold"]||0)}};function Qe(t,e){void 0===t&&(t="left");const i=S(e);let n;return n=t.indexOf("center")>-1?i?e/2:"middle":t.indexOf("right")>-1?i?e:"end":i?0:"start",n}var ti={initTitle:function(){const t=this.config,e=this.$el;if(t.title_text){e.title=e.svg.append("g");N(e.title.append("text").style("text-anchor",Qe(t.title_position)).attr("class",zt.title),t.title_text,[.3,1.5])}},redrawTitle:function(){const t=this,e=t.config,i=t.state.current,n=t.$el.title;if(n){const s=Qe(e.title_position,i.width),a=(e.title_padding.top||0)+t.getTextRect(t.$el.title,zt.title).height;n.attr("transform","translate("+s+", "+a+")")}},getTitlePadding:function(){const t=this,e=t.$el,i=t.config;return(i.title_padding.top||0)+t.getTextRect(e.title,zt.title).height+(i.title_padding.bottom||0)}},ei={initTooltip:function(){const t=this,e=t.config,i=t.$el;i.tooltip=(0,s.select)(e.tooltip_contents.bindto),i.tooltip.empty()&&(i.tooltip=i.chart.append("div").attr("class",Mt.tooltipContainer).style("position","absolute").style("pointer-events","none").style("display","none")),t.bindTooltipResizePos()},initShowTooltip:function(){const t=this,e=t.config,i=t.$el,n=t.state,s=n.hasAxis,a=n.hasRadar;if(e.tooltip_init_show){var r,o;null!=(r=t.axis)&&r.isTimeSeries()&&A(e.tooltip_init_x)&&(e.tooltip_init_x=ot.call(t,e.tooltip_init_x)),t.api.tooltip.show({data:(o={},o[s||a?"x":"index"]=e.tooltip_init_x,o)});const n=e.tooltip_init_position;if(!e.tooltip_contents.bindto&&!I(n)){const t=n.top,e=void 0===t?0:t,s=n.left,a=void 0===s?50:s;i.tooltip.style("top",A(e)?e:e+"px").style("left",A(a)?a:a+"px").style("display",null)}}},getTooltipHTML:function(){const t=this,e=t.api,i=t.config;return w(i.tooltip_contents)?i.tooltip_contents.bind(e).apply(void 0,arguments):t.getTooltipContent.apply(t,arguments)},getTooltipContent:function(t,e,n,s){var a=this;const r=this,o=r.api,c=r.config,l=r.state,d=r.$el,u=["title","name","value"].map(function(t){i(this,a);const e=c["tooltip_format_"+t];return w(e)?e.bind(o):e}.bind(this)),h=u[0],g=u[1],f=u[2],p=function(){return i(this,a),B((h||e).apply(void 0,arguments))}.bind(this),x=function(){var t=this;return i(this,a),B((g||function(e){return i(this,t),e}.bind(this)).apply(void 0,arguments))}.bind(this),b=function(){var t=this;i(this,a);return B((f||(l.hasTreemap||r.isStackNormalized()?function(e,n){return i(this,t),(100*n).toFixed(2)+"%"}.bind(this):n)).apply(void 0,arguments))}.bind(this),m=c.tooltip_order,_=function(t){return i(this,a),r.axis&&r.isBubbleZType(t)?r.getBubbleZData(t.value,"z"):r.getBaseValue(t)}.bind(this),v=r.levelColor?function(t){return i(this,a),r.levelColor(t.value)}.bind(this):function(t){return i(this,a),s(t)}.bind(this),y=c.tooltip_contents,A=y.template,S=r.mapToTargetIds();if(null===m&&c.data_groups.length){const e=r.orderTargets(r.data.targets).map(function(t){return i(this,a),t.id}.bind(this)).reverse();t.sort(function(t,n){i(this,a);let s=t?t.value:null,r=n?n.value:null;return s>0&&r>0&&(s=t.id?e.indexOf(t.id):null,r=n.id?e.indexOf(n.id):null),s-r}.bind(this))}else/^(asc|desc)$/.test(m)?t.sort(function(t,e){i(this,a);const n=t?_(t):null,s=e?_(e):null;return"asc"===m?n-s:s-n}.bind(this)):w(m)&&t.sort(m.bind(o));const C=r.getTooltipContentTemplate(A),R=t.length;let E,O,L,P,I;for(I=0;I'+t+"":""})}if(!O.ratio&&d.arcs&&(L=["arc",r.$el.arcs.select("path."+ft.arc+"-"+O.id).data()[0]],O.ratio=r.getRatio.apply(r,L)),L=[O.ratio,O.id,O.index],r.isAreaRangeType(O)){const t=["high","low"].map(function(t){return i(this,a),b.apply(void 0,[r.getRangedData(O,t)].concat(L))}.bind(this)),e=t[0],n=t[1];P="Mid: "+b.apply(void 0,[_(O)].concat(L))+" High: "+e+" Low: "+n}else if(r.isCandlestickType(O)){const t=["open","high","low","close","volume"].map(function(t){i(this,a);return r.getRangedData(O,t,"candlestick")?b.apply(void 0,[r.getRangedData(O,t,"candlestick")].concat(L)):void 0}.bind(this)),e=t[0],n=t[1],s=t[2],o=t[3],c=t[4];P="Open: "+e+" High: "+n+" Low: "+s+" Close: "+o+(c?" Volume: "+c:"")}else if(r.isBarRangeType(O)){const t=O,e=t.value,i=t.id,n=t.index;P=""+b(e,void 0,i,n)}else P=b.apply(void 0,[_(O)].concat(L));if(void 0!==P){if(null===O.name)continue;const t=x.apply(void 0,[O.name].concat(L)),e=v(O),n={CLASS_TOOLTIP_NAME:Mt.tooltipName+r.getTargetSelectorSuffix(O.id),COLOR:A||!r.patterns?e:'',NAME:t,VALUE:P};if(A&&M(y.text)){const t=S.indexOf(O.id);Object.keys(y.text).forEach(function(e){i(this,a),n[e]=y.text[e][t]}.bind(this))}E+=rt(C[1],n)}}return E+""},getTooltipContentTemplate:function(t){return(t||'\n\t\t\t\t{=TITLE}\n\t\t\t\t{{\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}}\n\t\t\t
'+(this.patterns?"{=COLOR}":'')+'{=NAME}{=VALUE}
').replace(/(\r?\n|\t)/g,"").split(/{{(.*)}}/)},setTooltipPosition:function(t,e){var n=this;const s=this,a=s.config,r=s.scale,o=s.state,c=s.$el,l=c.eventRect,d=c.tooltip,u=a.tooltip_contents.bindto,h=a.axis_rotated,g=null==d?void 0:d.datum();if(!u&&g){var f,p;const c=null!=t?t:JSON.parse(g.current),u=G(o.event,null!=e?e:null==l?void 0:l.node()),x={x:u[0],y:u[1]};if(o.hasAxis&&r.x&&g&&"x"in g){const t=function(t,e,a){var c;void 0===t&&(t=0),void 0===a&&(a="y"),i(this,n);const l=r[e?null==(c=s.axis)?void 0:c.getId(e):a];return l?l(t)+(h?o.margin.left:o.margin.top):0}.bind(this);x.xAxis=r.x(g.x)+(a.tooltip_position?h?o.margin.top:o.margin.left:0),1===c.length?x.yAxis=t(c[0].value,c[0].id):x.yAxis=t}const b=g.width,m=void 0===b?0:b,_=g.height,v=void 0===_?0:_,y=null!=(f=null==(p=a.tooltip_position)?void 0:p.bind(s.api)(c,m,v,null==l?void 0:l.node(),x))?f:s.getTooltipPosition.bind(s)(m,v,x);["top","left"].forEach(function(t){i(this,n);const e=y[t];d.style(t,e+"px"),"left"!==t||g.xPosInPercent||(g.xPosInPercent=e/o.current.width*100)}.bind(this))}},getTooltipPosition:function(t,e,n){var s=this;const a=this,r=a.config,o=a.scale,c=a.state,l=c,d=l.width,u=l.height,h=l.current,g=l.isLegendRight,f=l.inputType,p=a.hasType("gauge")&&!r.gauge_fullCircle,x=c.hasTreemap,b=r.axis_rotated,m=a.hasArcType(),_=a.getSvgLeft(!0);let v=_+h.width-a.getCurrentPaddingByDirection("right");let y=n.x,T=n.y;if(m){"touch"===f||a.hasType("radar")||(y+=(d-(g?a.getLegendWidth():0))/2,T+=p?u:u/2)}else if(!x){const t={top:a.getCurrentPaddingByDirection("top",!0),left:a.getCurrentPaddingByDirection("left",!0)};b?(y+=_+t.left+20,T=t.top+n.xAxis+20,v-=_):(y=_+t.left+20+(o.zoom?y:n.xAxis),T+=t.top-5)}if(y+t+15>v&&(y-=t+(x||m?0:b?40:38)),T+e>h.height){T-=p?3*e:e+(x?0:30)}const w={top:T,left:y};return Object.keys(w).forEach(function(t){i(this,s),w[t]<0&&(w[t]=0)}.bind(this)),w},showTooltip:function(t,e){var n=this;const s=this,a=s.config,r=s.$el.tooltip,o=t.filter(function(t){return i(this,n),t&&T(s.getBaseValue(t))}.bind(this));if(!r||0===o.length||!a.tooltip_show)return;let c=r.datum();const l=JSON.stringify(t);if(!c||c.current!==l){const e=t.concat().sort()[0],i=e.index,n=e.x;$(a.tooltip_onshow,s.api,t),r.html(s.getTooltipHTML(t,s.axis?s.axis.getXAxisTickFormat():s.categoryName.bind(s),s.getDefaultValueFormat(),s.color)).style("display",null).style("visibility",null).datum(c={index:i,x:n,current:l,width:r.property("offsetWidth"),height:r.property("offsetHeight")}),$(a.tooltip_onshown,s.api,t),s._handleLinkedCharts(!0,i)}s.setTooltipPosition(o,e)},bindTooltipResizePos:function(){var t=this;const e=this,n=e.resizeFunction,s=e.state,a=e.$el.tooltip;n.add(function(){if(i(this,t),"block"===a.style("display")){const t=s.current,e=a.datum(),i=e.width,n=e.xPosInPercent;let r=t.width/100*n;const o=t.width-(r+i);o<0&&(r+=o),a.style("left",r+"px")}}.bind(this))},hideTooltip:function(t){const e=this,i=e.api,n=e.config,s=e.$el.tooltip;if(s&&"none"!==s.style("display")&&(!n.tooltip_doNotHide||t)){var a;const t=JSON.parse(null!=(a=s.datum().current)?a:{});$(n.tooltip_onhide,i,t),s.style("display","none").style("visibility","hidden").datum(null),$(n.tooltip_onhidden,i,t)}},_handleLinkedCharts:function(t,e){var n=this;const s=this,a=s.charts,o=s.config,c=s.state.event;if(null!=c&&c.isTrusted&&o.tooltip_linked&&a.length>1){const c=o.tooltip_linked_name;a.filter(function(t){return i(this,n),t!==s.api}.bind(this)).forEach(function(s){i(this,n);const a=s.internal,o=a.config,l=a.$el,d=o.tooltip_linked,u=o.tooltip_linked_name,h=r.body.contains(l.chart.node());if(d&&c===u&&h){const i=l.tooltip.data()[0],n=e!==(null==i?void 0:i.index);try{s.tooltip[t&&n?"show":"hide"]({index:e})}catch(t){}}}.bind(this))}},updateTooltipOnRedraw:function(t,e){var n=this;const a=this,o=a.config,c=a.$el,l=c.eventRect,d=c.svg,u=c.tooltip,h=a.state,g=h.event,f=h.hasAxis,p=h.hasRadar,x=h.hasTreemap;if("block"===(null==u?void 0:u.style("display"))&&g){var b;const c=null!=t?t:null==(b=p?d:l)?void 0:b.node();if(f||p)if(a.isMultipleX())a.selectRectForMultipleXs(c,!1);else{const t=null!=e?e:a.getDataIndexFromEvent(g);-1===e?a.api.tooltip.hide():(a.selectRectForSingle(c,t),a.setExpand(t,null,!0))}else{const t=g.clientX,e=g.clientY;setTimeout(function(){i(this,n);let o=r.elementFromPoint(t,e);const c=(0,s.select)(o).datum();if(c){const t=a.hasArcType()?a.convertToArcData(a.updateAngle(c)):null==c?void 0:c.data;x&&(o=d.node()),t&&a.showTooltip([t],o)}else a.api.tooltip.hide()}.bind(this),o.transition_duration)}}}},ii={getTranslate:function(t,e){void 0===e&&(e=0);const i=this,n=i.config,s=i.state,a=n.axis_rotated;let r,o,c=0;if(e&&/^(x|y2?)$/.test(t)&&(c=i.getAxisSize(t)*e),"main"===t)r=O(s.margin.left),o=O(s.margin.top);else if("context"===t)r=O(s.margin2.left),o=O(s.margin2.top);else if("legend"===t)r=s.margin3.left,o=s.margin3.top;else if("x"===t)r=a?-c:0,o=a?0:s.height+c;else if("y"===t)r=a?0:-c,o=a?s.height+c:0;else if("y2"===t)r=a?0:s.width+c,o=a?-c-1:0;else if("subX"===t)r=0,o=a?0:s.height2;else if("arc"===t)r=s.arcWidth/2,o=s.arcHeight/2;else if("polar"===t)r=s.arcWidth/2,o=s.arcHeight/2;else if("radar"===t){const t=i.getRadarSize()[0];r=s.width/2-t,o=O(s.margin.top)}return"translate("+r+", "+o+")"},transformMain:function(t,e){const i=this,n=i.$el.main,s=i.$T,a=null!=e&&e.axisX?e.axisX:s(n.select("."+xt.axisX),t),r=null!=e&&e.axisY?e.axisY:s(n.select("."+xt.axisY),t),o=null!=e&&e.axisY2?e.axisY2:s(n.select("."+xt.axisY2),t);s(n,t).attr("transform",i.getTranslate("main")),a.attr("transform",i.getTranslate("x")),r.attr("transform",i.getTranslate("y")),o.attr("transform",i.getTranslate("y2")),n.select("."+ft.chartArcs).attr("transform",i.getTranslate("arc"))},transformAll:function(t,e){const i=this,n=i.config,s=i.state,a=s.hasAxis,r=s.hasTreemap,o=i.$el;r||i.transformMain(t,e),a&&n.subchart_show&&i.transformContext(t,e),o.legend&&i.transformLegend(t)}},ni={isValidChartType:function(t){return!!(t&&Object.values(d).indexOf(t)>-1)},setTargetType:function(t,e){var n=this;const s=this,a=s.config,r=s.state.withoutFadeIn;s.mapToTargetIds(t).forEach(function(t){i(this,n),r[t]=e===a.data_types[t],a.data_types[t]=e}.bind(this)),t||(a.data_type=e)},updateTypesElements:function(){var t=this;const e=this,n=e.state.current;Object.keys(d).forEach(function(s){i(this,t);const a=d[s],r=e.hasType(a,null,!0),o=n.types.indexOf(a);-1===o&&r?n.types.push(a):o>-1&&!r&&n.types.splice(o,1)}.bind(this)),e.setChartElements()},hasType:function(t,e,n){var s,a=this;void 0===n&&(n=!1);const r=this,o=r.config,c=r.state.current,l=o.data_types,d=e||r.data.targets;let u=!1;return!n&&(null==(s=c.types)?void 0:s.indexOf(t))>-1?u=!0:null!=d&&d.length?d.forEach(function(e){i(this,a);const n=l[e.id];(n===t||!n&&"line"===t)&&(u=!0)}.bind(this)):Object.keys(l).length?Object.keys(l).forEach(function(e){i(this,a),l[e]===t&&(u=!0)}.bind(this)):u=o.data_type===t,u},hasTypeOf:function(t,e,n){var s=this;return void 0===n&&(n=[]),t in h&&!h[t].filter(function(t){return i(this,s),-1===n.indexOf(t)}.bind(this)).every(function(t){return i(this,s),!this.hasType(t,e)}.bind(this))},isTypeOf:function(t,e){const i=A(t)?t:t.id,n=this.config.data_types[i]||this.config.data_type;return z(e)?e.indexOf(n)>=0:n===e},hasPointType:function(){const t=this;return t.hasTypeOf("Line")||t.hasType("bubble")||t.hasType("scatter")},hasArcType:function(t,e){return this.hasTypeOf("Arc",t,e)},hasMultiArcGauge:function(){return this.hasType("gauge")&&"multi"===this.config.gauge_type},isLineType:function(t){const e=A(t)?t:t.id;return!this.config.data_types[e]||this.isTypeOf(e,h.Line)},isStepType:function(t){return this.isTypeOf(t,h.Step)},isSplineType:function(t){return this.isTypeOf(t,h.Spline)},isAreaType:function(t){return this.isTypeOf(t,h.Area)},isAreaRangeType:function(t){return this.isTypeOf(t,h.AreaRange)},isBarType:function(t){return this.isTypeOf(t,"bar")},isBubbleType:function(t){return this.isTypeOf(t,"bubble")},isCandlestickType:function(t){return this.isTypeOf(t,"candlestick")},isScatterType:function(t){return this.isTypeOf(t,"scatter")},isTreemapType:function(t){return this.isTypeOf(t,"treemap")},isPieType:function(t){return this.isTypeOf(t,"pie")},isGaugeType:function(t){return this.isTypeOf(t,"gauge")},isDonutType:function(t){return this.isTypeOf(t,"donut")},isPolarType:function(t){return this.isTypeOf(t,"polar")},isRadarType:function(t){return this.isTypeOf(t,"radar")},isArcType:function(t){return this.isPieType(t)||this.isDonutType(t)||this.isGaugeType(t)||this.isPolarType(t)||this.isRadarType(t)},isCirclePoint:function(t){const e=this.config,i=e.point_pattern;let n=!1;return n="circle"===(null==t?void 0:t.tagName)||"circle"===e.point_type&&(!i||z(i)&&0===i.length),n},lineData:function(t){return this.isLineType(t)?[t]:[]},arcData:function(t){return this.isArcType(t.data)?[t]:[]},labelishData:function(t){var e=this;return this.isBarType(t)||this.isLineType(t)||this.isScatterType(t)||this.isBubbleType(t)||this.isCandlestickType(t)||this.isRadarType(t)||this.isTreemapType(t)?t.values.filter(function(t){return i(this,e),S(t.value)||!!t.value}.bind(this)):[]},barLineBubbleData:function(t){return this.isBarType(t)||this.isLineType(t)||this.isBubbleType(t)?t.values:[]},isInterpolationType:function(t){return["basis","basis-closed","basis-open","bundle","cardinal","cardinal-closed","cardinal-open","catmull-rom","catmull-rom-closed","catmull-rom-open","linear","linear-closed","monotone-x","monotone-y","natural"].indexOf(t)>=0}};let si=function(){function t(t){this.api=void 0,this.config=void 0,this.cache=void 0,this.$el=void 0,this.state=void 0,this.charts=void 0,this.data={xs:{},targets:[]},this.axis=void 0,this.scale={x:null,y:null,y2:null,subX:null,subY:null,subY2:null,zoom:null},this.org={xScale:null,xDomain:null},this.color=void 0,this.patterns=void 0,this.levelColor=void 0,this.point=void 0,this.brush=void 0,this.format={extraLineClasses:null,xAxisTick:null,dataTime:null,defaultAxisTime:null,axisTime:null};const e=this;e.api=t,e.config=new te,e.cache=new ue;const i=new Nt;e.$el=i.getStore("element"),e.state=i.getStore("state"),e.$T=e.$T.bind(e)}var e=t.prototype;return e.$T=function(t,e,i){const n=this.config,a=this.state,r=n.transition_duration,o=n.subchart_show;let c=t;if(c){"tagName"in c&&(c=(0,s.select)(c));c=(!1!==e&&r||e)&&(!a.zooming||a.dragging)&&!a.resizing&&a.rendered&&!o?c.transition(i).duration(r):c}return c},e.beforeInit=function(){const t=this;t.callPluginHook("$beforeInit"),$(t.config.onbeforeinit,t.api)},e.afterInit=function(){const t=this;t.callPluginHook("$afterInit"),$(t.config.onafterinit,t.api)},e.init=function(){const t=this,e=t.config,i=t.state,n=t.$el,a=e.boost_useCssRule;if(dt(t),i.hasRadar=!i.hasAxis&&t.hasType("radar"),i.hasTreemap=!i.hasAxis&&t.hasType("treemap"),i.hasAxis=!t.hasArcType()&&!i.hasTreemap,i.datetimeId="bb-"+ +new Date*H(),a){const t=r.createElement("style");t.type="text/css",r.head.appendChild(t),i.style={rootSelctor:"."+i.datetimeId,sheet:t.sheet},n.style=t}const o={element:e.bindto,classname:"bb"};M(e.bindto)&&(o.element=e.bindto.element||"#chart",o.classname=e.bindto.classname||o.classname),n.chart=w(o.element.node)?e.bindto.element:(0,s.select)(o.element||[]),n.chart.empty()&&(n.chart=(0,s.select)(r.body.appendChild(r.createElement("div")))),n.chart.html("").classed(o.classname,!0).classed(i.datetimeId,a).style("position","relative"),t.initParams(),t.initToRender()},e.initToRender=function(t){var e=this;const n=this,s=n.config,r=n.state,o=n.$el.chart,c=function(){return i(this,e),"none"===o.style("display")||"hidden"===o.style("visibility")}.bind(this),l=s.render.lazy||c(),d=a.MutationObserver;l&&d&&!1!==s.render.observe&&!t&&new d(function(t,s){i(this,e),c()||(s.disconnect(),r.rendered||n.initToRender(!0))}.bind(this)).observe(o.node(),{attributes:!0,attributeFilter:["class","style"]}),l&&!t||n.convertData(s,function(t){i(this,e),n.initWithData(t),n.afterInit()}.bind(this))},e.initParams=function(){var t=this;const e=this,s=e.config,o=e.format,c=e.state,l=s.axis_rotated;if(e.color=e.generateColor(),e.levelColor=e.generateLevelColor(),!1===s.padding&&(s.axis_x_show=!1,s.axis_y_show=!1,s.axis_y2_show=!1,s.subchart_show=!1),e.hasPointType()&&(e.point=e.generatePoint()),c.hasAxis){e.initClip(),o.extraLineClasses=e.generateExtraLineClass(),o.dataTime=s.data_xLocaltime?n.timeParse:n.utcParse,o.axisTime=s.axis_x_localtime?n.timeFormat:n.utcFormat;const a=e.config.zoom_enabled&&"drag"===e.config.zoom_type;o.defaultAxisTime=function(n){i(this,t);const s=e.scale,r=s.x,c=s.zoom,l=a?c:c&&r.orgDomain().toString()!==c.domain().toString(),d=(n.getMilliseconds()?".%L":n.getSeconds()&&".:%S")||n.getMinutes()&&"%I:%M"||n.getHours()&&"%I %p"||1!==n.getDate()&&"%b %d"||l&&1===n.getDate()&&"%b'%y"||n.getMonth()&&"%-m/%-d"||"%Y";return o.axisTime(d)(n)}.bind(this)}c.isLegendRight="right"===s.legend_position,c.isLegendInset="inset"===s.legend_position,c.isLegendTop="top-left"===s.legend_inset_anchor||"top-right"===s.legend_inset_anchor,c.isLegendLeft="top-left"===s.legend_inset_anchor||"bottom-left"===s.legend_inset_anchor,c.rotatedPadding.top=e.getResettedPadding(c.rotatedPadding.top),c.rotatedPadding.right=l&&!s.axis_x_show?0:30,c.inputType=function(t,e){var n=this;const s=a.DocumentTouch,o=a.matchMedia,c=a.navigator;let l=!1;if(e)if(c&&"maxTouchPoints"in c)l=c.maxTouchPoints>0;else if("ontouchmove"in a||s&&r instanceof s)l=!0;else if(null!=o&&o("(pointer:coarse)").matches)l=!0;else{const t=c.userAgent;l=/\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(t)||/\b(Android|Windows Phone|iPad|iPod)\b/i.test(t)}return(t&&["any-hover:hover","any-pointer:fine"].some(function(t){return i(this,n),null==o?void 0:o("("+t+")").matches}.bind(this))?"mouse":l&&"touch")||"mouse"}(s.interaction_inputType_mouse,s.interaction_inputType_touch)},e.initWithData=function(t){var e=this;const n=this,s=n.config,a=n.scale,r=n.state,o=n.$el,c=n.org,l=r,d=l.hasAxis,u=l.hasTreemap,h=s.interaction_enabled,g=n.hasType("polar");if(d&&(n.axis=n.getAxisInstance(),s.zoom_enabled&&n.initZoom()),n.data.xs={},n.data.targets=n.convertDataToTargets(t),s.data_filter&&(n.data.targets=n.data.targets.filter(s.data_filter.bind(n.api))),s.data_hide&&n.addHiddenTargetIds(!0===s.data_hide?n.mapToIds(n.data.targets):s.data_hide),s.legend_hide&&n.addHiddenLegendIds(!0===s.legend_hide?n.mapToIds(n.data.targets):s.legend_hide),n.updateSizes(),n.updateScales(!0),d){const t=a.x,e=a.y,i=a.y2,r=a.subX,o=a.subY,l=a.subY2;t&&(t.domain(it(n.getXDomain(n.data.targets),!s.axis_x_inverted)),r.domain(t.domain()),c.xDomain=t.domain()),e&&(e.domain(n.getYDomain(n.data.targets,"y")),o.domain(e.domain())),i&&(i.domain(n.getYDomain(n.data.targets,"y2")),l&&l.domain(i.domain()))}if(o.svg=o.chart.append("svg").style("overflow","hidden").style("display","block"),h&&r.inputType){const t="touch"===r.inputType,e=s.onclick,i=s.onover,a=s.onout;o.svg.on("click",(null==e?void 0:e.bind(n.api))||null).on(t?"touchstart":"mouseenter",(null==i?void 0:i.bind(n.api))||null).on(t?"touchend":"mouseleave",(null==a?void 0:a.bind(n.api))||null)}s.svg_classname&&o.svg.attr("class",s.svg_classname);const f=w(s.color_tiles)&&n.patterns;(d||f||g||u||s.data_labels_backgroundColors)&&(o.defs=o.svg.append("defs"),d&&["id","idXAxis","idYAxis","idGrid"].forEach(function(t){i(this,e),n.appendClip(o.defs,r.clip[t])}.bind(this)),n.generateDataLabelBackgroundColorFilter(),f&&n.patterns.forEach(function(t){var n=this;return i(this,e),o.defs.append(function(){return i(this,n),t.node}.bind(this))}.bind(this))),n.updateSvgSize(),n.bindResize();const p=o.svg.append("g").classed(gt.main,!0).attr("transform",u?null:n.getTranslate("main"));var x;(o.main=p,s.subchart_show&&n.initSubchart(),s.tooltip_show&&n.initTooltip(),s.title_text&&n.initTitle(),!u&&s.legend_show&&n.initLegend(),s.data_empty_label_text&&p.append("text").attr("class",zt.text+" "+gt.empty).attr("text-anchor","middle").attr("dominant-baseline","middle"),d&&(s.regions.length&&n.initRegion(),s.clipPath||n.axis.init()),p.append("g").classed(gt.chart,!0).attr("clip-path",d?r.clip.path:null),n.callPluginHook("$init"),n.initChartElements(),d)&&(h&&(null==n.initEventRect||n.initEventRect()),n.initGrid(),s.clipPath&&(null==(x=n.axis)||x.init()));if(n.updateTargets(n.data.targets),n.updateDimension(),$(s.oninit,n.api),n.setBackground(),n.redraw({withTransition:!1,withTransform:!0,withUpdateXDomain:!0,withUpdateOrgXDomain:!0,withTransitionForAxis:!1,initializing:!0}),s.data_onmin||s.data_onmax){const t=n.getMinMaxData();$(s.data_onmin,n.api,t.min),$(s.data_onmax,n.api,t.max)}s.tooltip_show&&n.initShowTooltip(),r.rendered=!0},e.initChartElements=function(){var t=this;const e=this,n=e.state,s=n.hasAxis,a=n.hasRadar,r=n.hasTreemap,o=[];if(s){const n=["bar","bubble","candlestick","line"];e.config.bar_front&&n.push(n.shift()),n.forEach(function(n){i(this,t);const s=q(n);("line"===n&&e.hasTypeOf(s)||e.hasType(n))&&o.push(s)}.bind(this))}else if(r)o.push("Treemap");else{const t=e.hasType("polar");a||o.push("Arc","Pie"),e.hasType("gauge")?o.push("Gauge"):a?o.push("Radar"):t&&o.push("Polar")}o.forEach(function(n){i(this,t),e["init"+n]()}.bind(this)),D(e.config.data_labels)&&!e.hasArcType(null,["radar"])&&e.initText()},e.setChartElements=function(){const t=this.$el,e=t.chart,i=t.svg,n=t.defs,s=t.main,a=t.tooltip,r=t.legend,o=t.title,c=t.grid,l=t.needle,d=t.arcs,u=t.circle,h=t.bar,g=t.candlestick,f=t.line,p=t.area,x=t.text;this.api.$={chart:e,svg:i,defs:n,main:s,tooltip:a,legend:r,title:o,grid:c,arc:d,circles:u,bar:{bars:h},candlestick:g,line:{lines:f,areas:p},needle:l,text:{texts:x}}},e.setBackground=function(){const t=this,e=t.config.background,i=t.state,n=t.$el.svg;if(D(e)){const t=n.select("g").insert(e.imgUrl?"image":"rect",":first-child");e.imgUrl?t.attr("href",e.imgUrl):e.color&&t.style("fill",e.color).attr("clip-path",i.clip.path),t.attr("class",e.class||null).attr("width","100%").attr("height","100%")}},e.updateTargets=function(t){var e=this;const n=this,s=n.state,a=s.hasAxis,r=s.hasRadar,o=s.hasTreemap,c=function(s){return i(this,e),n["updateTargetsFor"+s](t.filter(n["is"+s+"Type"].bind(n)))}.bind(this);if(n.updateTargetsForText(t),a)["bar","candlestick","line"].forEach(function(t){i(this,e);const s=q(t);("line"===t&&n.hasTypeOf(s)||n.hasType(t))&&c(s)}.bind(this)),n.updateTargetsForSubchart&&n.updateTargetsForSubchart(t);else if(n.hasArcType(t)){let t="Arc";r?t="Radar":n.hasType("polar")&&(t="Polar"),c(t)}else o&&c("Treemap");const l=n.hasType("bubble")||n.hasType("scatter");l&&(null==n.updateTargetForCircle||n.updateTargetForCircle()),n.filterTargetsToShowAtInit(l)},e.filterTargetsToShowAtInit=function(t){var e=this;void 0===t&&(t=!1);const n=this,s=n.$el.svg,a=n.$T;let r="."+gt.target;t&&(r+=", ."+_t.chartCircles+" > ."+_t.circles),a(s.selectAll(r).filter(function(t){return i(this,e),n.isTargetToShow(t.id)}.bind(this))).style("opacity",null)},e.getWithOption=function(t){var e=this;const n={Dimension:!0,EventRect:!0,Legend:!1,Subchart:!0,Transform:!1,Transition:!0,TrimXDomain:!0,UpdateXAxis:"UpdateXDomain",UpdateXDomain:!1,UpdateOrgXDomain:!1,TransitionForExit:"Transition",TransitionForAxis:"Transition",Y:!0};return Object.keys(n).forEach(function(s){i(this,e);let a=n[s];A(a)&&(a=n[a]),n[s]=X(t,"with"+s,a)}.bind(this)),n},e.initialOpacity=function(t){const e=this.state.withoutFadeIn;return null!==this.getBaseValue(t)&&e[t.id]?null:"0"},e.bindResize=function(){var t=this;const e=this,n=e.config,s=e.state,r=function(t){var e=this;const n=[];let s;const a=function(){var e=this;a.clear(),!1===t?l(function(){var t=this;i(this,e),n.forEach(function(e){return i(this,t),e()}.bind(this))}.bind(this),{timeout:200}):s=he(function(){var t=this;i(this,e),n.forEach(function(e){return i(this,t),e()}.bind(this))}.bind(this),S(t)?t:200)};return a.clear=function(){i(this,e),s&&(ge(s),s=null)}.bind(this),a.add=function(t){return i(this,e),n.push(t)}.bind(this),a.remove=function(t){return i(this,e),n.splice(n.indexOf(t),1)}.bind(this),a}(n.resize_timer),o=[];o.push(function(){return i(this,t),$(n.onresize,e.api)}.bind(this)),n.resize_auto&&o.push(function(){i(this,t),s.resizing=!0,n.legend_show&&(e.updateSizes(),e.updateLegend()),e.api.flush(!1)}.bind(this)),o.push(function(){i(this,t),$(n.onresized,e.api),s.resizing=!1}.bind(this)),o.forEach(function(e){return i(this,t),r.add(e)}.bind(this)),e.resizeFunction=r,a.addEventListener("resize",e.resizeFunction=r)},e.callPluginHook=function(t){for(var e=this,n=arguments.length,s=Array(n>1?n-1:0),a=1;a\n\t\t\t\n\t\t\t\t'+x+"\n\t\t\t\t"+f.replace(/(url\()[^#]+/g,"$1")+"\n\t\t\t";return"data:image/svg+xml;base64,"+li(b)}function ui(t){var e=this;const n=t.getBoundingClientRect(),s=n.left,r=n.top,o=function(t){return i(this,e),t.textContent||t.childElementCount}.bind(this),c=[];return K(t.querySelectorAll("text")).filter(o).forEach(function(t){var n=this;i(this,e);const l=function(t){var e;i(this,n);const o=a.getComputedStyle(t),c=o.fill,l=o.fontFamily,d=o.fontSize,u=o.textAnchor,h=o.transform,g=function(t,e){const i=e.top,n=e.left,s=t.getBBox(),a=s.x,r=s.y,o=t.getScreenCTM(),c=o.a,l=o.b,d=o.c,u=o.d,h=o.e,g=o.f,f=t.getBoundingClientRect(),p=f.width,x=f.height;return{x:c*a+d*r+h-n,y:l*a+u*r+g-i+(x-Math.round(x/4)),width:p,height:x}}(t,{left:s,top:r}),f=g.x,p=g.y,x=g.width,b=g.height;return(e={})[t.textContent]={x:f,y:p,width:x,height:b,fill:c,fontFamily:l,fontSize:d,textAnchor:u,transform:h},e}.bind(this);if(t.childElementCount>1)return K(t.querySelectorAll("tspan")).filter(o).forEach(function(t){i(this,n),c.push(l(t))}.bind(this)),[];c.push(l(t))}.bind(this)),c}var hi={export:function(t,e){var n=this;const s=this.internal,a=s.state,o=s.$el,c=o.chart,l=o.svg,d=a.current,u=d.width,h=d.height,g=et({width:u,height:h,preserveAspectRatio:!0,preserveFontStyle:!1,mimeType:"image/png"},t),f=di(c.node(),g,{width:u,height:h}),p=g.preserveFontStyle?ui(l.node()):[];if(e&&w(e)){const t=new Image;t.crossOrigin="Anonymous",t.onload=function(){i(this,n);const s=r.createElement("canvas"),a=s.getContext("2d");s.width=g.width||u,s.height=g.height||h,a.drawImage(t,0,0),p.length&&(!function(t,e){var n=this;e.forEach(function(e){var s=this;i(this,n),Object.keys(e).forEach(function(n){var a=this;i(this,s);const r=e[n],o=r.x,c=r.y,l=r.width,d=r.height,u=r.fill,h=r.fontFamily,g=r.fontSize,f=r.transform;if(t.save(),t.font=g+" "+h,t.fillStyle=u,"none"===f)t.fillText(n,o,c);else{const e=f.replace(/(matrix|\(|\))/g,"").split(",");e.splice(4).every(function(t){return i(this,a),0==+t}.bind(this))?(e.push(o+l-l/4),e.push(c-d+d/3)):(e.push(o),e.push(c)),t.transform.apply(t,e),t.fillText(n,0,0)}t.restore()}.bind(this))}.bind(this))}(a,p),p.length=0),e.bind(this)(s.toDataURL(g.mimeType))}.bind(this),t.src=f}return f}},gi={focus:function(t){var e=this;const n=this.internal,s=n.state,a=n.mapToTargetIds(t),r=n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n)));this.revert(),this.defocus(),r.classed(kt.focused,!0).classed(kt.defocused,!1),n.hasArcType()&&!s.hasRadar&&(n.expandArc(a),n.hasType("gauge")&&n.markOverlapped(t,n,"."+Tt.gaugeValue)),n.toggleFocusLegend(a,!0),s.focusedTargetIds=a,s.defocusedTargetIds=s.defocusedTargetIds.filter(function(t){return i(this,e),a.indexOf(t)<0}.bind(this))},defocus:function(t){var e=this;const n=this.internal,s=n.state,a=n.mapToTargetIds(t);n.$el.svg.selectAll(n.selectorTargets(a.filter(n.isTargetToShow,n))).classed(kt.focused,!1).classed(kt.defocused,!0),n.hasArcType(null,["polar"])&&(n.unexpandArc(a),n.hasType("gauge")&&n.undoMarkOverlapped(n,"."+Tt.gaugeValue)),n.toggleFocusLegend(a,!1),s.focusedTargetIds=s.focusedTargetIds.filter(function(t){return i(this,e),a.indexOf(t)<0}.bind(this)),s.defocusedTargetIds=a},revert:function(t){const e=this.internal,i=e.config,n=e.state,a=e.$el,r=e.mapToTargetIds(t);a.svg.selectAll(e.selectorTargets(r)).classed(kt.focused,!1).classed(kt.defocused,!1),e.hasArcType(null,["polar"])&&e.unexpandArc(r),i.legend_show&&(e.showLegend(r.filter(e.isLegendToShow.bind(e))),a.legend.selectAll(e.selectorLegends(r)).filter((function(){return(0,s.select)(this).classed(kt.legendItemFocused)})).classed(kt.legendItemFocused,!1)),n.focusedTargetIds=[],n.defocusedTargetIds=[]}};var fi={legend:{show:function(t){const e=this.internal;e.showLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})},hide:function(t){const e=this.internal;e.hideLegend(e.mapToTargetIds(t)),e.updateAndRedraw({withLegend:!0})}}},pi={load:function(t){var e=this;const n=this.internal,s=n.config;t.xs&&n.addXs(t.xs),"names"in t&&this.data.names(t.names),"classes"in t&&Object.keys(t.classes).forEach(function(n){i(this,e),s.data_classes[n]=t.classes[n]}.bind(this)),"categories"in t&&n.axis.isCategorized()&&(s.axis_x_categories=t.categories),"axes"in t&&Object.keys(t.axes).forEach(function(n){i(this,e),s.data_axes[n]=t.axes[n]}.bind(this)),"colors"in t&&Object.keys(t.colors).forEach(function(n){i(this,e),s.data_colors[n]=t.colors[n]}.bind(this)),"unload"in t&&!1!==t.unload?n.unload(n.mapToTargetIds(!0===t.unload?null:t.unload),function(){var s=this;i(this,e),l(function(){return i(this,s),n.loadFromArgs(t)}.bind(this))}.bind(this)):n.loadFromArgs(t)},unload:function(t){var e=this;const n=this.internal;let s=t||{};I(s)&&this.tooltip.hide(),z(s)?s={ids:s}:A(s)&&(s={ids:[s]});const a=n.mapToTargetIds(s.ids);n.unload(a,function(){i(this,e),n.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),n.cache.remove(a),Ce.call(n,s.done,s.resizeAfter)}.bind(this))}};function xi(t,e,n){var s=this;const a=this.internal,r=a.mapToTargetIds(e),o=a.state.hiddenTargetIds.map(function(t){return i(this,s),r.indexOf(t)>-1&&t}.bind(this)).filter(Boolean);a.state.toggling=!0,a[(t?"remove":"add")+"HiddenTargetIds"](r);const c=a.$el.svg.selectAll(a.selectorTargets(r)),l=t?null:"0";t&&o.length&&(c.style("display",null),$(a.config.data_onshown,this,o)),a.$T(c).style("opacity",l,"important").call(F,function(){i(this,s),t||0!==o.length||(c.style("display","none"),$(a.config.data_onhidden,this,r)),c.style("opacity",l)}.bind(this)),n.withLegend&&a[(t?"show":"hide")+"Legend"](r),a.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0,withLegend:!0}),a.state.toggling=!1}var bi={show:function(t,e){void 0===e&&(e={}),xi.call(this,!0,t,e)},hide:function(t,e){void 0===e&&(e={}),xi.call(this,!1,t,e)},toggle:function(t,e){var n=this;void 0===e&&(e={});const s=this.internal,a={show:[],hide:[]};s.mapToTargetIds(t).forEach(function(t){return i(this,n),a[s.isTargetToShow(t)?"hide":"show"].push(t)}.bind(this)),a.show.length&&this.show(a.show,e),a.hide.length&&setTimeout(function(){return i(this,n),this.hide(a.hide,e)}.bind(this),0)}};const mi={show:function(t){var e=this;const n=this.internal,s=n.$el,a=n.config,r=n.state,o=r.eventReceiver,c=r.hasTreemap,l=r.inputType;let d,u;if(t.mouse&&(u=t.mouse),t.data){var h;const e=t.data,i=null==(h=n.getYScaleById(e.id))?void 0:h(e.value);if(c&&e.id)o.rect=s.main.select(""+n.selectorTarget(e.id,void 0,"rect"));else if(n.isMultipleX())u=[n.xx(e),i];else{var g,f;a.tooltip_grouped||(u=[0,i]),d=null!=(g=e.index)?g:n.hasArcType()&&e.id?null==(f=n.getArcElementByIdOrIndex(e.id))?void 0:f.datum().index:n.getIndexByX(e.x)}}else C(t.x)?d=n.getIndexByX(t.x):C(t.index)&&(d=t.index);("mouse"===l?["mouseover","mousemove"]:["touchstart"]).forEach(function(t){i(this,e),n.dispatchEvent(t,d,u)}.bind(this))},hide:function(){var t=this;const e=this.internal,n=e.state.inputType,s=e.$el.tooltip,a=null==s?void 0:s.datum();if(a){const s=JSON.parse(a.current)[0].index;("mouse"===n?["mouseout"]:["touchend"]).forEach(function(n){i(this,t),e.dispatchEvent(n,s)}.bind(this))}"touch"===n&&e.callOverOutForTouch(),e.hideTooltip(!0),null==e.hideGridFocus||e.hideGridFocus(),null==e.unexpandCircles||e.unexpandCircles(),null==e.expandBarTypeShapes||e.expandBarTypeShapes(!1)}};var _i={tooltip:mi};let vi=function t(e){this.plugins=[],this.internal=void 0;const n=new si(this);this.internal=n,function t(e,n,s){var a=this;Object.keys(e).forEach(function(r){i(this,a);const o=w(e[r]),c=n!==s,l=D(e[r]),d=l&&Object.keys(e[r]).length>0;n[r]=o&&(!c&&d||c)?e[r].bind(s):l&&!o?{}:e[r],d&&t(e[r],n[r],s)}.bind(this))}(t.prototype,this,this),ai.call(n,e),n.beforeInit(),n.init()};function yi(t,e,n){var s=this;const a=t.config,r=function(t,n){i(this,s);const r=S(n)?n:!1===n?void 0:null;null!==r&&(a["axis_"+t+"_"+e]=r)}.bind(this);C(n)&&(P(n)?Object.keys(n).forEach(function(t){i(this,s),r(t,n[t])}.bind(this)):(S(n)||!1===n)&&["y","y2"].forEach(function(t){i(this,s),r(t,n)}.bind(this)),t.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))}function Ti(t,e){const i=t.config;return{x:i["axis_x_"+e],y:i["axis_y_"+e],y2:i["axis_y2_"+e]}}Z(vi.prototype,[ri,{color:function(t){return this.internal.color(t)}},ci,hi,gi,fi,pi,bi,_i]);const wi={labels:function(t){var e=this;const n=this.internal;let s;return t&&(Object.keys(t).forEach(function(s){i(this,e),n.axis.setLabelText(s,t[s])}.bind(this)),n.axis.updateLabels()),["x","y","y2"].forEach(function(t){i(this,e);const a=n.axis.getLabelText(t);a&&(s||(s={}),s[t]=a)}.bind(this)),s},min:function(t){const e=this.internal;return T(t)||!1===t?yi(e,"min",t):Ti(e,"min")},max:function(t){const e=this.internal;return T(t)||!1===t?yi(e,"max",t):Ti(e,"max")},range:function(t){const e=this.axis;if(!arguments.length)return{max:e.max(),min:e.min()};{const i=t.min,n=t.max;C(n)&&e.max(n),C(i)&&e.min(i)}}};var Ai={axis:wi},Si={category:function(t,e){const i=this.internal,n=i.config;return arguments.length>1&&(n.axis_x_categories[t]=e,i.redraw()),n.axis_x_categories[t]},categories:function(t){const e=this.internal,i=e.config;if(!t||!Array.isArray(t)){const t=i.axis_x_categories;return I(t)?Object.values(e.data.xs)[0]:t}return i.axis_x_categories=t,e.redraw(),i.axis_x_categories}};function ki(t,e){const i=this.internal,n=i.config,s=n.transition_duration&&ct(),a="grid_"+e+"_lines";return t?(n[a]=t,i.updateGrid(),i.redrawGrid(s),n[a]):n[a]}function Ci(t,e){return ki.bind(this)(this.internal.config["grid_"+e+"_lines"].concat(t||[]),e)}function Ri(t,e){this.internal.removeGridLines(t,e)}const Ei=function(t){return ki.bind(this)(t,"x")};Z(Ei,{add:function(t){return Ci.bind(this)(t,"x")},remove:function(t){return Ri.bind(this)(t,!0)}});const Oi=function(t){return ki.bind(this)(t,"y")};Z(Oi,{add:function(t){return Ci.bind(this)(t,"y")},remove:function(t){return Ri.bind(this)(t,!1)}});var Li={xgrids:Ei,ygrids:Oi},Pi={groups:function(t){const e=this.internal,i=e.config;return k(t)||(i.data_groups=t,e.redraw()),i.data_groups}};function Ii(t,e){void 0===e&&(e=!1);const i=this.internal,n=i.config,s=n.transition_duration&&ct();return t?(n.regions=e?n.regions.concat(t):t,i.updateRegion(),i.redrawRegion(s),e?n.regions:t):n.regions}const Di=function(t){return Ii.bind(this)(t)};Z(Di,{add:function(t){return Ii.bind(this)(t,!0)},remove:function(t){var e=this;const n=this.internal,s=n.config,a=n.$T,r=t||{},o=X(r,"classes",[Lt.region]);let c=n.$el.main.select("."+Lt.regions).selectAll(o.map(function(t){return i(this,e),"."+t}.bind(this)));return a(c).style("opacity","0").remove(),c=s.regions,Object.keys(r).length?(c=c.filter(function(t){var n=this;i(this,e);let s=!1;return!t.class||(t.class.split(" ").forEach(function(t){i(this,n),o.indexOf(t)>=0&&(s=!0)}.bind(this)),!s)}.bind(this)),s.regions=c):s.regions=[],c}});var zi={regions:Di},Mi={x:function(t){const e=this.internal,i=e.axis,n=e.data,s=i.isCustomX()&&i.isCategorized();return z(t)&&(s?this.categories(t):(e.updateTargetX(n.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0}))),s?this.categories():n.xs},xs:function(t){const e=this.internal;return M(t)&&(e.updateTargetXs(e.data.targets,t),e.redraw({withUpdateOrgXDomain:!0,withUpdateXDomain:!0})),e.data.xs}},Xi={flow:function(t){var e=this;const n=this.internal;let s;(t.json||t.rows||t.columns)&&n.convertData(t,function(a){i(this,e),s=a,function(){var e=this;let a,r,o,c=0,l=0;if(n.state.redrawing||!s||!ct())return;const d=[],u=n.getMaxDataCount(),h=n.convertDataToTargets(s,!0),g=n.axis.isTimeSeries();n.data.targets.forEach(function(t){i(this,e);let n=!1;for(let e=0;e1?f.values[f.values.length-1].x-p.x:p.x-n.getXDomain(n.data.targets)[0]:1,a=[p.x-r,p.x]);a&&n.updateXDomain(null,!0,!0,!1,a),n.updateTargets(n.data.targets),n.redraw({flow:{index:p.index,length:c,duration:T(t.duration)?t.duration:n.config.transition_duration,done:t.done,orgDataCount:u},withLegend:!0,withTransition:u>1,withTrimXDomain:!1,withUpdateXAxis:!0})}()}.bind(this))}},$i=p(10);let Fi=function(){function t(t){this.owner=void 0,this.config=void 0,this.scale=void 0;const e=Ge(),i=t.config,n=t.params;this.owner=t,this.config=i,this.scale=e,!i.noTransition&&n.config.transition_duration||(i.withoutTransition=!0),i.range=this.scaleExtent((n.orgXScale||e).range())}t.getSizeFor1Char=function(t){var e=this;const n={w:5.5,h:11.5};return t.empty()||t.select("text").text("0").call(function(t){i(this,e);try{const e=t.node().getBBox(),i=e.width,s=e.height;i&&s&&(n.w=i,n.h=s)}catch(t){}finally{t.text("")}}.bind(this)),this.getSizeFor1Char=function(){return i(this,e),n}.bind(this),n};var e=t.prototype;return e.getTickTransformSetter=function(t){var e=this;const n=this.config,s="x"===t?function(t){return i(this,e),"translate("+(t+n.tickOffset)+",0)"}.bind(this):function(t){return i(this,e),"translate(0,"+t+")"}.bind(this);return function(t,n){var a=this;i(this,e),t.attr("transform",function(t){return i(this,a),T(t)?s(Math.ceil(n(t))):null}.bind(this))}.bind(this)},e.scaleExtent=function(t){const e=t[0],i=t[t.length-1];return e0?r:1,o]).range(t.range());c=e.ticks();for(let t=o.toFixed().length;c.length>15;t--)c=e.ticks(t);c.splice(0,1,r),c.splice(c.length-1,1,o)}c=c.map(function(t){i(this,n);return A(t)&&S(t)&&!isNaN(t)&&Math.round(10*t)/10||t}.bind(this))}return c},e.copyScale=function(){const t=this.scale.copy();return t.domain().length||t.domain(this.scale.domain()),t.type=this.scale.type,t},e.textFormatted=function(t){const e=this.config.tickFormat,i=/\d+\.\d+0{5,}\d$/.test(t)?+(t+"").replace(/0+\d$/,""):t,n=e?e(i):i;return C(n)?n:""},e.transitionise=function(t){const e=this.config;let i=t;if(e.withoutTransition)i=t.interrupt();else if(e.transition||!this.owner.params.noTransition)try{i=t.transition(e.transition)}catch(t){}return i},t}(),Bi=function(){function t(t){void 0===t&&(t={}),this.helper=void 0,this.config=void 0,this.params=void 0,this.g=void 0,this.generatedTicks=void 0;const e={innerTickSize:6,outerTickSize:t.outerTick?6:0,orient:"bottom",range:[],tickArguments:null,tickCentered:null,tickCulling:!0,tickFormat:null,tickLength:9,tickOffset:0,tickPadding:3,tickValues:null,transition:null,noTransition:t.noTransition};e.tickLength=Math.max(e.innerTickSize,0)+e.tickPadding,this.config=e,this.params=t,this.helper=new Fi(this)}var e=t.prototype;return e.create=function(t){const e=this,n=e.config,a=e.helper,r=e.params,o=a.scale,c=n.orient,l=this.splitTickText.bind(e),d=/^(left|right)$/.test(c),u=/^(top|bottom)$/.test(c),h=a.getTickTransformSetter(u?"x":"y"),g=h===a.axisX?"y":"x",f=/^(top|left)$/.test(c)?-1:1,p=r.tickTextRotate;this.config.range=o.rangeExtent?o.rangeExtent():a.scaleExtent((r.orgXScale||o).range());const x=n.innerTickSize,b=n.tickLength,m=n.range,_=r.id,v=_&&/^(x|y|y2)$/.test(_)?r.config["axis_"+_+"_tick_text_position"]:{x:0,y:0},y="subX"===_?"subchart_axis_x":"axis_"+_,T=r.config[y+"_show"],w=!!T&&r.config[y+"_tick_show"],A=!!T&&r.config[y+"_tick_text_show"];let k;t.each((function(){var t=this;const _=(0,s.select)(this);let y=this.__chart__||o,T=a.copyScale();k=_,this.__chart__=T,n.tickOffset=r.isCategory?Math.ceil((T(1)-T(0))/2):0;const C=_.selectAll(".domain").data([0]);if(C.enter().append("path").attr("class","domain").merge(C).attr("d",function(){i(this,t);const e=n.outerTickSize*f;return u?"M"+m[0]+","+e+"V0H"+m[1]+"V"+e:"M"+e+","+m[0]+"H0V"+m[1]+"H"+e}.bind(this)),w||A){const s=n.tickValues||a.generateTicks(T,d);e.generatedTicks=s;let o=_.selectAll(".tick").data(s,T);const m=o.enter().insert("g",".domain").attr("class","tick"),k=o.exit().remove();o=m.merge(o),w&&m.append("line"),A&&m.append("text");const C=Fi.getSizeFor1Char(o),R=[];let E=o.select("text").selectAll("tspan").data(function(e,n){var o=this;i(this,t);const c=r.tickMultiline?l(e,T,s,d,C.w):z(a.textFormatted(e))?a.textFormatted(e).concat():[a.textFormatted(e)];return R[n]=c.length,c.map(function(t){return i(this,o),{index:n,splitted:t}}.bind(this))}.bind(this));E.exit().remove(),E=E.enter().append("tspan").merge(E).text(function(e){return i(this,t),e.splitted}.bind(this)),E.attr("x",u?0:b*f).attr("dx",function(){i(this,t);let e=0;return/(top|bottom)/.test(c)&&p&&(e=8*Math.sin(Math.PI*(p/180))*("top"===c?-1:1)),e+(v.x||0)}.bind(this)()).attr("dy",function(e,n){i(this,t);let s=0;return"top"!==c&&(s=C.h,0===n&&(s=d?-((R[e.index]-1)*(C.h/2)-3):0===v.y?".71em":0)),S(s)&&v.y?s+v.y:s||".71em"}.bind(this));const O=o.select("line"),L=o.select("text");if(m.select("line").attr(g+"2",x*f),m.select("text").attr(g,b*f),e.setTickLineTextPosition(O,L),r.tickTitle){const e=L.select("title");(e.empty()?L.append("title"):e).text(function(e){return i(this,t),r.tickTitle[e]}.bind(this))}if(T.bandwidth){const e=T,n=e.bandwidth()/2;y=function(s){return i(this,t),e(s)+n}.bind(this),T=y}else y.bandwidth?y=T:h(k,T);o=r.owner.state.flowing?a.transitionise(o):r.owner.$T(o),h(m,y),h(o.style("opacity",null),T)}})),this.g=k},e.getGeneratedTicks=function(t){var e,n=this;const s=(null==(e=this.generatedTicks)?void 0:e.length)-1;let a=this.generatedTicks;if(s>t){const e=Math.round(s/t+.1);a=this.generatedTicks.map(function(t,s){return i(this,n),s%e==0?t:null}.bind(this)).filter(function(t){return i(this,n),null!==t}.bind(this)).splice(0,t)}return a},e.getTickXY=function(){const t=this.config,e={x:0,y:0};return this.params.isCategory&&(e.x=t.tickCentered?0:t.tickOffset,e.y=t.tickCentered?t.tickOffset:0),e},e.getTickSize=function(t){const e=this.helper.scale,i=this.config,n=i,s=n.innerTickSize,a=n.range,r=e(t)+(i.tickCentered?0:i.tickOffset);return a[0]0?0:1]:"middle"}.bind(this),h=function(t){return i(this,n),t?"rotate("+t+")":null}.bind(this),g=function(t){i(this,n);return t?11.5-2.5*(t/("bottom"===o?15:23))*(t>0?1:-1):c}.bind(this);switch(o){case"bottom":t.attr("x1",s.x).attr("x2",s.x).attr("y2",this.getTickSize.bind(this)),e.attr("x",0).attr("y",g(d)).style("text-anchor",u(d)).attr("transform",h(d));break;case"top":t.attr("x2",0).attr("y2",-r),e.attr("x",0).attr("y",2*-g(d)).style("text-anchor",u(d)).attr("transform",h(d));break;case"left":t.attr("x2",-r).attr("y1",s.y).attr("y2",s.y),e.attr("x",-c).attr("y",l).style("text-anchor","end");break;case"right":t.attr("x2",r).attr("y2",0),e.attr("x",c).attr("y",0).style("text-anchor","start")}},e.splitTickText=function(t,e,i,n,s){const a=this.params,r=this.helper.textFormatted(t),o=A(r)&&r.indexOf("\n")>-1?r.split("\n"):[];if(o.length)return o;if(z(r))return r;let c=a.tickWidth;return(!c||c<=0)&&(c=n?95:a.isCategory?Math.ceil(a.isInverted?e(i[0])-e(i[1]):e(i[1])-e(i[0]))-12:110),function t(e,i){let n,a,r;for(let o=1;o=0||i.hasRadar},e.isCustomX=function(){const t=this.owner.config;return!this.isTimeSeries()&&(t.data_x||D(t.data_xs))},e.isTimeSeries=function(t){return void 0===t&&(t="x"),"timeseries"===this.owner.config["axis_"+t+"_type"]},e.isLog=function(t){return void 0===t&&(t="x"),"log"===this.owner.config["axis_"+t+"_type"]},e.isTimeSeriesY=function(){return this.isTimeSeries("y")},e.getAxisType=function(t){void 0===t&&(t="x");let e="linear";return this.isTimeSeries(t)?e=this.owner.config.axis_x_localtime?"time":"utc":this.isLog(t)&&(e="log"),e},e.init=function(){var t=this;const e=this.owner,n=e.config,s=e.$el,a=s.main,r=s.axis,o=e.state.clip,c=n.axis_rotated,l=["x","y"];n.axis_y2_show&&l.push("y2"),l.forEach(function(s){var l=this;i(this,t);const d=this.getAxisClassName(s),u=xt["axis"+s.toUpperCase()+"Label"];r[s]=a.append("g").attr("class",d).attr("clip-path",function(){i(this,l);let t=null;return"x"===s?t=o.pathXAxis:"y"===s&&(t=o.pathYAxis),t}.bind(this)).attr("transform",e.getTranslate(s)).style("visibility",n["axis_"+s+"_show"]?null:"hidden"),r[s].append("text").attr("class",u).attr("transform",["rotate(-90)",null]["x"===s?+!c:+c]).style("text-anchor",function(){return i(this,l),this.textAnchorForAxisLabel(s)}.bind(this)),this.generateAxes(s)}.bind(this))},e.setOrient=function(){const t=this.owner.config,e=t.axis_rotated,i=t.axis_y_inner,n=t.axis_y2_inner;this.orient={x:e?"left":"bottom",y:e?i?"top":"bottom":i?"right":"left",y2:e?n?"bottom":"top":n?"left":"right",subX:e?"left":"bottom"}},e.generateAxes=function(t){var e=this;const n=this.owner,s=n.config,a=[],r=s["axis_"+t+"_axes"],o=s.axis_rotated;let c;"x"===t?c=o?$i.axisLeft:$i.axisBottom:"y"===t?c=o?$i.axisBottom:$i.axisLeft:"y2"===t&&(c=o?$i.axisTop:$i.axisRight),r.length&&r.forEach(function(s){var r=this;i(this,e);const o=s.tick||{},l=n.scale[t].copy();s.domain&&l.domain(s.domain),a.push(c(l).ticks(o.count).tickFormat(w(o.format)?o.format.bind(n.api):function(t){return i(this,r),t}.bind(this)).tickValues(o.values).tickSizeOuter(!1===o.outer?0:6))}.bind(this)),this.axesList[t]=a},e.updateAxes=function(){var t=this;const e=this.owner,n=e.config,s=e.$el.main,a=e.$T;Object.keys(this.axesList).forEach(function(r){var o=this;i(this,t);const c=n["axis_"+r+"_axes"],l=e.scale[r].copy(),d=l.range();this.axesList[r].forEach(function(t,u){var h=this;i(this,o);const g=t.scale().range();d.every(function(t,e){return i(this,h),t===g[e]}.bind(this))||t.scale().range(d);const f=this.getAxisClassName(r)+"-"+(u+1);let p=s.select("."+f.replace(/\s/,"."));p.empty()?p=s.append("g").attr("class",f).style("visibility",n["axis_"+r+"_show"]?null:"hidden").call(t):(c[u].domain&&l.domain(c[u].domain),a(p).call(t.scale(l))),p.attr("transform",e.getTranslate(r,u+1))}.bind(this))}.bind(this))},e.setAxis=function(t,e,i,n){const s=this.owner;"subX"!==t&&(this.tick[t]=this.getTickValues(t)),this[t]=this.getAxis(t,e,i,!("x"!==t||!(s.scale.zoom||s.config.subchart_show||s.state.resizing))||n)},e.getAxis=function(t,e,n,s,a){var r=this;const o=this.owner,c=o.config,l=/^(x|subX)$/.test(t),d=l?"x":t,u=l&&this.isCategorized(),h=this.orient[t],g=a?0:o.getAxisTickRotate(d);let f;if(l)f="subX"===t?o.format.subXAxisTick:o.format.xAxisTick;else{const e=c["axis_"+t+"_tick_format"];w(e)&&(f=e.bind(o.api))}let p=this.tick[d];const x=et({outerTick:n,noTransition:s,config:c,id:t,tickTextRotate:g,owner:o},l&&{isCategory:u,isInverted:c.axis_x_inverted,tickMultiline:c.axis_x_tick_multiline,tickWidth:c.axis_x_tick_width,tickTitle:u&&c.axis_x_tick_tooltip&&o.api.categories(),orgXScale:o.scale.x});l||(x.tickStepSize=c["axis_"+d+"_tick_stepSize"]);const b=new Bi(x).scale(l&&o.scale.zoom||e).orient(h);if(l&&this.isTimeSeries()&&p&&!w(p)){const t=ot.bind(o);p=p.map(function(e){return i(this,r),t(e)}.bind(this))}else!l&&this.isTimeSeriesY()&&(b.ticks(c.axis_y_tick_time_value),p=null);p&&b.tickValues(p),b.tickFormat(f||!l&&o.isStackNormalized()&&function(t){return i(this,r),t+"%"}.bind(this)),u&&(b.tickCentered(c.axis_x_tick_centered),I(c.axis_x_tick_culling)&&(c.axis_x_tick_culling=!1));const m=c["axis_"+d+"_tick_count"];return m&&b.ticks(m),b},e.updateXAxisTickValues=function(t,e){const i=this.owner,n=i.config,s=n.axis_x_tick_fit;let a,r=n.axis_x_tick_count;if((s||r&&s)&&(a=i.mapTargetsToUniqueXs(t),this.isCategorized()&&r>a.length&&(r=a.length),a=this.generateTickValues(a,r,this.isTimeSeries())),e)e.tickValues(a);else if(this.x){var o;this.x.tickValues(a),null==(o=this.subX)||o.tickValues(a)}return a},e.getId=function(t){const e=this.owner,i=e.config,n=e.scale;let s=i.data_axes[t];return s&&n[s]||(s="y"),s},e.getXAxisTickFormat=function(t){var e=this;const n=this.owner,s=n.config,a=n.format,r=t&&s.subchart_axis_x_tick_format||s.axis_x_tick_format,o=this.isTimeSeries(),c=this.isCategorized();let l;return r?w(r)?l=r.bind(n.api):o&&(l=function(t){return i(this,e),t?a.axisTime(r)(t):""}.bind(this)):l=o?a.defaultAxisTime:c?n.categoryName:function(t){return i(this,e),t<0?t.toFixed(0):t}.bind(this),w(l)?function(t){return i(this,e),l.apply(n,c?[t,n.categoryName(t)]:[t])}.bind(this):l},e.getTickValues=function(t){const e=this.owner,i=e.config["axis_"+t+"_tick_values"],n=e[t+"Axis"];return(w(i)?i.call(e.api):i)||(n?n.tickValues():void 0)},e.getLabelOptionByAxisId=function(t){return this.owner.config["axis_"+t+"_label"]},e.getLabelText=function(t){const e=this.getLabelOptionByAxisId(t);return A(e)?e:e?e.text:null},e.setLabelText=function(t,e){const i=this.owner.config,n=this.getLabelOptionByAxisId(t);A(n)?i["axis_"+t+"_label"]=e:n&&(n.text=e)},e.getLabelPosition=function(t,e){var n=this;const s=this.owner.config.axis_rotated,a=this.getLabelOptionByAxisId(t),r=P(a)&&a.position?a.position:e[+!s],o=function(t){return i(this,n),!!~r.indexOf(t)}.bind(this);return{isInner:o("inner"),isOuter:o("outer"),isLeft:o("left"),isCenter:o("center"),isRight:o("right"),isTop:o("top"),isMiddle:o("middle"),isBottom:o("bottom")}},e.getAxisLabelPosition=function(t){return this.getLabelPosition(t,"x"===t?["inner-top","inner-right"]:["inner-right","inner-top"])},e.getLabelPositionById=function(t){return this.getAxisLabelPosition(t)},e.xForAxisLabel=function(t){const e=this.owner,i=e.state,n=i.width,s=i.height,a=this.getAxisLabelPosition(t);let r=a.isMiddle?-s/2:0;return this.isHorizontal(e,"x"!==t)?r=a.isLeft?0:a.isCenter?n/2:n:a.isBottom&&(r=-s),r},e.dxForAxisLabel=function(t){const e=this.owner,i=this.getAxisLabelPosition(t);let n=i.isBottom?"0.5em":"0";return this.isHorizontal(e,"x"!==t)?n=i.isLeft?"0.5em":i.isRight?"-0.5em":"0":i.isTop&&(n="-0.5em"),n},e.textAnchorForAxisLabel=function(t){const e=this.owner,i=this.getAxisLabelPosition(t);let n=i.isMiddle?"middle":"end";return this.isHorizontal(e,"x"!==t)?n=i.isLeft?"start":i.isCenter?"middle":"end":i.isBottom&&(n="start"),n},e.dyForAxisLabel=function(t){const e=this.owner,i=e.config,n=i.axis_rotated,s=this.getAxisLabelPosition(t).isInner,a=i["axis_"+t+"_tick_rotate"]?e.getHorizontalAxisHeight(t):0,r=this.getMaxTickSize(t).width;let o;if("x"===t){const t=i.axis_x_height;o=n?s?"1.2em":-25-r:s?"-0.5em":t?t-10:a?a-10:"3em"}else o={y:["-0.5em",10,"3em","1.2em",10],y2:["1.2em",-20,"-2.2em","-0.5em",15]}[t],o=n?s?o[0]:a?a*("y2"===t?-1:1)-o[1]:o[2]:s?o[3]:(o[4]+(i["axis_"+t+"_inner"]?0:r+o[4]))*("y"===t?-1:1);return o},e.getMaxTickSize=function(t,e){var n=this;const s=this.owner,a=s.config,r=s.state.current,o=s.$el,c=o.svg,l=o.chart,d=r.maxTickSize[t],u="axis_"+t,h={width:0,height:0};if(e||!a[u+"_show"]||d.width>0&&0===s.filterTargetsToShow().length)return d;if(c){const e=/^y2?$/.test(t),r=s.filterTargetsToShow(s.data.targets),o=s.scale[t].copy().domain(s["get"+(e?"Y":"X")+"Domain"](r,t)),c=o.domain(),g=c[0]===c[1]&&c.every(function(t){return i(this,n),t>0}.bind(this)),f=z(d.domain)&&d.domain[0]===d.domain[1]&&d.domain.every(function(t){return i(this,n),t>0}.bind(this));if(g||f)return d.size;d.domain=c,e||d.ticks.splice(0);const p=this.getAxis(t,o,!1,!1,!0),x=a[u+"_tick_rotate"],b=a[u+"_tick_count"];!a[u+"_tick_values"]&&b&&p.tickValues(this.generateTickValues(c,b,e?this.isTimeSeriesY():this.isTimeSeries())),e||this.updateXAxisTickValues(r,p);const m=l.append("svg").style("visibility","hidden").style("position","fixed").style("top","0").style("left","0");p.create(m),m.selectAll("text").attr("transform",S(x)?"rotate("+x+")":null).each((function(t,i){const n=this.getBoundingClientRect(),s=n.width,a=n.height;h.width=Math.max(h.width,s),h.height=Math.max(h.height,a),e||(d.ticks[i]=s)})),m.remove()}return Object.keys(h).forEach(function(t){i(this,n),h[t]>0&&(d[t]=h[t])}.bind(this)),d},e.getXAxisTickTextY2Overflow=function(t){const e=this.owner,i=e.axis,n=e.config,s=e.state,a=e.getAxisTickRotate("x");if((i.isCategorized()||i.isTimeSeries())&&n.axis_x_tick_fit&&(!n.axis_x_tick_culling||I(n.axis_x_tick_culling))&&!n.axis_x_tick_multiline&&a>0&&a<90){const i=s.current.width-e.getCurrentPaddingByDirection("left"),n=this.getXAxisTickMaxOverflow(a,i-t),r=Math.max(0,n)+t;return Math.min(r,i/2)}return 0},e.getXAxisTickMaxOverflow=function(t,e){const i=this.owner,n=i.axis,s=i.config,a=i.state,r=n.isTimeSeries(),o=a.current.maxTickSize.x.ticks,c=o.length,l=a.axis.x.padding,d=l.left,u=l.right;let h=0;const g=c-(r&&s.axis_x_tick_fit?.5:0);for(let i=0;i2){const e=this.isCategorized(),s=i-2,r=t[0],o=t[t.length-1];let c;a=[r];for(let t=0;t=h)&&(g=!0,e.preventDefault())}.bind(this);r.on("touchstart",function(n){i(this,t),s.event=n,e.updateEventRect()}.bind(this)).on("touchstart.eventRect touchmove.eventRect",function(n){if(i(this,t),s.event=n,!r.empty()&&r.classed(St.eventRect)){if(s.dragging||s.flowing||e.hasArcType()||n.touches.length>1)return;f(n),c(r.node())}else l()}.bind(this),!0).on("touchend.eventRect",function(n){i(this,t),s.event=n,!r.empty()&&r.classed(St.eventRect)&&(e.hasArcType()||!e.toggleShape||s.cancelClick)&&s.cancelClick&&(s.cancelClick=!1)}.bind(this),!0),o.on("touchstart",function(e){i(this,t),s.event=e;const n=e.target;n&&n!==r.node()&&l()}.bind(this))},updateEventRect:function(t,e){var n=this;void 0===e&&(e=!1);const s=this.state,a=this.$el,r=s,o=r.eventReceiver,c=r.width,l=r.height,d=r.rendered,u=r.resizing,h=t||a.eventRect,g=function(){i(this,n),o&&(o.rect=h.node().getBoundingClientRect())}.bind(this);(!d||u||e)&&(h.attr("x",0).attr("y",0).attr("width",c).attr("height",l),d&&!e||h.classed(St.eventRect,!0)),g()},updateEventRectData:function(){var t=this;const e=this,n=e.config,s=e.scale,a=e.state,r=s.zoom||s.x,o=n.axis_rotated;let c,l,d,u;if(e.isMultipleX())c=0,l=0,d=a.width,u=a.height;else{let n,s;if(e.axis.isCategorized())n=e.getEventRectWidth(),s=function(e){return i(this,t),r(e.x)-n/2}.bind(this);else{const c=function(n){let s=n.index;return i(this,t),{prev:e.getPrevX(s),next:e.getNextX(s)}}.bind(this);n=function(e){var n=this;i(this,t);const s=c(e),l=r.domain();let d;return null===s.prev&&null===s.next?d=o?a.height:a.width:null===s.prev?d=(r(s.next)+r(e.x))/2:null===s.next?d=r(l[1])-(r(s.prev)+r(e.x))/2:(Object.keys(s).forEach(function(t,e){var a;i(this,n),s[t]=null!=(a=s[t])?a:l[e]}.bind(this)),d=Math.max(0,(r(s.next)-r(s.prev))/2)),d}.bind(this),s=function(e){i(this,t);const n=c(e);let s;return s=null===n.prev&&null===n.next?0:null===n.prev?r(r.domain()[0]):(r(e.x)+r(n.prev))/2,s}.bind(this)}c=o?0:s,l=o?s:0,d=o?a.width:n,u=o?n:a.height}const h=a.eventReceiver,g=function(e,n){return i(this,t),w(e)?e(n):e}.bind(this);h.coords.splice(h.data.length),h.data.forEach(function(e,n){i(this,t),h.coords[n]={x:g(c,e),y:g(l,e),w:g(d,e),h:g(u,e)}}.bind(this))},selectRectForSingle:function(t,e){var n=this;const s=this,a=s.config,r=s.$el,o=r.main,c=r.circle,l=a.data_selection_enabled,d=a.data_selection_grouped,u=a.data_selection_isselectable,h=a.tooltip_grouped,g=s.getAllValuesOnIndex(e);if(h&&(s.showTooltip(g,t),null==s.showGridFocus||s.showGridFocus(g),!l||d))return;c||o.selectAll("."+gt.EXPANDED+":not(."+It.shape+"-"+e+")").classed(gt.EXPANDED,!1);const f=o.selectAll("."+It.shape+"-"+e).classed(gt.EXPANDED,!0).style("cursor",u?"pointer":null).filter((function(t){return s.isWithinShape(this,t)}));f.empty()&&!h&&(null==s.hideGridFocus||s.hideGridFocus(),s.hideTooltip(),d||s.setExpand(e)),f.call(function(a){var r=this;i(this,n);const o=a.data();l&&(d||null!=u&&u.bind(s.api)(o))&&(t.style.cursor="pointer"),h||(s.showTooltip(o,t),null==s.showGridFocus||s.showGridFocus(o),null==s.unexpandCircles||s.unexpandCircles(),a.each(function(t){return i(this,r),s.setExpand(e,t.id)}.bind(this)))}.bind(this))},selectRectForMultipleXs:function(t,e){var n=this;void 0===e&&(e=!0);const s=this,a=s.config,r=s.state,o=s.filterTargetsToShow(s.data.targets);if(r.dragging||s.hasArcType(o))return;const c=G(r.event,t),l=s.findClosestFromTargets(o,c);if(!e||!r.mouseover||l&&l.id===r.mouseover.id||(a.data_onout.call(s.api,r.mouseover),r.mouseover=void 0),!l)return void s.unselectRect();const d=(s.isBubbleType(l)||s.isScatterType(l)||!a.tooltip_grouped?[l]:s.filterByX(o,l.x)).map(function(t){return i(this,n),s.addName(t)}.bind(this));s.showTooltip(d,t),s.setExpand(l.index,l.id,!0),s.showGridFocus(d);const u=s.dist(l,c);(s.isBarType(l.id)||u-1?r.data[s]:null}.bind(this);o.on("mouseover",function(t){i(this,e),a.event=t,n.updateEventRect()}.bind(this)).on("mousemove",(function(e){const i=t(e);if(a.event=e,!i)return;let o=i.index;const c=s.line_step_type;if(s.line_step_tooltipMatch&&n.hasType("step")&&/^step\-(before|after)$/.test(c)){const t=n.scale.zoom||n.scale.x,i=n.axis.xs[o],s=t.invert(G(e,this)[0]);"step-after"===c&&si&&(o+=1)}const l=s.tooltip_grouped&&o===r.currentIdx;a.dragging||a.flowing||n.hasArcType()||l?s.tooltip_show&&l&&n.setTooltipPosition():(o!==r.currentIdx&&(n.setOverOut(!1,r.currentIdx),r.currentIdx=o),-1===o?n.unselectRect():n.selectRectForSingle(this,o),n.setOverOut(-1!==o,o))})).on("mouseout",function(t){i(this,e),a.event=t,s&&!n.hasArcType()&&-1!==r.currentIdx&&(n.unselectRect(),n.setOverOut(!1,r.currentIdx),r.currentIdx=-1)}.bind(this))}return o},clickHandlerForSingleX:function(t,e){const i=e,n=i.config,s=i.state,a=i.$el.main;if(!t||i.hasArcType()||s.cancelClick)return void(s.cancelClick&&(s.cancelClick=!1));const r=t.index;a.selectAll("."+It.shape+"-"+r).each((function(t){(n.data_selection_grouped||i.isWithinShape(this,t))&&(null==i.toggleShape||i.toggleShape(this,t,r),n.data_onclick.bind(i.api)(t,this))}))},generateEventRectsForMultipleXs:function(t){var e=this;const n=this,s=n.state;t.on("click",(function(t){s.event=t,n.clickHandlerForMultipleXS.bind(this)(n)})),"mouse"===s.inputType&&t.on("mouseover mousemove",(function(t){s.event=t,n.selectRectForMultipleXs(this)})).on("mouseout",function(t){i(this,e),s.event=t,n.config&&!n.hasArcType()&&n.unselectRect()}.bind(this))},clickHandlerForMultipleXS:function(t){const e=t,i=e.config,n=e.state,s=e.filterTargetsToShow(e.data.targets);if(e.hasArcType(s))return;const a=G(n.event,this),r=e.findClosestFromTargets(s,a),o="radius"===i.point_sensitivity?r.r:i.point_sensitivity;r&&(e.isBarType(r.id)||e.dist(r,a)1&&(s=s[n[1]]),null!=(e=s)&&e.size()&&(c[t]=s)}.bind(this)),e.hideGridFocus(),e.setFlowList(c,t)}},setFlowList:function(t,e){var n=this;const s=this,a=e.flow,r=e.targets,o=a,c=o.duration,l=void 0===c?e.duration:c,d=o.index,u=o.length,h=o.orgDataCount,g=s.getFlowTransform(r,h,d,u),f=fe();let p;f.add(Object.keys(t).map(function(e){var a=this;return i(this,n),p=t[e].transition().ease(Vi.easeLinear).duration(l),p="axis.x"===e?p.call(function(t){i(this,a),s.axis.x.setTransition(t).create(t)}.bind(this)):"region.list"===e?p.filter(s.isRegionOnX).attr("transform",g):p.attr("transform",g),p}.bind(this))),p.call(f,function(){i(this,n),s.cleanUpFlow(t,e)}.bind(this))},cleanUpFlow:function(t,e){var n=this;const s=this,a=s.config,r=s.state,o=s.$el.svg,c=a.axis_rotated,l=e.flow,d=e.shape,u=e.xv,h=d.pos,g=h.cx,f=h.cy,p=h.xForText,x=h.yForText,b=l,m=b.done,_=void 0===m?function(){i(this,n)}.bind(this):m,v=b.length;v&&(["circle","text","shape","eventRect"].forEach(function(t){i(this,n);const e=[];for(let i=0;i=0?"":r.URL.split("#")[0])+"#"+t+")"},appendClip:function(t,e){e&&t.append("clipPath").attr("id",e).append("rect")},setXAxisClipPath:function(t){const e=this.config,i=this.state,n=i.margin,s=i.width,a=i.height,r=e.axis_rotated,o=Math.max(30,n.left)-(r?0:20),c=(r?n.top+a+10:n.bottom)+20,l=r?-(1+o):-(o-1),d=r?n.left+20:s+10+o;t.attr("x",l).attr("y",-15).attr("width",d).attr("height",c)},setYAxisClipPath:function(t){const e=this.config,i=this.state,n=i.margin,s=i.width,a=i.height,r=e.axis_rotated,o=Math.max(30,n.left)-(r?20:0),c=e.axis_y_inner,l=c&&!r?e.axis_y_label.text?-20:-1:r?-(1+o):-(o-1),d=-(r?20:n.top),u=(r?s+15+o:n.left+20)+(c?20:0),h=(r?n.bottom+10:n.top+a)+10;t.attr("x",l).attr("y",d).attr("width",u).attr("height",h)},updateXAxisTickClip:function(){const t=this,e=t.config,i=t.state,n=i.clip,s=i.xAxisHeight,a=t.$el.defs,r=t.getHorizontalAxisHeight("x");if(a&&!n.idXAxisTickTexts){const e=n.id+"-xaxisticktexts";t.appendClip(a,e),n.pathXAxisTickTexts=t.getClipPath(n.idXAxisTickTexts),n.idXAxisTickTexts=e}!e.axis_x_tick_multiline&&t.getAxisTickRotate("x")&&r!==s&&(t.setXAxisTickClipWidth(),t.setXAxisTickTextClipPathWidth()),t.state.xAxisHeight=r},setXAxisTickClipWidth:function(){const t=this,e=t.config,i=t.state.current.maxTickSize,n=t.getAxisTickRotate("x");if(!e.axis_x_tick_multiline&&n){const e=Math.sin(Math.PI/180*Math.abs(n));i.x.clipPath=(t.getHorizontalAxisHeight("x")-20)/e}else i.x.clipPath=null},setXAxisTickTextClipPathWidth:function(){const t=this.state,e=t.clip,i=t.current,n=this.$el.svg;n&&n.select("#"+e.idXAxisTickTexts+" rect").attr("width",i.maxTickSize.x.clipPath).attr("height",30)}},Ui=void 0;const Wi=function(t){return i(this,Ui),T(t.position)||"end"}.bind(void 0),Zi=function(t){return i(this,Ui),"start"===t.position?4:"middle"===t.position?0:-4}.bind(void 0);function qi(t,e,n){var s=this;return function(a){i(this,s);let r=t?0:e;return"start"===a.position?r=t?-n:0:"middle"===a.position&&(r=(t?-n:e)/2),r}.bind(this)}function Ki(t,e){"grid"===e&&t.each((function(){var t=this;const e=(0,s.select)(this);["x1","x2","y1","y2"].forEach(function(n){return i(this,t),e.attr(n,Math.ceil(+e.attr(n)))}.bind(this))}))}var Ji={hasGrid:function(){var t=this;const e=this.config;return["x","y"].some(function(n){return i(this,t),e["grid_"+n+"_show"]||e["grid_"+n+"_lines"].length}.bind(this))},initGrid:function(){const t=this;t.hasGrid()&&t.initGridLines(),t.initFocusGrid()},initGridLines:function(){const t=this,e=t.config,i=t.state.clip,n=t.$el;(e.grid_x_lines.length||e.grid_y_lines.length)&&(n.gridLines.main=n.main.insert("g","."+gt.chart+(e.grid_lines_front?" + *":"")).attr("clip-path",i.pathGrid).attr("class",Ct.grid+" "+Ct.gridLines),n.gridLines.main.append("g").attr("class",Ct.xgridLines),n.gridLines.main.append("g").attr("class",Ct.ygridLines),n.gridLines.x=(0,s.selectAll)([]))},updateXGrid:function(t){var e=this;const n=this,a=n.config,r=n.scale,o=n.state,c=n.$el,l=c.main,d=c.grid,u=a.axis_rotated,h=n.generateGridData(a.grid_x_type,r.x),g=n.axis.isCategorized()?n.axis.x.tickOffset():0,f=function(t){return i(this,e),(r.zoom||r.x)(t)+g*(u?-1:1)}.bind(this);o.xgridAttr=u?{x1:0,x2:o.width,y1:f,y2:f}:{x1:f,x2:f,y1:0,y2:o.height},d.x=l.select("."+Ct.xgrids).selectAll("."+Ct.xgrid).data(h),d.x.exit().remove(),d.x=d.x.enter().append("line").attr("class",Ct.xgrid).merge(d.x),t||d.x.each((function(){var t=this;const e=(0,s.select)(this);Object.keys(o.xgridAttr).forEach(function(n){var s=this;i(this,t),e.attr(n,o.xgridAttr[n]).style("opacity",function(){return i(this,s),e.attr(u?"y1":"x1")===(u?o.height:0)?"0":null}.bind(this))}.bind(this))}))},updateYGrid:function(){var t=this;const e=this,n=e.axis,s=e.config,a=e.scale,r=e.state,o=e.$el,c=o.grid,l=o.main,d=s.axis_rotated,u=function(e){return i(this,t),Math.ceil(a.y(e))}.bind(this),h=n.y.getGeneratedTicks(s.grid_y_ticks)||e.scale.y.ticks(s.grid_y_ticks);c.y=l.select("."+Ct.ygrids).selectAll("."+Ct.ygrid).data(h),c.y.exit().remove(),c.y=c.y.enter().append("line").attr("class",Ct.ygrid).merge(c.y),c.y.attr("x1",d?u:0).attr("x2",d?u:r.width).attr("y1",d?0:u).attr("y2",d?r.height:u),Ki(c.y,"grid")},updateGrid:function(){const t=this,e=t.$el,i=e.grid;e.gridLines.main||t.initGridLines(),i.main.style("visibility",t.hasArcType()?"hidden":null),t.hideGridFocus(),t.updateGridLines("x"),t.updateGridLines("y")},updateGridLines:function(t){var e=this;const n=this,a=n.config,r=n.$el,o=r.gridLines,c=r.main,l=n.$T,d=a.axis_rotated;a["grid_"+t+"_show"]&&n["update"+t.toUpperCase()+"Grid"]();let u=c.select("."+Ct[t+"gridLines"]).selectAll("."+Ct[t+"gridLine"]).data(a["grid_"+t+"_lines"]);l(u.exit()).style("opacity","0").remove();const h=u.enter().append("g");h.append("line").style("opacity","0"),u=h.merge(u),u.each((function(t){const e=(0,s.select)(this);e.select("text").empty()&&t.text&&e.append("text").style("opacity","0")})),l(u.attr("class",function(n){return i(this,e),(Ct[t+"gridLine"]+" "+(n.class||"")).trim()}.bind(this)).select("text").attr("text-anchor",Wi).attr("transform",function(){return i(this,e),"x"===t?d?null:"rotate(-90)":d?"rotate(-90)":null}.bind(this)).attr("dx",Zi).attr("dy",-5)).text((function(t){var e;return null!=(e=t.text)?e:this.remove()})),o[t]=u},redrawGrid:function(t){const e=this,i=e.config.axis_rotated,n=e.state,s=n.width,a=n.height,r=e.$el.gridLines,o=e.$T,c=e.xv.bind(e),l=e.yv.bind(e);let d=r.x.select("line"),u=r.x.select("text"),h=r.y.select("line"),g=r.y.select("text");return d=o(d,t).attr("x1",i?0:c).attr("x2",i?s:c).attr("y1",i?c:0).attr("y2",i?c:a),u=o(u,t).attr("x",qi(!i,s,a)).attr("y",c),h=o(h,t).attr("x1",i?l:0).attr("x2",i?l:s).attr("y1",i?0:l).attr("y2",i?a:l),g=o(g,t).attr("x",qi(i,s,a)).attr("y",l),[d.style("opacity",null),u.style("opacity",null),h.style("opacity",null),g.style("opacity",null)]},initFocusGrid:function(){const t=this,e=t.config,i=t.state.clip,n=t.$el,s=e.grid_front,a="."+(s&&n.gridLines.main?Ct.gridLines:gt.chart)+(s?" + *":""),r=n.main.insert("g",a).attr("clip-path",i.pathGrid).attr("class",Ct.grid);n.grid.main=r,e.grid_x_show&&r.append("g").attr("class",Ct.xgrids),e.grid_y_show&&r.append("g").attr("class",Ct.ygrids),e.interaction_enabled&&e.grid_focus_show&&(r.append("g").attr("class",kt.xgridFocus).append("line").attr("class",kt.xgridFocus),e.grid_focus_y&&!e.tooltip_grouped&&r.append("g").attr("class",kt.ygridFocus).append("line").attr("class",kt.ygridFocus))},showGridFocus:function(t){var e=this;const n=this,a=n.config,r=n.state,o=r.width,c=r.height,l=a.axis_rotated,d=n.$el.main.selectAll("line."+kt.xgridFocus+", line."+kt.ygridFocus),u=(t||[d.datum()]).filter(function(t){return i(this,e),t&&T(n.getBaseValue(t))}.bind(this));if(!a.tooltip_show||0===u.length||n.hasType("bubble")||n.hasArcType())return;const h=a.grid_focus_edge&&!a.tooltip_grouped,g=n.xx.bind(n);d.style("visibility",null).data(u.concat(u)).each((function(t){var e=this;const a=(0,s.select)(this),r={x:g(t),y:n.getYScaleById(t.id)(t.value)};let d;if(a.classed(kt.xgridFocus))d=l?[null,r.x,h?r.y:o,r.x]:[r.x,h?r.y:null,r.x,c];else{const e="y2"===n.axis.getId(t.id);d=l?[r.y,h&&!e?r.x:null,r.y,h&&e?r.x:c]:[h&&e?r.x:null,r.y,h&&!e?r.x:o,r.y]}["x1","y1","x2","y2"].forEach(function(t,n){return i(this,e),a.attr(t,d[n])}.bind(this))})),Ki(d,"grid"),null==n.showCircleFocus||n.showCircleFocus(t)},hideGridFocus:function(){const t=this,e=t.state,i=e.inputType,n=e.resizing,s=t.$el.main;"mouse"!==i&&n||(s.selectAll("line."+kt.xgridFocus+", line."+kt.ygridFocus).style("visibility","hidden"),null==t.hideCircleFocus||t.hideCircleFocus())},updateGridFocus:function(){const t=this,e=t.state,i=e.inputType,n=e.width,s=e.height,a=e.resizing,r=t.$el.grid.main.select("line."+kt.xgridFocus);if("touch"===i)r.empty()?a&&(null==t.showCircleFocus||t.showCircleFocus()):t.showGridFocus();else{const e=t.config.axis_rotated;r.attr("x1",e?0:-10).attr("x2",e?n:-10).attr("y1",e?-10:0).attr("y2",e?-10:s)}return!0},generateGridData:function(t,e){var n=this;const s=this,a=s.$el.main.select("."+xt.axisX).selectAll(".tick").size();let r=[];if("year"===t){const t=s.getXDomain().map(function(t){return i(this,n),t.getFullYear()}.bind(this)),e=t[0],a=t[1];for(let t=e;t<=a;t++)r.push(new Date(t+"-01-01 00:00:00"))}else r=e.ticks(10),r.length>a&&(r=r.filter(function(t){return i(this,n),(t+"").indexOf(".")<0}.bind(this)));return r},getGridFilterToRemove:function(t){var e=this;return t?function(n){var s=this;i(this,e);let a=!1;return(z(t)?t.concat():[t]).forEach(function(t){i(this,s),("value"in t&&n.value===t.value||"class"in t&&n.class===t.class)&&(a=!0)}.bind(this)),a}.bind(this):function(){return i(this,e),!0}.bind(this)},removeGridLines:function(t,e){var n=this;const s=this,a=s.config,r=s.$T,o=s.getGridFilterToRemove(t),c=function(t){return i(this,n),!o(t)}.bind(this),l=e?Ct.xgridLines:Ct.ygridLines,d=e?Ct.xgridLine:Ct.ygridLine;r(s.$el.main.select("."+l).selectAll("."+d).filter(o)).style("opacity","0").remove();const u="grid_"+(e?"x":"y")+"_lines";a[u]=a[u].filter(c)}},Qi={initRegion:function(){const t=this.$el;t.region.main=t.main.insert("g",":first-child").attr("clip-path",this.state.clip.path).attr("class",Lt.regions)},updateRegion:function(){const t=this,e=t.config,i=t.$el.region,n=t.$T;i.main||t.initRegion(),i.main.style("visibility",t.hasArcType()?"hidden":null);const a=i.main.selectAll("."+Lt.region).data(e.regions);n(a.exit()).style("opacity","0").remove();const r=a.enter().append("g");r.append("rect").style("fill-opacity","0"),i.list=r.merge(a).attr("class",t.classRegion.bind(t)),i.list.each((function(t){var e;(0,s.select)(this).select("text").empty()&&null!=(e=t.label)&&e.text&&(0,s.select)(this).append("text").style("opacity","0")}))},redrawRegion:function(t){var e=this;const n=this,a=n.$el.region,r=n.$T;let o=a.list.select("rect"),c=a.list.selectAll("text");return o=r(o,t).attr("x",n.regionX.bind(n)).attr("y",n.regionY.bind(n)).attr("width",n.regionWidth.bind(n)).attr("height",n.regionHeight.bind(n)),c=r(c,t).attr("transform",function(t){var s;i(this,e);const a=null!=(s=t.label)?s:{},r=a.x,o=void 0===r?0:r,c=a.y,l=void 0===c?0:c,d=a.rotated,u=void 0!==d&&d;return"translate("+(n.regionX.bind(n)(t)+o)+", "+(n.regionY.bind(n)(t)+l)+")"+(u?" rotate(-90)":"")}.bind(this)).attr("text-anchor",function(t){var n;return i(this,e),null!=(n=t.label)&&n.rotated?"end":null}.bind(this)).attr("dy","1em").style("fill",function(t){var n,s;return i(this,e),null!=(n=null==(s=t.label)?void 0:s.color)?n:null}.bind(this)).text(function(t){var n;return i(this,e),null==(n=t.label)?void 0:n.text}.bind(this)),[o.style("fill-opacity",function(t){return i(this,e),T(t.opacity)?t.opacity:null}.bind(this)).on("end",(function(){(0,s.select)(this.parentNode).selectAll("rect:not([x])").remove()})),c.style("opacity",null)]},getRegionXY:function(t,e){const i=this,n=i.config,s=i.scale,a=n.axis_rotated,r="x"===t;let o,c="start",l=0;return"y"===e.axis||"y2"===e.axis?(r||(c="end"),(r?a:!a)&&c in e&&(o=s[e.axis],l=o(e[c]))):(r?!a:a)&&c in e&&(o=s.zoom||s.x,l=o(i.axis.isTimeSeries()?ot.call(i,e[c]):e[c])),l},regionX:function(t){return this.getRegionXY("x",t)},regionY:function(t){return this.getRegionXY("y",t)},getRegionSize:function(t,e){const i=this,n=i.config,s=i.scale,a=i.state,r=n.axis_rotated,o="width"===t,c=i[o?"regionX":"regionY"](e);let l,d="end",u=a[t];return"y"===e.axis||"y2"===e.axis?(o||(d="start"),(o?r:!r)&&d in e&&(l=s[e.axis],u=l(e[d]))):(o?!r:r)&&d in e&&(l=s.zoom||s.x,u=l(i.axis.isTimeSeries()?ot.call(i,e[d]):e[d])),u13&&(g+=f.height-13),g+(n.axis.getLabelPositionById(t).isInner?0:10)+("y2"!==t||l?0:-10)},getEventRectWidth:function(){const t=this.config,e=this.axis,i=t.axis_x_inverted,n=e.x.tickInterval();return Math.max(0,i?Math.abs(n):n)},getAxisTickRotate:function(t){const e=this,i=e.axis,n=e.config,s=e.state,a=e.$el;let r=n["axis_"+t+"_tick_rotate"];if("x"===t){const t=i.isCategorized()||i.isTimeSeries();if(n.axis_x_tick_fit&&t){const t=n.axis_x_tick_count,i=s.current.maxTickSize.x.ticks.length;let a=0;if(t?a=t>i?i:t:i&&(a=i),a!==s.axis.x.tickCount){const t=e.data.targets;s.axis.x.padding=e.getXDomainPadding([e.getXDomainMinMax(t,"min"),e.getXDomainMinMax(t,"max")],a)}s.axis.x.tickCount=a}a.svg&&n.axis_x_tick_autorotate&&n.axis_x_tick_fit&&!n.axis_x_tick_multiline&&!n.axis_x_tick_culling&&t&&(r=e.needToRotateXAxisTickTexts()?n.axis_x_tick_rotate:0)}return r},needToRotateXAxisTickTexts:function(){const t=this,e=t.state,i=e.axis,n=e.current.width-t.getCurrentPaddingByDirection("left")-t.getCurrentPaddingByDirection("right"),s=i.x.tickCount+i.x.padding.left+i.x.padding.right;return t.axis.getMaxTickSize("x").width>(s?n/s:0)}},en={axis_y_clipPath:!0,axis_y_show:!0,axis_y_type:"indexed",axis_y_max:void 0,axis_y_min:void 0,axis_y_inverted:!1,axis_y_center:void 0,axis_y_inner:!1,axis_y_label:{},axis_y_tick_format:void 0,axis_y_tick_culling:!1,axis_y_tick_culling_max:5,axis_y_tick_culling_lines:!0,axis_y_tick_outer:!0,axis_y_tick_values:null,axis_y_tick_rotate:0,axis_y_tick_count:void 0,axis_y_tick_show:!0,axis_y_tick_stepSize:null,axis_y_tick_text_show:!0,axis_y_tick_text_position:{x:0,y:0},axis_y_tick_time_value:void 0,axis_y_padding:{},axis_y_default:void 0,axis_y_axes:[]},nn={axis_y2_show:!1,axis_y2_type:"indexed",axis_y2_max:void 0,axis_y2_min:void 0,axis_y2_inverted:!1,axis_y2_center:void 0,axis_y2_inner:!1,axis_y2_label:{},axis_y2_tick_format:void 0,axis_y2_tick_culling:!1,axis_y2_tick_culling_max:5,axis_y2_tick_culling_lines:!0,axis_y2_tick_outer:!0,axis_y2_tick_values:null,axis_y2_tick_rotate:0,axis_y2_tick_count:void 0,axis_y2_tick_show:!0,axis_y2_tick_stepSize:null,axis_y2_tick_text_show:!0,axis_y2_tick_text_position:{x:0,y:0},axis_y2_padding:{},axis_y2_default:void 0,axis_y2_axes:[]};function sn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function an(t){for(var e,i=1;i360&&(e=2),e*Math.PI},getGaugeStartAngle:function(){const t=this.config,e=t.gauge_fullCircle,i=-1*Math.PI/2,n=Math.PI/2;let s=t.gauge_startingAngle;return!e&&s<=i?s=i:!e&&s>=n?s=n:(s>Math.PI||s<-1*Math.PI)&&(s=Math.PI),s},updateAngle:function(t){var e=this;const n=this,s=n.config,a=n.state;let r=n.pie,o=t,c=!1;if(!s)return null;const l=n.getGaugeStartAngle(),d=s.gauge_fullCircle?n.getArcLength():-2*l;if(o.data&&n.isGaugeType(o.data)&&!n.hasMultiArcGauge()){const t=s.gauge_min,e=s.gauge_max,i=n.getTotalDataSum(a.rendered);r=r.startAngle(l).endAngle(d*((i-t)/(e-t))+l)}if(r(n.filterTargetsToShow()).forEach(function(t,n){var s;i(this,e),c||t.data.id!==(null==(s=o.data)?void 0:s.id)||(c=!0,o=t,o.index=n)}.bind(this)),isNaN(o.startAngle)&&(o.startAngle=0),isNaN(o.endAngle)&&(o.endAngle=o.startAngle),o.data&&n.hasMultiArcGauge()){const t=s.gauge_min,e=s.gauge_max,i=o.value1){var c;let a=n.getRadius(t).outerRadius;n.hasType("polar")&&(a=n.getPolarOuterRadius(t,a));const l=this.svgArc.centroid(r).map(function(t){return i(this,e),isNaN(t)?0:t}.bind(this)),d=l[0],u=l[1],h=Math.sqrt(d*d+u*u);let g=null==(c=["donut","pie","polar"].filter(n.hasType.bind(n)).map(function(t){return i(this,e),s[t+"_label_ratio"]}.bind(this)))?void 0:c[0];g=g?w(g)?g.bind(n.api)(t,a,h):g:a&&(h?(36/a>.375?1.175-36/a:.8)*a/h:0),o="translate("+d*g+","+u*g+")"}return o},convertToArcData:function(t){return this.addName({id:"data"in t?t.data.id:t.id,value:t.value,ratio:this.getRatio("arc",t),index:t.index})},textForArcLabel:function(t){const e=this,i=e.hasType("gauge");e.shouldShowArcLabel()&&t.style("fill",e.updateTextColor.bind(e)).attr("filter",e.updateTextBackgroundColor.bind(e)).each((function(t){var n;const a=(0,s.select)(this),r=e.updateAngle(t),o=e.getRatio("arc",r);if(e.meetsLabelThreshold(o,null==(n=["donut","gauge","pie","polar"].filter(e.hasType.bind(e)))?void 0:n[0])){const n=(r||t).value;N(a,(e.getArcLabelFormat()||e.defaultArcValueFormat)(n,o,t.data.id).toString(),[-1,1],i)}else a.text("")}))},expandArc:function(t){var e=this;const n=this,a=n.state.transiting,r=n.$el;if(a){const s=setInterval(function(){i(this,e),a||(clearInterval(s),r.legend.selectAll("."+kt.legendItemFocused).size()>0&&n.expandArc(t))}.bind(this),10);return}const o=n.mapToTargetIds(t);r.svg.selectAll(n.selectorTargets(o,"."+ft.chartArc)).each((function(t){if(!n.shouldExpand(t.data.id))return;const e=n.getExpandConfig(t.data.id,"duration"),i=n.getSvgArcExpanded(n.getExpandConfig(t.data.id,"rate"));(0,s.select)(this).selectAll("path").transition().duration(e).attrTween("d",fn(n.svgArcExpanded.bind(n))).transition().duration(2*e).attrTween("d",fn(i.bind(n)))}))},unexpandArc:function(t){var e=this;const n=this,s=n.state.transiting,a=n.$el.svg;if(s)return;const r=n.mapToTargetIds(t);a.selectAll(n.selectorTargets(r,"."+ft.chartArc)).selectAll("path").transition().duration(function(t){return i(this,e),n.getExpandConfig(t.data.id,"duration")}.bind(this)).attrTween("d",fn(n.svgArc.bind(n))),a.selectAll(""+ft.arc).style("opacity",null)},getExpandConfig:function(t,e){const i=this,n=i.config;let s;return i.isDonutType(t)?s="donut":i.isGaugeType(t)?s="gauge":i.isPieType(t)&&(s="pie"),s?n[s+"_expand_"+e]:{duration:50,rate:.98}[e]},shouldExpand:function(t){const e=this,i=e.config;return e.isDonutType(t)&&i.donut_expand||e.isGaugeType(t)&&i.gauge_expand||e.isPieType(t)&&i.pie_expand},shouldShowArcLabel:function(){var t=this;const e=this,n=e.config;return["donut","gauge","pie","polar"].some(function(s){return i(this,t),e.hasType(s)&&n[s+"_label_show"]}.bind(this))},getArcLabelFormat:function(){var t=this;const e=this,n=e.config;let s=function(e){return i(this,t),e}.bind(this);return["donut","gauge","pie","polar"].filter(e.hasType.bind(e)).forEach(function(e){i(this,t),s=n[e+"_label_format"]}.bind(this)),w(s)?s.bind(e.api):s},updateTargetsForArc:function(t){var e=this;const n=this,s=n.$el,a=n.hasType("gauge"),r=n.getChartClass("Arc"),o=n.getClass("arcs",!0),c=n.classFocus.bind(n),l=s.main.select("."+ft.chartArcs),d=l.selectAll("."+ft.chartArc).data(n.pie(t)).attr("class",function(t){return i(this,e),r(t)+c(t.data)}.bind(this)),u=d.enter().append("g").attr("class",r).call(this.setCssRule(!1,"."+ft.chartArcs+" text",["pointer-events:none","text-anchor:middle"]));u.append("g").attr("class",o).merge(d),u.append("text").attr("dy",a&&!n.hasMultiTargets()?"-.1em":".35em").style("opacity","0").style("text-anchor",n.getStylePropValue("middle")).style("pointer-events",n.getStylePropValue("none")),s.text=l.selectAll("."+gt.target+" text")},initArc:function(){const t=this,e=t.$el;e.arcs=e.main.select("."+gt.chart).append("g").attr("class",ft.chartArcs).attr("transform",t.getTranslate("arc")),t.setArcTitle()},setArcTitle:function(t){const e=this,i=t||e.getArcTitle(),n=e.hasType("gauge");if(i){const t=n?Tt.chartArcsGaugeTitle:ft.chartArcsTitle;let s=e.$el.arcs.select("."+t);s.empty()&&(s=e.$el.arcs.append("text").attr("class",t).style("text-anchor","middle")),n&&s.attr("dy","-0.3em"),N(s,i,n?void 0:[-.6,1.35],!0)}},getArcTitle:function(){const t=this,e=t.hasType("donut")?"donut":t.hasType("gauge")&&"gauge";return e?t.config[e+"_title"]:""},getArcTitleWithNeedleValue:function(){const t=this,e=t.config,i=t.state,n=t.getArcTitle();if(n&&t.config.arc_needle_show&&/{=[A-Z_]+}/.test(n)){let t=i.current.needle;return S(t)||(t=e.arc_needle_value),rt(n,{NEEDLE_VALUE:S(t)?t:0})}return!1},redrawArc:function(t,e,n){var a=this;const r=this,o=r.config,c=r.state,l=r.$el.main,d=o.interaction_enabled,u=d&&o.data_selection_isselectable;let h=l.selectAll("."+ft.arcs).selectAll("."+ft.arc).data(r.arcData.bind(r));h.exit().transition().duration(e).style("opacity","0").remove(),h=h.enter().append("path").attr("class",r.getClass("arc",!0)).style("fill",function(t){return i(this,a),r.color(t.data)}.bind(this)).style("cursor",function(t){return i(this,a),null!=u&&null!=u.bind&&u.bind(r.api)(t)?"pointer":null}.bind(this)).style("opacity","0").each((function(t){r.isGaugeType(t.data)&&(t.startAngle=o.gauge_startingAngle,t.endAngle=o.gauge_startingAngle),this._current=t})).merge(h),r.hasType("gauge")&&(r.updateGaugeMax(),r.hasMultiArcGauge()&&r.redrawMultiArcGauge()),h.attr("transform",function(t){return i(this,a),!r.isGaugeType(t.data)&&n?"scale(0)":""}.bind(this)).style("opacity",(function(t){return t===this._current?"0":null})).each(function(){i(this,a),c.transiting=!0}.bind(this)).transition().duration(t).attrTween("d",(function(t){var e=this;const n=r.updateAngle(t);if(!n)return function(){return i(this,e),"M 0 0"}.bind(this);isNaN(this._current.startAngle)&&(this._current.startAngle=0),isNaN(this._current.endAngle)&&(this._current.endAngle=this._current.startAngle);const s=(0,dn.interpolate)(this._current,n);return this._current=s(0),function(e){const i=s(e);return i.data=t.data,r.getArc(i,!0)}})).attr("transform",n?"scale(1)":"").style("fill",function(t){let e;return i(this,a),r.levelColor?(e=r.levelColor(t.data.values[0].value),o.data_colors[t.data.id]=e):e=r.color(t.data),e}.bind(this)).style("opacity",null).call(F,(function(){if(r.levelColor){const t=(0,s.select)(this),e=t.datum(this._current);r.updateLegendItemColor(e.data.id,t.style("fill"))}c.transiting=!1,$(o.onrendered,r.api)})),d&&r.bindArcEvent(h),r.hasType("polar")&&r.redrawPolar(),r.hasType("gauge")&&r.redrawBackgroundArcs(),o.arc_needle_show&&r.redrawNeedle(),r.redrawArcText(t)},redrawNeedle:function(){var t=this;const e=this,n=e.$el,s=e.config,a=e.state,r=a.hiddenTargetIds,o=(a.radius-1)/100*s.arc_needle_length,c=r.length!==e.data.targets.length;let l=e.$el.arcs.select("."+ft.needle);const d=s.arc_needle_path,u=s.arc_needle_bottom_width/2,h=s.arc_needle_top_width/2,g=s.arc_needle_top_rx,f=s.arc_needle_top_ry,p=s.arc_needle_bottom_len,x=s.arc_needle_bottom_rx,b=s.arc_needle_bottom_ry,m=e.getNeedleAngle(),_=function(){i(this,t);const n=e.getArcTitleWithNeedleValue();n&&e.setArcTitle(n)}.bind(this);if(_(),l.empty()&&(l=n.arcs.append("path").classed(ft.needle,!0),n.needle=l,n.needle.updateHelper=function(a,r){var o=this;void 0===r&&(r=!1),i(this,t),"none"!==n.needle.style("display")&&e.$T(n.needle).style("transform","rotate("+e.getNeedleAngle(a)+"deg)").call(F,function(){i(this,o),r&&(s.arc_needle_value=a),_()}.bind(this))}.bind(this)),c){const t=w(d)?d.call(e,o):"M-"+u+" "+p+" A"+x+" "+b+" 0 0 0 "+u+" "+p+" L"+h+" -"+o+" A"+g+" "+f+" 0 0 0 -"+h+" -"+o+" L-"+u+" "+p+" Z";e.$T(l).attr("d",t).style("fill",s.arc_needle_color).style("display",null).style("transform","rotate("+m+"deg)")}else l.style("display","none")},getNeedleAngle:function(t){const e=this,i=e.config,n=e.state,s=e.getArcLength(),a=e.hasType("gauge"),r=e.getTotalDataSum(!0);let o=C(t)?t:i.arc_needle_value,c=i[i.data_type+"_startingAngle"]||0,l=0;if(S(o)||(o=a&&1===e.data.targets.length?r:0),n.current.needle=o,a){c=e.getGaugeStartAngle();const t=i.gauge_fullCircle?s:-2*c,n=i.gauge_min;l=t*((o-n)/(i.gauge_max-n))}else l=s*(o/r);return(c+l)*(180/Math.PI)},redrawBackgroundArcs:function(){var t=this;const e=this,n=e.config,s=e.state,a=e.hasMultiArcGauge(),r=n.gauge_fullCircle,o=0===e.filterTargetsToShow(e.data.targets).length&&!!n.data_empty_label_text,c=e.getGaugeStartAngle(),l=r?c+e.getArcLength():-1*c;let d=e.$el.arcs.select((a?"g":"")+"."+ft.chartArcsBackground);if(a){let a=0;d=d.selectAll("path."+ft.chartArcsBackground).data(e.data.targets),d.enter().append("path").attr("class",function(e,n){return i(this,t),ft.chartArcsBackground+" "+ft.chartArcsBackground+"-"+n}.bind(this)).merge(d).style("fill",n.gauge_background||null).attr("d",function(r){let d=r.id;if(i(this,t),o||s.hiddenTargetIds.indexOf(d)>=0)return"M 0 0";const u={data:[{value:n.gauge_max}],startAngle:c,endAngle:l,index:a++};return e.getArc(u,!0,!0)}.bind(this)),d.exit().remove()}else d.attr("d",o?"M 0 0":function(){i(this,t);const s={data:[{value:n.gauge_max}],startAngle:c,endAngle:l};return e.getArc(s,!0,!0)}.bind(this))},bindArcEvent:function(t){var e=this;const n=this,a=n.config,o=n.state,c="touch"===o.inputType,l="mouse"===o.inputType;function d(t,e,i){n.expandArc(i),n.api.focus(i),n.toggleFocusLegend(i,!0),n.showTooltip([e],t)}function u(t){const e=(null==t?void 0:t.id)||void 0;n.unexpandArc(e),n.api.revert(),n.revertLegend(),n.hideTooltip()}if(t.on("click",(function(t,e,i){const s=n.updateAngle(e);let r;s&&(r=n.convertToArcData(s),null==n.toggleShape||n.toggleShape(this,r,i),a.data_onclick.bind(n.api)(r,this))})),l&&t.on("mouseover",(function(t,e){var i;if(o.transiting)return;o.event=t;const s=n.updateAngle(e),a=s?n.convertToArcData(s):null;d(this,a,(null==(i=a)?void 0:i.id)||void 0),n.setOverOut(!0,a)})).on("mouseout",function(t,s){if(i(this,e),o.transiting)return;o.event=t;const a=n.updateAngle(s),r=a?n.convertToArcData(a):null;u(),n.setOverOut(!1,r)}.bind(this)).on("mousemove",(function(t,e){const i=n.updateAngle(e),s=i?n.convertToArcData(i):null;o.event=t,n.showTooltip([s],this)})),c&&n.hasArcType()&&!n.radars){const t=function(t){var n,a;i(this,e);const o=null!=(n=null==(a=t.changedTouches)?void 0:a[0])?n:{clientX:0,clientY:0},c=o.clientX,l=o.clientY;return(0,s.select)(r.elementFromPoint(c,l))}.bind(this);n.$el.svg.on("touchstart touchmove",(function(e){var i,s;if(o.transiting)return;o.event=e;const a=t(e).datum(),r=null!=(i=a)&&i.data&&a.data.id?n.updateAngle(a):null,c=r?n.convertToArcData(r):null,l=(null==(s=c)?void 0:s.id)||void 0;n.callOverOutForTouch(c),k(l)?u():d(this,c,l)}))}},redrawArcText:function(t){var e=this;const n=this,s=n.config,a=n.state,r=n.$el,o=r.main,c=r.arcs,l=n.hasType("gauge"),d=n.hasMultiArcGauge();let u;if(l&&1===n.data.targets.length&&s.gauge_title||(u=o.selectAll("."+ft.chartArc).select("text").style("opacity","0").attr("class",function(t){return i(this,e),n.isGaugeType(t.data)?Tt.gaugeValue:null}.bind(this)).call(n.textForArcLabel.bind(n)).attr("transform",n.transformForArcLabel.bind(n)).style("font-size",function(t){return i(this,e),n.isGaugeType(t.data)&&1===n.data.targets.length&&!d?Math.round(a.radius/5)+"px":null}.bind(this)).transition().duration(t).style("opacity",function(t){return i(this,e),n.isTargetToShow(t.data.id)&&n.isArcType(t.data)?null:"0"}.bind(this)),d&&u.attr("dy","-.1em")),o.select("."+ft.chartArcsTitle).style("opacity",n.hasType("donut")||l?null:"0"),l){var h;const t=s.gauge_fullCircle;t&&(null==(h=u)||h.attr("dy",""+(d?0:Math.round(a.radius/14)))),s.gauge_label_show&&(c.select("."+Tt.chartArcsGaugeUnit).attr("dy",(t?1.5:.75)+"em").text(s.gauge_units),c.select("."+Tt.chartArcsGaugeMin).attr("dx",-1*(a.innerRadius+(a.radius-a.innerRadius)/(t?1:2))+"px").attr("dy","1.2em").text(n.textForGaugeMinMax(s.gauge_min,!1)),t||c.select("."+Tt.chartArcsGaugeMax).attr("dx",a.innerRadius+(a.radius-a.innerRadius)/2+"px").attr("dy","1.2em").text(n.textForGaugeMinMax(s.gauge_max,!0)))}},getArcElementByIdOrIndex:function(t){var e=this;const n=this.$el.arcs,s=S(t)?function(n){return i(this,e),n.index===t}.bind(this):function(n){return i(this,e),n.data.id===t}.bind(this);return null==n?void 0:n.selectAll("."+gt.target+" path").filter(s)}},xn={initArea:function(t){const e=this.config;t.insert("g","."+(e.area_front?_t.circles:At.lines)).attr("class",this.getClass("areas",!0))},updateAreaColor:function(t){const e=this;return e.config.area_linearGradient?e.getGradienColortUrl(t.id):e.color(t)},updateArea:function(t,e){void 0===e&&(e=!1);const i=this,n=i.config,a=i.state,r=i.$el,o=i.$T,c=e?r.subchart:r;n.area_linearGradient&&i.updateLinearGradient();const l=c.main.selectAll("."+pt.areas).selectAll("."+pt.area).data(i.lineData.bind(i));o(l.exit(),t).style("opacity","0").remove(),c.area=l.enter().append("path").attr("class",i.getClass("area",!0)).style("fill",i.updateAreaColor.bind(i)).style("opacity",(function(){return a.orgAreaOpacity=(0,s.select)(this).style("opacity"),"0"})).merge(l),l.style("opacity",a.orgAreaOpacity),i.setRatioForGroupedData(c.area.data())},redrawArea:function(t,e,n){var s=this;void 0===n&&(n=!1);const a=this,r=(n?this.$el.subchart:this.$el).area,o=a.state.orgAreaOpacity;return[a.$T(r,e,H()).attr("d",t).style("fill",a.updateAreaColor.bind(a)).style("opacity",function(t){return i(this,s),(a.isAreaRangeType(t)?o/1.75:o)+""}.bind(this))]},generateDrawArea:function(t,e){var n=this;const s=this,a=s.config,r=a.line_connectNull,o=a.axis_rotated,c=s.generateGetAreaPoints(t,e),l=s.getYScaleById.bind(s),d=function(t){return i(this,n),(e?s.subxx:s.xx).call(s,t)}.bind(this),u=function(t,a){return i(this,n),s.isGrouped(t.id)?c(t,a)[0][1]:l(t.id,e)(s.isAreaRangeType(t)?s.getRangedData(t,"high"):s.getShapeYMin(t.id))}.bind(this),h=function(t,a){return i(this,n),s.isGrouped(t.id)?c(t,a)[1][1]:l(t.id,e)(s.isAreaRangeType(t)?s.getRangedData(t,"low"):t.value)}.bind(this);return function(t){var e=this;i(this,n);let c,l=r?s.filterRemoveNull(t.values):t.values,g=0,f=0;if(s.isAreaType(t)){let n=(0,Ye.area)();n=o?n.y(d).x0(u).x1(h):n.x(d).y0(a.area_above?0:a.area_below?s.state.height:u).y1(h),r||(n=n.defined(function(t){return i(this,e),null!==s.getBaseValue(t)}.bind(this))),s.isStepType(t)&&(l=s.convertValuesToStep(l)),c=n.curve(s.getCurve(t))(l)}else l[0]&&(g=s.scale.x(l[0].x),f=s.getYScaleById(t.id)(l[0].value)),c=o?"M "+f+" "+g:"M "+g+" "+f;return c||"M 0 0"}.bind(this)},generateGetAreaPoints:function(t,e){const i=this,n=i.config,s=i.getShapeX(0,t,e),a=i.getShapeY(!!e),r=i.getShapeOffset(i.isAreaType,t,e),o=i.getYScaleById.bind(i);return function(t,c){const l=o.call(i,t.id,e)(i.getShapeYMin(t.id)),d=r(t,c)||l,u=s(t),h=t.value;let g=a(t);return n.axis_rotated&&(h>0&&g0?function(){return i(this,n),c}.bind(this):S(l)?function(t){return i(this,n),t*l}.bind(this):null;return function(t,e){i(this,n);const c=r(t,e),l=+o,u=+!l,h=t.value<0,g=a["axis_"+s.axis.getId(t.id)+"_inverted"],f=!g&&h||g&&!h,p=["",""];let x=0;const b=s.isGrouped(t.id),m=!(!d||!b)&&s.isStackingRadiusData(t);if(d){const t=o?u:l,e=c[2][t]-c[0][t];x=!b||m?d(e):0;const i="a"+x+","+x+" "+(f?"1 0 0":"0 0 1")+" ";p[+!o]=""+i+x+","+x,p[+o]=""+i+[-x,x][o?"sort":"reverse"](),f&&p.reverse()}const _=o?"H"+(c[1][l]+(f?x:-x))+" "+p[0]+"V"+(c[2][u]-x)+" "+p[1]+"H"+c[3][l]:"V"+(c[1][u]+(f?-x:x))+" "+p[0]+"H"+(c[2][l]-x)+" "+p[1]+"V"+c[3][u];return"M"+c[0][l]+","+c[0][u]+_+"z"}.bind(this)},isStackingRadiusData:function(t){var e=this;const n=this,s=n.$el,a=n.config,r=n.data,o=n.state,c=t.id,l=t.index,d=t.value;if(o.hiddenTargetIds.indexOf(c)>-1){const t=s.bar.filter(function(t){return i(this,e),t.id===c&&t.value===d}.bind(this));return!t.empty()&&/a\d+/i.test(t.attr("d"))}const u=a.data_groups.find(function(t){return i(this,e),t.indexOf(c)>-1}.bind(this)),h=n.orderTargets(n.filterTargetsToShow(r.targets.filter(n.isBarType,n))).filter(function(t){return i(this,e),u.indexOf(t.id)>-1}.bind(this)).map(function(t){var n=this;return i(this,e),t.values.filter(function(t){return i(this,n),t.index===l&&(S(d)&&d>0?t.value>0:t.value<0)}.bind(this))[0]}.bind(this)).filter(Boolean).map(function(t){return i(this,e),t.id}.bind(this));return 0!==d&&h.indexOf(c)===h.length-1},generateGetBarPoints:function(t,e){var n=this;const s=this,a=s.config,r=e?s.axis.subX:s.axis.x,o=s.getIndicesMax(t)+1,c=s.getBarW("bar",r,o),l=s.getShapeX(c,t,!!e),d=s.getShapeY(!!e),u=s.getShapeOffset(s.isBarType,t,!!e),h=s.getYScaleById.bind(s);return function(t,r){i(this,n);const o=t.id,g=h.call(s,o,e)(s.getShapeYMin(o)),f=u(t,r)||g,p=S(c)?c:c[t.id]||c._$width,x=a["axis_"+s.axis.getId(o)+"_inverted"],b=t.value,m=l(t);let _=d(t);a.axis_rotated&&!x&&(b>0&&_=e.open),e||null}},vn={initGauge:function(){var t=this;const e=this,n=e.config,s=e.$el.arcs,a=function(e){i(this,t),s.append("text").attr("class",e).style("text-anchor","middle").style("pointer-events","none")}.bind(this);if(e.hasType("gauge")){const t=e.hasMultiArcGauge();s.append(t?"g":"path").attr("class",ft.chartArcsBackground).style("fill",!t&&n.gauge_background||null),n.gauge_units&&a(Tt.chartArcsGaugeUnit),n.gauge_label_show&&(a(Tt.chartArcsGaugeMin),n.gauge_fullCircle||a(Tt.chartArcsGaugeMax))}},updateGaugeMax:function(){const t=this,e=t.config,i=t.state,n=t.hasMultiArcGauge()?t.getMinMaxData().max[0].value:t.getTotalDataSum(i.rendered);n+e.gauge_min*(e.gauge_min>0?-1:1)>e.gauge_max&&(e.gauge_max=n-e.gauge_min)},redrawMultiArcGauge:function(){var t=this;const e=this,n=e.config,a=e.state,r=e.$el,o=e.state.hiddenTargetIds,c=r.main.selectAll("."+ft.arcs).selectAll("."+ft.arcLabelLine).data(e.arcData.bind(e));c.enter().append("rect").attr("class",function(e){return i(this,t),ft.arcLabelLine+" "+gt.target+" "+gt.target+"-"+e.data.id}.bind(this)).merge(c).style("fill",function(n){return i(this,t),e.levelColor?e.levelColor(n.data.values[0].value):e.color(n.data)}.bind(this)).style("display",n.gauge_label_show?null:"none").each((function(t){let i=0,n=0,r=0,c="";if(o.indexOf(t.data.id)<0){const s=e.updateAngle(t),o=a.gaugeArcWidth/e.filterTargetsToShow(e.data.targets).length*(s.index+1),l=s.endAngle-Math.PI/2,d=a.radius-o,u=l-(0===d?0:1/d);i=a.radiusExpanded-a.radius+o,n=Math.cos(u)*d,r=Math.sin(u)*d,c="rotate("+180*l/Math.PI+", "+n+", "+r+")"}(0,s.select)(this).attr("x",n).attr("y",r).attr("width",i).attr("height",2).attr("transform",c).style("stroke-dasharray","0, "+(i+2)+", 0")}))},textForGaugeMinMax:function(t,e){const i=this.config.gauge_label_extents;return w(i)?i.bind(this.api)(t,e):t},getGaugeLabelHeight:function(){const t=this.config;return this.config.gauge_label_show&&!t.gauge_fullCircle?20:0},getPaddingBottomForGauge:function(){return this.getGaugeLabelHeight()*(this.config.gauge_label_show?2:2.5)}},yn={initBubble:function(){const t=this.config;this.hasType("bubble")&&(t.point_show=!0,t.point_type="circle")},getBaseLength:function(){const t=this,e=t.state,i=e.width,n=e.height,s=ee;let a=t.cache.get(s);return a||t.cache.add(s,a=nt("min",[i,n])),a},getBubbleR:function(t){var e=this;const n=this;let s=n.config.bubble_maxR;w(s)?s=s.bind(n.api)(t):S(s)||(s=n.getBaseLength()/(2*n.getMaxDataCount())+12);const a=nt("max",n.getMinMaxData().max.map(function(t){return i(this,e),n.isBubbleZType(t)?n.getBubbleZData(t.value,"y"):M(t.value)?t.value.mid:t.value}.bind(this))),r=s*s*Math.PI,o=(n.isBubbleZType(t)?n.getBubbleZData(t.value,"z"):t.value)*(r/a);return Math.sqrt(o/Math.PI)},getBubbleZData:function(t,e){return M(t)?t[e]:t["y"===e?0:1]}},Tn={initLine:function(){const t=this.$el;t.line=t.main.select("."+gt.chart).append("g").attr("class",At.chartLines).call(this.setCssRule(!1,"."+At.chartLines,["pointer-events:none"]))},updateTargetsForLine:function(t){var e=this;const n=this,s=n.$el,a=s.area,r=s.line,o=s.main,c=n.getChartClass("Line"),l=n.getClass("lines",!0),d=n.classFocus.bind(n);r||n.initLine();const u=t.filter(function(t){return i(this,e),!(n.isScatterType(t)||n.isBubbleType(t))}.bind(this)),h=o.select("."+At.chartLines).selectAll("."+At.chartLine).data(u).attr("class",function(t){return i(this,e),c(t)+d(t)}.bind(this)),g=h.enter().append("g").attr("class",c).style("opacity","0").style("pointer-events",n.getStylePropValue("none"));if(g.append("g").attr("class",l),n.hasTypeOf("Area")){const t=(!a&&g.empty()?h:g).filter(n.isAreaType.bind(n));n.initArea(t)}n.updateTargetForCircle(u,g)},updateLine:function(t,e){var n=this;void 0===e&&(e=!1);const s=this,a=s.format.extraLineClasses,r=s.$el,o=s.$T,c=e?r.subchart:r,l=c.main.selectAll("."+At.lines).selectAll("."+At.line).data(s.lineData.bind(s));o(l.exit(),t).style("opacity","0").remove(),c.line=l.enter().append("path").attr("class",function(t){return i(this,n),s.getClass("line",!0)(t)+" "+(a(t)||"")}.bind(this)).style("stroke",s.color).merge(l).style("opacity",s.initialOpacity.bind(s)).attr("transform",null)},redrawLine:function(t,e,i){void 0===i&&(i=!1);const n=this.$el;return[(0,this.$T)((i?n.subchart:n).line,e,H()).attr("d",t).style("stroke",this.color).style("opacity",null)]},getCurve:function(t){var e=this;const n=this;return n.config.axis_rotated&&n.isStepType(t)?function(s){i(this,e);const a=n.getInterpolate(t)(s);return a.orgPoint=a.point,a.pointRotated=function(t,e){1===this._point&&(this._point=2);const i=this._y*(1-this._t)+e*this._t;this._context.lineTo(this._x,i),this._context.lineTo(t,i),this._x=t,this._y=e},a.point=function(t,e){0===this._point?this.orgPoint(t,e):this.pointRotated(t,e)},a}.bind(this):n.getInterpolate(t)},generateDrawLine:function(t,e){var n=this;const s=this,a=s.config,r=s.scale,o=a.line_connectNull,c=a.axis_rotated,l=s.generateGetLinePoints(t,e),d=s.getYScaleById.bind(s),u=function(t){return i(this,n),(e?s.subxx:s.xx).call(s,t)}.bind(this),h=function(t,a){return i(this,n),s.isGrouped(t.id)?l(t,a)[0][1]:d(t.id,e)(s.getBaseValue(t))}.bind(this);let g=(0,Ye.line)();g=c?g.x(h).y(u):g.x(u).y(h),o||(g=g.defined(function(t){return i(this,n),null!==s.getBaseValue(t)}.bind(this)));const f=e?r.subX:r.x;return function(t){i(this,n);const l=d(t.id,e);let u,h=o?s.filterRemoveNull(t.values):t.values,p=0,x=0;if(s.isLineType(t)){const e=a.data_regions[t.id];e?u=s.lineWithRegions(h,r.zoom||f,l,e):(s.isStepType(t)&&(h=s.convertValuesToStep(h)),u=g.curve(s.getCurve(t))(h))}else h[0]&&(p=f(h[0].x),x=l(h[0].value)),u=c?"M "+x+" "+p:"M "+p+" "+x;return u||"M 0 0"}.bind(this)},lineWithRegions:function(t,e,n,s){var a=this;const r=this,o=r.config.axis_rotated,c=r.axis.isTimeSeries(),l=[];let d,u,h,g;if(C(s)){const e=function(t,e){return i(this,a),k(t)?e:c?ot.call(r,t):t}.bind(this);for(let i,n=0;i=s[n];n++){const s=e(i.start,t[0].x),a=e(i.end,t[t.length-1].x),r=i.style||{dasharray:"2 2"};l[n]={start:s,end:a,style:r}}}const f=o?function(t){return i(this,a),n(t.value)}.bind(this):function(t){return i(this,a),e(t.x)}.bind(this),p=o?function(t){return i(this,a),e(t.x)}.bind(this):function(t){return i(this,a),n(t.value)}.bind(this),x=function(t){return i(this,a),"M"+t[0][0]+","+t[0][1]+"L"+t[1][0]+","+t[1][1]}.bind(this),b=c?function(t,s,r,c){i(this,a);const l=t.x.getTime(),d=s.x-t.x,g=new Date(l+d*r),f=new Date(l+d*(r+c)),p=o?[[n(u(r)),e(g)],[n(u(r+h)),e(f)]]:[[e(g),n(u(r))],[e(f),n(u(r+h))]];return x(p)}.bind(this):function(t,s,r,c){i(this,a);const l=o?[[n(u(r),!0),e(d(r))],[n(u(r+c),!0),e(d(r+c))]]:[[e(d(r),!0),n(u(r))],[e(d(r+c),!0),n(u(r+c))]];return x(l)}.bind(this),m={x:r.axis.getAxisType("x"),y:r.axis.getAxisType("y")};let _="";for(let i,s=0;i=t[s];s++){const a=t[s-1],o=a&&T(a.value);let c=r.isWithinRegions(i.x,l);if(T(i.value))if(!k(l)&&c&&o){if(o){try{c=c.dasharray.split(" ")}catch(t){c="2 2".split(" ")}d=Ge(m.x,a.x,i.x),u=Ge(m.y,a.value,i.value);const t=e(i.x)-e(a.x),s=n(i.value)-n(a.value),r=Math.sqrt(Math.pow(t,2)+Math.pow(s,2));h=c[0]/r,g=h*c[1];for(let t=h;t<=1;t+=g)_+=b(a,i,t,h),t+g>=1&&(_+=b(a,i,1,0))}}else _+=(s&&o?"L":"M")+f(i)+","+p(i)}return _},isWithinRegions:function(t,e){for(let i,n=0;i=e[n];n++)if(i.start-1?"0":null})),l&&h.forEach(function(t){var e=this;i(this,n),c.main.selectAll("."+Pt.selectedCircles+a.getTargetSelectorSuffix(t.id)).selectAll(""+Pt.selectedCircle).each(function(n){i(this,e),n.value=t.values[n.index].value}.bind(this))}.bind(this))},updateCircle:function(t){var e=this;void 0===t&&(t=!1);const n=this,s=n.config,a=n.state,r=n.$el,o=n.isPointFocusOnly(),c=t?r.subchart:r;if(s.point_show&&!a.toggling){s.point_radialGradient&&n.updateLinearGradient();const t=c.main.selectAll("."+_t.circles).selectAll("."+_t.circle).data(function(t){return i(this,e),n.isLineType(t)&&n.shouldDrawPointsForLine(t)||n.isBubbleType(t)||n.isRadarType(t)||n.isScatterType(t)?o?[t.values[0]]:t.values:[]}.bind(this));t.exit().remove(),t.enter().filter(Boolean).append(n.point("create",this,n.pointR.bind(n),n.updateCircleColor.bind(n))),c.circle=c.main.selectAll("."+_t.circles+" ."+_t.circle).style("stroke",n.getStylePropValue(n.color)).style("opacity",n.initialOpacityForCircle.bind(n))}},updateCircleColor:function(t){const e=this,i=e.getStylePropValue(e.color);return e.config.point_radialGradient?e.getGradienColortUrl(t.id):i?i(t):null},redrawCircle:function(t,e,i,n,s){void 0===s&&(s=!1);const a=this,r=a.state.rendered,o=a.$el,c=a.$T,l=s?o.subchart:o,d=l.main.selectAll("."+Pt.selectedCircle);if(!a.config.point_show)return[];const u=a.point("update",a,t,e,a.updateCircleColor.bind(a),i,n,d),h=a.isCirclePoint()?"c":"",g=H(),f=a.opacityForCircle.bind(a),p=[];return l.circle.each((function(t){let e=u.bind(this)(t);e=c(e,i||!r,g).style("opacity",f),p.push(e)})),[p,c(d,i).attr(h+"x",t).attr(h+"y",e)]},showCircleFocus:function(t){const e=this,n=e.state,a=n.hasRadar,r=n.resizing,o=n.toggling,c=n.transiting;let l=e.$el.circle;if(!1===c&&l&&e.isPointFocusOnly()){const n=(a?e.radarCircleX:e.circleX).bind(e),c=(a?e.radarCircleY:e.circleY).bind(e),d=o||k(t),u=e.point("update",e,n,c,e.getStylePropValue(e.color),!r&&d);t&&(l=l.filter((function(e){var n=this;const a=null==t.filter?void 0:t.filter(function(t){return i(this,n),t.id===e.id}.bind(this));return!!a.length&&(0,s.select)(this).datum(a[0])}))),l.attr("class",this.updatePointClass.bind(this)).style("opacity",null).each((function(t){const i=t.id,n=t.index,s=t.value;let a="hidden";T(s)&&(u.bind(this)(t),e.expandCircles(n,i),a=""),this.style.visibility=a}))}},hideCircleFocus:function(){const t=this,e=t.$el.circle;t.isPointFocusOnly()&&e&&(t.unexpandCircles(),e.style("visibility","hidden"))},circleX:function(t){return this.xx(t)},updateCircleY:function(t){var e=this;void 0===t&&(t=!1);const n=this,s=n.generateGetLinePoints(n.getShapeIndices(n.isLineType),t);return function(a,r){i(this,e);const o=a.id;return n.isGrouped(o)?s(a,r)[0][1]:n.getYScaleById(o,t)(n.getBaseValue(a))}.bind(this)},expandCircles:function(t,e,i){const n=this,a=n.pointExpandedR.bind(n);i&&n.unexpandCircles();const r=n.getShapeByIndex("circle",t,e).classed(gt.EXPANDED,!0),o=a(r)/n.config.point_r,c=1-o;n.isCirclePoint()?r.attr("r",a):r.each((function(){const t=(0,s.select)(this);if("circle"===this.tagName)t.attr("r",a);else{const e=this.getBBox(),i=e.width,n=e.height,s=c*(+t.attr("x")+i/2),a=c*(+t.attr("y")+n/2);t.attr("transform","translate("+s+" "+a+") scale("+o+")")}}))},unexpandCircles:function(t){const e=this,i=e.pointR.bind(e),n=e.getShapeByIndex("circle",t).filter((function(){return(0,s.select)(this).classed(gt.EXPANDED)})).classed(gt.EXPANDED,!1);if(n.attr("r",i),!e.isCirclePoint()){const t=i(n)/e.config.point_r;n.attr("transform",1!==t?"scale("+t+")":null)}},pointR:function(t){const e=this,i=e.config.point_r;let n=i;return e.isBubbleType(t)?n=e.getBubbleR(t):w(i)&&(n=i.bind(e.api)(t)),t.r=n,n},pointExpandedR:function(t){const e=this,i=e.config,n=e.isBubbleType(t)?1.15:1.75;return i.point_focus_expand_enabled?i.point_focus_expand_r||e.pointR(t)*n:e.pointR(t)},pointSelectR:function(t){const e=this.config.point_select_r;return w(e)?e(t):e||4*this.pointR(t)},isPointFocusOnly:function(){const t=this;return t.config.point_focus_only&&!t.hasType("bubble")&&!t.hasType("scatter")&&!t.hasArcType(null,["radar"])},isWithinCircle:function(t,e){const i=this.config,n=G(this.state.event,t),a=(0,s.select)(t),r=this.isCirclePoint(t)?"c":"",o="radius"===i.point_sensitivity?t.getAttribute("r"):i.point_sensitivity;let c=+a.attr(r+"x"),l=+a.attr(r+"y");if(!c&&!l&&1===t.nodeType){const e=Y(t);c=e.x,l=e.y}return Math.sqrt(Math.pow(c-n[0],2)+Math.pow(l-n[1],2))<(e||o)},getPointSensitivity:function(t){const e=this;let i=e.config.point_sensitivity;return w(i)?i=i.call(e.api,t):"radius"===i&&(i=t.r),i},insertPointInfoDefs:function(t,e){var n,a=this;const o=function(t,e){i(this,a);const n=t.attributes;for(let i,s=0;i=n[s];s++)i=i.name,e.setAttribute(i,t.getAttribute(i))}.bind(this),c=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement,l=r.createElementNS(s.namespaces.svg,c.nodeName.toLowerCase());if(l.id=e,l.style.fill="inherit",l.style.stroke="inherit",o(c,l),null!=(n=c.childNodes)&&n.length){const t=(0,s.select)(l);"innerHTML"in l?t.html(c.innerHTML):K(c.childNodes).forEach(function(e){i(this,a),o(e,t.append(e.tagName).node())}.bind(this))}this.$el.defs.node().appendChild(l)},pointFromDefs:function(t){return this.$el.defs.select("#"+t)},updatePointClass:function(t){const e=this,i=e.$el.circle;let n=!1;return(M(t)||i)&&(n=!0===t?i.each((function(t){let i=e.getClass("circle",!0)(t);this.getAttribute("class").indexOf(gt.EXPANDED)>-1&&(i+=" "+gt.EXPANDED),this.setAttribute("class",i)})):e.getClass("circle",!0)(t)),n},generateGetLinePoints:function(t,e){var n=this;const s=this,a=s.config,r=s.getShapeX(0,t,e),o=s.getShapeY(e),c=s.getShapeOffset(s.isLineType,t,e),l=s.getYScaleById.bind(s);return function(t,d){i(this,n);const u=l.call(s,t.id,e)(s.getShapeYMin(t.id)),h=c(t,d)||u,g=r(t);let f=o(t);a.axis_rotated&&(t.value>0&&f2?o-2:0),l=2;li&&(i=e),i}var kn={initPolar:function(){const t=this,e=t.$el.arcs,i=t.config,n=i.polar_level_text_show,s=i.polar_level_text_backgroundColor;e.levels=e.append("g").attr("class",Et),n&&s&&t.generateDataLabelBackgroundColorFilter(s)},getPolarOuterRadius:function(t,e){var i;const n=Sn(this);return(null!=(i=null==t?void 0:t.data.values[0].value)?i:0)/n*e},updateTargetsForPolar:function(t){this.updateTargetsForArc(t)},redrawPolar:function(){this.config.polar_level_show&&this.updatePolarLevel()},updatePolarLevel:function(){var t=this;const e=this,n=e.config,s=e.state,a=e.$el.arcs.levels,r=n.polar_level_depth,o=Sn(e),c=st(0,r),l=s.radius,d=c.map(function(e){return i(this,t),l*((e+1)/r)}.bind(this)),u=(n.polar_level_text_format||function(){}).bind(e.api),h=a.selectAll("."+Rt).data(c);h.exit().remove();const g=h.enter().append("g").attr("class",function(e,n){return i(this,t),Rt+" "+Rt+"-"+n}.bind(this));if(g.append("circle"),g.merge(h).selectAll("circle").style("visibility",n.polar_level_show?null:"hidden").attr("cx",0).attr("cy",0).attr("r",function(e){return i(this,t),d[e]}.bind(this)),n.polar_level_text_show){const a=n.polar_level_text_backgroundColor,r="#"+s.datetimeId+"-labels-bg"+e.getTargetSelectorSuffix(a);g.append("text").style("text-anchor","middle"),g.merge(h).selectAll("text").attr("dy",function(e){return i(this,t),5-d[e]}.bind(this)).attr("filter",a?"url("+r+")":null).text(function(e){return i(this,t),u(o/c.length*(e+1))}.bind(this))}}};const Cn=oe;var Rn={initRadar:function(){const t=this,e=t.config,i=t.state.current,n=t.$el;t.hasType("radar")&&(n.radar=n.main.select("."+gt.chart).append("g").attr("class",Ot.chartRadars),n.radar.levels=n.radar.append("g").attr("class",Et),n.radar.axes=n.radar.append("g").attr("class",xt.axis),n.radar.shapes=n.radar.append("g").attr("class",It.shapes),i.dataMax=e.radar_axis_max||t.getMinMaxData().max[0].value)},getRadarSize:function(){const t=this.config,e=this.state,i=e.arcWidth,n=e.arcHeight,s=t.axis_x_categories.length<4?-20:10,a=(Math.min(i,n)-s)/2;return[a,a]},updateTargetsForRadar:function(t){var e=this;const n=this.config;I(n.axis_x_categories)&&(n.axis_x_categories=st(0,nt("max",t.map(function(t){return i(this,e),t.values.length}.bind(this))))),this.generateRadarPoints()},getRadarPosition:function(t,e,n,s){var a=this;const r=this.config,o=this.getRadarSize(),c=o[0],l=o[1],d=r.axis_x_categories.length,u=r.radar_direction_clockwise,h=K(t).map(function(o){return i(this,a),function(t,e,i,n,s,a){const r=t&&n>0?i-n:n,o=2*Math.PI;return s*(1-a*("x"===e?Math.sin:Math.cos)(r*o/i))}(u,o,d,e,C(n)?n:"x"===t?c:l,S(s)?s:r.radar_size_ratio)}.bind(this));return 1===h.length?h[0]:h},generateRadarPoints:function(){var t=this;const e=this,n=e.data.targets,s=e.getRadarSize(),a=s[0],r=s[1],o=e.cache.get(Cn)||{},c=o._size;(!c||c.width!==a&&c.height!==r)&&(n.forEach(function(n){var s=this;i(this,t),o[n.id]=n.values.map(function(t,n){return i(this,s),e.getRadarPosition(["x","y"],n,void 0,e.getRatio("radar",t))}.bind(this))}.bind(this)),o._size={width:a,height:r},e.cache.add(Cn,o))},redrawRadar:function(){const t=this,e=t.$el,i=e.radar,n=e.main,s=t.getTranslate("radar");s&&(i.attr("transform",s),n.select("."+zt.chartTexts).attr("transform",s),t.generateRadarPoints(),t.updateRadarLevel(),t.updateRadarAxes(),t.updateRadarShape())},generateGetRadarPoints:function(){var t=this;const e=this.cache.get(Cn);return function(n,s){i(this,t);const a=e[n.id][s];return[a,a,a,a]}.bind(this)},updateRadarLevel:function(){var t=this;const e=this,n=e.config,s=e.state,a=e.$el.radar,r=e.getRadarSize(),o=r[0],c=r[1],l=n.radar_level_depth,d=n.axis_x_categories.length,u=n.radar_level_text_show,h=a.levels,g=st(0,l),f=n.radar_size_ratio*Math.min(o,c),p=g.map(function(e){return i(this,t),f*((e+1)/l)}.bind(this)),x=(n.radar_level_text_format||function(){}).bind(e.api),b=g.map(function(n){var s=this;i(this,t);const a=p[n];return st(0,d).map(function(t){return i(this,s),e.getRadarPosition(["x","y"],t,a,1).join(",")}.bind(this)).join(" ")}.bind(this)),m=h.selectAll("."+Rt).data(g);m.exit().remove();const _=m.enter().append("g").attr("class",function(e,n){return i(this,t),Rt+" "+Rt+"-"+n}.bind(this));_.append("polygon").style("visibility",n.radar_level_show?null:"hidden"),u&&(h.select("text").empty()&&h.append("text").attr("dx","-.5em").attr("dy","-.7em").style("text-anchor","end").text(function(){return i(this,t),x(0)}.bind(this)),_.append("text").attr("dx","-.5em").style("text-anchor","end").text(function(e){return i(this,t),x(s.current.dataMax/g.length*(e+1))}.bind(this))),_.merge(m).attr("transform",function(e){return i(this,t),"translate("+(o-p[e])+", "+(c-p[e])+")"}.bind(this)).selectAll("polygon").attr("points",function(e){return i(this,t),b[e]}.bind(this)),u&&h.selectAll("text").attr("x",function(e){return i(this,t),k(e)?o:b[e].split(",")[0]}.bind(this)).attr("y",function(e){return i(this,t),k(e)?c:0}.bind(this))},updateRadarAxes:function(){var t=this;const e=this,n=e.config,a=e.$el.radar,r=e.getRadarSize(),o=r[0],c=r[1],l=n.axis_x_categories;let d=a.axes.selectAll("g").data(l);d.exit().remove();const u=d.enter().append("g").attr("class",function(e,n){return i(this,t),xt.axis+"-"+n}.bind(this));if(n.radar_axis_line_show&&u.append("line"),n.radar_axis_text_show&&u.append("text"),d=u.merge(d),n.radar_axis_line_show&&d.select("line").attr("x1",o).attr("y1",c).attr("x2",function(n,s){return i(this,t),e.getRadarPosition("x",s)}.bind(this)).attr("y2",function(n,s){return i(this,t),e.getRadarPosition("y",s)}.bind(this)),n.radar_axis_text_show){const a=n.radar_axis_text_position,r=a.x,l=void 0===r?0:r,u=a.y,h=void 0===u?0:u;d.select("text").style("text-anchor","middle").attr("dy",".5em").call(function(e){i(this,t),e.each((function(t){N((0,s.select)(this),t+"",[-.6,1.2])}))}.bind(this)).datum(function(e,n){return i(this,t),{index:n}}.bind(this)).attr("transform",(function(t){k(this.width)&&(this.width=this.getBoundingClientRect().width/2);let i=e.getRadarPosition("x",t.index,void 0,1),n=Math.round(e.getRadarPosition("y",t.index,void 0,1));return i>o?i+=this.width+l:Math.round(i)c?(n/2===c&&"tspan"===this.firstChild.tagName&&this.firstChild.setAttribute("dy","0em"),n+=h):n=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Ln(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=Array(e);i=0,p=!i||i.indexOf(h)>=0,x=o.classed(Pt.SELECTED);o.classed(At.line)||o.classed(pt.area)||(t?f&&p&&l(r)&&!x?g(!0,o.classed(Pt.SELECTED,!0),r,h):C(n)&&n&&x&&g(!1,o.classed(Pt.SELECTED,!1),r,h):f&&p&&l(r)&&x&&g(!1,o.classed(Pt.SELECTED,!1),r,h))}))}var _s={selected:function(t){var e=this;const n=this.internal,a=[];return n.$el.main.selectAll("."+(It.shapes+n.getTargetSelectorSuffix(t))).selectAll("."+It.shape).filter((function(){return(0,s.select)(this).classed(Pt.SELECTED)})).each(function(t){return i(this,e),a.push(t)}.bind(this)),a},select:function(t,e,i){const n=this.internal;ms.bind(n)(!0,t,e,i)},unselect:function(t,e){const i=this.internal;ms.bind(i)(!1,t,e)}};const vs=function(t){var e=this;const n=this.internal,s=n.axis,a=n.brush,r=n.config,o=n.scale,c=o.x,l=o.subX,d=n.state;let u;if(r.subchart_show)if(u=t,Array.isArray(u)){s.isTimeSeries()&&(u=u.map(function(t){return i(this,e),ot.bind(n)(t)}.bind(this)));n.withinRange(u,n.getZoomDomain("subX",!0),n.getZoomDomain("subX"))&&(d.domain=u,a.move(a.getSelection(),u.map(l)))}else{var h;u=null!=(h=d.domain)?h:c.orgDomain()}return u};Z(vs,{show:function(){const t=this.internal,e=t.$el.subchart,i=t.config,n=i.subchart_show;if(!n){var s,a;t.unbindZoomEvent(),i.subchart_show=!n,e.main||t.initSubchart();let o=e.main.selectAll("."+gt.target);var r;if(t.data.targets.length!==o.size())t.updateSizes(),t.updateTargetsForSubchart(t.data.targets),o=null==(r=e.main)?void 0:r.selectAll("."+gt.target);null==(s=o)||s.style("opacity",null),null==(a=e.main)||a.style("display",null),this.resize()}},hide:function(){const t=this.internal,e=t.$el.subchart.main,i=t.config;i.subchart_show&&"none"!==(null==e?void 0:e.style("display"))&&(i.subchart_show=!1,e.style("display","none"),this.resize())},toggle:function(){const t=this.internal.config;this.subchart[t.subchart_show?"hide":"show"]()},reset:function(){const t=this.internal.brush;t.clear(t.getSelection())}});var ys={subchart:vs},Ts=p(14);const ws=function(t){var e,n=this;const s=this.internal,a=s.$el,r=s.axis,o=s.config,c=s.org,l=s.scale,d=s.state,u=o.axis_rotated,h=r.isCategorized();let g;if(o.zoom_enabled)if(g=t,Array.isArray(g)){r.isTimeSeries()&&(g=g.map(function(t){return i(this,n),ot.bind(s)(t)}.bind(this)));if(s.withinRange(g,s.getZoomDomain("zoom",!0),s.getZoomDomain("zoom"))){if(d.domain=g,h&&(g=g.map(function(t,e){return i(this,n),+t+(0===e?0:1)}.bind(this))),s.api.tooltip.hide(),o.subchart_show){const t=l.zoom||l.x;s.brush.getSelection().call(s.brush.move,g.map(t))}else{var f;const t=h?l.x.orgScale():c.xScale||l.x,e=[-t(g[0]),0],i=(f=Ts.zoomIdentity.scale(t.range()[1]/(t(g[1])-t(g[0])))).translate.apply(f,u?e.reverse():e);a.eventRect.call(s.zoom.transform,i)}s.setZoomResetButton()}}else g=s.zoom.getDomain();return null!=(e=d.domain)?e:g};Z(ws,{enable:function(t){const e=this.internal,i=e.config;/^(drag|wheel)$/.test(t)&&(i.zoom_type=t),i.zoom_enabled=!!t,e.zoom?!1===t&&e.bindZoomEvent(!1):(e.initZoom(),e.bindZoomEvent()),e.updateAndRedraw()},max:function(t){const e=this.internal,i=e.config,n=e.org.xDomain;return(0===t||t)&&(i.zoom_x_max=nt("max",[n[1],t])),i.zoom_x_max},min:function(t){const e=this.internal,i=e.config,n=e.org.xDomain;return(0===t||t)&&(i.zoom_x_min=nt("min",[n[0],t])),i.zoom_x_min},range:function(t){const e=this.zoom;if(M(t)){const i=t.min,n=t.max;C(i)&&e.min(i),C(n)&&e.max(n)}return{min:e.min(),max:e.max()}}});var As={zoom:ws,unzoom:function(){const t=this.internal,e=t.config,i=t.$el,n=i.eventRect,s=i.zoomResetBtn,a=t.state;t.scale.zoom&&(e.subchart_show?t.brush.getSelection().call(t.brush.move,null):t.zoom.updateTransformScale(Ts.zoomIdentity),t.updateZoom(!0),null==s||s.style("display","none"),(0,Ts.zoomTransform)(n.node())!==Ts.zoomIdentity&&t.zoom.transform(n,Ts.zoomIdentity),a.domain=void 0)}},Ss={drag:function(t){var e=this;const n=this,a=n.config,r=n.state,o=n.$el.main,c=a.data_selection_grouped,l=a.interaction_enabled&&a.data_selection_isselectable;if(n.hasArcType()||!a.data_selection_enabled||a.zoom_enabled&&!n.zoom.altDomain||!a.data_selection_multiple)return;const d=r.dragStart||[0,0],u=d[0],h=d[1],g=t[0],f=t[1],p=Math.min(u,g),x=Math.max(u,g),b=c?r.margin.top:Math.min(h,f),m=c?r.height:Math.max(h,f);o.select("."+yt.dragarea).attr("x",p).attr("y",b).attr("width",x-p).attr("height",m-b),o.selectAll("."+It.shapes).selectAll("."+It.shape).filter(function(t){return i(this,e),null==l?void 0:l.bind(n.api)(t)}.bind(this)).each((function(t,e){const i=(0,s.select)(this),a=i.classed(Pt.SELECTED),r=i.classed(yt.INCLUDED);let o,c=!1;if(i.classed(_t.circle)){const t=1*+i.attr("cx"),e=1*+i.attr("cy");o=n.togglePoint,c=p0?a:e]}.bind(this))),c&&r[1].reverse(),this.extent(r),this.update()},e.brush.getSelection=function(){return i(this,t),r.main?r.main.select("."+Ft.brush):(0,s.select)([])}.bind(this)},initSubchart:function(){var t=this;const e=this,n=e.config,s=e.state,a=s.clip,r=s.hasAxis,o=e.$el,c=o.defs,l=o.svg,d=o.subchart,u=o.axis;if(!r)return;const h=n.subchart_show?null:"hidden",g=a.id+"-subchart",f=e.getClipPath(g);a.idSubchart=g,e.appendClip(c,g),e.initBrush(),d.main=l.append("g").classed(Ft.subchart,!0).attr("transform",e.getTranslate("context"));const p=d.main;p.style("visibility",h),p.append("g").attr("clip-path",f).attr("class",Ft.chart),["bar","line","bubble","candlestick","scatter"].forEach(function(n){i(this,t);const s=q(/^(bubble|scatter)$/.test(n)?"circle":n);if(e.hasType(n)||e.hasTypeOf(s)){const t=p.select("."+Ft.chart),e=Ft["chart"+s+"s"];t.select("."+e).empty()&&t.append("g").attr("class",e)}}.bind(this));const x=p.append("g").attr("clip-path",f).attr("class",Ft.brush).call(e.brush);n.subchart_showHandle&&e.addBrushHandle(x),u.subX=p.append("g").attr("class",Ft.axisX).attr("transform",e.getTranslate("subX")).attr("clip-path",n.axis_rotated?"":a.pathXAxis).style("visibility",n.subchart_axis_x_show?h:"hidden")},addBrushHandle:function(t){var e=this;const n=this.config,s=n.axis_rotated,a=n.subchart_init_range,r=s?["M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z","M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"]:["M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z","M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"];this.brush.handle=t.selectAll(".handle--custom").data(s?[{type:"n"},{type:"s"}]:[{type:"w"},{type:"e"}]).enter().append("path").attr("class","handle--custom").attr("cursor",(s?"ns":"ew")+"-resize").attr("d",function(t){return i(this,e),r[+/[se]/.test(t.type)]}.bind(this)).attr("display",a?null:"none")},updateTargetsForSubchart:function(t){var e=this;const n=this,s=n.config,a=n.state,r=n.$el.subchart.main;s.subchart_show&&(["bar","line","bubble","candlestick","scatter"].filter(function(t){return i(this,e),n.hasType(t)||n.hasTypeOf(q(t))}.bind(this)).forEach(function(s){i(this,e);const a=/^(bubble|scatter)$/.test(s),o=q(a?"circle":s),c=n.getChartClass(o,!0),l=n.getClass(a?"circles":s+"s",!0),d=r.select("."+Ft["chart"+o+"s"]);if(a){const e=d.selectAll("."+Ft.circles).data(t.filter(n["is"+q(s)+"Type"].bind(n))).attr("class",l);e.exit().remove(),e.enter().append("g").attr("class",l)}else{const e=d.selectAll("."+Ft["chart"+o]).attr("class",c).data(t.filter(n["is"+o+"Type"].bind(n))),i=e.enter().append("g").style("opacity","0").attr("class",c).append("g").attr("class",l);e.exit().remove(),"line"===s&&n.hasTypeOf("Area")&&i.append("g").attr("class",n.getClass("areas",!0))}}.bind(this)),r.selectAll("."+Ft.brush+" rect").attr(s.axis_rotated?"width":"height",s.axis_rotated?a.width2:a.height2))},redrawSubchart:function(t,e,n){var s=this;const a=this,r=a.config,o=a.$el.subchart.main,c=a.state,l=!!e;var d;if((o.style("visibility",r.subchart_show?null:"hidden"),r.subchart_show)&&("zoom"===(null==(d=c.event)?void 0:d.type)&&a.brush.update(),t)){const t=r.subchart_init_range;if(W(a)||a.brush.update(),Object.keys(n.type).forEach(function(t){i(this,s);const e=q(t),r=a["generateDraw"+e](n.indices[t],!0);a["update"+e](l,!0),a["redraw"+e](r,l,!0)}.bind(this)),a.hasType("bubble")||a.hasType("scatter")){const t=n.pos.cx,e=a.updateCircleY(!0);a.updateCircle(!0),a.redrawCircle(t,e,l,void 0,!0)}!c.rendered&&t&&(c.domain=t,a.brush.move(a.brush.getSelection(),t.map(a.scale.x)))}},redrawForBrush:function(t){var e;void 0===t&&(t=!0);const i=this,n=i.config,s=n.subchart_onbrush,a=n.zoom_rescale,r=i.scale,o=i.state;i.redraw({withTransition:!1,withY:a,withSubchart:!1,withUpdateXDomain:!0,withDimension:!1}),t&&o.rendered&&s.bind(i.api)(null!=(e=o.domain)?e:r.x.orgDomain())},transformContext:function(t,e){const i=this,n=i.$el.subchart,s=i.$T,a=null!=e&&e.axisSubX?e.axisSubX:s(n.main.select("."+Ft.axisX),t);n.main.attr("transform",i.getTranslate("context")),a.attr("transform",i.getTranslate("subX"))},getExtent:function(){var t=this;const e=this,n=e.config,s=e.scale;let a=n.axis_x_extent;if(a)if(w(a))a=a.bind(e.api)(e.getXDomain(e.data.targets),s.subX);else if(e.axis.isTimeSeries()&&a.every(isNaN)){const n=ot.bind(e);a=a.map(function(e){return i(this,t),s.subX(n(e))}.bind(this))}return a}},Os={initZoom:function(){const t=this;t.scale.zoom=null,t.generateZoom(),t.initZoomBehaviour()},bindZoomEvent:function(t){void 0===t&&(t=!0);const e=this,i=e.config;i.zoom_enabled&&t?i.subchart_show||e.bindZoomOnEventRect():!1===t&&(e.api.unzoom(),e.unbindZoomEvent())},generateZoom:function(){var t=this;const e=this,n=e.config,s=e.org,a=e.scale,r=(0,Ts.zoom)().duration(0).on("start",e.onZoomStart.bind(e)).on("zoom",e.onZoom.bind(e)).on("end",e.onZoomEnd.bind(e));r.orgScaleExtent=function(){i(this,t);const s=n.zoom_extent||[1,10];return[s[0],Math.max(e.getMaxDataCount()/s[1],s[1])]}.bind(this),r.updateScaleExtent=function(){const t=L(e.scale.x.orgDomain())/L(e.getZoomDomain()),i=this.orgScaleExtent();return this.scaleExtent([i[0]*t,i[1]*t]),this},r.updateTransformScale=function(r,o){var c;i(this,t);const l=n.axis_rotated;null==(c=s.xScale)||c.range(a.x.range());const d=r[l?"rescaleY":"rescaleX"](s.xScale||a.x),u=e.trimXDomain(d.domain()),h=n.zoom_rescale;if(d.domain(u,s.xDomain),o){const t=d(a.x.domain()[0]),i=l?r.x:t,n=l?t:r.y;e.$el.eventRect.property("__zoom",Ts.zoomIdentity.translate(i,n).scale(r.k))}e.state.xTickOffset||(e.state.xTickOffset=e.axis.x.tickOffset()),a.zoom=e.getCustomizedXScale(d),e.axis.x.scale(a.zoom),h&&(s.xScale||(s.xScale=a.x.copy()),a.x.domain(u))}.bind(this),r.getDomain=function(){i(this,t);const n=a[a.zoom?"zoom":"subX"].domain();return e.axis.isCategorized()&&(n[1]-=2),n}.bind(this),e.zoom=r},onZoomStart:function(t){const e=this,i=t.sourceEvent;i&&(e.zoom.startEvent=i,e.state.zooming=!0,$(e.config.zoom_onzoomstart,e.api,t))},onZoom:function(t){var e,n=this;const s=this,a=s.config,r=s.scale,o=s.state,c=s.org,l=t.sourceEvent,d=(null==t?void 0:t.transform)===Ts.zoomIdentity;if(!a.zoom_enabled||0===s.filterTargetsToShow(s.data.targets).length||!r.zoom&&(null==l?void 0:l.type.indexOf("touch"))>-1&&1===(null==l?void 0:l.touches.length))return;t.sourceEvent&&(o.zooming=!0,o.domain=void 0);const u="mousemove"===(null==l?void 0:l.type),h=(null==l?void 0:l.wheelDelta)<0,g=t.transform;!u&&h&&r.x.domain().every(function(t,e){return i(this,n),t!==c.xDomain[e]}.bind(this))&&r.x.domain(c.xDomain),s.zoom.updateTransformScale(g,"wheel"===a.zoom_type&&l);const f=a.transition_duration>0&&!a.subchart_show&&(o.dragging||d||!t.sourceEvent);s.redraw({withTransition:f,withY:a.zoom_rescale,withSubchart:!1,withEventRect:!1,withDimension:!1}),s.state.cancelClick=u,d||$(a.zoom_onzoom,s.api,null!=(e=s.state.domain)?e:s.zoom.getDomain())},onZoomEnd:function(t){var e,i;const n=this,s=n.config,a=n.state;let r=n.zoom.startEvent,o=null==t?void 0:t.sourceEvent;const c=(null==t?void 0:t.transform)===Ts.zoomIdentity;var l;(null==(e=r)?void 0:e.type.indexOf("touch"))>-1&&(r=r.changedTouches[0],o=null==(l=o)||null==(l=l.changedTouches)?void 0:l[0]);"drag"===s.zoom_type&&o&&r.clientX===o.clientX&&r.clientY===o.clientY||(n.redrawEventRect(),n.updateZoom(),a.zooming=!1,!c&&(o||a.dragging)&&$(s.zoom_onzoomend,n.api,null!=(i=n.state.domain)?i:n.zoom.getDomain()))},updateZoom:function(t){const e=this,i=e.scale,n=i.subX,s=i.x,a=i.zoom;if(a){const i=a.domain(),r=n.domain(),o=.015,c=e.config.axis_x_inverted?(i[0]>=r[0]||i[0]+o>=r[0])&&(r[1]>=i[1]||r[1]>=i[1]+o):(i[0]<=r[0]||i[0]-o<=r[0])&&(r[1]<=i[1]||r[1]<=i[1]-o);(t||c)&&(e.axis.x.scale(n),s.domain(n.orgDomain()),e.scale.zoom=null)}},bindZoomOnEventRect:function(){var t=this;const e=this,n=e.config,s=e.$el.eventRect,a="drag"===n.zoom_type?e.zoomBehaviour:e.zoom;e.$el.svg.on("wheel",function(){i(this,t)}.bind(this)),null==s||s.call(a).on("dblclick.zoom",null)},initZoomBehaviour:function(){var t=this;const e=this,n=e.config,s=e.state,a=n.axis_rotated;let r,o=0,c=0;const l={axis:a?"y":"x",attr:a?"height":"width",index:a?1:0};e.zoomBehaviour=(0,Ee.drag)().clickDistance(4).on("start",(function(t){s.event=t,e.setDragStatus(!0),e.unselectRect(),r||(r=e.$el.main.append("rect").attr("clip-path",s.clip.path).attr("class",$t.zoomBrush).attr("width",a?s.width:0).attr("height",a?0:s.height)),o=G(t,this)[l.index],c=o,r.attr(l.axis,o).attr(l.attr,0),e.onZoomStart(t)})).on("drag",(function(t){c=G(t,this)[l.index],r.attr(l.axis,Math.min(o,c)).attr(l.attr,Math.abs(c-o))})).on("end",function(n){var a=this;i(this,t);const d=e.scale.zoom||e.scale.x;if(s.event=n,r.attr(l.axis,0).attr(l.attr,0),o>c){var u=[c,o];o=u[0],c=u[1]}o<0&&(c+=Math.abs(o),o=0),o!==c&&e.api.zoom([o,c].map(function(t){return i(this,a),d.invert(t)}.bind(this))),e.setDragStatus(!1)}.bind(this))},setZoomResetButton:function(){const t=this,e=t.config,i=t.$el,n=e.zoom_resetButton;n&&"drag"===e.zoom_type&&(i.zoomResetBtn?i.zoomResetBtn.style("display",null):i.zoomResetBtn=t.$el.chart.append("div").classed(gt.button,!0).append("span").on("click",(function(){w(n.onclick)&&n.onclick.bind(t.api)(this),t.api.unzoom()})).classed($t.buttonZoomReset,!0).text(n.text||"Reset Zoom"))}},Ls=void 0,Ps={data_selection_enabled:!1,data_selection_grouped:!1,data_selection_isselectable:function(){return i(this,Ls),!0}.bind(void 0),data_selection_multiple:!0,data_selection_draggable:!1,data_onselected:function(){i(this,Ls)}.bind(void 0),data_onunselected:function(){i(this,Ls)}.bind(void 0)},Is={subchart_show:!1,subchart_showHandle:!1,subchart_size_height:60,subchart_axis_x_show:!0,subchart_axis_x_tick_show:!0,subchart_axis_x_tick_format:void 0,subchart_axis_x_tick_text_show:!0,subchart_init_range:void 0,subchart_onbrush:function(){i(this,undefined)}.bind(void 0)},Ds={zoom_enabled:!1,zoom_type:"wheel",zoom_extent:void 0,zoom_privileged:!1,zoom_rescale:!1,zoom_onzoom:void 0,zoom_onzoomstart:void 0,zoom_onzoomend:void 0,zoom_resetButton:!0,zoom_x_min:void 0,zoom_x_max:void 0},zs=void 0;let Ms=function(){var t=this;return i(this,zs),Z(si.prototype,Rs),Z(vi.prototype,_s),te.setOptions([Ps]),(Ms=function(){return i(this,t),!0}.bind(this))()}.bind(void 0),Xs=function(){var t=this;return i(this,zs),Z(si.prototype,Es),Z(vi.prototype,ys),te.setOptions([Is]),(Xs=function(){return i(this,t),!0}.bind(this))()}.bind(void 0),$s=function(){var t=this;return i(this,zs),Z(si.prototype,Os),Z(vi.prototype,As),te.setOptions([Ds]),($s=function(){return i(this,t),!0}.bind(this))()}.bind(void 0),Fs={};const Bs={version:"3.10.3",generate:function(t){const e=et({},Fs,t),i=new vi(e);return i.internal.charts=this.instance,this.instance.push(i),i},defaults:function(t){return M(t)&&(Fs=t),Fs},instance:[],plugin:{}};var Ns=void 0;Object.keys(t).forEach(function(e){return i(this,Ns),t[e]()}.bind(void 0)),Object.keys(e).forEach(function(t){return i(this,Ns),e[t]()}.bind(void 0))}(),x}()})); \ No newline at end of file diff --git a/org.idempiere.zk.billboard/src/web/js/zul/billboard/ext/billboard.src.js b/org.idempiere.zk.billboard/src/web/js/zul/billboard/ext/billboard.src.js index b5f64f1484..fdb167980c 100644 --- a/org.idempiere.zk.billboard/src/web/js/zul/billboard/ext/billboard.src.js +++ b/org.idempiere.zk.billboard/src/web/js/zul/billboard/ext/billboard.src.js @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.0 + * @version 3.10.3 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') @@ -218,7 +218,6 @@ var external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format var external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_ = __webpack_require__(2); ;// CONCATENATED MODULE: ./src/module/browser.ts -var _this = undefined; /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license @@ -229,26 +228,43 @@ var _this = undefined; */ /* eslint-disable no-new-func, no-undef */ -var win = function () { - _newArrowCheck(this, _this); - var root = typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self; - return root || Function("return this")(); - }.bind(undefined)(), - hasRAF = typeof win.requestAnimationFrame === "function", - hasRIC = typeof win.requestIdleCallback === "function", - requestAnimationFrame = hasRAF ? win.requestAnimationFrame : function (cb) { - _newArrowCheck(this, _this); - return setTimeout(cb, 1); - }.bind(undefined), - cancelAnimationFrame = hasRAF ? win.cancelAnimationFrame : function (id) { - _newArrowCheck(this, _this); - return clearTimeout(id); - }.bind(undefined), - requestIdleCallback = hasRIC ? win.requestIdleCallback : requestAnimationFrame, - cancelIdleCallback = hasRIC ? win.cancelIdleCallback : cancelAnimationFrame, - browser_doc = win == null ? void 0 : win.document; -/* eslint-enable no-new-func, no-undef */ -// fallback for non-supported environments + +/** + * Get global object + * @returns {object} window object + * @private + */ +function getGlobal() { + return typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self || Function("return this")(); +} + +/** + * Get fallback object + * @param {object} w global object + * @returns {Array} fallback object array + * @private + */ +function getFallback(w) { + var _this = this; + const hasRAF = typeof (w == null ? void 0 : w.requestAnimationFrame) === "function" && typeof (w == null ? void 0 : w.cancelAnimationFrame) === "function", + hasRIC = typeof (w == null ? void 0 : w.requestIdleCallback) === "function" && typeof (w == null ? void 0 : w.cancelIdleCallback) === "function", + request = function (cb) { + _newArrowCheck(this, _this); + return setTimeout(cb, 1); + }.bind(this), + cancel = function (id) { + _newArrowCheck(this, _this); + return clearTimeout(id); + }.bind(this); + return [hasRAF ? w.requestAnimationFrame : request, hasRAF ? w.cancelAnimationFrame : cancel, hasRIC ? w.requestIdleCallback : request, hasRIC ? w.cancelIdleCallback : cancel]; +} +const win = getGlobal(), + browser_doc = win == null ? void 0 : win.document, + _getFallback = getFallback(win), + requestAnimationFrame = _getFallback[0], + cancelAnimationFrame = _getFallback[1], + requestIdleCallback = _getFallback[2], + cancelIdleCallback = _getFallback[3]; ;// CONCATENATED MODULE: ./src/config/const.ts /** * Copyright (c) 2017 ~ present NAVER Corp. @@ -258,7 +274,7 @@ var win = function () { * Chart type constant * @private */ -var TYPE = { +const TYPE = { AREA: "area", AREA_LINE_RANGE: "area-line-range", AREA_SPLINE: "area-spline", @@ -283,7 +299,7 @@ var TYPE = { * Chart type module and its method from ChartInternal class, needed to be initialized. * @private */ -var TYPE_METHOD_NEEDED = { +const TYPE_METHOD_NEEDED = { AREA: "initArea", AREA_LINE_RANGE: "initArea", AREA_SPLINE: "initArea", @@ -308,7 +324,7 @@ var TYPE_METHOD_NEEDED = { * chart types by category * @private */ -var TYPE_BY_CATEGORY = { +const TYPE_BY_CATEGORY = { Area: [TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.AREA_STEP], AreaRange: [TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE], Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.POLAR, TYPE.RADAR], @@ -317,14 +333,14 @@ var TYPE_BY_CATEGORY = { Spline: [TYPE.SPLINE, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE] }; ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js -function _typeof(obj) { +function _typeof(o) { "@babel/helpers - typeof"; - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { - return typeof obj; - } : function (obj) { - return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }, _typeof(obj); + return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; + }, _typeof(o); } ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js @@ -366,9 +382,9 @@ var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webp ;// CONCATENATED MODULE: ./src/module/util.ts -var util_this = undefined; -function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +var _this = undefined; +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license @@ -378,64 +394,64 @@ function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i -var isValue = function (v) { - _newArrowCheck(this, util_this); +const isValue = function (v) { + _newArrowCheck(this, _this); return v || v === 0; }.bind(undefined), isFunction = function (v) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return typeof v === "function"; }.bind(undefined), isString = function (v) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return typeof v === "string"; }.bind(undefined), isNumber = function (v) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return typeof v === "number"; }.bind(undefined), isUndefined = function (v) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return typeof v === "undefined"; }.bind(undefined), isDefined = function (v) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return typeof v !== "undefined"; }.bind(undefined), isboolean = function (v) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return typeof v === "boolean"; }.bind(undefined), ceil10 = function (v) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return Math.ceil(v / 10) * 10; }.bind(undefined), asHalfPixel = function (n) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return Math.ceil(n) + .5; }.bind(undefined), diffDomain = function (d) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return d[1] - d[0]; }.bind(undefined), isObjectType = function (v) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return typeof v === "object"; }.bind(undefined), isEmpty = function (o) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && Object.keys(o).length === 0 || isNumber(o) && isNaN(o); }.bind(undefined), notEmpty = function (o) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return !isEmpty(o); }.bind(undefined), isArray = function (arr) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return Array.isArray(arr); }.bind(undefined), isObject = function (obj) { - _newArrowCheck(this, util_this); + _newArrowCheck(this, _this); return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj); }.bind(undefined); /** @@ -471,8 +487,8 @@ function getOption(options, key, defaultValue) { * @private */ function hasValue(dict, value) { - var _this2 = this, - found = !1; + var _this2 = this; + let found = !1; Object.keys(dict).forEach(function (key) { _newArrowCheck(this, _this2); return dict[key] === value && (found = !0); @@ -489,7 +505,7 @@ function hasValue(dict, value) { * @private */ function callFn(fn, thisArg) { - var isFn = isFunction(fn); + const isFn = isFunction(fn); for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } @@ -504,14 +520,15 @@ function callFn(fn, thisArg) { * @private */ function endall(transition, cb) { - var _this3 = this, - n = 0, - end = function () { - for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { - args[_key2] = arguments[_key2]; - } - --n || cb.apply.apply(cb, [this].concat(args)); - }; + var _this3 = this; + let n = 0; + const end = function () { + for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + --n || cb.apply.apply(cb, [this].concat(args)); + }; + // if is transition selection if ("duration" in transition) { transition.each(function () { @@ -530,8 +547,8 @@ function endall(transition, cb) { * @returns {string} * @private */ -function sanitise(str) { - return isString(str) ? str.replace(//g, ">") : str; +function sanitize(str) { + return isString(str) ? str.replace(/<(script|img)?/ig, "<").replace(/(script)?>/ig, ">") : str; } /** @@ -556,12 +573,12 @@ function setTextValue(node, text, dy, toMiddle) { if (text.indexOf("\n") === -1) { node.text(text); } else { - var diff = [node.text(), text].map(function (v) { + const diff = [node.text(), text].map(function (v) { _newArrowCheck(this, _this4); return v.replace(/[\s\n]/g, ""); }.bind(this)); if (diff[0] !== diff[1]) { - var multiline = text.split("\n"), + const multiline = text.split("\n"), len = toMiddle ? multiline.length - 1 : 1; // reset possible text node.html(""); @@ -587,7 +604,7 @@ function getRectSegList(path) { * | | * seg0 ---------- seg3 * */ - var _path$getBBox = path.getBBox(), + const _path$getBBox = path.getBBox(), x = _path$getBBox.x, y = _path$getBBox.y, width = _path$getBBox.width, @@ -621,7 +638,7 @@ function getRectSegList(path) { * @private */ function getPathBox(path) { - var _path$getBoundingClie = path.getBoundingClientRect(), + const _path$getBoundingClie = path.getBoundingClientRect(), width = _path$getBoundingClie.width, height = _path$getBoundingClie.height, items = getRectSegList(path), @@ -644,9 +661,12 @@ function getPathBox(path) { */ function getPointer(event, element) { var _ref, - touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]), - pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element), _this5 = this; + const touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]); + let pointer = [0, 0]; + try { + pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element); + } catch (e) {} return pointer.map(function (v) { _newArrowCheck(this, _this5); return isNaN(v) ? 0 : v; @@ -660,10 +680,10 @@ function getPointer(event, element) { * @private */ function getBrushSelection(ctx) { - var event = ctx.event, + const event = ctx.event, $el = ctx.$el, main = $el.subchart.main || $el.main; - var selection; + let selection; // check from event if (event && event.type === "brush") { @@ -683,7 +703,7 @@ function getBrushSelection(ctx) { * @private */ function getBoundingRect(node) { - var needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width"); + const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +node.getAttribute("width"); return needEvaluate ? node.rect = node.getBoundingClientRect() : node.rect; } @@ -705,7 +725,7 @@ function getRandom(asStr, min, max) { if (max === void 0) { max = 1e4; } - var crpt = win.crypto || win.msCrypto, + const crpt = win.crypto || win.msCrypto, rand = crpt ? min + crpt.getRandomValues(new Uint32Array(1))[0] % (max - min + 1) : Math.floor(Math.random() * (max - min) + min); return asStr ? rand + "" : rand; } @@ -724,8 +744,8 @@ function findIndex(arr, v, start, end, isRotated) { if (start > end) { return -1; } - var mid = Math.floor((start + end) / 2); - var _arr$mid = arr[mid], + const mid = Math.floor((start + end) / 2); + let _arr$mid = arr[mid], x = _arr$mid.x, _arr$mid$w = _arr$mid.w, w = _arr$mid$w === void 0 ? 0 : _arr$mid$w; @@ -746,7 +766,7 @@ function findIndex(arr, v, start, end, isRotated) { * @private */ function brushEmpty(ctx) { - var selection = getBrushSelection(ctx); + const selection = getBrushSelection(ctx); if (selection) { // brush selected area // two-dimensional: [[x0, y0], [x1, y1]] @@ -763,17 +783,19 @@ function brushEmpty(ctx) { * @private */ function deepClone() { - for (var _this6 = this, _clone = function clone(v) { - _newArrowCheck(this, _this6); - if (isObject(v) && v.constructor) { - var r = new v.constructor(); - for (var k in v) { - r[k] = _clone(v[k]); - } - return r; + var _this6 = this; + const _clone = function clone(v) { + _newArrowCheck(this, _this6); + if (isObject(v) && v.constructor) { + const r = new v.constructor(); + for (const k in v) { + r[k] = _clone(v[k]); } - return v; - }.bind(this), _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + return r; + } + return v; + }.bind(this); + for (var _len3 = arguments.length, objectN = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { objectN[_key3] = arguments[_key3]; } return objectN.map(function (v) { @@ -805,7 +827,7 @@ function extend(target, source) { } // exclude name with only numbers - for (var p in source) { + for (const p in source) { if (/^\d+$/.test(p) || p in target) { continue; } @@ -820,8 +842,8 @@ function extend(target, source) { * @returns {string} capitalized string * @private */ -var capitalize = function (str) { - _newArrowCheck(this, util_this); +const capitalize = function (str) { + _newArrowCheck(this, _this); return str.charAt(0).toUpperCase() + str.slice(1); }.bind(undefined); @@ -849,8 +871,8 @@ function camelize(str, separator) { * @returns {Array} * @private */ -var toArray = function (v) { - _newArrowCheck(this, util_this); +const toArray = function (v) { + _newArrowCheck(this, _this); return [].slice.call(v); }.bind(undefined); @@ -863,8 +885,8 @@ var toArray = function (v) { * @private */ function addCssRules(style, selector, prop) { - var _this9 = this, - rootSelctor = style.rootSelctor, + var _this9 = this; + const rootSelctor = style.rootSelctor, sheet = style.sheet, getSelector = function (s) { _newArrowCheck(this, _this9); @@ -881,8 +903,8 @@ function addCssRules(style, selector, prop) { * @private */ function getCssRules(styleSheets) { - var _this10 = this, - rules = []; + var _this10 = this; + let rules = []; styleSheets.forEach(function (sheet) { _newArrowCheck(this, _this10); try { @@ -891,7 +913,7 @@ function getCssRules(styleSheets) { } } catch (e) { var _window$console; - (_window$console = win.console) == null ? void 0 : _window$console.warn("Error while reading rules from " + sheet.href + ": " + e.toString()); + (_window$console = win.console) == null || _window$console.warn("Error while reading rules from " + sheet.href + ": " + e.toString()); } }.bind(this)); return rules; @@ -904,7 +926,7 @@ function getCssRules(styleSheets) { * @private */ function getTranslation(node) { - var transform = node ? node.transform : null, + const transform = node ? node.transform : null, baseVal = transform && transform.baseVal; return baseVal && baseVal.numberOfItems ? baseVal.getItem(0).matrix : { a: 0, @@ -923,8 +945,8 @@ function getTranslation(node) { * @private */ function getUnique(data) { - var _this11 = this, - isDate = data[0] instanceof Date, + var _this11 = this; + const isDate = data[0] instanceof Date, d = (isDate ? data.map(Number) : data).filter(function (v, i, self) { _newArrowCheck(this, _this11); return self.indexOf(v) === i; @@ -963,11 +985,11 @@ function mergeObj(target) { if (!objectN.length || objectN.length === 1 && !objectN[0]) { return target; } - var source = objectN.shift(); + const source = objectN.shift(); if (isObject(target) && isObject(source)) { Object.keys(source).forEach(function (key) { _newArrowCheck(this, _this13); - var value = source[key]; + const value = source[key]; if (isObject(value)) { target[key] || (target[key] = {}); target[key] = mergeObj(target[key], value); @@ -991,7 +1013,7 @@ function sortValue(data, isAsc) { if (isAsc === void 0) { isAsc = !0; } - var fn; + let fn; if (data[0] instanceof Date) { fn = isAsc ? function (a, b) { _newArrowCheck(this, _this14); @@ -1024,11 +1046,11 @@ function sortValue(data, isAsc) { * @private */ function getMinMax(type, data) { - var _this15 = this, - res = data.filter(function (v) { - _newArrowCheck(this, _this15); - return notEmpty(v); - }.bind(this)); + var _this15 = this; + let res = data.filter(function (v) { + _newArrowCheck(this, _this15); + return notEmpty(v); + }.bind(this)); if (res.length) { if (isNumber(res[0])) { res = Math[type].apply(Math, res); @@ -1049,14 +1071,14 @@ function getMinMax(type, data) { * @returns {Array} * @private */ -var getRange = function (start, end, step) { +const getRange = function (start, end, step) { if (step === void 0) { step = 1; } - _newArrowCheck(this, util_this); - var res = [], + _newArrowCheck(this, _this); + const res = [], n = Math.max(0, Math.ceil((end - start) / step)) | 0; - for (var i = start; i < n; i++) { + for (let i = start; i < n; i++) { res.push(start + i * step); } return res; @@ -1064,8 +1086,8 @@ var getRange = function (start, end, step) { emulateEvent = { mouse: function () { var _this16 = this; - _newArrowCheck(this, util_this); - var getParams = function () { + _newArrowCheck(this, _this); + const getParams = function () { _newArrowCheck(this, _this16); return { bubbles: !1, @@ -1093,7 +1115,7 @@ var getRange = function (start, end, step) { params = getParams(); } _newArrowCheck(this, _this16); - var mouseEvent = browser_doc.createEvent("MouseEvent"); + const mouseEvent = browser_doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, @@ -1104,8 +1126,8 @@ var getRange = function (start, end, step) { } }.bind(undefined)(), touch: function touch(el, eventType, params) { - _newArrowCheck(this, util_this); - var touchObj = new Touch(mergeObj({ + _newArrowCheck(this, _this); + const touchObj = new Touch(mergeObj({ identifier: Date.now(), target: el, radiusX: 2.5, @@ -1131,8 +1153,8 @@ var getRange = function (start, end, step) { * @private */ function tplProcess(tpl, data) { - var res = tpl; - for (var x in data) { + let res = tpl; + for (const x in data) { res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]); } return res; @@ -1146,13 +1168,14 @@ function tplProcess(tpl, data) { * @private */ function parseDate(date) { - var parsedDate; + let parsedDate; if (date instanceof Date) { parsedDate = date; } else if (isString(date)) { - var _format$dataTime, - config = this.config, + var _format$dataTime; + const config = this.config, format = this.format; + // if fails to parse, try by new Date() // https://github.com/naver/billboard.js/issues/1714 parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date); @@ -1182,11 +1205,11 @@ function isTabVisible() { * @private */ function convertInputType(mouse, touch) { - var _this17 = this, - DocumentTouch = win.DocumentTouch, + var _this17 = this; + const DocumentTouch = win.DocumentTouch, matchMedia = win.matchMedia, - navigator = win.navigator, - hasTouch = !1; + navigator = win.navigator; + let hasTouch = !1; if (touch) { // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/ if (navigator && "maxTouchPoints" in navigator) { @@ -1202,7 +1225,7 @@ function convertInputType(mouse, touch) { hasTouch = !0; } else { // Only as a last resort, fall back to user agent sniffing - var UA = navigator.userAgent; + const UA = navigator.userAgent; hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA); } } @@ -1211,7 +1234,7 @@ function convertInputType(mouse, touch) { // Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/ - var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) { + const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) { _newArrowCheck(this, _this17); return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches; }.bind(this)); @@ -1255,14 +1278,14 @@ function runUntil(fn, conditionFn) { * @private */ function checkModuleImport(ctx) { - var $$ = ctx, + const $$ = ctx, config = $$.config; - var type = ""; + let type = ""; if (isEmpty(config.data_type || config.data_types) && !$$[TYPE_METHOD_NEEDED.LINE]) { type = "line"; } else { - for (var x in TYPE_METHOD_NEEDED) { - var t = TYPE[x]; + for (const x in TYPE_METHOD_NEEDED) { + const t = TYPE[x]; if ($$.hasType(t) && !$$[TYPE_METHOD_NEEDED[x]]) { type = t; break; @@ -1279,19 +1302,18 @@ function checkModuleImport(ctx) { * @private */ function logError(head, tail) { - var _window$console, - prefix = "[billboard.js]", - hasConsole = (_window$console = win.console) == null ? void 0 : _window$console.error; + var _window$console; + const hasConsole = (_window$console = win.console) == null ? void 0 : _window$console.error; if (hasConsole) { - console.error("\u274C " + prefix + " " + head, "background:red;color:white;display:block;font-size:15px", tail); + console.error("\u274C [billboard.js] " + head, "background:red;color:white;display:block;font-size:15px", tail); console.info("%cℹ️", "font-size:15px", "https://github.com/naver/billboard.js/wiki/CHANGELOG-v2#modularization-by-its-functionality"); } - throw Error(prefix + " " + head.replace(/\%c([a-z-]+)/i, "'$1' ") + " " + tail); + throw Error("[billboard.js] " + head.replace(/\%c([a-z-]+)/i, "'$1' ") + " " + tail); } ;// CONCATENATED MODULE: ./src/config/classes.ts -function classes_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function classes_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? classes_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : classes_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function classes_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function classes_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? classes_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : classes_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license @@ -1300,7 +1322,7 @@ function classes_objectSpread(target) { for (var i = 1, source; i < arguments.le * CSS class names definition * @private */ -var $COMMON = { +const $COMMON = { button: "bb-button", chart: "bb-chart", empty: "bb-empty", @@ -1308,7 +1330,7 @@ var $COMMON = { target: "bb-target", EXPANDED: "_expanded_" }; -var $ARC = { +const $ARC = { arc: "bb-arc", arcLabelLine: "bb-arc-label-line", arcs: "bb-arcs", @@ -1318,11 +1340,11 @@ var $ARC = { chartArcsTitle: "bb-chart-arcs-title", needle: "bb-needle" }; -var $AREA = { +const $AREA = { area: "bb-area", areas: "bb-areas" }; -var $AXIS = { +const $AXIS = { axis: "bb-axis", axisX: "bb-axis-x", axisXLabel: "bb-axis-x-label", @@ -1331,13 +1353,13 @@ var $AXIS = { axisY2Label: "bb-axis-y2-label", axisYLabel: "bb-axis-y-label" }; -var $BAR = { +const $BAR = { bar: "bb-bar", bars: "bb-bars", chartBar: "bb-chart-bar", chartBars: "bb-chart-bars" }; -var $CANDLESTICK = { +const $CANDLESTICK = { candlestick: "bb-candlestick", candlesticks: "bb-candlesticks", chartCandlestick: "bb-chart-candlestick", @@ -1345,27 +1367,27 @@ var $CANDLESTICK = { valueDown: "bb-value-down", valueUp: "bb-value-up" }; -var $CIRCLE = { +const $CIRCLE = { chartCircles: "bb-chart-circles", circle: "bb-circle", circles: "bb-circles" }; -var $COLOR = { +const $COLOR = { colorPattern: "bb-color-pattern", colorScale: "bb-colorscale" }; -var $DRAG = { +const $DRAG = { dragarea: "bb-dragarea", INCLUDED: "_included_" }; -var $GAUGE = { +const $GAUGE = { chartArcsGaugeMax: "bb-chart-arcs-gauge-max", chartArcsGaugeMin: "bb-chart-arcs-gauge-min", chartArcsGaugeUnit: "bb-chart-arcs-gauge-unit", chartArcsGaugeTitle: "bb-chart-arcs-gauge-title", gaugeValue: "bb-gauge-value" }; -var $LEGEND = { +const $LEGEND = { legend: "bb-legend", legendBackground: "bb-legend-background", legendItem: "bb-legend-item", @@ -1374,26 +1396,26 @@ var $LEGEND = { legendItemPoint: "bb-legend-item-point", legendItemTile: "bb-legend-item-tile" }; -var $LINE = { +const $LINE = { chartLine: "bb-chart-line", chartLines: "bb-chart-lines", line: "bb-line", lines: "bb-lines" }; -var $EVENT = { +const $EVENT = { eventRect: "bb-event-rect", eventRects: "bb-event-rects", eventRectsMultiple: "bb-event-rects-multiple", eventRectsSingle: "bb-event-rects-single" }; -var $FOCUS = { +const $FOCUS = { focused: "bb-focused", defocused: "bb-defocused", legendItemFocused: "bb-legend-item-focused", xgridFocus: "bb-xgrid-focus", ygridFocus: "bb-ygrid-focus" }; -var $GRID = { +const $GRID = { grid: "bb-grid", gridLines: "bb-grid-lines", xgrid: "bb-xgrid", @@ -1405,32 +1427,32 @@ var $GRID = { ygridLines: "bb-ygrid-lines", ygrids: "bb-ygrids" }; -var $LEVEL = { +const $LEVEL = { level: "bb-level", levels: "bb-levels" }; -var $RADAR = { +const $RADAR = { chartRadar: "bb-chart-radar", chartRadars: "bb-chart-radars" }; -var $REGION = { +const $REGION = { region: "bb-region", regions: "bb-regions" }; -var $SELECT = { +const $SELECT = { selectedCircle: "bb-selected-circle", selectedCircles: "bb-selected-circles", SELECTED: "_selected_" }; -var $SHAPE = { +const $SHAPE = { shape: "bb-shape", shapes: "bb-shapes" }; -var $SUBCHART = { +const $SUBCHART = { brush: "bb-brush", subchart: "bb-subchart" }; -var $TEXT = { +const $TEXT = { chartText: "bb-chart-text", chartTexts: "bb-chart-texts", text: "bb-text", @@ -1438,17 +1460,17 @@ var $TEXT = { title: "bb-title", TextOverlapping: "text-overlapping" }; -var $TOOLTIP = { +const $TOOLTIP = { tooltip: "bb-tooltip", tooltipContainer: "bb-tooltip-container", tooltipName: "bb-tooltip-name" }; -var $TREEMAP = { +const $TREEMAP = { treemap: "bb-treemap", chartTreemap: "bb-chart-treemap", chartTreemaps: "bb-chart-treemaps" }; -var $ZOOM = { +const $ZOOM = { buttonZoomReset: "bb-zoom-reset", zoomBrush: "bb-zoom-brush" }; @@ -1464,7 +1486,7 @@ var $ZOOM = { * @ignore * @private */ -var Element = function () { +let Element = function () { return { chart: null, main: null, @@ -1541,7 +1563,7 @@ var Element = function () { * @ignore * @private */ -var State = function () { +let State = function () { return { // chart drawn area dimension, excluding axes width: 0, @@ -1575,23 +1597,28 @@ var State = function () { // for data CSS rule index (used when boost.useCssRule is true) cssRule: {}, current: { + // current domain value. Assigned when is zoom is called + domain: undefined, // chart whole dimension width: 0, height: 0, dataMax: 0, - maxTickWidths: { + maxTickSize: { x: { - size: 0, + width: 0, + height: 0, ticks: [], clipPath: 0, domain: "" }, y: { - size: 0, + width: 0, + height: 0, domain: "" }, y2: { - size: 0, + width: 0, + height: 0, domain: "" } }, @@ -1706,7 +1733,7 @@ var State = function () { // mapping -var Store_classes = { +const Store_classes = { element: Element, state: State }; @@ -1717,7 +1744,7 @@ var Store_classes = { * @ignore * @private */ -var Store = /*#__PURE__*/function () { +let Store = /*#__PURE__*/function () { function Store() { var _this = this; Object.keys(Store_classes).forEach(function (v) { @@ -1737,6 +1764,7 @@ var Store = /*#__PURE__*/function () { * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license */ + /** * main config options */ @@ -1836,6 +1864,7 @@ var Store = /*#__PURE__*/function () { size_height: undefined, /** * The padding of the chart element. + * - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)"" wiki documentaion. * @name padding * @memberof Options * @type {object} @@ -2111,13 +2140,21 @@ var Store = /*#__PURE__*/function () { * @memberof Options * @type {Array} * @default [] + * @see [Demo](https://naver.github.io/billboard.js/demo/#Region.RegionLabel) * @example * regions: [ * { * axis: "x", * start: 1, * end: 4, - * class: "region-1-4" + * class: "region-1-4", + * label: { + * text: "Region Text", + * x: 5, // position relative of the initial x coordinate + * y: 5, // position relative of the initial y coordinate + * color: "red", // color string + * rotated: true // make text to show in vertical or horizontal + * } * } * ] */ @@ -2791,7 +2828,11 @@ var data_this = undefined; * {name: "www.site4.com", upload: 400, download: 100, total: 500} * ], * keys: { - * // x: "name", // it's possible to specify 'x' when category axis + * // case 1: specify 'x' key for category axis + * x: "name", // 'name' key will be used as category x axis values + * value: ["upload", "download"] + * + * // case 2: without 'x' key for non-category axis * value: ["upload", "download"] * } * } @@ -2989,7 +3030,11 @@ var data_this = undefined; * {name: "www.site4.com", upload: 400, download: 100, total: 500} * ], * keys: { - * // x: "name", // it's possible to specify 'x' when category axis + * // case 1: specify 'x' key for category axis + * x: "name", // 'name' key will be used as category x axis values + * value: ["upload", "download"] + * + * // case 2: without 'x' key for non-category axis * value: ["upload", "download"] * } * } @@ -3378,9 +3423,9 @@ var tooltip_this = undefined; * Specified function receives x of the data point to show. * @property {Function} [tooltip.format.name] Set format for the name of each data in tooltip.
* Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge. - * @property {Function} [tooltip.format.value] Set format for the value of each data in tooltip. If undefined returned, the row of that value will be skipped to be called. + * @property {Function} [tooltip.format.value] Set format for the value of each data value in tooltip. If undefined returned, the row of that value will be skipped to be called. * - Will pass following arguments to the given function: - * - `value {string}`: Value of the data point + * - `value {string}`: Value of the data point. If data row contains multiple or ranged(ex. candlestick, area range, etc.) value, formatter will be called as value length. * - `ratio {number}`: Ratio of the data point in the `pie/donut/gauge` and `area/bar` when contains grouped data. Otherwise is `undefined`. * - `id {string}`: id of the data point * - `index {number}`: Index of the data point @@ -3419,7 +3464,7 @@ var tooltip_this = undefined; * - The value array length should match with the data length * @property {boolean} [tooltip.init.show=false] Show tooltip at the initialization. * @property {number} [tooltip.init.x=0] Set x Axis index(or index for Arc(donut, gauge, pie) types) to be shown at the initialization. - * @property {object} [tooltip.init.position={top: "0px",left: "50px"}] Set the position of tooltip at the initialization. + * @property {object} [tooltip.init.position] Set the position of tooltip at the initialization. * @property {Function} [tooltip.onshow] Set a callback that will be invoked before the tooltip is shown. * @property {Function} [tooltip.onhide] Set a callback that will be invoked before the tooltip is hidden. * @property {Function} [tooltip.onshown] Set a callback that will be invoked after the tooltip is shown @@ -3436,6 +3481,7 @@ var tooltip_this = undefined; * @see [Demo: Tooltip Grouping](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipGrouping) * @see [Demo: Tooltip Format](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipFormat) * @see [Demo: Linked Tooltip](https://naver.github.io/billboard.js/demo/#Tooltip.LinkedTooltips) + * @see [Demo: Tooltip Position](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipPosition) * @see [Demo: Tooltip Template](https://naver.github.io/billboard.js/demo/#Tooltip.TooltipTemplate) * @example * tooltip: { @@ -3445,6 +3491,9 @@ var tooltip_this = undefined; * format: { * title: function(x) { return "Data " + x; }, * name: function(name, ratio, id, index) { return name; }, + * + * // If data row contains multiple or ranged(ex. candlestick, area range, etc.) value, + * // formatter will be called as value length times. * value: function(value, ratio, id, index) { return ratio; } * }, * position: function(data, width, height, element, pos) { @@ -3456,8 +3505,31 @@ var tooltip_this = undefined; * // x: Current mouse event x position, * // y: Current mouse event y position, * // xAxis: Current x Axis position (the value is given for axis based chart type only) + * // yAxis: Current y Axis position value or function(the value is given for axis based chart type only) * // } - * return {top: 0, left: 0} + * + * // yAxis will work differently per data lenghts + * // - a) Single data: `yAxis` will return `number` value + * // - b) Multiple data: `yAxis` will return a function with property value + * + * // a) Single data: + * // Get y coordinate + * pos.yAxis; // y axis coordinate value of current data point + * + * // b) Multiple data: + * // Get y coordinate of value 500, where 'data1' scales(y or y2). + * // When 'data.axes' option is used, data can bound to different axes. + * // - when "data.axes={data1: 'y'}", wil return y value from y axis scale. + * // - when "data.axes={data1: 'y2'}", wil return y value from y2 axis scale. + * pos.yAxis(500, "data1"); // will return y coordinate value of data1 + * + * pos.yAxis(500); // get y coordinate with value of 500, using y axis scale + * pos.yAxis(500, null, "y2"); // get y coordinate with value of 500, using y2 axis scale + * + * return { + * top: 0, + * left: 0 + * } * }, * * contents: function(d, defaultTitleFormat, defaultValueFormat, color) { @@ -3511,10 +3583,10 @@ var tooltip_this = undefined; * // show at the initialization * init: { * show: true, - * x: 2, // x Axis index(or index for Arc(donut, gauge, pie) types) + * x: 2, // x Axis index (or index for Arc(donut, gauge, pie) types) * position: { - * top: "150px", - * left: "250px" + * top: "150px", // specify as number or as string with 'px' unit string + * left: 250 // specify as number or as string with 'px' unit string * } * }, * @@ -3566,10 +3638,7 @@ var tooltip_this = undefined; tooltip_contents: {}, tooltip_init_show: !1, tooltip_init_x: 0, - tooltip_init_position: { - top: "0px", - left: "50px" - }, + tooltip_init_position: undefined, tooltip_linked: !1, tooltip_linked_name: "", tooltip_onshow: function tooltip_onshow() { @@ -3589,8 +3658,8 @@ var tooltip_this = undefined; ;// CONCATENATED MODULE: ./src/config/Options/Options.ts -function Options_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function Options_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? Options_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : Options_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function Options_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function Options_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Options_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Options_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license @@ -3612,7 +3681,7 @@ function Options_objectSpread(target) { for (var i = 1, source; i < arguments.le * @class Options * @see {@link bb.generate} to use these options on generating the chart */ -var Options = /*#__PURE__*/function () { +let Options = /*#__PURE__*/function () { Options.setOptions = function setOptions(options) { var _this = this; this.data = options.reduce(function (a, c) { @@ -3639,7 +3708,7 @@ Options.data = {}; * - NOTE: Prefixed with '$', will be resetted when .load() is called * @private */ -var KEY = { +const KEY = { bubbleBaseLength: "$baseLength", colorPattern: "__colorPattern__", dataMinMax: "$dataMinMax", @@ -3651,7 +3720,7 @@ var KEY = { callOverOutForTouch: "callOverOutForTouch", textRect: "textRect" }; -var Cache = /*#__PURE__*/function () { +let Cache = /*#__PURE__*/function () { function Cache() { this.cache = {}; } @@ -3679,7 +3748,7 @@ var Cache = /*#__PURE__*/function () { */; _proto.remove = function remove(key) { var _this = this; - toArray(key).forEach(function (v) { + (isString(key) ? [key] : key).forEach(function (v) { _newArrowCheck(this, _this); return delete this.cache[v]; }.bind(this)); @@ -3696,16 +3765,17 @@ var Cache = /*#__PURE__*/function () { if (isDataType === void 0) { isDataType = !1; } - if (isDataType) { - var targets = []; - for (var i = 0, id; id = key[i]; i++) { + // when is isDataType, key should be string array + if (isDataType && Array.isArray(key)) { + const targets = []; + for (let i = 0, id; id = key[i]; i++) { if (id in this.cache) { targets.push(this.cloneTarget(this.cache[id])); } } return targets; } else { - var value = this.cache[key]; + const value = this.cache[key]; return isValue(value) ? value : null; } } @@ -3716,8 +3786,8 @@ var Cache = /*#__PURE__*/function () { * @private */; _proto.reset = function reset(all) { - var $$ = this; - for (var x in $$.cache) { + const $$ = this; + for (const x in $$.cache) { // reset the prefixed '$' key(which is internal use data) only. if (all || /^\$/.test(x)) { $$.cache[x] = null; @@ -3760,7 +3830,7 @@ var Cache = /*#__PURE__*/function () { -var generator_setTimeout = win.setTimeout, +const generator_setTimeout = win.setTimeout, generator_clearTimeout = win.clearTimeout; /** @@ -3770,35 +3840,35 @@ var generator_setTimeout = win.setTimeout, * @private */ function generateResize(option) { - var _this4 = this, - fn = [], - timeout, - callResizeFn = function () { - var _this = this; - // Delay all resize functions call, to prevent unintended excessive call from resize event - callResizeFn.clear(); - if (option === !1) { - requestIdleCallback(function () { - var _this2 = this; - _newArrowCheck(this, _this); - fn.forEach(function (f) { - _newArrowCheck(this, _this2); - return f(); - }.bind(this)); - }.bind(this), { - timeout: 200 - }); - } else { - timeout = generator_setTimeout(function () { - var _this3 = this; - _newArrowCheck(this, _this); - fn.forEach(function (f) { - _newArrowCheck(this, _this3); - return f(); - }.bind(this)); - }.bind(this), isNumber(option) ? option : 200); - } - }; + var _this4 = this; + const fn = []; + let timeout; + const callResizeFn = function () { + var _this = this; + // Delay all resize functions call, to prevent unintended excessive call from resize event + callResizeFn.clear(); + if (option === !1) { + requestIdleCallback(function () { + var _this2 = this; + _newArrowCheck(this, _this); + fn.forEach(function (f) { + _newArrowCheck(this, _this2); + return f(); + }.bind(this)); + }.bind(this), { + timeout: 200 + }); + } else { + timeout = generator_setTimeout(function () { + var _this3 = this; + _newArrowCheck(this, _this); + fn.forEach(function (f) { + _newArrowCheck(this, _this3); + return f(); + }.bind(this)); + }.bind(this), isNumber(option) ? option : 200); + } + }; callResizeFn.clear = function () { _newArrowCheck(this, _this4); if (timeout) { @@ -3822,10 +3892,10 @@ function generateResize(option) { * @private */ function generateWait() { - var transitionsToWait = []; + let transitionsToWait = []; // 'f' is called as selection.call(f, ...); - var f = function (selection, callback) { + const f = function (selection, callback) { var _this5 = this; /** * Check if transition is complete @@ -3833,8 +3903,8 @@ function generateWait() { * @private */ function loop() { - var done = 0; - for (var i = 0, t; t = transitionsToWait[i]; i++) { + let done = 0; + for (let i = 0, t; t = transitionsToWait[i]; i++) { if (t === !0 || t.empty != null && t.empty()) { done++; continue; @@ -3855,7 +3925,7 @@ function generateWait() { } runUntil(function () { _newArrowCheck(this, _this5); - callback == null ? void 0 : callback(); + callback == null || callback(); }.bind(this), loop); }; f.add = function (t) { @@ -3871,7 +3941,7 @@ function generateWait() { // Store blob in memory -var blob = {}; +const blob = {}; /** * Get Object URL @@ -3881,7 +3951,7 @@ var blob = {}; * @private */ function getObjectURL(fn, depsFn) { - var fnString = fn.toString(), + const fnString = fn.toString(), key = fnString.replace(/(function|[\s\W\n])/g, "").substring(0, 15); if (!(key in blob)) { var _depsFn$map$join; @@ -3893,6 +3963,23 @@ function getObjectURL(fn, depsFn) { return win.URL.createObjectURL(blob[key]); } +/** + * Get WebWorker instance + * @param {string} src URL object as string + * @returns {object} WebWorker instance + * @private + */ +function getWorker(src) { + const worker = new win.Worker(src); + + // handle error + worker.onerror = function (e) { + // eslint-disable-next-line no-console + console.error ? console.error(e) : console.log(e); + }; + return worker; +} + /** * Create and run on Web Worker * @param {boolean} useWorker Use Web Worker @@ -3920,10 +4007,13 @@ function runWorker(useWorker, fn, callback, depsFn) { if (useWorker === void 0) { useWorker = !0; } - var runFn; + let runFn = function () { + const res = fn.apply(void 0, arguments); + callback(res); + }; if (win.Worker && useWorker) { - var src = getObjectURL(fn, depsFn), - worker = new win.Worker(src); + const src = getObjectURL(fn, depsFn), + worker = getWorker(src); runFn = function () { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; @@ -3938,22 +4028,13 @@ function runWorker(useWorker, fn, callback, depsFn) { return callback(e.data); }; - // handle error - worker.onerror = function (e) { - console.error(e); - }; - // return new Promise((resolve, reject) => { // worker.onmessage = ({data}) => resolve(data); // worker.onerror = reject; // }); }; - } else { - runFn = function () { - var res = fn.apply(void 0, arguments); - callback(res); - }; } + return runFn; } // EXTERNAL MODULE: external {"commonjs":"d3-dsv","commonjs2":"d3-dsv","amd":"d3-dsv","root":"d3"} @@ -3981,9 +4062,9 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re * @private */ function columns(columns) { - var newRows = []; + const newRows = []; columns.forEach(function (col, i) { - var key = col[0]; + const key = col[0]; col.forEach(function (v, j) { if (j > 0) { if (typeof newRows[j - 1] === "undefined") { @@ -4006,11 +4087,11 @@ function columns(columns) { * @private */ function rows(rows) { - var keys = rows[0], + const keys = rows[0], newRows = []; rows.forEach(function (row, i) { if (i > 0) { - var newRow = {}; + const newRow = {}; row.forEach(function (v, j) { if (typeof v === "undefined") { throw new Error("Source data is missing a component at (" + i + ", " + j + ")!"); @@ -4030,17 +4111,17 @@ function rows(rows) { * @private */ function json(json, keysParam) { - var newRows = []; - var targetKeys, data; + const newRows = []; + let targetKeys, data; if (Array.isArray(json)) { - var findValueInJson = function (object, path) { + const findValueInJson = function (object, path) { if (object[path] !== undefined) { return object[path]; } - var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"), + const convertedPath = path.replace(/\[(\w+)\]/g, ".$1"), pathArray = convertedPath.replace(/^\./, "").split("."); // convert indexes to properties (replace [] with .) // strip a leading dot - var target = object; + let target = object; pathArray.some(function (k) { return !(target = target && k in target ? target[k] : undefined); }); @@ -4053,9 +4134,9 @@ function json(json, keysParam) { } newRows.push(targetKeys); json.forEach(function (o) { - var newRow = targetKeys.map(function (key) { + const newRow = targetKeys.map(function (key) { // convert undefined to null because undefined data will be removed in convertDataToTargets() - var v = findValueInJson(o, key); + let v = findValueInJson(o, key); if (typeof v === "undefined") { v = null; } @@ -4066,26 +4147,14 @@ function json(json, keysParam) { data = rows(newRows); } else { Object.keys(json).forEach(function (key) { - var tmp = json[key].concat(); - tmp.unshift == null ? void 0 : tmp.unshift(key); + const tmp = json[key].concat(); + tmp.unshift == null || tmp.unshift(key); newRows.push(tmp); }); data = columns(newRows); } return data; } -function jsonTreemap(json) { - var _this = this, - _convertKey = function convertKey(v) { - _newArrowCheck(this, _this); - if (v.children) { - v.children.forEach(_convertKey); - } - v.name = v.id; - }.bind(this); - json.forEach(_convertKey); - return json; -} /***** Functions can't be executed on Web Worker *****/ /** @@ -4101,7 +4170,7 @@ function url(url, mimeType, headers, keys, done) { if (mimeType === void 0) { mimeType = "csv"; } - var req = new XMLHttpRequest(), + const req = new XMLHttpRequest(), converter = { csv: csv, tsv: tsv, @@ -4116,7 +4185,7 @@ function url(url, mimeType, headers, keys, done) { req.onreadystatechange = function () { if (req.readyState === 4) { if (req.status === 200) { - var response = req.responseText; + const response = req.responseText; response && done.call(this, converter[mimeType](mimeType === "json" ? JSON.parse(response) : response, keys)); } else { throw new Error(url + ": Something went wrong loading!"); @@ -4134,13 +4203,13 @@ function url(url, mimeType, headers, keys, done) { * @private */ function convertCsvTsvToData(parser, xsv) { - var _this2 = this, - rows = parser.rows(xsv), - d; + var _this = this; + const rows = parser.rows(xsv); + let d; if (rows.length === 1) { d = [{}]; rows[0].forEach(function (id) { - _newArrowCheck(this, _this2); + _newArrowCheck(this, _this); d[0][id] = null; }.bind(this)); } else { @@ -4177,7 +4246,7 @@ function tsv(tsv) { * @private */ function getDataKeyForJson(keysParam, config) { - var keys = keysParam || (config == null ? void 0 : config.data_keys); + const keys = keysParam || (config == null ? void 0 : config.data_keys); if (keys != null && keys.x) { config.data_x = keys.x; } @@ -4197,15 +4266,15 @@ function getDataKeyForJson(keysParam, config) { * @private */ convertData: function convertData(args, callback) { - var _this = this, - config = this.config, - useWorker = config.boost_useWorker, - data = args; + var _this = this; + const config = this.config, + useWorker = config.boost_useWorker; + let data = args; if (args.bindto) { data = {}; ["url", "mimeType", "headers", "keys", "json", "keys", "rows", "columns"].forEach(function (v) { _newArrowCheck(this, _this); - var key = "data_" + v; + const key = "data_" + v; if (key in args) { data[v] = args[key]; } @@ -4224,13 +4293,13 @@ function getDataKeyForJson(keysParam, config) { } }, convertDataToTargets: function convertDataToTargets(data, appendXs) { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, axis = $$.axis, config = $$.config, state = $$.state, - chartType = config.data_type, - isCategorized = !1, + chartType = config.data_type; + let isCategorized = !1, isTimeSeries = !1, isCustomX = !1; if (axis) { @@ -4238,16 +4307,16 @@ function getDataKeyForJson(keysParam, config) { isTimeSeries = axis.isTimeSeries(); isCustomX = axis.isCustomX(); } - var dataKeys = Object.keys(data[0] || {}), + const dataKeys = Object.keys(data[0] || {}), ids = dataKeys.length ? dataKeys.filter($$.isNotX, $$) : [], xs = dataKeys.length ? dataKeys.filter($$.isX, $$) : []; - var xsData; + let xsData; // save x for update data by load when custom x and bb.x API ids.forEach(function (id) { var _this3 = this; _newArrowCheck(this, _this2); - var xKey = this.getXKey(id); + const xKey = this.getXKey(id); if (isCustomX || isTimeSeries) { // if included in input data if (xs.indexOf(xKey) >= 0) { @@ -4284,10 +4353,10 @@ function getDataKeyForJson(keysParam, config) { }.bind(this)); // convert to target - var targets = ids.map(function (id, index) { + const targets = ids.map(function (id, index) { var _this4 = this; _newArrowCheck(this, _this2); - var convertedId = config.data_idConverter.bind($$.api)(id), + const convertedId = config.data_idConverter.bind($$.api)(id), xKey = $$.getXKey(id), isCategory = isCustomX && isCategorized, hasCategory = isCategory && data.map(function (v) { @@ -4305,8 +4374,8 @@ function getDataKeyForJson(keysParam, config) { id_org: id, values: data.map(function (d, i) { _newArrowCheck(this, _this4); - var rawX = d[xKey]; - var value = d[id], + const rawX = d[xKey]; + let value = d[id], x; value = value !== null && !isNaN(value) && !isObject(value) ? +value : isArray(value) || isObject(value) ? value : null; @@ -4350,7 +4419,7 @@ function getDataKeyForJson(keysParam, config) { if (config.data_xSort) { t.values = t.values.sort(function (v1, v2) { _newArrowCheck(this, _this5); - var x1 = v1.x || v1.x === 0 ? v1.x : Infinity, + const x1 = v1.x || v1.x === 0 ? v1.x : Infinity, x2 = v2.x || v2.x === 0 ? v2.x : Infinity; return x1 - x2; }.bind(this)); @@ -4363,7 +4432,7 @@ function getDataKeyForJson(keysParam, config) { }.bind(this)); // this needs to be sorted because its index and value.index is identical - (_$$$data$xs$t$id = $$.data.xs[t.id]) == null ? void 0 : _$$$data$xs$t$id.sort(function (v1, v2) { + (_$$$data$xs$t$id = $$.data.xs[t.id]) == null || _$$$data$xs$t$id.sort(function (v1, v2) { _newArrowCheck(this, _this5); return v1 - v2; }.bind(this)); @@ -4375,7 +4444,7 @@ function getDataKeyForJson(keysParam, config) { // set target types if (chartType && $$.isValidChartType(chartType)) { - var targetIds = $$.mapToIds(targets).filter(function (id) { + const targetIds = $$.mapToIds(targets).filter(function (id) { _newArrowCheck(this, _this2); return !(id in config.data_types) || !$$.isValidChartType(config.data_types[id]); }.bind(this)); @@ -4399,9 +4468,10 @@ function getDataKeyForJson(keysParam, config) { + /* harmony default export */ var data_data = ({ isX: function isX(key) { - var $$ = this, + const $$ = this, config = $$.config, dataKey = config.data_x && key === config.data_x, existValue = notEmpty(config.data_xs) && hasValue(config.data_xs, key); @@ -4411,27 +4481,33 @@ function getDataKeyForJson(keysParam, config) { return !this.isX(key); }, isStackNormalized: function isStackNormalized() { - var config = this.config; + const config = this.config; return !!(config.data_stack_normalize && config.data_groups.length); }, + /** + * Check if given id is grouped data or has grouped data + * @param {string} id Data id value + * @returns {boolean} is grouped data or has grouped data + * @private + */ isGrouped: function isGrouped(id) { - var _this = this, - groups = this.config.data_groups; + var _this = this; + const groups = this.config.data_groups; return id ? groups.some(function (v) { _newArrowCheck(this, _this); return v.indexOf(id) >= 0 && v.length > 1; }.bind(this)) : groups.length > 0; }, getXKey: function getXKey(id) { - var $$ = this, + const $$ = this, config = $$.config; return config.data_x ? config.data_x : notEmpty(config.data_xs) ? config.data_xs[id] : null; }, getXValuesOfXKey: function getXValuesOfXKey(key, targets) { - var _this2 = this, - $$ = this, - ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : [], - xValues; + var _this2 = this; + const $$ = this, + ids = targets && notEmpty(targets) ? $$.mapToIds(targets) : []; + let xValues; ids.forEach(function (id) { _newArrowCheck(this, _this2); if ($$.getXKey(id) === key) { @@ -4448,27 +4524,27 @@ function getDataKeyForJson(keysParam, config) { * @private */ getIndexByX: function getIndexByX(x, basedX) { - var $$ = this; + const $$ = this; return basedX ? basedX.indexOf(isString(x) ? x : +x) : ($$.filterByX($$.data.targets, x)[0] || { index: null }).index; }, getXValue: function getXValue(id, i) { - var $$ = this; + const $$ = this; return id in $$.data.xs && $$.data.xs[id] && isValue($$.data.xs[id][i]) ? $$.data.xs[id][i] : i; }, getOtherTargetXs: function getOtherTargetXs() { - var $$ = this, + const $$ = this, idsForX = Object.keys($$.data.xs); return idsForX.length ? $$.data.xs[idsForX[0]] : null; }, getOtherTargetX: function getOtherTargetX(index) { - var xs = this.getOtherTargetXs(); + const xs = this.getOtherTargetXs(); return xs && index < xs.length ? xs[index] : null; }, addXs: function addXs(xs) { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, config = $$.config; Object.keys(xs).forEach(function (id) { _newArrowCheck(this, _this3); @@ -4479,9 +4555,9 @@ function getDataKeyForJson(keysParam, config) { return notEmpty(this.config.data_xs) || this.hasType("bubble") || this.hasType("scatter"); }, addName: function addName(data) { - var $$ = this, + const $$ = this, config = $$.config; - var name; + let name; if (data) { name = config.data_names[data.id]; data.name = name !== undefined ? name : data.id; @@ -4500,8 +4576,8 @@ function getDataKeyForJson(keysParam, config) { if (filterNull === void 0) { filterNull = !1; } - var $$ = this; - var value = $$.filterTargetsToShow($$.data.targets).map(function (t) { + const $$ = this; + let value = $$.filterTargetsToShow($$.data.targets).map(function (t) { _newArrowCheck(this, _this4); return $$.addName($$.getValueOnIndex(t.values, index)); }.bind(this)); @@ -4514,16 +4590,16 @@ function getDataKeyForJson(keysParam, config) { return value; }, getValueOnIndex: function getValueOnIndex(values, index) { - var _this5 = this, - valueOnIndex = values.filter(function (v) { - _newArrowCheck(this, _this5); - return v.index === index; - }.bind(this)); + var _this5 = this; + const valueOnIndex = values.filter(function (v) { + _newArrowCheck(this, _this5); + return v.index === index; + }.bind(this)); return valueOnIndex.length ? valueOnIndex[0] : null; }, updateTargetX: function updateTargetX(targets, x) { - var _this6 = this, - $$ = this; + var _this6 = this; + const $$ = this; targets.forEach(function (t) { var _this7 = this; _newArrowCheck(this, _this6); @@ -4535,19 +4611,19 @@ function getDataKeyForJson(keysParam, config) { }.bind(this)); }, updateTargetXs: function updateTargetXs(targets, xs) { - var _this8 = this, - $$ = this; + var _this8 = this; + const $$ = this; targets.forEach(function (t) { _newArrowCheck(this, _this8); xs[t.id] && $$.updateTargetX([t], xs[t.id]); }.bind(this)); }, generateTargetX: function generateTargetX(rawX, id, index) { - var $$ = this, + const $$ = this, axis = $$.axis; - var x = axis != null && axis.isCategorized() ? index : rawX || index; + let x = axis != null && axis.isCategorized() ? index : rawX || index; if (axis != null && axis.isTimeSeries()) { - var fn = parseDate.bind($$); + const fn = parseDate.bind($$); x = rawX ? fn(rawX) : fn($$.getXValue(id, index)); } else if (axis != null && axis.isCustomX() && !(axis != null && axis.isCategorized())) { x = isValue(rawX) ? +rawX : $$.getXValue(id, index); @@ -4564,11 +4640,11 @@ function getDataKeyForJson(keysParam, config) { } }, getPrevX: function getPrevX(i) { - var x = this.axis.xs[i - 1]; + const x = this.axis.xs[i - 1]; return isDefined(x) ? x : null; }, getNextX: function getNextX(i) { - var x = this.axis.xs[i + 1]; + const x = this.axis.xs[i + 1]; return isDefined(x) ? x : null; }, /** @@ -4578,9 +4654,9 @@ function getDataKeyForJson(keysParam, config) { * @private */ getBaseValue: function getBaseValue(data) { - var $$ = this, + const $$ = this, hasAxis = $$.state.hasAxis; - var value = data.value; + let value = data.value; // In case of area-range, data is given as: [low, mid, high] or {low, mid, high} // will take the 'mid' as the base value @@ -4600,16 +4676,15 @@ function getDataKeyForJson(keysParam, config) { * @returns {{min: {number}, max: {number}}} */ getMinMaxValue: function getMinMaxValue(data) { - var _this10 = this, - getBaseValue = this.getBaseValue.bind(this), - min, - max; + var _this10 = this; + const getBaseValue = this.getBaseValue.bind(this); + let min, max; (data || this.data.targets.map(function (t) { _newArrowCheck(this, _this10); return t.values; }.bind(this))).forEach(function (v, i) { _newArrowCheck(this, _this10); - var value = v.map(getBaseValue).filter(isNumber); + const value = v.map(getBaseValue).filter(isNumber); min = Math.min.apply(Math, [i ? min : Infinity].concat(value)); max = Math.max.apply(Math, [i ? max : -Infinity].concat(value)); }.bind(this)); @@ -4624,21 +4699,21 @@ function getDataKeyForJson(keysParam, config) { * @returns {{min: Array, max: Array}} */ getMinMaxData: function getMinMaxData() { - var _this11 = this, - $$ = this, - cacheKey = KEY.dataMinMax, - minMaxData = $$.cache.get(cacheKey); + var _this11 = this; + const $$ = this, + cacheKey = KEY.dataMinMax; + let minMaxData = $$.cache.get(cacheKey); if (!minMaxData) { - var data = $$.data.targets.map(function (t) { + const data = $$.data.targets.map(function (t) { _newArrowCheck(this, _this11); return t.values; }.bind(this)), minMax = $$.getMinMaxValue(data); - var min = [], + let min = [], max = []; data.forEach(function (v) { _newArrowCheck(this, _this11); - var minData = $$.getFilteredDataByValue(v, minMax.min), + const minData = $$.getFilteredDataByValue(v, minMax.min), maxData = $$.getFilteredDataByValue(v, minMax.max); if (minData.length) { min = min.concat(minData); @@ -4662,10 +4737,10 @@ function getDataKeyForJson(keysParam, config) { * @returns {Array} */ getTotalPerIndex: function getTotalPerIndex() { - var _this12 = this, - $$ = this, - cacheKey = KEY.dataTotalPerIndex, - sum = $$.cache.get(cacheKey); + var _this12 = this; + const $$ = this, + cacheKey = KEY.dataTotalPerIndex; + let sum = $$.cache.get(cacheKey); if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) { sum = []; $$.data.targets.forEach(function (row) { @@ -4689,12 +4764,12 @@ function getDataKeyForJson(keysParam, config) { * @private */ getTotalDataSum: function getTotalDataSum(subtractHidden) { - var _this14 = this, - $$ = this, - cacheKey = KEY.dataTotalSum, - total = $$.cache.get(cacheKey); + var _this14 = this; + const $$ = this, + cacheKey = KEY.dataTotalSum; + let total = $$.cache.get(cacheKey); if (!isNumber(total)) { - var sum = mergeArray($$.data.targets.map(function (t) { + const sum = mergeArray($$.data.targets.map(function (t) { _newArrowCheck(this, _this14); return t.values; }.bind(this))).map(function (v) { @@ -4718,11 +4793,11 @@ function getDataKeyForJson(keysParam, config) { * @private */ getHiddenTotalDataSum: function getHiddenTotalDataSum() { - var _this15 = this, - $$ = this, + var _this15 = this; + const $$ = this, api = $$.api, - hiddenTargetIds = $$.state.hiddenTargetIds, - total = 0; + hiddenTargetIds = $$.state.hiddenTargetIds; + let total = 0; if (hiddenTargetIds.length) { total = api.data.values.bind(api)(hiddenTargetIds).reduce(function (p, c) { _newArrowCheck(this, _this15); @@ -4755,12 +4830,12 @@ function getDataKeyForJson(keysParam, config) { return Math.max.apply(Math, this.data.targets.map(function (t) { _newArrowCheck(this, _this17); return t.values.length; - }.bind(this))); + }.bind(this)).concat([0])); }, getMaxDataCountTarget: function getMaxDataCountTarget() { - var _this18 = this, - target = this.filterTargetsToShow() || [], - length = target.length, + var _this18 = this; + let target = this.filterTargetsToShow() || []; + const length = target.length, isInverted = this.config.axis_x_inverted; if (length > 1) { target = target.map(function (t) { @@ -4793,12 +4868,12 @@ function getDataKeyForJson(keysParam, config) { }.bind(this)); }, mapToTargetIds: function mapToTargetIds(ids) { - var $$ = this; + const $$ = this; return ids ? isArray(ids) ? ids.concat() : [ids] : $$.mapToIds($$.data.targets); }, hasTarget: function hasTarget(targets, id) { - var ids = this.mapToIds(targets); - for (var i = 0, val; val = ids[i]; i++) { + const ids = this.mapToIds(targets); + for (let i = 0, val; val = ids[i]; i++) { if (val === id) { return !0; } @@ -4812,18 +4887,18 @@ function getDataKeyForJson(keysParam, config) { return this.state.hiddenLegendIds.indexOf(targetId) < 0; }, filterTargetsToShow: function filterTargetsToShow(targets) { - var _this20 = this, - $$ = this; + var _this20 = this; + const $$ = this; return (targets || $$.data.targets).filter(function (t) { _newArrowCheck(this, _this20); return $$.isTargetToShow(t.id); }.bind(this)); }, mapTargetsToUniqueXs: function mapTargetsToUniqueXs(targets) { - var _this21 = this, - $$ = this, - axis = $$.axis, - xs = []; + var _this21 = this; + const $$ = this, + axis = $$.axis; + let xs = []; if (targets != null && targets.length) { xs = getUnique(mergeArray(targets.map(function (t) { var _this22 = this; @@ -4847,8 +4922,8 @@ function getDataKeyForJson(keysParam, config) { * @private */ addTargetIds: function addTargetIds(type, targetIds) { - var _this23 = this, - state = this.state, + var _this23 = this; + const state = this.state, ids = isArray(targetIds) ? targetIds : [targetIds]; ids.forEach(function (v) { _newArrowCheck(this, _this23); @@ -4862,12 +4937,12 @@ function getDataKeyForJson(keysParam, config) { * @private */ removeTargetIds: function removeTargetIds(type, targetIds) { - var _this24 = this, - state = this.state, + var _this24 = this; + const state = this.state, ids = isArray(targetIds) ? targetIds : [targetIds]; ids.forEach(function (v) { _newArrowCheck(this, _this24); - var index = state[type].indexOf(v); + const index = state[type].indexOf(v); index >= 0 && state[type].splice(index, 1); }.bind(this)); }, @@ -4884,8 +4959,8 @@ function getDataKeyForJson(keysParam, config) { this.removeTargetIds("hiddenLegendIds", targetIds); }, getValuesAsIdKeyed: function getValuesAsIdKeyed(targets) { - var _this25 = this, - $$ = this, + var _this25 = this; + const $$ = this, hasAxis = $$.state.hasAxis, ys = {}, isMultipleX = $$.isMultipleX(), @@ -4896,14 +4971,14 @@ function getDataKeyForJson(keysParam, config) { targets.forEach(function (t) { var _this26 = this; _newArrowCheck(this, _this25); - var data = []; + const data = []; t.values.filter(function (_ref) { - var value = _ref.value; + let value = _ref.value; _newArrowCheck(this, _this26); return isValue(value) || value === null; }.bind(this)).forEach(function (v) { _newArrowCheck(this, _this26); - var value = v.value; + let value = v.value; // exclude 'volume' value to correct mis domain calculation if (value !== null && $$.isCandlestickType(v)) { @@ -4928,11 +5003,11 @@ function getDataKeyForJson(keysParam, config) { return ys; }, checkValueInTargets: function checkValueInTargets(targets, checker) { - var ids = Object.keys(targets); - var values; - for (var i = 0; i < ids.length; i++) { + const ids = Object.keys(targets); + let values; + for (let i = 0; i < ids.length; i++) { values = targets[ids[i]].values; - for (var j = 0; j < values.length; j++) { + for (let j = 0; j < values.length; j++) { if (checker(values[j].value)) { return !0; } @@ -4965,7 +5040,7 @@ function getDataKeyForJson(keysParam, config) { * @private */ orderTargets: function orderTargets(targetsValue) { - var $$ = this, + const $$ = this, targets = [].concat(targetsValue), fn = $$.getSortCompareFn(); fn && targets.sort(fn); @@ -4982,20 +5057,20 @@ function getDataKeyForJson(keysParam, config) { if (isReversed === void 0) { isReversed = !1; } - var $$ = this, + const $$ = this, config = $$.config, order = config.data_order, orderAsc = /asc/i.test(order), orderDesc = /desc/i.test(order); - var fn; + let fn; if (orderAsc || orderDesc) { - var reducer = function (p, c) { + const reducer = function (p, c) { _newArrowCheck(this, _this29); return p + Math.abs(c.value); }.bind(this); fn = function (t1, t2) { _newArrowCheck(this, _this29); - var t1Sum = "values" in t1 ? t1.values.reduce(reducer, 0) : t1.value, + const t1Sum = "values" in t1 ? t1.values.reduce(reducer, 0) : t1.value, t2Sum = "values" in t2 ? t2.values.reduce(reducer, 0) : t2.value; return isReversed ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum; }.bind(this); @@ -5037,7 +5112,7 @@ function getDataKeyForJson(keysParam, config) { }.bind(this)); }, hasDataLabel: function hasDataLabel() { - var dataLabels = this.config.data_labels; + const dataLabels = this.config.data_labels; return isboolean(dataLabels) && dataLabels || isObjectType(dataLabels) && notEmpty(dataLabels); }, /** @@ -5046,24 +5121,34 @@ function getDataKeyForJson(keysParam, config) { * @returns {number} */ getDataIndexFromEvent: function getDataIndexFromEvent(event) { - var $$ = this, + const $$ = this, config = $$.config, _$$$state = $$.state, + hasRadar = _$$$state.hasRadar, inputType = _$$$state.inputType, _$$$state$eventReceiv = _$$$state.eventReceiver, coords = _$$$state$eventReceiv.coords, - rect = _$$$state$eventReceiv.rect, - isRotated = config.axis_rotated, - e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event, + rect = _$$$state$eventReceiv.rect; + let index; + if (hasRadar) { + let target = event.target; + + // in case of multilined axis text + if (/tspan/i.test(target.tagName)) { + target = target.parentNode; + } + const d = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum(); + index = d && Object.keys(d).length === 1 ? d.index : undefined; + } else { + const isRotated = config.axis_rotated, + e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event; // get data based on the mouse coords index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated); - - // get data based on the mouse coords - + } return index; }, getDataLabelLength: function getDataLabelLength(min, max, key) { - var _this34 = this, - $$ = this, + var _this34 = this; + const $$ = this, lengths = [0, 0]; $$.$el.chart.select("svg").selectAll(".dummy").data([min, max]).enter().append("text").text(function (d) { _newArrowCheck(this, _this34); @@ -5080,9 +5165,9 @@ function getDataKeyForJson(keysParam, config) { return "data" in d && this.hasTarget(this.data.targets, d.data.id); }, findSameXOfValues: function findSameXOfValues(values, index) { - var targetX = values[index].x, + const targetX = values[index].x, sames = []; - var i; + let i; for (i = index - 1; i >= 0; i--) { if (targetX !== values[i].x) { break; @@ -5098,8 +5183,8 @@ function getDataKeyForJson(keysParam, config) { return sames; }, findClosestFromTargets: function findClosestFromTargets(targets, pos) { - var _this35 = this, - $$ = this, + var _this35 = this; + const $$ = this, candidates = targets.map(function (target) { _newArrowCheck(this, _this35); return $$.findClosest(target.values, pos); @@ -5109,26 +5194,14 @@ function getDataKeyForJson(keysParam, config) { return $$.findClosest(candidates, pos); }, findClosest: function findClosest(values, pos) { - var _this36 = this, - $$ = this, - config = $$.config, + var _this36 = this; + const $$ = this, main = $$.$el.main, data = values.filter(function (v) { _newArrowCheck(this, _this36); return v && isValue(v.value); - }.bind(this)), - getSensitivity = function (d) { - _newArrowCheck(this, _this36); - var sensitivity = config.point_sensitivity; - if (isFunction(sensitivity)) { - sensitivity = sensitivity.call($$.api, d); - } else if (sensitivity === "radius") { - sensitivity = d.r; - } - return sensitivity; - }.bind(this), - minDist, - closest; + }.bind(this)); + let minDist, closest; // find mouseovering bar/candlestick // https://github.com/naver/billboard.js/issues/2434 data.filter(function (v) { @@ -5136,7 +5209,7 @@ function getDataKeyForJson(keysParam, config) { return $$.isBarType(v.id) || $$.isCandlestickType(v.id); }.bind(this)).forEach(function (v) { _newArrowCheck(this, _this36); - var selector = $$.isBarType(v.id) ? "." + $BAR.chartBar + "." + $COMMON.target + $$.getTargetSelectorSuffix(v.id) + " ." + $BAR.bar + "-" + v.index : "." + $CANDLESTICK.chartCandlestick + "." + $COMMON.target + $$.getTargetSelectorSuffix(v.id) + " ." + $CANDLESTICK.candlestick + "-" + v.index + " path"; + const selector = $$.isBarType(v.id) ? "." + $BAR.chartBar + "." + $COMMON.target + $$.getTargetSelectorSuffix(v.id) + " ." + $BAR.bar + "-" + v.index : "." + $CANDLESTICK.chartCandlestick + "." + $COMMON.target + $$.getTargetSelectorSuffix(v.id) + " ." + $CANDLESTICK.candlestick + "-" + v.index + " path"; if (!closest && $$.isWithinBar(main.select(selector).node())) { closest = v; } @@ -5148,8 +5221,8 @@ function getDataKeyForJson(keysParam, config) { return !$$.isBarType(v.id) && !$$.isCandlestickType(v.id); }.bind(this)).forEach(function (v) { _newArrowCheck(this, _this36); - var d = $$.dist(v, pos); - minDist = getSensitivity(v); + const d = $$.dist(v, pos); + minDist = $$.getPointSensitivity(v); if (d < minDist) { minDist = d; closest = v; @@ -5158,7 +5231,7 @@ function getDataKeyForJson(keysParam, config) { return closest; }, dist: function dist(data, pos) { - var $$ = this, + const $$ = this, isRotated = $$.config.axis_rotated, scale = $$.scale, y = $$.circleY(data, data.index), @@ -5176,7 +5249,7 @@ function getDataKeyForJson(keysParam, config) { * @private */ convertValuesToStep: function convertValuesToStep(values) { - var $$ = this, + const $$ = this, axis = $$.axis, config = $$.config, stepType = config.line_step_type, @@ -5190,10 +5263,10 @@ function getDataKeyForJson(keysParam, config) { // https://github.com/naver/billboard.js/issues/3124 if (converted.length) { // insert & append cloning first/last value to be fully rendered covering on each gap sides - var head = converted[0], + const head = converted[0], tail = converted[converted.length - 1], id = head.id; - var x = head.x; + let x = head.x; // insert head converted.unshift({ @@ -5223,12 +5296,12 @@ function getDataKeyForJson(keysParam, config) { return converted; }, convertValuesToRange: function convertValuesToRange(values) { - var _this37 = this, - converted = isArray(values) ? values.concat() : [values], + var _this37 = this; + const converted = isArray(values) ? values.concat() : [values], ranges = []; converted.forEach(function (range) { _newArrowCheck(this, _this37); - var x = range.x, + const x = range.x, id = range.id; ranges.push({ x: x, @@ -5244,8 +5317,8 @@ function getDataKeyForJson(keysParam, config) { return ranges; }, updateDataAttributes: function updateDataAttributes(name, attrs) { - var _this38 = this, - $$ = this, + var _this38 = this; + const $$ = this, config = $$.config, current = config["data_" + name]; if (isUndefined(attrs)) { @@ -5261,21 +5334,29 @@ function getDataKeyForJson(keysParam, config) { return current; }, getRangedData: function getRangedData(d, key, type) { + var _this39 = this; if (key === void 0) { key = ""; } if (type === void 0) { type = "areaRange"; } - var value = d == null ? void 0 : d.value; + const value = d == null ? void 0 : d.value; if (isArray(value)) { - // @ts-ignore - var index = { - areaRange: ["high", "mid", "low"], - candlestick: ["open", "high", "low", "close", "volume"] - }[type].indexOf(key); - return index >= 0 && value ? value[index] : undefined; - } else if (value) { + if (type === "bar") { + return value.reduce(function (a, c) { + _newArrowCheck(this, _this39); + return c - a; + }.bind(this)); + } else { + // @ts-ignore + const index = { + areaRange: ["high", "mid", "low"], + candlestick: ["open", "high", "low", "close", "volume"] + }[type].indexOf(key); + return index >= 0 && value ? value[index] : undefined; + } + } else if (value && key) { return value[key]; } return value; @@ -5286,20 +5367,20 @@ function getDataKeyForJson(keysParam, config) { * @private */ setRatioForGroupedData: function setRatioForGroupedData(data) { - var _this39 = this, - $$ = this, + var _this40 = this; + const $$ = this, config = $$.config; // calculate ratio if grouped data exists if (config.data_groups.length && data.some(function (d) { - _newArrowCheck(this, _this39); + _newArrowCheck(this, _this40); return $$.isGrouped(d.id); }.bind(this))) { - var setter = function (d) { - _newArrowCheck(this, _this39); + const setter = function (d) { + _newArrowCheck(this, _this40); return $$.getRatio("index", d, !0); }.bind(this); data.forEach(function (v) { - _newArrowCheck(this, _this39); + _newArrowCheck(this, _this40); "values" in v ? v.values.forEach(setter) : setter(v); }.bind(this)); } @@ -5313,15 +5394,15 @@ function getDataKeyForJson(keysParam, config) { * @private */ getRatio: function getRatio(type, d, asPercent) { - var _this40 = this; + var _this41 = this; if (asPercent === void 0) { asPercent = !1; } - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, api = $$.api; - var ratio = 0; + let ratio = 0; if (d && api.data.shown().length) { ratio = d.ratio || d.value; if (type === "arc") { @@ -5331,43 +5412,43 @@ function getDataKeyForJson(keysParam, config) { // otherwise, based on the rendered angle value } else { - var gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getGaugeStartAngle() * -2, + const gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getGaugeStartAngle() * -2, arcLength = $$.hasType("gauge") ? gaugeArcLength : Math.PI * 2; ratio = (d.endAngle - d.startAngle) / arcLength; } } else if (type === "index") { - var dataValues = api.data.values.bind(api); - var total = this.getTotalPerIndex(); + const dataValues = api.data.values.bind(api); + let total = this.getTotalPerIndex(); if (state.hiddenTargetIds.length) { - var hiddenSum = dataValues(state.hiddenTargetIds, !1); + let hiddenSum = dataValues(state.hiddenTargetIds, !1); if (hiddenSum.length) { hiddenSum = hiddenSum.reduce(function (acc, curr) { - var _this41 = this; - _newArrowCheck(this, _this40); + var _this42 = this; + _newArrowCheck(this, _this41); return acc.map(function (v, i) { - _newArrowCheck(this, _this41); + _newArrowCheck(this, _this42); return (isNumber(v) ? v : 0) + curr[i]; }.bind(this)); }.bind(this)); total = total.map(function (v, i) { - _newArrowCheck(this, _this40); + _newArrowCheck(this, _this41); return v - hiddenSum[i]; }.bind(this)); } } - var divisor = total[d.index]; + const divisor = total[d.index]; d.ratio = isNumber(d.value) && total && divisor ? d.value / divisor : 0; ratio = d.ratio; } else if (type === "radar") { ratio = parseFloat(Math.max(d.value, 0) + "") / state.current.dataMax * config.radar_size_ratio; } else if (type === "bar") { - var yScale = $$.getYScaleById.bind($$)(d.id), + const yScale = $$.getYScaleById.bind($$)(d.id), max = yScale.domain().reduce(function (a, c) { - _newArrowCheck(this, _this40); + _newArrowCheck(this, _this41); return c - a; }.bind(this)); // when all data are 0, return 0 - ratio = max === 0 ? 0 : Math.abs(d.value) / max; + ratio = max === 0 ? 0 : Math.abs($$.getRangedData(d, null, type) / max); } else if (type === "treemap") { ratio /= $$.getTotalDataSum(!0); } @@ -5380,19 +5461,19 @@ function getDataKeyForJson(keysParam, config) { * @private */ updateDataIndexByX: function updateDataIndexByX(tickValues) { - var _this42 = this, - $$ = this, + var _this43 = this; + const $$ = this, tickValueMap = tickValues.reduce(function (out, tick, index) { - _newArrowCheck(this, _this42); + _newArrowCheck(this, _this43); out[+tick.x] = index; return out; }.bind(this), {}); $$.data.targets.forEach(function (t) { - var _this43 = this; - _newArrowCheck(this, _this42); + var _this44 = this; + _newArrowCheck(this, _this43); t.values.forEach(function (value, valueIndex) { - _newArrowCheck(this, _this43); - var index = tickValueMap[+value.x]; + _newArrowCheck(this, _this44); + let index = tickValueMap[+value.x]; if (index === undefined) { index = valueIndex; } @@ -5407,7 +5488,7 @@ function getDataKeyForJson(keysParam, config) { * @private */ isBubbleZType: function isBubbleZType(d) { - var $$ = this; + const $$ = this; return $$.isBubbleType(d) && (isObject(d.value) && ("z" in d.value || "y" in d.value) || isArray(d.value) && d.value.length >= 2); }, /** @@ -5417,11 +5498,11 @@ function getDataKeyForJson(keysParam, config) { * @private */ isBarRangeType: function isBarRangeType(d) { - var _this44 = this, - $$ = this, + var _this45 = this; + const $$ = this, value = d.value; return $$.isBarType(d) && isArray(value) && value.length >= 2 && value.every(function (v) { - _newArrowCheck(this, _this44); + _newArrowCheck(this, _this45); return isNumber(v); }.bind(this)); }, @@ -5432,8 +5513,8 @@ function getDataKeyForJson(keysParam, config) { * @private */ getDataById: function getDataById(id) { - var _d$, - d = this.cache.get(id) || this.api.data(id); + var _d$; + const d = this.cache.get(id) || this.api.data(id); return (_d$ = d == null ? void 0 : d[0]) != null ? _d$ : d; } }); @@ -5456,18 +5537,18 @@ function callDone(fn, resizeAfter) { if (resizeAfter === void 0) { resizeAfter = !1; } - var $$ = this, + const $$ = this, api = $$.api; resizeAfter && $$.api.flush(!0); - fn == null ? void 0 : fn.call(api); + fn == null || fn.call(api); } /* harmony default export */ var load = ({ load: function load(rawTargets, args) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, data = $$.data, - append = args.append, - targets = rawTargets; + append = args.append; + let targets = rawTargets; if (targets) { // filter loading targets if needed if (args.filter) { @@ -5479,7 +5560,7 @@ function callDone(fn, resizeAfter) { targets.forEach(function (t) { var _args$types; _newArrowCheck(this, _this); - var type = ((_args$types = args.types) == null ? void 0 : _args$types[t.id]) || args.type; + const type = ((_args$types = args.types) == null ? void 0 : _args$types[t.id]) || args.type; $$.setTargetType(t.id, type); }.bind(this)); } @@ -5487,7 +5568,7 @@ function callDone(fn, resizeAfter) { // Update/Add data data.targets.forEach(function (d) { _newArrowCheck(this, _this); - for (var i = 0; i < targets.length; i++) { + for (let i = 0; i < targets.length; i++) { if (d.id === targets[i].id) { d.values = append ? d.values.concat(targets[i].values) : targets[i].values; targets.splice(i, 1); @@ -5513,8 +5594,9 @@ function callDone(fn, resizeAfter) { callDone.call($$, args.done, args.resizeAfter); }, loadFromArgs: function loadFromArgs(args) { - var _this2 = this, - $$ = this; + var _this2 = this; + const $$ = this; + // prevent load when chart is already destroyed if (!$$.config) { return; @@ -5524,18 +5606,18 @@ function callDone(fn, resizeAfter) { $$.cache.reset(); $$.convertData(args, function (d) { _newArrowCheck(this, _this2); - var data = args.data || d; + const data = args.data || d; args.append && (data.__append__ = !0); data && $$.load($$.convertDataToTargets(data), args); }.bind(this)); }, unload: function unload(rawTargetIds, customDoneCb) { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, state = $$.state, $el = $$.$el, - $T = $$.$T, - done = customDoneCb, + $T = $$.$T; + let done = customDoneCb, targetIds = rawTargetIds; // reset internally cached data $$.cache.reset(); @@ -5556,7 +5638,7 @@ function callDone(fn, resizeAfter) { done(); return; } - var targets = $el.svg.selectAll(targetIds.map(function (id) { + const targets = $el.svg.selectAll(targetIds.map(function (id) { _newArrowCheck(this, _this3); return $$.selectorTarget(id); }.bind(this))); @@ -5600,54 +5682,6 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack /* harmony default export */ var interactions_interaction = ({ - selectRectForSingle: function selectRectForSingle(context, eventRect, index) { - var _this = this, - $$ = this, - config = $$.config, - _$$$$el = $$.$el, - main = _$$$$el.main, - circle = _$$$$el.circle, - isSelectionEnabled = config.data_selection_enabled, - isSelectionGrouped = config.data_selection_grouped, - isSelectable = config.data_selection_isselectable, - isTooltipGrouped = config.tooltip_grouped, - selectedData = $$.getAllValuesOnIndex(index); - if (isTooltipGrouped) { - $$.showTooltip(selectedData, context); - $$.showGridFocus == null ? void 0 : $$.showGridFocus(selectedData); - if (!isSelectionEnabled || isSelectionGrouped) { - return; - } - } - - // remove possible previous focused state - circle || main.selectAll("." + $COMMON.EXPANDED + ":not(." + $SHAPE.shape + "-" + index + ")").classed($COMMON.EXPANDED, !1); - var shapeAtIndex = main.selectAll("." + $SHAPE.shape + "-" + index).classed($COMMON.EXPANDED, !0).style("cursor", isSelectable ? "pointer" : null).filter(function (d) { - return $$.isWithinShape(this, d); - }); - if (shapeAtIndex.empty() && !isTooltipGrouped) { - $$.hideGridFocus == null ? void 0 : $$.hideGridFocus(); - $$.hideTooltip(); - isSelectionGrouped || $$.setExpand(index); - } - shapeAtIndex.call(function (selected) { - var _this2 = this; - _newArrowCheck(this, _this); - var d = selected.data(); - if (isSelectionEnabled && (isSelectionGrouped || isSelectable != null && isSelectable.bind($$.api)(d))) { - eventRect.style("cursor", "pointer"); - } - if (!isTooltipGrouped) { - $$.showTooltip(d, context); - $$.showGridFocus == null ? void 0 : $$.showGridFocus(d); - $$.unexpandCircles == null ? void 0 : $$.unexpandCircles(); - selected.each(function (d) { - _newArrowCheck(this, _this2); - return $$.setExpand(index, d.id); - }.bind(this)); - } - }.bind(this)); - }, /** * Expand data shape/point * @param {number} index Index number @@ -5656,7 +5690,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @private */ setExpand: function setExpand(index, id, reset) { - var $$ = this, + const $$ = this, config = $$.config, circle = $$.$el.circle; circle && config.point_focus_expand_enabled && $$.expandCircles(index, id, reset); @@ -5673,16 +5707,16 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @private */ expandBarTypeShapes: function expandBarTypeShapes(expand, i, id, reset) { - var _this3 = this; + var _this = this; if (expand === void 0) { expand = !0; } - var $$ = this; + const $$ = this; ["bar", "candlestick"].filter(function (v) { - _newArrowCheck(this, _this3); + _newArrowCheck(this, _this); return $$.$el[v]; }.bind(this)).forEach(function (v) { - _newArrowCheck(this, _this3); + _newArrowCheck(this, _this); reset && $$.$el[v].classed($COMMON.EXPANDED, !1); $$.getShapeByIndex(v, i, id).classed($COMMON.EXPANDED, expand); }.bind(this)); @@ -5694,8 +5728,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @private */ setOverOut: function setOverOut(isOver, d) { - var _this5 = this, - $$ = this, + var _this3 = this; + const $$ = this, config = $$.config, _$$$state = $$.state, hasRadar = _$$$state.hasRadar, @@ -5704,31 +5738,31 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack isArcTreemap = isObject(d); // Call event handler if (isArcTreemap || d !== -1) { - var callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api); + const callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api); config.color_onover && $$.setOverColor(isOver, d, isArcTreemap); if (isArcTreemap && "id") { - var selector = hasTreemap ? $TREEMAP.treemap : $ARC.arc; + const selector = hasTreemap ? $TREEMAP.treemap : $ARC.arc; callback(d, main.select("." + selector + $$.getTargetSelectorSuffix(d.id)).node()); } else if (!config.tooltip_grouped) { - var last = $$.cache.get(KEY.setOverOut) || [], + const last = $$.cache.get(KEY.setOverOut) || [], shapesAtIndex = main.selectAll("." + $SHAPE.shape + "-" + d).filter(function (d) { return $$.isWithinShape(this, d); }), shape = shapesAtIndex.filter(function () { - var _this4 = this; + var _this2 = this; return last.every(function (v) { - _newArrowCheck(this, _this4); + _newArrowCheck(this, _this2); return v !== this; }.bind(this)); }); // select based on the index // filter if has new selection // call onout callback if (!isOver || shapesAtIndex.empty() || last.length === shape.size() && shape.nodes().every(function (v, i) { - _newArrowCheck(this, _this5); + _newArrowCheck(this, _this3); return v !== last[i]; }.bind(this))) { while (last.length) { - var target = last.pop(); + const target = last.pop(); config.data_onout.bind($$.api)((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum(), target); } } @@ -5743,7 +5777,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack $$.cache.add(KEY.setOverOut, last); } else { if (isOver) { - config.point_focus_only && hasRadar ? $$.showCircleFocus($$.getAllValuesOnIndex(d, !0)) : $$.setExpand(d, null, !0); + hasRadar && $$.isPointFocusOnly() ? $$.showCircleFocus($$.getAllValuesOnIndex(d, !0)) : $$.setExpand(d, null, !0); } $$.isMultipleX() || main.selectAll("." + $SHAPE.shape + "-" + d).each(function (d) { callback(d, this); @@ -5757,7 +5791,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @private */ callOverOutForTouch: function callOverOutForTouch(d) { - var $$ = this, + const $$ = this, last = $$.cache.get(KEY.callOverOutForTouch); if (isObject(d) && last ? d.id !== last.id : d !== last) { (last || isNumber(last)) && $$.setOverOut(!1, last); @@ -5771,8 +5805,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @private */ getDraggableSelection: function getDraggableSelection() { - var _this6 = this, - $$ = this, + var _this4 = this; + const $$ = this, config = $$.config, state = $$.state; return config.interaction_enabled && config.data_selection_draggable && $$.drag ? (0,external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_.drag)().on("drag", function (event) { @@ -5782,11 +5816,11 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack state.event = event; $$.dragstart(getPointer(event, this)); }).on("end", function (event) { - _newArrowCheck(this, _this6); + _newArrowCheck(this, _this4); state.event = event; $$.dragend(); }.bind(this)) : function () { - _newArrowCheck(this, _this6); + _newArrowCheck(this, _this4); }.bind(this); }, /** @@ -5797,38 +5831,40 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @param {Array} mouse x and y coordinate value */ dispatchEvent: function dispatchEvent(type, index, mouse) { - var _ref, - _this7 = this, - $$ = this, + var _ref; + const $$ = this, config = $$.config, _$$$state2 = $$.state, eventReceiver = _$$$state2.eventReceiver, hasAxis = _$$$state2.hasAxis, hasRadar = _$$$state2.hasRadar, hasTreemap = _$$$state2.hasTreemap, - _$$$$el2 = $$.$el, - eventRect = _$$$$el2.eventRect, - arcs = _$$$$el2.arcs, - radar = _$$$$el2.radar, - treemap = _$$$$el2.treemap, - element = (_ref = hasTreemap && eventReceiver.rect || hasRadar && radar.axes.select("." + $AXIS.axis + "-" + index + " text") || eventRect || (arcs == null ? void 0 : arcs.selectAll("." + $COMMON.target + " path").filter(function (d, i) { - _newArrowCheck(this, _this7); - return i === index; - }.bind(this)))) == null ? void 0 : _ref.node(); + _$$$$el = $$.$el, + eventRect = _$$$$el.eventRect, + radar = _$$$$el.radar, + treemap = _$$$$el.treemap, + element = (_ref = hasTreemap && eventReceiver.rect || hasRadar && radar.axes.select("." + $AXIS.axis + "-" + index + " text") || eventRect || ($$.getArcElementByIdOrIndex == null ? void 0 : $$.getArcElementByIdOrIndex(index))) == null ? void 0 : _ref.node(); if (element) { - var isMultipleX = $$.isMultipleX(); - var _element$getBoundingC = element.getBoundingClientRect(), + const isMultipleX = $$.isMultipleX(), + isRotated = config.axis_rotated; + let _element$getBoundingC = element.getBoundingClientRect(), width = _element$getBoundingC.width, left = _element$getBoundingC.left, top = _element$getBoundingC.top; if (hasAxis && !hasRadar && !isMultipleX) { - var coords = eventReceiver.coords[index]; - width = coords.w; - left += coords.x; - top += coords.y; + const coords = eventReceiver.coords[index]; + if (coords) { + width = coords.w; + left += coords.x; + top += coords.y; + } else { + width = 0; + left = 0; + top = 0; + } } - var x = left + (mouse ? mouse[0] : 0) + (isMultipleX || config.axis_rotated ? 0 : width / 2), - y = top + (mouse ? mouse[1] : 0); + const x = left + (mouse ? mouse[0] : 0) + (isMultipleX || isRotated ? 0 : width / 2), + y = top + (mouse ? mouse[1] : 0) + (isRotated ? 4 : 0); // value 4, is to adjust coordinate value set from: scale.ts - updateScales(): $$.getResettedPadding(1) emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](hasTreemap ? treemap.node() : element, type, { screenX: x, screenY: y, @@ -5845,34 +5881,34 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @private */ unbindZoomEvent: function unbindZoomEvent() { - var $$ = this, - _$$$$el3 = $$.$el, - eventRect = _$$$$el3.eventRect, - zoomResetBtn = _$$$$el3.zoomResetBtn; - eventRect == null ? void 0 : eventRect.on(".zoom wheel.zoom .drag", null); - zoomResetBtn == null ? void 0 : zoomResetBtn.on("click", null).style("display", "none"); + const $$ = this, + _$$$$el2 = $$.$el, + eventRect = _$$$$el2.eventRect, + zoomResetBtn = _$$$$el2.zoomResetBtn; + eventRect == null || eventRect.on(".zoom wheel.zoom .drag", null); + zoomResetBtn == null || zoomResetBtn.on("click", null).style("display", "none"); }, /** * Unbind all attached events * @private */ unbindAllEvents: function unbindAllEvents() { - var _this8 = this, - $$ = this, - _$$$$el4 = $$.$el, - arcs = _$$$$el4.arcs, - eventRect = _$$$$el4.eventRect, - legend = _$$$$el4.legend, - region = _$$$$el4.region, - svg = _$$$$el4.svg, - treemap = _$$$$el4.treemap, + var _this5 = this; + const $$ = this, + _$$$$el3 = $$.$el, + arcs = _$$$$el3.arcs, + eventRect = _$$$$el3.eventRect, + legend = _$$$$el3.legend, + region = _$$$$el3.region, + svg = _$$$$el3.svg, + treemap = _$$$$el3.treemap, brush = $$.brush; // detach all possible event types [svg, eventRect, region == null ? void 0 : region.list, brush == null ? void 0 : brush.getSelection(), arcs == null ? void 0 : arcs.selectAll("path"), legend == null ? void 0 : legend.selectAll("g"), treemap].forEach(function (v) { - _newArrowCheck(this, _this8); + _newArrowCheck(this, _this5); return v == null ? void 0 : v.on("wheel click mouseover mousemove mouseout touchstart touchmove touchend touchstart.eventRect touchmove.eventRect touchend.eventRect .brush .drag .zoom wheel.zoom dblclick.zoom", null); }.bind(this)); - $$.unbindZoomEvent == null ? void 0 : $$.unbindZoomEvent(); + $$.unbindZoomEvent == null || $$.unbindZoomEvent(); } }); ;// CONCATENATED MODULE: ./src/ChartInternal/internals/class.ts @@ -5894,13 +5930,13 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @private */ getClass: function getClass(type, withShape) { - var _this = this, - isPlural = /s$/.test(type), + var _this = this; + const isPlural = /s$/.test(type), useIdKey = /^(area|arc|line|treemap)s?$/.test(type), key = isPlural ? "id" : "index"; return function (d) { _newArrowCheck(this, _this); - var data = d.data || d, + const data = d.data || d, result = (withShape ? this.generateClass(classes[isPlural ? "shapes" : "shape"], data[key]) : "") + this.generateClass(classes[type], data[useIdKey ? "id" : key]); return result.trim(); }.bind(this); @@ -5919,12 +5955,12 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack }.bind(this); }, generateExtraLineClass: function generateExtraLineClass() { - var $$ = this, + const $$ = this, classes = $$.config.line_classes || [], ids = []; return function (d) { - var _d$data, - id = d.id || ((_d$data = d.data) == null ? void 0 : _d$data.id) || d; + var _d$data; + const id = d.id || ((_d$data = d.data) == null ? void 0 : _d$data.id) || d; if (ids.indexOf(id) < 0) { ids.push(id); } @@ -5935,8 +5971,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack return this.generateClass(classes.region, i) + " " + ("class" in d ? d.class : ""); }, classTarget: function classTarget(id) { - var additionalClassSuffix = this.config.data_classes[id]; - var additionalClass = ""; + const additionalClassSuffix = this.config.data_classes[id]; + let additionalClass = ""; if (additionalClassSuffix) { additionalClass = " " + classes.target + "-" + additionalClassSuffix; } @@ -5952,7 +5988,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack return " " + (this.state.defocusedTargetIds.indexOf(d.id) >= 0 ? classes.defocused : ""); }, getTargetSelectorSuffix: function getTargetSelectorSuffix(targetId) { - var targetStr = targetId || targetId === 0 ? "-" + targetId : ""; + const targetStr = targetId || targetId === 0 ? "-" + targetId : ""; return targetStr.replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g, "-"); }, selectorTarget: function selectorTarget(id, prefix, postfix) { @@ -5962,14 +5998,14 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack if (postfix === void 0) { postfix = ""; } - var target = this.getTargetSelectorSuffix(id); + const target = this.getTargetSelectorSuffix(id); // select target & circle return prefix + "." + (classes.target + target) + " " + postfix + ", " + prefix + "." + (classes.circles + target) + " " + postfix; }, selectorTargets: function selectorTargets(idsValue, prefix) { - var _this3 = this, - ids = idsValue || []; + var _this3 = this; + const ids = idsValue || []; return ids.length ? ids.map(function (id) { _newArrowCheck(this, _this3); return this.selectorTarget(id, prefix); @@ -5999,8 +6035,9 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack * @private */ categoryName: function categoryName(i) { - var categories = this.config.axis_x_categories; - return i < (categories == null ? void 0 : categories.length) ? categories[i] : i; + var _axis_x_categories$i; + const axis_x_categories = this.config.axis_x_categories; + return (_axis_x_categories$i = axis_x_categories == null ? void 0 : axis_x_categories[i]) != null ? _axis_x_categories$i : i; } }); // EXTERNAL MODULE: external {"commonjs":"d3-scale","commonjs2":"d3-scale","amd":"d3-scale","root":"d3"} @@ -6027,9 +6064,9 @@ var color_this = undefined; * @returns {{id: string, node: SVGPatternElement}} * @private */ -var colorizePattern = function (pattern, color, id) { +const colorizePattern = function (pattern, color, id) { _newArrowCheck(this, color_this); - var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(pattern.cloneNode(!0)); + const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(pattern.cloneNode(!0)); node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color); return { id: id, @@ -6045,12 +6082,12 @@ var colorizePattern = function (pattern, color, id) { * @private */ function getColorFromCss(element) { - var _this2 = this, - cacheKey = KEY.colorPattern, - body = browser_doc.body, - pattern = body[cacheKey]; + var _this2 = this; + const cacheKey = KEY.colorPattern, + body = browser_doc.body; + let pattern = body[cacheKey]; if (!pattern) { - var content = element.classed($COLOR.colorPattern, !0).style("background-image"); + const content = element.classed($COLOR.colorPattern, !0).style("background-image"); element.classed($COLOR.colorPattern, !1); if (content.indexOf(";") > -1) { pattern = content.replace(/url[^#]*|["'()]|(\s|%20)/g, "").split(";").map(function (v) { @@ -6065,23 +6102,23 @@ function getColorFromCss(element) { // Replacement of d3.schemeCategory10. // Contained differently depend on d3 version: v4(d3-scale), v5(d3-scale-chromatic) -var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]; +const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]; /* harmony default export */ var internals_color = ({ generateColor: function generateColor() { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, $el = $$.$el, config = $$.config, colors = config.data_colors, callback = config.data_color, - ids = [], - pattern = notEmpty(config.color_pattern) ? config.color_pattern : (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleOrdinal)(getColorFromCss($el.chart) || schemeCategory10).range(), - originalColorPattern = pattern; + ids = []; + let pattern = notEmpty(config.color_pattern) ? config.color_pattern : (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleOrdinal)(getColorFromCss($el.chart) || schemeCategory10).range(); + const originalColorPattern = pattern; if (isFunction(config.color_tiles)) { - var tiles = config.color_tiles.bind($$.api)(), + const tiles = config.color_tiles.bind($$.api)(), colorizedPatterns = pattern.map(function (p, index) { _newArrowCheck(this, _this3); - var color = p.replace(/[#\(\)\s,]/g, ""), + const color = p.replace(/[#\(\)\s,]/g, ""), id = $$.state.datetimeId + "-pattern-" + color + "-" + index; return colorizePattern(tiles[index % tiles.length], p, id); }.bind(this)); // Add background color to patterns @@ -6092,10 +6129,11 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " $$.patterns = colorizedPatterns; } return function (d) { - var _data, - id = d.id || ((_data = d.data) == null ? void 0 : _data.id) || d, - isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !config.data_types[id], - color; + var _data; + const id = d.id || ((_data = d.data) == null ? void 0 : _data.id) || d, + isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !config.data_types[id]; + let color; + // if callback function is provided if (isFunction(colors[id])) { color = colors[id].bind($$.api)(d); @@ -6116,7 +6154,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " }; }, generateLevelColor: function generateLevelColor() { - var $$ = this, + const $$ = this, config = $$.config, colors = config.color_pattern, threshold = config.color_threshold, @@ -6124,9 +6162,9 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " max = threshold.max || 100, values = threshold.values && threshold.values.length ? threshold.values : []; return notEmpty(threshold) ? function (value) { - var v = asValue ? value : value * 100 / max; - var color = colors[colors.length - 1]; - for (var i = 0, l = values.length; i < l; i++) { + const v = asValue ? value : value * 100 / max; + let color = colors[colors.length - 1]; + for (let i = 0, l = values.length; i < l; i++) { if (v <= values[i]) { color = colors[i]; break; @@ -6141,14 +6179,14 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " * @private */ generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter(color) { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, $el = $$.$el, config = $$.config, state = $$.state, backgroundColors = color || config.data_labels_backgroundColors; if (backgroundColors) { - var ids = []; + let ids = []; if (isString(backgroundColors)) { ids.push(""); } else if (isObject(backgroundColors)) { @@ -6156,7 +6194,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " } ids.forEach(function (v) { _newArrowCheck(this, _this4); - var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : ""); + const id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : ""); $el.defs.append("filter").attr("x", "0").attr("y", "0").attr("width", "1").attr("height", "1").attr("id", id).html(""); }.bind(this)); } @@ -6171,12 +6209,14 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " return "url(#" + this.state.datetimeId + "-gradient" + this.getTargetSelectorSuffix(id) + ")"; }, /** - * Update linear gradient definition (for area & bar only) + * Update linear/radial gradient definition + * - linear: area & bar only + * - radial: type which has data points only * @private */ updateLinearGradient: function updateLinearGradient() { - var _this5 = this, - $$ = this, + var _this5 = this; + const $$ = this, config = $$.config, targets = $$.data.targets, datetimeId = $$.state.datetimeId, @@ -6184,23 +6224,46 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " targets.forEach(function (d) { var _this6 = this; _newArrowCheck(this, _this5); - var id = datetimeId + "-gradient" + $$.getTargetSelectorSuffix(d.id), - supportedType = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar", - isRotated = config.axis_rotated; - if (supportedType && defs.select("#" + id).empty()) { - var color = $$.color(d), - _config = config[supportedType + "_linearGradient"], - _config$x = _config.x, - x = _config$x === void 0 ? isRotated ? [1, 0] : [0, 0] : _config$x, - _config$y = _config.y, - y = _config$y === void 0 ? isRotated ? [0, 0] : [0, 1] : _config$y, - _config$stops = _config.stops, - stops = _config$stops === void 0 ? [[0, color, 1], [1, color, 0]] : _config$stops, - linearGradient = defs.append("linearGradient").attr("id", "" + id).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]); - stops.forEach(function (v) { + const id = datetimeId + "-gradient" + $$.getTargetSelectorSuffix(d.id), + radialGradient = $$.hasPointType() && config.point_radialGradient, + supportedType = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar"; + if ((radialGradient || supportedType) && defs.select("#" + id).empty()) { + const color = $$.color(d), + gradient = { + defs: null, + stops: [] + }; + if (radialGradient) { + const _radialGradient = radialGradient, + _radialGradient$cx = _radialGradient.cx, + cx = _radialGradient$cx === void 0 ? .3 : _radialGradient$cx, + _radialGradient$cy = _radialGradient.cy, + cy = _radialGradient$cy === void 0 ? .3 : _radialGradient$cy, + _radialGradient$r = _radialGradient.r, + r = _radialGradient$r === void 0 ? .7 : _radialGradient$r, + _radialGradient$stops = _radialGradient.stops, + stops = _radialGradient$stops === void 0 ? [[.1, color, 0], [.9, color, 1]] : _radialGradient$stops; + gradient.stops = stops; + gradient.defs = defs.append("radialGradient").attr("id", "" + id).attr("cx", cx).attr("cy", cy).attr("r", r); + } else { + const isRotated = config.axis_rotated, + _config = config[supportedType + "_linearGradient"], + _config$x = _config.x, + x = _config$x === void 0 ? isRotated ? [1, 0] : [0, 0] : _config$x, + _config$y = _config.y, + y = _config$y === void 0 ? isRotated ? [0, 0] : [0, 1] : _config$y, + _config$stops = _config.stops, + stops = _config$stops === void 0 ? [[0, color, 1], [1, color, 0]] : _config$stops; + gradient.stops = stops; + gradient.defs = defs.append("linearGradient").attr("id", "" + id).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]); + } + gradient.stops.forEach(function (v) { _newArrowCheck(this, _this6); - var stopColor = isFunction(v[1]) ? v[1].bind($$.api)(d.id) : v[1]; - linearGradient.append("stop").attr("offset", v[0]).attr("stop-color", stopColor || color).attr("stop-opacity", v[2]); + const offset = v[0], + stopColor = v[1], + stopOpacity = v[2], + colorValue = isFunction(stopColor) ? stopColor.bind($$.api)(d.id) : stopColor; + gradient.defs && gradient.defs.append("stop").attr("offset", offset).attr("stop-color", colorValue || color).attr("stop-opacity", stopOpacity); }.bind(this)); } }.bind(this)); @@ -6213,15 +6276,15 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " * @private */ setOverColor: function setOverColor(isOver, d) { - var _this7 = this, - $$ = this, + var _this7 = this; + const $$ = this, config = $$.config, main = $$.$el.main, - onover = config.color_onover, - color = isOver ? onover : $$.color; + onover = config.color_onover; + let color = isOver ? onover : $$.color; if (isObject(color)) { color = function (_ref) { - var id = _ref.id; + let id = _ref.id; _newArrowCheck(this, _this7); return id in onover ? onover[id] : $$.color(id); }.bind(this); @@ -6247,8 +6310,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " /* harmony default export */ var domain = ({ getYDomainMinMax: function getYDomainMinMax(targets, type) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, axis = $$.axis, config = $$.config, isMin = type === "min", @@ -6256,17 +6319,17 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " ids = $$.mapToIds(targets), ys = $$.getValuesAsIdKeyed(targets); if (dataGroups.length > 0) { - var hasValue = $$["has" + (isMin ? "Negative" : "Positive") + "ValueInTargets"](targets); + const hasValue = $$["has" + (isMin ? "Negative" : "Positive") + "ValueInTargets"](targets); dataGroups.forEach(function (groupIds) { var _this2 = this; _newArrowCheck(this, _this); // Determine baseId - var idsInGroup = groupIds.filter(function (v) { + const idsInGroup = groupIds.filter(function (v) { _newArrowCheck(this, _this2); return ids.indexOf(v) >= 0; }.bind(this)); if (idsInGroup.length) { - var baseId = idsInGroup[0], + const baseId = idsInGroup[0], baseAxisId = axis.getId(baseId); // Initialize base value. Set to 0 if not match with the condition if (hasValue && ys[baseId]) { @@ -6282,10 +6345,10 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " var _this3 = this; _newArrowCheck(this, _this2); if (ys[id]) { - var axisId = axis.getId(id); + const axisId = axis.getId(id); ys[id].forEach(function (v, i) { _newArrowCheck(this, _this3); - var val = +v, + const val = +v, meetCondition = isMin ? val > 0 : val < 0; if (axisId === baseAxisId && !(hasValue && meetCondition)) { ys[baseId][i] += val; @@ -6308,16 +6371,16 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " * @private */ isHiddenTargetWithYDomain: function isHiddenTargetWithYDomain(id) { - var _this4 = this, - $$ = this; + var _this4 = this; + const $$ = this; return $$.state.hiddenTargetIds.some(function (v) { _newArrowCheck(this, _this4); return $$.axis.getId(v) === id; }.bind(this)); }, getYDomain: function getYDomain(targets, axisId, xDomain) { - var _this5 = this, - $$ = this, + var _this5 = this; + const $$ = this, axis = $$.axis, config = $$.config, scale = $$.scale, @@ -6325,7 +6388,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " if ($$.isStackNormalized()) { return [0, 100]; } - var isLog = (scale == null ? void 0 : scale[axisId]) && scale[axisId].type === "log", + const isLog = (scale == null ? void 0 : scale[axisId]) && scale[axisId].type === "log", targetsByAxisId = targets.filter(function (t) { _newArrowCheck(this, _this5); return axis.getId(t.id) === axisId; @@ -6342,17 +6405,17 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " $$.getYDomain(targets, "y2", xDomain); } } - var yMin = config[pfx + "_min"], + const yMin = config[pfx + "_min"], yMax = config[pfx + "_max"], center = config[pfx + "_center"], isInverted = config[pfx + "_inverted"], showHorizontalDataLabel = $$.hasDataLabel() && config.axis_rotated, showVerticalDataLabel = $$.hasDataLabel() && !config.axis_rotated; - var yDomainMin = $$.getYDomainMinMax(yTargets, "min"), + let yDomainMin = $$.getYDomainMinMax(yTargets, "min"), yDomainMax = $$.getYDomainMinMax(yTargets, "max"), isZeroBased = [TYPE.BAR, TYPE.BUBBLE, TYPE.SCATTER].concat(TYPE_BY_CATEGORY.Line).some(function (v) { _newArrowCheck(this, _this5); - var type = v.indexOf("area") > -1 ? "area" : v; + const type = v.indexOf("area") > -1 ? "area" : v; return $$.hasType(v, yTargets, !0) && config[type + "_zerobased"]; }.bind(this)); // MEMO: avoid inverting domain unexpectedly @@ -6369,7 +6432,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " if (yDomainMin === yDomainMax) { yDomainMin < 0 ? yDomainMax = 0 : yDomainMin = 0; } - var isAllPositive = yDomainMin >= 0 && yDomainMax >= 0, + const isAllPositive = yDomainMin >= 0 && yDomainMax >= 0, isAllNegative = yDomainMin <= 0 && yDomainMax <= 0; // Cancel zerobased if axis_*_min / axis_*_max specified if (isValue(yMin) && isAllPositive || isValue(yMax) && isAllNegative) { @@ -6381,20 +6444,20 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " isAllPositive && (yDomainMin = 0); isAllNegative && (yDomainMax = 0); } - var domainLength = Math.abs(yDomainMax - yDomainMin); - var padding = { + const domainLength = Math.abs(yDomainMax - yDomainMin); + let padding = { top: domainLength * .1, bottom: domainLength * .1 }; if (isDefined(center)) { - var yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax)); + const yDomainAbs = Math.max(Math.abs(yDomainMin), Math.abs(yDomainMax)); yDomainMax = center + yDomainAbs; yDomainMin = center - yDomainAbs; } // add padding for data label if (showHorizontalDataLabel) { - var diff = diffDomain(scale.y.range()), + const diff = diffDomain(scale.y.range()), ratio = $$.getDataLabelLength(yDomainMin, yDomainMax, "width").map(function (v) { _newArrowCheck(this, _this5); return v / diff; @@ -6404,7 +6467,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " padding[v] += domainLength * (ratio[i] / (1 - ratio[0] - ratio[1])); }.bind(this)); } else if (showVerticalDataLabel) { - var lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, "height"); + const lengths = $$.getDataLabelLength(yDomainMin, yDomainMax, "height"); ["bottom", "top"].forEach(function (v, i) { _newArrowCheck(this, _this5); padding[v] += $$.convertPixelToScale("y", lengths[i], domainLength); @@ -6414,7 +6477,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " // if padding is set, the domain will be updated relative the current domain value // ex) $$.height=300, padding.top=150, domainLength=4 --> domain=6 - var p = config[pfx + "_padding"]; + const p = config[pfx + "_padding"]; if (notEmpty(p)) { ["bottom", "top"].forEach(function (v) { _newArrowCheck(this, _this5); @@ -6427,7 +6490,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " isAllPositive && (padding.bottom = yDomainMin); isAllNegative && (padding.top = -yDomainMax); } - var domain = isLog ? [yDomainMin, yDomainMax].map(function (v) { + const domain = isLog ? [yDomainMin, yDomainMax].map(function (v) { _newArrowCheck(this, _this5); return v < 0 ? 0 : v; }.bind(this)) : [yDomainMin - padding.bottom, yDomainMax + padding.top]; @@ -6435,7 +6498,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " }, getXDomainMinMax: function getXDomainMinMax(targets, type) { var _this6 = this, - $$ = this, + _$$$axis; + const $$ = this, configValue = $$.config["axis_x_" + type], dataValue = getMinMax(type, targets.map(function (t) { var _this7 = this; @@ -6444,9 +6508,8 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " _newArrowCheck(this, _this7); return v.x; }.bind(this))); - }.bind(this))), - _$$$axis, - value = isObject(configValue) ? configValue.value : configValue; + }.bind(this))); + let value = isObject(configValue) ? configValue.value : configValue; value = isDefined(value) && (_$$$axis = $$.axis) != null && _$$$axis.isTimeSeries() ? parseDate.bind(this)(value) : value; if (isObject(configValue) && configValue.fit && (type === "min" && value < dataValue || type === "max" && value > dataValue)) { value = undefined; @@ -6461,24 +6524,24 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " * @private */ getXDomainPadding: function getXDomainPadding(domain, tickCount) { - var $$ = this, + const $$ = this, axis = $$.axis, config = $$.config, padding = config.axis_x_padding, isTimeSeriesTickCount = axis.isTimeSeries() && tickCount, diff = diffDomain(domain); - var defaultValue; + let defaultValue; // determine default padding value if (axis.isCategorized() || isTimeSeriesTickCount) { defaultValue = 0; } else if ($$.hasType("bar")) { - var maxDataCount = $$.getMaxDataCount(); + const maxDataCount = $$.getMaxDataCount(); defaultValue = maxDataCount > 1 ? diff / (maxDataCount - 1) / 2 : .5; } else { defaultValue = $$.getResettedPadding(diff * .01); } - var _ref = isNumber(padding) ? { + let _ref = isNumber(padding) ? { left: padding, right: padding } : padding, @@ -6489,13 +6552,13 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " // when the unit is pixel, convert pixels to axis scale value if (padding.unit === "px") { - var domainLength = Math.abs(diff + diff * .2); + const domainLength = Math.abs(diff + diff * .2); left = axis.getPadding(padding, "left", defaultValue, domainLength); right = axis.getPadding(padding, "right", defaultValue, domainLength); } else { - var range = diff + left + right; + const range = diff + left + right; if (isTimeSeriesTickCount && range) { - var relativeTickWidth = diff / tickCount / range; + const relativeTickWidth = diff / tickCount / range; left = left / range / relativeTickWidth; right = right / range / relativeTickWidth; } @@ -6512,21 +6575,21 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " * @private */ getXDomain: function getXDomain(targets) { - var $$ = this, + const $$ = this, axis = $$.axis, config = $$.config, x = $$.scale.x, isInverted = config.axis_x_inverted, domain = [$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")]; - var _domain$ = domain[0], + let _domain$ = domain[0], min = _domain$ === void 0 ? 0 : _domain$, _domain$2 = domain[1], max = _domain$2 === void 0 ? 0 : _domain$2; if (x.type !== "log") { - var isCategorized = axis.isCategorized(), + const isCategorized = axis.isCategorized(), isTimeSeries = axis.isTimeSeries(), padding = $$.getXDomainPadding(domain); - var firstX = domain[0], + let firstX = domain[0], lastX = domain[1]; // show center of x domain if min and max are the same @@ -6549,7 +6612,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " return isInverted ? [max, min] : [min, max]; }, updateXDomain: function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) { - var $$ = this, + const $$ = this, config = $$.config, org = $$.org, _$$$scale = $$.scale, @@ -6560,13 +6623,19 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " var _$$$brush; x.domain(domain || sortValue($$.getXDomain(targets), !config.axis_x_inverted)); org.xDomain = x.domain(); - zoomEnabled && $$.zoom.updateScaleExtent(); + + // zoomEnabled && $$.zoom.updateScaleExtent(); + subX.domain(x.domain()); - (_$$$brush = $$.brush) == null ? void 0 : _$$$brush.scale(subX); + (_$$$brush = $$.brush) == null || _$$$brush.scale(subX); } if (withUpdateXDomain) { - var domainValue = domain || !$$.brush || brushEmpty($$) ? org.xDomain : getBrushSelection($$).map(subX.invert); + const domainValue = domain || !$$.brush || brushEmpty($$) ? org.xDomain : getBrushSelection($$).map(subX.invert); x.domain(domainValue); + // zoomEnabled && $$.zoom.updateScaleExtent(); + } + + if (withUpdateOrgXDomain || withUpdateXDomain) { zoomEnabled && $$.zoom.updateScaleExtent(); } @@ -6581,15 +6650,15 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " * @private */ trimXDomain: function trimXDomain(domain) { - var $$ = this, + const $$ = this, isInverted = $$.config.axis_x_inverted, zoomDomain = $$.getZoomDomain(), _zoomDomain = zoomDomain, min = _zoomDomain[0], max = _zoomDomain[1]; if (isInverted ? domain[0] >= min : domain[0] <= min) { - domain[0] = min; domain[1] = +domain[1] + (min - domain[0]); + domain[0] = min; } if (isInverted ? domain[1] <= max : domain[1] >= max) { domain[0] = +domain[0] - (domain[1] - max); @@ -6598,22 +6667,33 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " return domain; }, /** - * Get zoom domain + * Get subchart/zoom domain + * @param {string} type "subX" or "zoom" + * @param {boolean} getCurrent Get current domain if true * @returns {Array} zoom domain * @private */ - getZoomDomain: function getZoomDomain() { - var $$ = this, - config = $$.config, - org = $$.org; - var _org$xDomain = org.xDomain, - min = _org$xDomain[0], - max = _org$xDomain[1]; - if (isDefined(config.zoom_x_min)) { - min = getMinMax("min", [min, config.zoom_x_min]); + getZoomDomain: function getZoomDomain(type, getCurrent) { + if (type === void 0) { + type = "zoom"; } - if (isDefined(config.zoom_x_max)) { - max = getMinMax("max", [max, config.zoom_x_max]); + if (getCurrent === void 0) { + getCurrent = !1; + } + const $$ = this, + config = $$.config, + scale = $$.scale, + org = $$.org; + let _ref2 = getCurrent && scale[type] ? scale[type].domain() : org.xDomain, + min = _ref2[0], + max = _ref2[1]; + if (type === "zoom") { + if (isDefined(config.zoom_x_min)) { + min = getMinMax("min", [min, config.zoom_x_min]); + } + if (isDefined(config.zoom_x_max)) { + max = getMinMax("max", [max, config.zoom_x_max]); + } } return [min, max]; }, @@ -6626,17 +6706,48 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " * @private */ convertPixelToScale: function convertPixelToScale(type, pixels, domainLength) { - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, isRotated = config.axis_rotated; - var length; + let length; if (type === "x") { length = isRotated ? "height" : "width"; } else { length = isRotated ? "width" : "height"; } return domainLength * (pixels / state[length]); + }, + /** + * Check if the given domain is within subchart/zoom range + * @param {Array} domain Target domain value + * @param {Array} current Current subchart/zoom domain value + * @param {Array} range subchart/zoom range value + * @returns {boolean} + * @private + */ + withinRange: function withinRange(domain, current, range) { + var _this8 = this; + const $$ = this, + isInverted = $$.config.axis_x_inverted, + _ref3 = range, + min = _ref3[0], + max = _ref3[1]; + if (Array.isArray(domain)) { + const target = [].concat(domain); + isInverted && target.reverse(); + if (target[0] < target[1]) { + return domain.every(function (v, i) { + var _this9 = this; + _newArrowCheck(this, _this8); + return (i === 0 ? isInverted ? +v <= min : +v >= min : isInverted ? +v >= max : +v <= max) && !domain.every(function (v, i) { + _newArrowCheck(this, _this9); + return v === current[i]; + }.bind(this)); + }.bind(this)); + } + } + return !1; } }); ;// CONCATENATED MODULE: ./src/ChartInternal/internals/format.ts @@ -6655,7 +6766,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", " * @private */ function getFormat($$, typeValue, v) { - var config = $$.config, + const config = $$.config, type = "axis_" + typeValue + "_tick_format", format = config[type] ? config[type] : $$.defaultValueFormat; return format.call($$.api, v); @@ -6673,18 +6784,18 @@ function getFormat($$, typeValue, v) { * @private */ getDefaultValueFormat: function getDefaultValueFormat() { - var $$ = this, + const $$ = this, defaultArcValueFormat = $$.defaultArcValueFormat, yFormat = $$.yFormat, y2Format = $$.y2Format, hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]); return function (v, ratio, id) { - var format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat; + const format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat; return format.call($$, v, ratio); }; }, defaultValueFormat: function defaultValueFormat(v) { - return isValue(v) ? +v : ""; + return isArray(v) ? v.join("~") : isValue(v) ? +v : ""; }, defaultArcValueFormat: function defaultArcValueFormat(v, ratio) { return (ratio * 100).toFixed(1) + "%"; @@ -6693,14 +6804,22 @@ function getFormat($$, typeValue, v) { return "" + v; }, dataLabelFormat: function dataLabelFormat(targetId) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, dataLabels = $$.config.data_labels, defaultFormat = function (v) { _newArrowCheck(this, _this); - return isValue(v) ? +v : ""; - }.bind(this), - format = defaultFormat; + const delimiter = "~"; + let res = v; + if (isArray(v)) { + res = v.join(delimiter); + } else if (isObject(v)) { + res = Object.values(v).join(delimiter); + } + return res; + }.bind(this); + let format = defaultFormat; + // find format according to axis id if (isFunction(dataLabels.format)) { format = dataLabels.format; @@ -6736,7 +6855,7 @@ function getFormat($$, typeValue, v) { * @private */ function getLegendColor(id) { - var $$ = this, + const $$ = this, data = $$.getDataById(id), color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data); return color; @@ -6747,7 +6866,7 @@ function getLegendColor(id) { * @private */ initLegend: function initLegend() { - var $$ = this, + const $$ = this, config = $$.config, $el = $$.$el; $$.legendItemTextBox = {}; @@ -6772,8 +6891,8 @@ function getLegendColor(id) { * @private */ updateLegend: function updateLegend(targetIds, options, transitions) { - var _$el$legend, - $$ = this, + var _$el$legend; + const $$ = this, config = $$.config, state = $$.state, scale = $$.scale, @@ -6792,8 +6911,8 @@ function getLegendColor(id) { } // toggle legend state - (_$el$legend = $el.legend) == null ? void 0 : _$el$legend.selectAll("." + $LEGEND.legendItem).classed($LEGEND.legendItemHidden, function (id) { - var hide = !$$.isTargetToShow(id); + (_$el$legend = $el.legend) == null || _$el$legend.selectAll("." + $LEGEND.legendItem).classed($LEGEND.legendItemHidden, function (id) { + const hide = !$$.isTargetToShow(id); if (hide) { this.style.opacity = null; } @@ -6813,19 +6932,19 @@ function getLegendColor(id) { * @private */ updateLegendTemplate: function updateLegendTemplate() { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, $el = $$.$el, wrapper = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(config.legend_contents_bindto), template = config.legend_contents_template; if (!wrapper.empty()) { - var targets = $$.mapToIds($$.data.targets), + const targets = $$.mapToIds($$.data.targets), ids = []; - var html = ""; + let html = ""; targets.forEach(function (v) { _newArrowCheck(this, _this); - var content = isFunction(template) ? template.bind($$.api)(v, $$.color(v), $$.api.data(v)[0].values) : tplProcess(template, { + const content = isFunction(template) ? template.bind($$.api)(v, $$.color(v), $$.api.data(v)[0].values) : tplProcess(template, { COLOR: $$.color(v), TITLE: v }); @@ -6834,7 +6953,7 @@ function getLegendColor(id) { html += content; } }.bind(this)); - var legendItem = wrapper.html(html).selectAll(function () { + const legendItem = wrapper.html(html).selectAll(function () { return this.childNodes; }).data(ids); $$.setLegendItem(legendItem); @@ -6847,7 +6966,7 @@ function getLegendColor(id) { * @private */ updateSizeForLegend: function updateSizeForLegend(size) { - var $$ = this, + const $$ = this, config = $$.config, _$$$state = $$.state, isLegendTop = _$$$state.isLegendTop, @@ -6858,8 +6977,8 @@ function getLegendColor(id) { width = size.width, height = size.height, insetLegendPosition = { - top: isLegendTop ? $$.getCurrentPaddingTop() + config.legend_inset_y + 5.5 : current.height - height - $$.getCurrentPaddingBottom() - config.legend_inset_y, - left: isLegendLeft ? $$.getCurrentPaddingLeft() + config.legend_inset_x + .5 : current.width - width - $$.getCurrentPaddingRight() - config.legend_inset_x + .5 + top: isLegendTop ? $$.getCurrentPaddingByDirection("top") + config.legend_inset_y + 5.5 : current.height - height - $$.getCurrentPaddingByDirection("bottom") - config.legend_inset_y, + left: isLegendLeft ? $$.getCurrentPaddingByDirection("left") + config.legend_inset_x + .5 : current.width - width - $$.getCurrentPaddingByDirection("right") - config.legend_inset_x + .5 }; $$.state.margin3 = { top: isLegendRight ? 0 : isLegendInset ? insetLegendPosition.top : current.height - height, @@ -6874,7 +6993,7 @@ function getLegendColor(id) { * @private */ transformLegend: function transformLegend(withTransition) { - var $$ = this, + const $$ = this, legend = $$.$el.legend, $T = $$.$T; $T(legend, withTransition).attr("transform", $$.getTranslate("legend")); @@ -6910,7 +7029,7 @@ function getLegendColor(id) { * @private */ updateLegendItemColor: function updateLegendItemColor(id, color) { - var legend = this.$el.legend; + const legend = this.$el.legend; if (legend) { legend.select("." + $LEGEND.legendItem + "-" + id + " line").style("stroke", color); } @@ -6921,7 +7040,7 @@ function getLegendColor(id) { * @private */ getLegendWidth: function getLegendWidth() { - var $$ = this, + const $$ = this, _$$$state2 = $$.state, width = _$$$state2.current.width, isLegendRight = _$$$state2.isLegendRight, @@ -6936,8 +7055,8 @@ function getLegendColor(id) { * @private */ getLegendHeight: function getLegendHeight() { - var _$$$config$padding, - $$ = this, + var _$$$config$padding; + const $$ = this, _$$$state3 = $$.state, current = _$$$state3.current, isLegendRight = _$$$state3.isLegendRight, @@ -6962,8 +7081,8 @@ function getLegendColor(id) { * @private */ toggleFocusLegend: function toggleFocusLegend(targetIds, focus) { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, legend = $$.$el.legend, $T = $$.$T, targetIdz = $$.mapToTargetIds(targetIds); @@ -6979,7 +7098,7 @@ function getLegendColor(id) { * @private */ revertLegend: function revertLegend() { - var $$ = this, + const $$ = this, legend = $$.$el.legend, $T = $$.$T; legend && $T(legend.selectAll("." + $LEGEND.legendItem).classed($FOCUS.legendItemFocused, !1)).style("opacity", null); @@ -6990,7 +7109,7 @@ function getLegendColor(id) { * @private */ showLegend: function showLegend(targetIds) { - var $$ = this, + const $$ = this, config = $$.config, $el = $$.$el, $T = $$.$T; @@ -7008,7 +7127,7 @@ function getLegendColor(id) { * @private */ hideLegend: function hideLegend(targetIds) { - var $$ = this, + const $$ = this, config = $$.config, legend = $$.$el.legend; if (config.legend_show && isEmpty(targetIds)) { @@ -7026,13 +7145,13 @@ function getLegendColor(id) { * @private */ getLegendItemTextBox: function getLegendItemTextBox(id, textElement) { - var $$ = this, + const $$ = this, cache = $$.cache, state = $$.state; - var data; + let data; // do not prefix w/'$', to not be resetted cache in .load() call - var cacheKey = KEY.legendItemTextBox; + const cacheKey = KEY.legendItemTextBox; if (id) { data = !state.redrawing && cache.get(cacheKey) || {}; if (!data[id]) { @@ -7049,8 +7168,8 @@ function getLegendColor(id) { * @private */ setLegendItem: function setLegendItem(item) { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, $el = $$.$el, api = $$.api, config = $$.config, @@ -7060,7 +7179,7 @@ function getLegendColor(id) { useCssRule = config.boost_useCssRule, interaction = config.legend_item_interaction; item.attr("class", function (id) { - var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), + const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), itemClass = !node.empty() && node.attr("class") || ""; return itemClass + $$.generateClass($LEGEND.legendItem, id); }).style("visibility", function (id) { @@ -7071,14 +7190,14 @@ function getLegendColor(id) { if (useCssRule) { [["." + $LEGEND.legendItem, "cursor:pointer"], ["." + $LEGEND.legendItem + " text", "pointer-events:none"], ["." + $LEGEND.legendItemPoint + " text", "pointer-events:none"], ["." + $LEGEND.legendItemTile, "pointer-events:none"], ["." + $LEGEND.legendItemEvent, "fill-opacity:0"]].forEach(function (v) { _newArrowCheck(this, _this3); - var selector = v[0], + const selector = v[0], props = v[1]; $$.setCssRule(!1, selector, [props])($el.legend); }.bind(this)); } item.on(interaction.dblclick ? "dblclick" : "click", interaction || isFunction(config.legend_item_onclick) ? function (event, id) { if (!callFn(config.legend_item_onclick, api, id)) { - var altKey = event.altKey, + const altKey = event.altKey, target = event.target, type = event.type; if (type === "dblclick" || altKey) { @@ -7127,8 +7246,8 @@ function getLegendColor(id) { * @private */ updateLegendElement: function updateLegendElement(targetIds, options) { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, config = $$.config, state = $$.state, legend = $$.$el.legend, @@ -7160,16 +7279,15 @@ function getLegendColor(id) { heights: {}, margins: [0], steps: {} - }, - xForLegend, - yForLegend, - background, - targetIdz = targetIds.filter(function (id) { + }; + let xForLegend, yForLegend, background; + // Skip elements when their name is set to null + const targetIdz = targetIds.filter(function (id) { _newArrowCheck(this, _this4); return !isDefined(config.data_names[id]) || config.data_names[id] !== null; }.bind(this)), withTransition = options.withTransition, - updatePositions = $$.getUpdateLegendPositions(targetIdz, dimension, sizes); // Skip elements when their name is set to null + updatePositions = $$.getUpdateLegendPositions(targetIdz, dimension, sizes); if (state.isLegendInset) { dimension.step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length; $$.updateLegendStep(dimension.step); @@ -7202,7 +7320,7 @@ function getLegendColor(id) { return dimension.max.height * sizes.steps[id]; }.bind(this); } - var posFn = { + const posFn = { xText: function xText(id, i) { _newArrowCheck(this, _this4); return xForLegend(id, i) + 4 + itemTileSize.width; @@ -7239,7 +7357,7 @@ function getLegendColor(id) { if (state.isLegendInset && dimension.max.width > 0 && background.size() === 0) { background = legend.insert("g", "." + $LEGEND.legendItem).attr("class", $LEGEND.legendBackground).append("rect"); } - var texts = legend.selectAll("text").data(targetIdz).text(function (id) { + const texts = legend.selectAll("text").data(targetIdz).text(function (id) { _newArrowCheck(this, _this4); return isDefined(config.data_names[id]) ? config.data_names[id] : id; }.bind(this)) // MEMO: needed for update @@ -7247,7 +7365,7 @@ function getLegendColor(id) { updatePositions(this, id, i); }); $T(texts, withTransition).attr("x", posFn.xText).attr("y", posFn.yText); - var rects = legend.selectAll("rect." + $LEGEND.legendItemEvent).data(targetIdz); + const rects = legend.selectAll("rect." + $LEGEND.legendItemEvent).data(targetIdz); $T(rects, withTransition).attr("width", function (id) { _newArrowCheck(this, _this4); return sizes.widths[id]; @@ -7276,33 +7394,35 @@ function getLegendColor(id) { * @private */ getUpdateLegendPositions: function getUpdateLegendPositions(targetIdz, dimension, sizes) { - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, isLegendRightOrInset = state.isLegendRight || state.isLegendInset; return function (textElement, id, index) { - var _this5 = this, - isLast = index === targetIdz.length - 1, + var _this5 = this; + const isLast = index === targetIdz.length - 1, box = $$.getLegendItemTextBox(id, textElement), itemWidth = box.width + dimension.tileWidth + (isLast && !isLegendRightOrInset ? 0 : dimension.padding.right) + config.legend_padding, itemHeight = box.height + dimension.padding.top, itemLength = isLegendRightOrInset ? itemHeight : itemWidth, - areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(), - margin, - updateValues = function (id2, withoutStep) { - if (!withoutStep) { - margin = (areaLength - dimension.totalLength - itemLength) / 2; - if (margin < dimension.posMin) { - margin = (areaLength - itemLength) / 2; - dimension.totalLength = 0; - dimension.step++; - } + areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(); + let margin; + + // MEMO: care about condifion of step, totalLength + const updateValues = function (id2, withoutStep) { + if (!withoutStep) { + margin = (areaLength - dimension.totalLength - itemLength) / 2; + if (margin < dimension.posMin) { + margin = (areaLength - itemLength) / 2; + dimension.totalLength = 0; + dimension.step++; } - sizes.steps[id2] = dimension.step; - sizes.margins[dimension.step] = state.isLegendInset ? 10 : margin; - sizes.offsets[id2] = dimension.totalLength; - dimension.totalLength += itemLength; - }; // MEMO: care about condifion of step, totalLength + } + sizes.steps[id2] = dimension.step; + sizes.margins[dimension.step] = state.isLegendInset ? 10 : margin; + sizes.offsets[id2] = dimension.totalLength; + dimension.totalLength += itemLength; + }; if (index === 0) { dimension.totalLength = 0; dimension.step = 0; @@ -7324,7 +7444,7 @@ function getLegendColor(id) { if (!dimension.max.height || itemHeight >= dimension.max.height) { dimension.max.height = itemHeight; } - var maxLength = isLegendRightOrInset ? dimension.max.height : dimension.max.width; + const maxLength = isLegendRightOrInset ? dimension.max.height : dimension.max.width; if (config.legend_equally) { Object.keys(sizes.widths).forEach(function (id2) { _newArrowCheck(this, _this5); @@ -7359,8 +7479,8 @@ function getLegendColor(id) { * @private */ generateLegendItem: function generateLegendItem(targetIdz, itemTileSize, updatePositions, posFn) { - var _this6 = this, - $$ = this, + var _this6 = this; + const $$ = this, config = $$.config, state = $$.state, legend = $$.$el.legend, @@ -7369,7 +7489,9 @@ function getLegendColor(id) { legendType = config.legend_item_tile_type, isRectangle = legendType !== "circle", isLegendRightOrInset = state.isLegendRight || state.isLegendInset, + pos = -200, l = legend.selectAll("." + $LEGEND.legendItem).data(targetIdz).enter().append("g"); + // Define g for legend area $$.setLegendItem(l); @@ -7381,19 +7503,19 @@ function getLegendColor(id) { }).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ? posFn.xText : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yText); l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ? posFn.xRect : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yRect); if (usePoint) { - var _ids = []; + const ids = []; l.append(function (d) { _newArrowCheck(this, _this6); - var pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type]; - _ids.indexOf(d) === -1 && _ids.push(d); - var point = pattern[_ids.indexOf(d) % pattern.length]; + const pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type]; + ids.indexOf(d) === -1 && ids.push(d); + let point = pattern[ids.indexOf(d) % pattern.length]; if (point === "rectangle") { point = "rect"; } return browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, "hasValidPointType" in $$ && $$.hasValidPointType(point) ? point : "use"); }.bind(this)).attr("class", $LEGEND.legendItemPoint).style("fill", getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).attr("href", function (data, idx, selection) { _newArrowCheck(this, _this6); - var node = selection[idx], + const node = selection[idx], nodeName = node.nodeName.toLowerCase(), id = $$.getTargetSelectorSuffix(data); return nodeName === "use" ? "#" + state.datetimeId + "-point" + id : undefined; @@ -7402,9 +7524,9 @@ function getLegendColor(id) { l.append(isRectangle ? "line" : legendType).attr("class", $LEGEND.legendItemTile).style("stroke", getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).call(function (selection) { _newArrowCheck(this, _this6); if (legendType === "circle") { - selection.attr("r", legendItemR).style("fill", getLegendColor.bind($$)).attr("cx", isLegendRightOrInset ? posFn.x2Tile : -200).attr("cy", isLegendRightOrInset ? -200 : posFn.yTile); + selection.attr("r", legendItemR).style("fill", getLegendColor.bind($$)).attr("cx", isLegendRightOrInset ? posFn.x2Tile : pos).attr("cy", isLegendRightOrInset ? pos : posFn.yTile); } else if (isRectangle) { - selection.attr("stroke-width", itemTileSize.height).attr("x1", isLegendRightOrInset ? posFn.x1Tile : -200).attr("y1", isLegendRightOrInset ? -200 : posFn.yTile).attr("x2", isLegendRightOrInset ? posFn.x2Tile : -200).attr("y2", isLegendRightOrInset ? -200 : posFn.yTile); + selection.attr("stroke-width", itemTileSize.height).attr("x1", isLegendRightOrInset ? posFn.x1Tile : pos).attr("y1", isLegendRightOrInset ? pos : posFn.yTile).attr("x2", isLegendRightOrInset ? posFn.x2Tile : pos).attr("y2", isLegendRightOrInset ? pos : posFn.yTile); } }.bind(this)); } @@ -7417,20 +7539,20 @@ function getLegendColor(id) { * @private */ updateLegendItemPos: function updateLegendItemPos(targetIdz, withTransition, posFn) { - var _this8 = this, - $$ = this, + var _this8 = this; + const $$ = this, config = $$.config, legend = $$.$el.legend, $T = $$.$T, usePoint = config.legend_usePoint, legendType = config.legend_item_tile_type; if (usePoint) { - var tiles = legend.selectAll("." + $LEGEND.legendItemPoint).data(targetIdz); + const tiles = legend.selectAll("." + $LEGEND.legendItemPoint).data(targetIdz); $T(tiles, withTransition).each(function () { - var _this7 = this, - nodeName = this.nodeName.toLowerCase(), - pointR = config.point_r, - x = "x", + var _this7 = this; + const nodeName = this.nodeName.toLowerCase(), + pointR = config.point_r; + let x = "x", y = "y", xOffset = 2, yOffset = 2.5, @@ -7438,16 +7560,16 @@ function getLegendColor(id) { width = null, height = null; if (nodeName === "circle") { - var size = pointR * .2; + const size = pointR * .2; x = "cx"; y = "cy"; radius = pointR + size; xOffset = pointR * 2; yOffset = -size; } else if (nodeName === "rect") { - var _size = pointR * 2.5; - width = _size; - height = _size; + const size = pointR * 2.5; + width = size; + height = size; yOffset = 3; } (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr(x, function (d) { @@ -7459,14 +7581,14 @@ function getLegendColor(id) { }.bind(this)).attr("r", radius).attr("width", width).attr("height", height); }); } else { - var _tiles = legend.selectAll("." + $LEGEND.legendItemTile).data(targetIdz); - $T(_tiles, withTransition).style("stroke", getLegendColor.bind($$)).call(function (selection) { + const tiles = legend.selectAll("." + $LEGEND.legendItemTile).data(targetIdz); + $T(tiles, withTransition).style("stroke", getLegendColor.bind($$)).call(function (selection) { var _this9 = this; _newArrowCheck(this, _this8); if (legendType === "circle") { selection.attr("cx", function (d) { _newArrowCheck(this, _this9); - var x2 = posFn.x2Tile(d); + const x2 = posFn.x2Tile(d); return x2 - (x2 - posFn.x1Tile(d)) / 2; }.bind(this)).attr("cy", posFn.yTile); } else if (legendType !== "circle") { @@ -7495,7 +7617,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro if (options === void 0) { options = {}; } - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, $el = $$.$el, @@ -7503,7 +7625,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro main = _$el.main, treemap = _$el.treemap; state.redrawing = !0; - var targetsToShow = $$.filterTargetsToShow($$.data.targets), + const targetsToShow = $$.filterTargetsToShow($$.data.targets), _options = options, flow = _options.flow, initializing = _options.initializing, @@ -7524,11 +7646,6 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro $$.updateDimension(!0); } - // update circleY based on updated parameters - if (!treemap && (!$$.hasArcType() || state.hasRadar)) { - $$.updateCircleY && ($$.circleY = $$.updateCircleY()); - } - // Data empty label positioning and text. config.data_empty_label_text && main.select("text." + $TEXT.text + "." + $COMMON.empty).attr("x", state.width / 2).attr("y", state.height / 2).text(config.data_empty_label_text).style("display", targetsToShow.length ? "none" : null); @@ -7544,7 +7661,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro config.regions.length && $$.updateRegion(); ["bar", "candlestick", "line", "area"].forEach(function (v) { _newArrowCheck(this, _this); - var name = capitalize(v); + const name = capitalize(v); if (/^(line|area)$/.test(v) && $$.hasTypeOf(name) || $$.hasType(v)) { $$["update" + name](wth.TransitionForExit); } @@ -7556,7 +7673,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro // event rects will redrawn when flow called if (config.interaction_enabled && !flow && wth.EventRect) { $$.redrawEventRect(); - $$.bindZoomEvent == null ? void 0 : $$.bindZoomEvent(); + $$.bindZoomEvent == null || $$.bindZoomEvent(); } } else { // arc @@ -7581,9 +7698,10 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro $$.hasDataLabel() && !$$.hasArcType(null, ["radar"]) && $$.updateText(); // title - $$.redrawTitle == null ? void 0 : $$.redrawTitle(); + $$.redrawTitle == null || $$.redrawTitle(); initializing && $$.updateTypesElements(); $$.generateRedrawList(targetsToShow, flow, duration, wth.Subchart); + $$.updateTooltipOnRedraw(); $$.callPluginHook("$redraw", options, duration); }, /** @@ -7595,8 +7713,8 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro * @private */ generateRedrawList: function generateRedrawList(targets, flow, duration, withSubchart) { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, state = $$.state, shape = $$.getDrawShape(); @@ -7606,7 +7724,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro } // generate flow - var flowFn = flow && $$.generateFlow({ + const flowFn = flow && $$.generateFlow({ targets: targets, flow: flow, duration: flow.duration, @@ -7626,7 +7744,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro // Only use transition when current tab is visible. if (withTransition && redrawList.length) { // Wait for end of transitions for callback - var waitForDraw = generateWait(); + const waitForDraw = generateWait(); // transition should be derived from one transition (0,external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_root_d3_.transition)().duration(duration).each(function () { @@ -7652,8 +7770,8 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro }.bind(this)); }, getRedrawList: function getRedrawList(shape, flow, flowFn, withTransition) { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, config = $$.config, _$$$state = $$.state, hasAxis = _$$$state.hasAxis, @@ -7675,7 +7793,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro } Object.keys(shape.type).forEach(function (v) { _newArrowCheck(this, _this4); - var name = capitalize(v), + const name = capitalize(v), drawFn = shape.type[v]; if (/^(area|line)$/.test(v) && $$.hasTypeOf(name) || $$.hasType(v)) { list.push($$["redraw" + name](drawFn, withTransition)); @@ -7686,7 +7804,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro if (!$$.hasArcType() || hasRadar) { notEmpty(config.data_labels) && config.data_labels !== !1 && list.push($$.redrawText(xForText, yForText, flow, withTransition)); } - if (($$.hasPointType() || hasRadar) && !config.point_focus_only) { + if (($$.hasPointType() || hasRadar) && !$$.isPointFocusOnly()) { $$.redrawCircle && list.push($$.redrawCircle(cx, cy, withTransition, flowFn)); } if (hasTreemap) { @@ -7698,10 +7816,10 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro if (options === void 0) { options = {}; } - var $$ = this, + const $$ = this, config = $$.config, state = $$.state; - var transitions; + let transitions; // same with redraw options.withTransition = getOption(options, "withTransition", !0); @@ -7758,7 +7876,7 @@ function getScale(type, min, max) { if (max === void 0) { max = 1; } - var scale = { + const scale = { linear: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear, log: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSymlog, _log: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLog, @@ -7780,7 +7898,7 @@ function getScale(type, min, max) { * @private */ getXScale: function getXScale(min, max, domain, offset) { - var $$ = this, + const $$ = this, scale = $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max); return $$.getCustomizedXScale(domain ? scale.domain(domain) : scale, offset); }, @@ -7794,7 +7912,7 @@ function getScale(type, min, max) { * @private */ getYScale: function getYScale(id, min, max, domain) { - var $$ = this, + const $$ = this, scale = getScale($$.axis.getAxisType(id), min, max); domain && scale.domain(domain); return scale; @@ -7811,7 +7929,7 @@ function getScale(type, min, max) { if (isSub === void 0) { isSub = !1; } - var isY2 = ((_this$axis = this.axis) == null ? void 0 : _this$axis.getId(id)) === "y2", + const isY2 = ((_this$axis = this.axis) == null ? void 0 : _this$axis.getId(id)) === "y2", key = isSub ? isY2 ? "subY2" : "subY" : isY2 ? "y2" : "y"; return this.scale[key]; }, @@ -7823,19 +7941,19 @@ function getScale(type, min, max) { * @private */ getCustomizedXScale: function getCustomizedXScale(scaleValue, offsetValue) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, offset = offsetValue || function () { _newArrowCheck(this, _this); return $$.axis.x.tickOffset(); }.bind(this), isInverted = $$.config.axis_x_inverted, scale = function (d, raw) { - var v = scaleValue(d) + offset(); + const v = scaleValue(d) + offset(); return raw ? v : Math.ceil(v); }; // copy original scale methods - for (var key in scaleValue) { + for (const key in scaleValue) { scale[key] = scaleValue[key]; } scale.orgDomain = function () { @@ -7850,7 +7968,7 @@ function getScale(type, min, max) { // define custom domain() for categorized axis if ($$.axis.isCategorized()) { scale.domain = function (domainValue) { - var domain = domainValue; + let domain = domainValue; if (!arguments.length) { domain = this.orgDomain(); return isInverted ? [domain[0] + 1, domain[1]] : [domain[0], domain[1] + 1]; @@ -7872,7 +7990,7 @@ function getScale(type, min, max) { if (updateXDomain === void 0) { updateXDomain = !0; } - var $$ = this, + const $$ = this, axis = $$.axis, config = $$.config, format = $$.format, @@ -7887,8 +8005,8 @@ function getScale(type, min, max) { hasAxis = _$$$state.hasAxis, hasTreemap = _$$$state.hasTreemap; if (hasAxis) { - var _scale$x, - isRotated = config.axis_rotated, + var _scale$x; + const isRotated = config.axis_rotated, resettedPadding = $$.getResettedPadding(1), min = { x: isRotated ? resettedPadding : 0, @@ -7903,12 +8021,9 @@ function getScale(type, min, max) { subY: isRotated ? width2 : 1 }, xDomain = updateXDomain && ((_scale$x = scale.x) == null ? void 0 : _scale$x.orgDomain()), - xSubDomain = updateXDomain && org.xDomain; - // update edges - + xSubDomain = updateXDomain && org.xDomain; // update edges // update scales // x Axis - scale.x = $$.getXScale(min.x, max.x, xDomain, function () { _newArrowCheck(this, _this2); return axis.x.tickOffset(); @@ -7937,12 +8052,12 @@ function getScale(type, min, max) { axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit); } } else if (hasTreemap) { - var padding = $$.getCurrentPadding(); + const padding = $$.getCurrentPadding(); scale.x = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear)().rangeRound([padding.left, current.width - padding.right]); scale.y = (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear)().rangeRound([padding.top, current.height - padding.bottom]); } else { // update for arc - $$.updateArc == null ? void 0 : $$.updateArc(); + $$.updateArc == null || $$.updateArc(); } }, /** @@ -7952,7 +8067,7 @@ function getScale(type, min, max) { * @private */ xx: function xx(d) { - var $$ = this, + const $$ = this, config = $$.config, _$$$scale = $$.scale, x = _$$$scale.x, @@ -7961,14 +8076,14 @@ function getScale(type, min, max) { return d ? fn(isValue(d.x) ? d.x : d) : null; }, xv: function xv(d) { - var $$ = this, + const $$ = this, axis = $$.axis, config = $$.config, _$$$scale2 = $$.scale, x = _$$$scale2.x, zoom = _$$$scale2.zoom, fn = config.zoom_enabled && zoom ? zoom : x; - var value = $$.getBaseValue(d); + let value = $$.getBaseValue(d); if (axis.isTimeSeries()) { value = parseDate.call($$, value); } else if (axis.isCategorized() && isString(value)) { @@ -7977,7 +8092,7 @@ function getScale(type, min, max) { return Math.ceil(fn(value)); }, yv: function yv(d) { - var $$ = this, + const $$ = this, _$$$scale3 = $$.scale, y = _$$$scale3.y, y2 = _$$$scale3.y2, @@ -8000,6 +8115,23 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp +/** + * Get grouped data point function for y coordinate + * - Note: Grouped(stacking) works only for line and bar types + * @param {object} d data vlaue + * @returns {Function|undefined} + * @private + */ +function getGroupedDataPointsFn(d) { + const $$ = this; + let fn; + if ($$.isLineType(d)) { + fn = $$.generateGetLinePoints($$.getShapeIndices($$.isLineType)); + } else if ($$.isBarType(d)) { + fn = $$.generateGetBarPoints($$.getShapeIndices($$.isBarType)); + } + return fn; +} /* harmony default export */ var shape = ({ /** * Get the shape draw function @@ -8007,8 +8139,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ getDrawShape: function getDrawShape() { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, isRotated = $$.config.axis_rotated, _$$$state = $$.state, hasRadar = _$$$state.hasRadar, @@ -8020,16 +8152,16 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp }; hasTreemap || ["bar", "candlestick", "line", "area"].forEach(function (v) { _newArrowCheck(this, _this); - var name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v); + const name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v); if ($$.hasType(v) || $$.hasTypeOf(name) || v === "line" && ($$.hasType("bubble") || $$.hasType("scatter"))) { - var indices = $$.getShapeIndices($$["is" + name + "Type"]), + const indices = $$.getShapeIndices($$["is" + name + "Type"]), drawFn = $$["generateDraw" + name]; shape.indices[v] = indices; shape.type[v] = drawFn ? drawFn.bind($$)(indices, !1) : undefined; } }.bind(this)); if (!$$.hasArcType() || hasRadar || hasTreemap) { - var cx, cy; + let cx, cy; // generate circle x/y functions depending on updated params if (!hasTreemap) { cx = hasRadar ? $$.radarCircleX : isRotated ? $$.circleY : $$.circleX; @@ -8045,7 +8177,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp return shape; }, /** - * Get shape's indices according it's position + * Get shape's indices according it's position within each axis tick. * * From the below example, indices will be: * ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1} @@ -8058,13 +8190,13 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @returns {object} Indices object with its position */ getShapeIndices: function getShapeIndices(typeFilter) { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, xs = config.data_xs, hasXs = notEmpty(xs), - indices = {}, - i = hasXs ? {} : 0; + indices = {}; + let i = hasXs ? {} : 0; if (hasXs) { getUnique(Object.keys(xs).map(function (v) { _newArrowCheck(this, _this2); @@ -8077,17 +8209,23 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp } $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$)).forEach(function (d) { _newArrowCheck(this, _this2); - var xKey = d.id in xs ? xs[d.id] : "", + const xKey = d.id in xs ? xs[d.id] : "", ind = xKey ? indices[xKey] : indices; - for (var j = 0, groups; groups = config.data_groups[j]; j++) { + for (let j = 0, groups; groups = config.data_groups[j]; j++) { if (groups.indexOf(d.id) < 0) { continue; } - for (var k = 0, row; row = groups[k]; k++) { - if (row in ind) { - ind[d.id] = ind[row]; + for (let k = 0, key; key = groups[k]; k++) { + if (key in ind) { + ind[d.id] = ind[key]; break; } + + // for same grouped data, add other data to same indices + if (d.id !== key && xKey) { + var _ind$d$id; + ind[key] = (_ind$d$id = ind[d.id]) != null ? _ind$d$id : i[xKey]; + } } } if (isUndefined(ind[d.id])) { @@ -8106,15 +8244,16 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ getIndices: function getIndices(indices, d) { - var _this3 = this, - $$ = this, + var _this3 = this; + // eslint-disable-line + const $$ = this, _$$$config = $$.config, xs = _$$$config.data_xs, removeNull = _$$$config.bar_indices_removeNull, id = d.id, - index = d.index; // eslint-disable-line + index = d.index; if ($$.isBarType(id) && removeNull) { - var ind = {}; + const ind = {}; // redefine bar indices order $$.getAllValuesOnIndex(index, !0).forEach(function (v, i) { @@ -8145,8 +8284,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp }.bind(this)) : indices.__max__; }, getShapeX: function getShapeX(offset, indices, isSub) { - var _this5 = this, - $$ = this, + var _this5 = this; + const $$ = this, config = $$.config, scale = $$.scale, currScale = isSub ? scale.subX : scale.zoom || scale.x, @@ -8157,18 +8296,19 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp return p + c; }.bind(this), halfWidth = isObjectType(offset) && (offset._$total.length ? offset._$total.reduce(sum) / 2 : 0); + // total shapes half width return function (d) { _newArrowCheck(this, _this5); - var ind = $$.getIndices(indices, d, "getShapeX"), + const ind = $$.getIndices(indices, d, "getShapeX"), index = d.id in ind ? ind[d.id] : 0, targetsNum = (ind.__max__ || 0) + 1; - var x = 0; + let x = 0; if (notEmpty(d.x)) { - var xPos = currScale(d.x, !0); + const xPos = currScale(d.x, !0); if (halfWidth) { - var offsetWidth = offset[d.id] || offset._$width; + const offsetWidth = offset[d.id] || offset._$width; x = barOverlap ? xPos - offsetWidth / 2 : xPos - offsetWidth + offset._$total.slice(0, index + 1).reduce(sum) - halfWidth; } else { x = xPos - (isNumber(offset) ? offset : offset._$width) * (targetsNum / 2 - (barOverlap ? 1 : index)); @@ -8190,14 +8330,16 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp }.bind(this); }, getShapeY: function getShapeY(isSub) { - var _this6 = this, - $$ = this, + var _this6 = this; + const $$ = this, isStackNormalized = $$.isStackNormalized(); return function (d) { _newArrowCheck(this, _this6); - var value = d.value; + let value = d.value; if (isNumber(d)) { value = d; + } else if ($$.isAreaRangeType(d)) { + value = $$.getBaseValue(d, "mid"); } else if (isStackNormalized) { value = $$.getRatio("index", d, !0); } else if ($$.isBubbleZType(d)) { @@ -8216,7 +8358,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ getShapeYMin: function getShapeYMin(id) { - var $$ = this, + const $$ = this, axisId = $$.axis.getId(id), scale = $$.scale[axisId], _scale$domain = scale.domain(), @@ -8231,21 +8373,21 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ getShapeOffsetData: function getShapeOffsetData(typeFilter) { - var _this7 = this, - $$ = this, + var _this7 = this; + const $$ = this, targets = $$.orderTargets($$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))), isStackNormalized = $$.isStackNormalized(), shapeOffsetTargets = targets.map(function (target) { var _this8 = this; _newArrowCheck(this, _this7); - var rowValues = target.values, - values = {}; + let rowValues = target.values; + const values = {}; if ($$.isStepType(target)) { rowValues = $$.convertValuesToStep(rowValues); } - var rowValueMapByXValue = rowValues.reduce(function (out, d) { + const rowValueMapByXValue = rowValues.reduce(function (out, d) { _newArrowCheck(this, _this8); - var key = +d.x; + const key = +d.x; out[key] = d; values[key] = isStackNormalized ? $$.getRatio("index", d, !0) : d.value; return out; @@ -8258,7 +8400,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp }; }.bind(this)), indexMapByTargetId = targets.reduce(function (out, _ref, index) { - var id = _ref.id; + let id = _ref.id; _newArrowCheck(this, _this7); out[id] = index; return out; @@ -8269,8 +8411,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp }; }, getShapeOffset: function getShapeOffset(typeFilter, indices, isSub) { - var _this9 = this, - $$ = this, + var _this9 = this; + const $$ = this, _$$$getShapeOffsetDat = $$.getShapeOffsetData(typeFilter), shapeOffsetTargets = _$$$getShapeOffsetDat.shapeOffsetTargets, indexMapByTargetId = _$$$getShapeOffsetDat.indexMapByTargetId, @@ -8278,7 +8420,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp return function (d, idx) { var _this10 = this; _newArrowCheck(this, _this9); - var id = d.id, + const id = d.id, value = d.value, x = d.x, ind = $$.getIndices(indices, d), @@ -8287,30 +8429,31 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp // TODO use range.getStart() return scale(value[0]); } - var dataXAsNumber = +x, + const dataXAsNumber = +x, y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id)); - var offset = y0; + let offset = y0; shapeOffsetTargets.filter(function (t) { _newArrowCheck(this, _this10); return t.id !== id && ind[t.id] === ind[id]; }.bind(this)).forEach(function (t) { _newArrowCheck(this, _this10); - var tid = t.id, + const tid = t.id, rowValueMapByXValue = t.rowValueMapByXValue, rowValues = t.rowValues, tvalues = t.values; // for same stacked group (ind[tid] === ind[id]) if (indexMapByTargetId[tid] < indexMapByTargetId[id]) { - var _row, - rValue = tvalues[dataXAsNumber], - row = rowValues[idx]; + var _row; + const rValue = tvalues[dataXAsNumber]; + let row = rowValues[idx]; + // check if the x values line up if (!row || +row.x !== dataXAsNumber) { row = rowValueMapByXValue[dataXAsNumber]; } if (((_row = row) == null ? void 0 : _row.value) * value >= 0 && isNumber(rValue)) { - var addOffset = value === 0 ? groupsZeroAs === "positive" && rValue > 0 || groupsZeroAs === "negative" && rValue < 0 : !0; + const addOffset = value === 0 ? groupsZeroAs === "positive" && rValue > 0 || groupsZeroAs === "negative" && rValue < 0 : !0; if (addOffset) { offset += scale(rValue) - y0; } @@ -8320,9 +8463,25 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp return offset; }.bind(this); }, + /** + * Get data's y coordinate + * @param {object} d Target data + * @param {number} i Index number + * @returns {number} y coordinate + * @private + */ + circleY: function circleY(d, i) { + const $$ = this, + id = d.id; + let points; + if ($$.isGrouped(id)) { + points = getGroupedDataPointsFn.bind($$)(d); + } + return points ? points(d, i)[0][1] : $$.getYScaleById(id)($$.getBaseValue(d)); + }, getBarW: function getBarW(type, axis, targetsNum) { - var _this11 = this, - $$ = this, + var _this11 = this; + const $$ = this, config = $$.config, org = $$.org, scale = $$.scale, @@ -8338,13 +8497,13 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp }.bind(this)) / maxDataCount : axis.tickInterval(maxDataCount), getWidth = function (id) { _newArrowCheck(this, _this11); - var width = id ? config[configName][id] : config[configName], + const width = id ? config[configName][id] : config[configName], ratio = id ? width.ratio : config[configName + "_ratio"], max = id ? width.max : config[configName + "_max"], w = isNumber(width) ? width : targetsNum ? tickInterval * ratio / targetsNum : 0; return max && w > max ? max : w; - }.bind(this), - result = getWidth(); + }.bind(this); + let result = getWidth(); if (!isGrouped && isObjectType(config[configName])) { result = { _$width: result, @@ -8369,11 +8528,12 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ getShapeByIndex: function getShapeByIndex(shapeName, i, id) { - var _this12 = this, - $$ = this, + var _this12 = this; + const $$ = this, $el = $$.$el, - suffix = isValue(i) ? "-" + i : "", - shape = $el[shapeName]; + suffix = isValue(i) ? "-" + i : ""; + let shape = $el[shapeName]; + // filter from shape reference if has if (shape && !shape.empty()) { shape = shape.filter(function (d) { @@ -8389,9 +8549,9 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp return shape; }, isWithinShape: function isWithinShape(that, d) { - var $$ = this, + const $$ = this, shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that); - var isWithin; + let isWithin; if (!$$.isTargetToShow(d.id)) { isWithin = !1; } else if ($$.hasValidPointType != null && $$.hasValidPointType(that.nodeName)) { @@ -8402,7 +8562,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp return isWithin; }, getInterpolate: function getInterpolate(d) { - var $$ = this, + const $$ = this, interpolation = $$.getInterpolateType(d); return { "basis": external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.curveBasis, @@ -8426,14 +8586,14 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp }[interpolation]; }, getInterpolateType: function getInterpolateType(d) { - var $$ = this, + const $$ = this, config = $$.config, type = config.spline_interpolation_type, interpolation = $$.isInterpolationType(type) ? type : "cardinal"; return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? config.line_step_type : "linear"; }, isWithinBar: function isWithinBar(that) { - var mouse = getPointer(this.state.event, that), + const mouse = getPointer(this.state.event, that), list = getRectSegList(that), _list = list, seg0 = _list[0], @@ -8463,103 +8623,21 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ setContainerSize: function setContainerSize() { - var $$ = this, + const $$ = this, state = $$.state; state.current.width = $$.getCurrentWidth(); state.current.height = $$.getCurrentHeight(); }, getCurrentWidth: function getCurrentWidth() { - var $$ = this; + const $$ = this; return $$.config.size_width || $$.getParentWidth(); }, getCurrentHeight: function getCurrentHeight() { - var $$ = this, + const $$ = this, config = $$.config, h = config.size_height || $$.getParentHeight(); return h > 0 ? h : 320 / ($$.hasType("gauge") && !config.gauge_fullCircle ? 2 : 1); }, - getCurrentPaddingTop: function getCurrentPaddingTop() { - var $$ = this, - config = $$.config, - hasAxis = $$.state.hasAxis, - $el = $$.$el, - axesLen = hasAxis ? config.axis_y2_axes.length : 0; - var padding = isValue(config.padding_top) ? config.padding_top : 0; - if ($el.title && $el.title.node()) { - padding += $$.getTitlePadding(); - } - if (axesLen && config.axis_rotated) { - padding += $$.getHorizontalAxisHeight("y2") * axesLen; - } - return padding; - }, - getCurrentPaddingBottom: function getCurrentPaddingBottom() { - var $$ = this, - config = $$.config, - hasAxis = $$.state.hasAxis, - axisId = config.axis_rotated ? "y" : "x", - axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0, - padding = isValue(config.padding_bottom) ? config.padding_bottom : 0; - return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0); - }, - getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) { - var _config$padding, - $$ = this, - config = $$.config, - hasAxis = $$.state.hasAxis, - isRotated = config.axis_rotated, - isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit", - axisId = isRotated ? "x" : "y", - axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0, - axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0; - if (!isFitPadding) { - axisWidth = ceil10(axisWidth); - } - var padding = config["axis_" + axisId + "_inner"] || !config["axis_" + axisId + "_show"] ? 0 : axisWidth; - if (isValue(config.padding_left)) { - padding = config.padding_left + (isFitPadding && isRotated ? axisWidth : 0); - } else if (hasAxis && isRotated) { - padding = !config.axis_x_show ? 1 : isFitPadding ? axisWidth : Math.max(axisWidth, 40); - } - if (hasAxis && (isFitPadding || config["axis_" + axisId + "_inner"]) && config["axis_" + axisId + "_label"].text) { - padding += $$.axis.getAxisLabelPosition("y").isOuter ? 20 : 0; - } - return padding + axisWidth * axesLen; - }, - getCurrentPaddingRight: function getCurrentPaddingRight(withXAxisTickTextOverflow) { - var _config$padding2, _$$$axis; - if (withXAxisTickTextOverflow === void 0) { - withXAxisTickTextOverflow = !1; - } - var $$ = this, - config = $$.config, - hasAxis = $$.state.hasAxis, - isRotated = config.axis_rotated, - isFitPadding = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit", - defaultPadding = isFitPadding ? 2 : 10, - legendWidthOnRight = $$.state.isLegendRight ? $$.getLegendWidth() + 20 : 0, - axesLen = hasAxis ? config.axis_y2_axes.length : 0, - axisLabelWidth = (_$$$axis = $$.axis) != null && _$$$axis.getAxisLabelPosition("y2").isOuter ? 20 : 0, - xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0; - var axisWidth = hasAxis && !config.axis_y2_inner ? $$.getAxisWidthByAxisId("y2") : 1; - if (!isFitPadding) { - axisWidth = ceil10(axisWidth); - } - var padding = isRotated ? 0 : Math.max(axisWidth + legendWidthOnRight, xAxisTickTextOverflow); - if (isValue(config.padding_right)) { - // padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line - - padding = config.padding_right + (isFitPadding && (isRotated || !config.axis_y2_show ? defaultPadding : padding)) + (hasAxis && !isFitPadding ? 1 : 0); // 1 is needed not to hide tick line - } else if ($$.axis && isRotated) { - padding = defaultPadding + legendWidthOnRight; - } else if ($$.axis && (!config.axis_y2_show || config.axis_y2_inner)) { - padding = Math.max((isFitPadding && !config.axis_y2_show ? 2 : 1) + legendWidthOnRight + axisLabelWidth, xAxisTickTextOverflow); - } - if (hasAxis && !isRotated && isFitPadding && config.axis_y2_show && !config.axis_y2_inner && config.axis_y2_label.text) { - padding += axisLabelWidth; - } - return padding + axisWidth * axesLen; - }, /** * Get the parent rect element's size * @param {string} key property/attribute name @@ -8567,8 +8645,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ getParentRectValue: function getParentRectValue(key) { - var offsetName = "offset" + capitalize(key); - var parent = this.$el.chart.node(), + const offsetName = "offset" + capitalize(key); + let parent = this.$el.chart.node(), v = 0; while (v < 30 && parent && parent.tagName !== "BODY") { try { @@ -8585,7 +8663,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp // Sometimes element's dimension value is incorrect(ex. flex container) // In this case, use body's offset instead. - var bodySize = browser_doc.body[offsetName]; + const bodySize = browser_doc.body[offsetName]; v > bodySize && (v = bodySize); return v; }, @@ -8593,36 +8671,48 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp return this.getParentRectValue("width"); }, getParentHeight: function getParentHeight() { - var h = this.$el.chart.style("height"); - var height = 0; + const h = this.$el.chart.style("height"); + let height = 0; if (h) { height = /px$/.test(h) ? parseInt(h, 10) : this.getParentRectValue("height"); } return height; }, getSvgLeft: function getSvgLeft(withoutRecompute) { - var $$ = this, + const $$ = this, config = $$.config, + hasAxis = $$.state.hasAxis, $el = $$.$el, - hasLeftAxisRect = config.axis_rotated || !config.axis_rotated && !config.axis_y_inner, - leftAxisClass = config.axis_rotated ? $AXIS.axisX : $AXIS.axisY, + isRotated = config.axis_rotated, + hasLeftAxisRect = isRotated || !isRotated && !config.axis_y_inner, + leftAxisClass = isRotated ? $AXIS.axisX : $AXIS.axisY, leftAxis = $el.main.select("." + leftAxisClass).node(), - svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { + leftLabel = hasAxis && config["axis_" + (isRotated ? "x" : "y") + "_label"]; + let labelWidth = 0; + + // if axis label position set to inner, exclude from the value + if (hasAxis && (isString(leftLabel) || isString(leftLabel.text) || /^inner-/.test(leftLabel == null ? void 0 : leftLabel.position))) { + const label = $el.main.select("." + leftAxisClass + "-label"); + if (!label.empty()) { + labelWidth = label.node().getBoundingClientRect().left; + } + } + const svgRect = leftAxis && hasLeftAxisRect ? leftAxis.getBoundingClientRect() : { right: 0 }, - chartRect = $el.chart.node().getBoundingClientRect(), + chartRectLeft = $el.chart.node().getBoundingClientRect().left + labelWidth, hasArc = $$.hasArcType(), - svgLeft = svgRect.right - chartRect.left - (hasArc ? 0 : $$.getCurrentPaddingLeft(withoutRecompute)); + svgLeft = svgRect.right - chartRectLeft - (hasArc ? 0 : $$.getCurrentPaddingByDirection("left", withoutRecompute)); return svgLeft > 0 ? svgLeft : 0; }, updateDimension: function updateDimension(withoutAxis) { - var $$ = this, + const $$ = this, config = $$.config, hasAxis = $$.state.hasAxis, $el = $$.$el; if (hasAxis && !withoutAxis && $$.axis.x && config.axis_rotated) { var _$$$axis$subX; - (_$$$axis$subX = $$.axis.subX) == null ? void 0 : _$$$axis$subX.create($el.axis.subX); + (_$$$axis$subX = $$.axis.subX) == null || _$$$axis$subX.create($el.axis.subX); } // pass 'withoutAxis' param to not animate at the init rendering @@ -8631,7 +8721,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp $$.transformAll(!1); }, updateSvgSize: function updateSvgSize() { - var $$ = this, + const $$ = this, _$$$state = $$.state, clip = _$$$state.clip, current = _$$$state.current, @@ -8641,7 +8731,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp svg = $$.$el.svg; svg.attr("width", current.width).attr("height", current.height); if (hasAxis) { - var brush = svg.select("." + $SUBCHART.brush + " .overlay"), + const brush = svg.select("." + $SUBCHART.brush + " .overlay"), brushSize = { width: 0, height: 0 @@ -8656,13 +8746,87 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp clip.idSubchart && svg.select("#" + clip.idSubchart).select("rect").attr("width", width).attr("height", brushSize.height); } }, - getCurrentPadding: function getCurrentPadding() { - var $$ = this; + /** + * Get padding by the direction. + * @param {string} type "top" | "bottom" | "left" | "right" + * @param {boolean} [withoutRecompute=false] If set true, do not recompute the padding value. + * @param {boolean} [withXAxisTickTextOverflow=false] If set true, calculate x axis tick text overflow. + * @returns {number} padding value + * @private + */ + getCurrentPaddingByDirection: function getCurrentPaddingByDirection(type, withoutRecompute, withXAxisTickTextOverflow) { + var _config$padding; + if (withoutRecompute === void 0) { + withoutRecompute = !1; + } + if (withXAxisTickTextOverflow === void 0) { + withXAxisTickTextOverflow = !1; + } + const $$ = this, + config = $$.config, + $el = $$.$el, + hasAxis = $$.state.hasAxis, + isRotated = config.axis_rotated, + isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit", + paddingOption = isNumber(config["padding_" + type]) ? config["padding_" + type] : undefined, + axisId = hasAxis ? { + top: isRotated ? "y2" : null, + bottom: isRotated ? "y" : "x", + left: isRotated ? "x" : "y", + right: isRotated ? null : "y2" + }[type] : null, + isLeftRight = /^(left|right)$/.test(type), + isAxisInner = axisId && config["axis_" + axisId + "_inner"], + isAxisShow = axisId && config["axis_" + axisId + "_show"], + axesLen = axisId ? config["axis_" + axisId + "_axes"].length : 0; + let axisSize = axisId ? isLeftRight ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : $$.getHorizontalAxisHeight(axisId) : 0; + const defaultPadding = 20; + let gap = 0; + if (!isFitPadding && isLeftRight) { + axisSize = ceil10(axisSize); + } + let padding = hasAxis && isLeftRight && (isAxisInner || isUndefined(paddingOption) && !isAxisShow) ? 0 : isFitPadding ? (isAxisShow ? axisSize : 0) + (paddingOption != null ? paddingOption : 0) : isUndefined(paddingOption) ? axisSize : paddingOption; + if (isLeftRight && hasAxis) { + if (axisId && (isFitPadding || isAxisInner) && config["axis_" + axisId + "_label"].text) { + padding += $$.axis.getAxisLabelPosition(axisId).isOuter ? defaultPadding : 0; + } + if (type === "right") { + padding += isRotated ? !isFitPadding && isUndefined(paddingOption) ? 10 : 2 : !isAxisShow || isAxisInner ? isFitPadding ? 2 : 1 : 0; + padding += withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0; + } else if (type === "left" && isRotated && isUndefined(paddingOption)) { + padding = !config.axis_x_show ? 1 : isFitPadding ? axisSize : Math.max(axisSize, 40); + } + } else { + if (type === "top") { + if ($el.title && $el.title.node()) { + padding += $$.getTitlePadding(); + } + gap = isRotated && !isAxisInner ? axesLen : 0; + } else if (type === "bottom" && hasAxis && isRotated && !isAxisShow) { + padding += 1; + } + } + return padding + axisSize * axesLen - gap; + }, + getCurrentPadding: function getCurrentPadding(withXAxisTickTextOverflow) { + var _this = this; + if (withXAxisTickTextOverflow === void 0) { + withXAxisTickTextOverflow = !1; + } + const $$ = this, + _map = ["top", "bottom", "left", "right"].map(function (v) { + _newArrowCheck(this, _this); + return $$.getCurrentPaddingByDirection(v, null, withXAxisTickTextOverflow); + }.bind(this)), + top = _map[0], + bottom = _map[1], + left = _map[2], + right = _map[3]; return { - top: $$.getCurrentPaddingTop(), - bottom: $$.getCurrentPaddingBottom(), - left: $$.getCurrentPaddingLeft(), - right: $$.getCurrentPaddingRight() + top: top, + bottom: bottom, + left: left, + right: right }; }, /** @@ -8673,14 +8837,14 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ getResettedPadding: function getResettedPadding(v) { - var _this = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, - isNum = isNumber(v), - p = isNum ? 0 : {}; + isNum = isNumber(v); + let p = isNum ? 0 : {}; if (config.padding === !1) { isNum || Object.keys(v).forEach(function (key) { - _newArrowCheck(this, _this); + _newArrowCheck(this, _this2); // when data.lables=true, do not reset top padding p[key] = !isEmpty(config.data_labels) && config.data_labels !== !1 && key === "top" ? v[key] : 0; }.bind(this)); @@ -8695,39 +8859,42 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ updateSizes: function updateSizes(isInit) { - var _config$padding3, - $$ = this, + var _config$padding2; + const $$ = this, config = $$.config, state = $$.state, legend = $$.$el.legend, isRotated = config.axis_rotated, isNonAxis = $$.hasArcType() || state.hasTreemap, - isFitPadding = ((_config$padding3 = config.padding) == null ? void 0 : _config$padding3.mode) === "fit"; + isFitPadding = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit"; isInit || $$.setContainerSize(); - var currLegend = { + const currLegend = { width: legend ? $$.getLegendWidth() : 0, height: legend ? $$.getLegendHeight() : 0 }; if (!isNonAxis && config.axis_x_show && config.axis_x_tick_autorotate) { $$.updateXAxisTickClip(); } - var legendHeightForBottom = state.isLegendRight || state.isLegendInset ? 0 : currLegend.height, + const legendSize = { + right: config.legend_show && state.isLegendRight ? $$.getLegendWidth() + (isFitPadding ? 0 : 20) : 0, + bottom: !config.legend_show || state.isLegendRight || state.isLegendInset ? 0 : currLegend.height + }, xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x"), subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30, subchartHeight = config.subchart_show && !isNonAxis ? config.subchart_size_height + subchartXAxisHeight : 0, gaugeHeight = $$.hasType("gauge") && config.arc_needle_show && !config.gauge_fullCircle && !config.gauge_label_show ? 10 : 0, - padding = $$.getCurrentPadding(); // when needle is shown with legend, it need some bottom space to not overlap with legend text + padding = $$.getCurrentPadding(!0); // when needle is shown with legend, it need some bottom space to not overlap with legend text // for main state.margin = !isNonAxis && isRotated ? { - top: $$.getHorizontalAxisHeight("y2") + padding.top, - right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0), - bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + padding.bottom, + top: padding.top, + right: isNonAxis ? 0 : padding.right + legendSize.right, + bottom: legendSize.bottom + padding.bottom, left: subchartHeight + (isNonAxis ? 0 : padding.left) } : { top: (isFitPadding ? 0 : 4) + padding.top, // for top tick text - right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0), - bottom: gaugeHeight + xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom, + right: isNonAxis ? 0 : padding.right + legendSize.right, + bottom: gaugeHeight + subchartHeight + legendSize.bottom + padding.bottom, left: isNonAxis ? 0 : padding.left }; state.margin = $$.getResettedPadding(state.margin); @@ -8736,12 +8903,12 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp state.margin2 = isRotated ? { top: state.margin.top, right: NaN, - bottom: 20 + legendHeightForBottom, + bottom: 20 + legendSize.bottom, left: $$.state.rotatedPadding.left } : { - top: state.current.height - subchartHeight - legendHeightForBottom, + top: state.current.height - subchartHeight - legendSize.bottom, right: NaN, - bottom: subchartXAxisHeight + legendHeightForBottom, + bottom: subchartXAxisHeight + legendSize.bottom, left: state.margin.left }; @@ -8752,7 +8919,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp bottom: 0, left: 0 }; - $$.updateSizeForLegend == null ? void 0 : $$.updateSizeForLegend(currLegend); + $$.updateSizeForLegend == null || $$.updateSizeForLegend(currLegend); state.width = state.current.width - state.margin.left - state.margin.right; state.height = state.current.height - state.margin.top - state.margin.bottom; if (state.width < 0) { @@ -8772,14 +8939,14 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp // for arc if ($$.hasArcType()) { - var hasGauge = $$.hasType("gauge"), + const hasGauge = $$.hasType("gauge"), isLegendRight = config.legend_show && state.isLegendRight; state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0); state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10); if (hasGauge && !config.gauge_fullCircle) { state.arcHeight += state.height - $$.getPaddingBottomForGauge(); } - $$.updateRadius == null ? void 0 : $$.updateRadius(); + $$.updateRadius == null || $$.updateRadius(); } if (state.isLegendRight && isNonAxis) { state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1; @@ -8805,8 +8972,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ setCssRule: function setCssRule(withShape, selector, props, propsFn) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, _$$$state = $$.state, cssRule = _$$$state.cssRule, @@ -8817,7 +8984,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp selection.each(function (d) { var _this3 = this; _newArrowCheck(this, _this2); - var res = propsFn && (propsFn == null ? void 0 : propsFn.call($$, d)), + const res = propsFn && (propsFn == null ? void 0 : propsFn.call($$, d)), shapeSelector = "" + (withShape ? "." + ($SHAPE.shapes + $$.getTargetSelectorSuffix(d.id)) : "") + selector; selector in cssRule && style.sheet.deleteRule(cssRule[shapeSelector]); $$.state.cssRule[shapeSelector] = addCssRules(style, shapeSelector, props.filter(Boolean).map(function (v) { @@ -8836,7 +9003,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ getStylePropValue: function getStylePropValue(v) { - var useCssRule = this.config.boost_useCssRule; + const useCssRule = this.config.boost_useCssRule; return useCssRule ? null : isFunction(v) ? v.bind(this) : v; } }); @@ -8857,7 +9024,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp * @private */ function getRotateAnchor(angle) { - var anchor = "middle"; + let anchor = "middle"; if (angle > 0 && angle <= 170) { anchor = "end"; } else if (angle > 190 && angle <= 360) { @@ -8879,33 +9046,34 @@ function getRotateAnchor(angle) { * @private */ function setRotatePos(d, pos, anchor, isRotated, isInverted) { - var _$$$getCandlestickDat, - $$ = this, + var _$$$getCandlestickDat; + const $$ = this, value = d.value, isCandlestickType = $$.isCandlestickType(d), - isNegative = isNumber(value) && value < 0 || isCandlestickType && !((_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp), - x = pos.x, - y = pos.y, + isNegative = isNumber(value) && value < 0 || isCandlestickType && !((_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp); + let x = pos.x, + y = pos.y; + const gap = 4, doubleGap = 8; if (isRotated) { if (anchor === "start") { x += isNegative ? 0 : doubleGap; - y += 4; + y += gap; } else if (anchor === "middle") { x += doubleGap; y -= doubleGap; } else if (anchor === "end") { isNegative && (x -= doubleGap); - y += 4; + y += gap; } } else { if (anchor === "start") { - x += 4; + x += gap; isNegative && (y += doubleGap * 2); } else if (anchor === "middle") { y -= doubleGap; } else if (anchor === "end") { - x -= 4; + x -= gap; isNegative && (y += doubleGap * 2); } if (isInverted) { @@ -8926,8 +9094,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) { * @private */ function getTextPos(d, type) { - var _ref, - position = this.config.data_labels_position, + var _ref; + const position = this.config.data_labels_position, id = d.id, index = d.index, value = d.value; @@ -8935,7 +9103,7 @@ function getTextPos(d, type) { } /* harmony default export */ var internals_text = ({ opacityForText: function opacityForText(d) { - var $$ = this; + const $$ = this; return $$.isBarType(d) && !$$.meetsLabelThreshold(Math.abs($$.getRatio("bar", d)), "bar") ? "0" : $$.hasDataLabel ? null : "0"; }, /** @@ -8943,7 +9111,7 @@ function getTextPos(d, type) { * @private */ initText: function initText() { - var $el = this.$el; + const $el = this.$el; $el.main.select("." + $COMMON.chart).append("g").attr("class", $TEXT.chartTexts).style("pointer-events", $el.treemap ? "none" : null); }, /** @@ -8952,8 +9120,8 @@ function getTextPos(d, type) { * @private */ updateTargetsForText: function updateTargetsForText(targets) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, classChartText = $$.getChartClass("Text"), classTexts = $$.getClass("texts", "id"), classFocus = $$.classFocus.bind($$), @@ -8969,8 +9137,8 @@ function getTextPos(d, type) { * @private */ updateText: function updateText() { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, $el = $$.$el, $T = $$.$T, config = $$.config, @@ -8981,29 +9149,29 @@ function getTextPos(d, type) { $T(text.exit()).style("fill-opacity", "0").remove(); $el.text = text.enter().append("text").merge(text).attr("class", classText).attr("text-anchor", function (d) { _newArrowCheck(this, _this2); - var isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"]; + const isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"]; // when value is negative or - var isEndAnchor = isInverted ? d.value > 0 : d.value < 0; + let isEndAnchor = isInverted ? d.value > 0 : d.value < 0; if ($$.isCandlestickType(d)) { - var data = $$.getCandlestickData(d); + const data = $$.getCandlestickData(d); isEndAnchor = !(data != null && data._isUp); } else if ($$.isTreemapType(d)) { return labelsCentered ? "middle" : "start"; } return config.axis_rotated ? isEndAnchor ? "end" : "start" : "middle"; }.bind(this)).style("fill", $$.getStylePropValue($$.updateTextColor)).style("fill-opacity", "0").each(function (d, i, texts) { - var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); - var value = d.value; + const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); + let value = d.value; if ($$.isBubbleZType(d)) { value = $$.getBubbleZData(value, "z"); } else if ($$.isCandlestickType(d)) { - var data = $$.getCandlestickData(d); + const data = $$.getCandlestickData(d); if (data) { value = data.close; } } - value = $$.isTreemapType(d) ? $$.treemapDataLabelFormat(d)(node) : $$.dataLabelFormat(d.id)(value, d.id, i, texts); + value = $$.isTreemapType(d) ? $$.treemapDataLabelFormat(d)(node) : $$.dataLabelFormat(d.id)(value, d.id, d.index, texts); if (isNumber(value)) { this.textContent = value; } else { @@ -9012,24 +9180,24 @@ function getTextPos(d, type) { }); }, updateTextColor: function updateTextColor(d) { - var $$ = this, + const $$ = this, config = $$.config, labelColors = config.data_labels_colors, defaultColor = $$.isArcType(d) && !$$.isRadarType(d) || $$.isTreemapType(d) ? null : $$.color(d); - var color; + let color; if (isString(labelColors)) { color = labelColors; } else if (isObject(labelColors)) { - var _ref2 = d.data || d, + const _ref2 = d.data || d, id = _ref2.id; color = labelColors[id]; } else if (isFunction(labelColors)) { color = labelColors.bind($$.api)(defaultColor, d); } if ($$.isCandlestickType(d) && !isFunction(labelColors)) { - var value = $$.getCandlestickData(d); + const value = $$.getCandlestickData(d); if (!(value != null && value._isUp)) { - var downColor = config.candlestick_color_down; + const downColor = config.candlestick_color_down; color = isObject(downColor) ? downColor[d.id] : downColor; } } @@ -9041,14 +9209,14 @@ function getTextPos(d, type) { * @returns {string|null} * @private */ - updateTextBacgroundColor: function updateTextBacgroundColor(d) { - var $$ = this, + updateTextBackgroundColor: function updateTextBackgroundColor(d) { + const $$ = this, $el = $$.$el, config = $$.config, backgroundColor = config.data_labels_backgroundColors; - var color = ""; + let color = ""; if (isString(backgroundColor) || isObject(backgroundColor)) { - var id = isString(backgroundColor) ? "" : $$.getTargetSelectorSuffix("id" in d ? d.id : d.data.id), + const id = isString(backgroundColor) ? "" : $$.getTargetSelectorSuffix("id" in d ? d.id : d.data.id), filter = $el.defs.select(["filter[id*='labels-bg", "']"].join(id)); if (filter.size()) { color = "url(#" + filter.attr("id") + ")"; @@ -9066,7 +9234,7 @@ function getTextPos(d, type) { * @private */ redrawText: function redrawText(getX, getY, forFlow, withTransition) { - var $$ = this, + const $$ = this, $T = $$.$T, axis = $$.axis, config = $$.config, @@ -9076,13 +9244,11 @@ function getTextPos(d, type) { angle = config.data_labels.rotate, anchorString = getRotateAnchor(angle), rotateString = angle ? "rotate(" + angle + ")" : ""; - // $$.meetsLabelThreshold(ratio, - - $$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.updateTextBacgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) { + $$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.updateTextBackgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) { // do not apply transition for newly added text elements - var node = $T(hasTreemap && this.childElementCount ? this.parentNode : this, !!(withTransition && this.getAttribute("x")), t), + const node = $T(hasTreemap && this.childElementCount ? this.parentNode : this, !!(withTransition && this.getAttribute("x")), t), isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"]; - var pos = { + let pos = { x: getX.bind(this)(d, i), y: getY.bind(this)(d, i) }; @@ -9111,15 +9277,15 @@ function getTextPos(d, type) { * @private */ getTextRect: function getTextRect(element, className) { - var _this3 = this, - $$ = this, - base = element.node ? element.node() : element; + var _this3 = this; + const $$ = this; + let base = element.node ? element.node() : element; if (!/text/i.test(base.tagName)) { base = base.querySelector("text"); } - var text = base.textContent, + const text = base.textContent, cacheKey = KEY.textRect + "-" + text.replace(/\W/g, "_"); - var rect = $$.cache.get(cacheKey); + let rect = $$.cache.get(cacheKey); if (!rect) { $$.$el.svg.append("text").style("visibility", "hidden").style("font", (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(base).style("font")).classed(className, !0).text(text).call(function (v) { _newArrowCheck(this, _this3); @@ -9137,8 +9303,8 @@ function getTextPos(d, type) { * @private */ generateXYForText: function generateXYForText(indices, forX) { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, _$$$state = $$.state, hasRadar = _$$$state.hasRadar, hasTreemap = _$$$state.hasTreemap, @@ -9152,7 +9318,7 @@ function getTextPos(d, type) { points[v] = $$["generateGet" + capitalize(v) + "Points"](indices[v], !1); }.bind(this)); return function (d, i) { - var type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isCandlestickType(d) && "candlestick" || $$.isRadarType(d) && "radar" || $$.isTreemapType(d) && "treemap" || "line"; + const type = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar" || $$.isCandlestickType(d) && "candlestick" || $$.isRadarType(d) && "radar" || $$.isTreemapType(d) && "treemap" || "line"; return getter.call($$, points[type](d, i), d, this); }; }, @@ -9166,20 +9332,20 @@ function getTextPos(d, type) { * @private */ getCenteredTextPos: function getCenteredTextPos(d, points, textElement, type) { - var $$ = this, + const $$ = this, config = $$.config, isRotated = config.axis_rotated, isBarType = $$.isBarType(d), isTreemapType = $$.isTreemapType(d); if (config.data_labels.centered && (isBarType || isTreemapType)) { - var rect = getBoundingRect(textElement); + const rect = getBoundingRect(textElement); if (isBarType) { - var isPositive = d.value >= 0; + const isPositive = $$.getRangedData(d, null, "bar") >= 0; if (isRotated) { - var w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2; + const w = (isPositive ? points[1][1] - points[0][1] : points[0][1] - points[1][1]) / 2 + rect.width / 2; return isPositive ? -w - 3 : w + 2; } else { - var h = (isPositive ? points[0][1] - points[1][1] : points[1][1] - points[0][1]) / 2 + rect.height / 2; + const h = (isPositive ? points[0][1] - points[1][1] : points[1][1] - points[0][1]) / 2 + rect.height / 2; return isPositive ? h : -h - 2; } } else if (isTreemapType) { @@ -9197,12 +9363,11 @@ function getTextPos(d, type) { * @private */ getXForText: function getXForText(points, d, textElement) { - var $$ = this, + const $$ = this, config = $$.config, - state = $$.state, isRotated = config.axis_rotated, isTreemapType = $$.isTreemapType(d); - var xPos = points[0][0]; + let xPos = points[0][0]; if ($$.isCandlestickType(d)) { if (isRotated) { var _$$$getCandlestickDat2; @@ -9214,7 +9379,7 @@ function getTextPos(d, type) { xPos += config.data_labels.centered ? 0 : 5; } else { if (isRotated) { - var isInverted = config["axis_" + $$.axis.getId(d.id) + "_inverted"], + const isInverted = config["axis_" + $$.axis.getId(d.id) + "_inverted"], padding = $$.isBarType(d) ? 4 : 6, value = d.value; xPos = points[2][1]; @@ -9227,17 +9392,6 @@ function getTextPos(d, type) { xPos = $$.hasType("bar") ? (points[2][0] + points[0][0]) / 2 : xPos; } } - - // show labels regardless of the domain if value is null - if (d.value === null) { - if (xPos > state.width) { - var _getBoundingRect = getBoundingRect(textElement), - width = _getBoundingRect.width; - xPos = state.width - width; - } else if (xPos < 0) { - xPos = 4; - } - } if (isRotated || isTreemapType) { xPos += $$.getCenteredTextPos(d, points, textElement, "x"); } @@ -9252,7 +9406,7 @@ function getTextPos(d, type) { * @private */ getYForText: function getYForText(points, d, textElement) { - var $$ = this, + const $$ = this, axis = $$.axis, config = $$.config, state = $$.state, @@ -9262,7 +9416,7 @@ function getTextPos(d, type) { isTreemapType = $$.isTreemapType(d), r = config.point_r, rect = getBoundingRect(textElement); - var value = d.value, + let value = d.value, baseY = 3, yPos; if ($$.isCandlestickType(d)) { @@ -9289,7 +9443,7 @@ function getTextPos(d, type) { if (value < 0 || value === 0 && !state.hasPositiveValue && state.hasNegativeValue) { yPos += isInverted ? isBarType ? -3 : -5 : rect.height + (isBarType ? -baseY : baseY); } else { - var diff = -baseY * 2; + let diff = -baseY * 2; if (isBarType) { diff = -baseY; } else if ($$.isBubbleType(d)) { @@ -9302,16 +9456,6 @@ function getTextPos(d, type) { } } } - - // show labels regardless of the domain if value is null - if (d.value === null && !isRotated) { - var boxHeight = rect.height; - if (yPos < boxHeight) { - yPos = boxHeight; - } else if (yPos > state.height) { - yPos = state.height - 4; - } - } if (!isRotated || isTreemapType) { yPos += $$.getCenteredTextPos(d, points, textElement, "y"); } @@ -9326,8 +9470,8 @@ function getTextPos(d, type) { * @private */ markOverlapped: function markOverlapped(id, $$, selector) { - var _this5 = this, - textNodes = $$.$el.arcs.selectAll(selector), + var _this5 = this; + const textNodes = $$.$el.arcs.selectAll(selector), filteredTextNodes = textNodes.filter(function (node) { _newArrowCheck(this, _this5); return node.data.id !== id; @@ -9340,11 +9484,9 @@ function getTextPos(d, type) { calcHypo = function (x, y) { _newArrowCheck(this, _this5); return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); - }.bind(this); - // Calculates the length of the hypotenuse - + }.bind(this); // Calculates the length of the hypotenuse textNode.node() && filteredTextNodes.each(function () { - var coordinate = getTranslation(this), + const coordinate = getTranslation(this), filteredTextNode = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : filteredTextNode, overlapsX = Math.ceil(Math.abs(translate.e - coordinate.e)) < Math.ceil(nodeForWidth.node().getComputedTextLength()), @@ -9375,7 +9517,7 @@ function getTextPos(d, type) { if (ratio === void 0) { ratio = 0; } - var $$ = this, + const $$ = this, config = $$.config, threshold = config[type + "_label_threshold"] || 0; return ratio >= threshold; @@ -9396,12 +9538,12 @@ function getTextPos(d, type) { * @returns {string|number} text-anchor value or position in pixel * @private */ -function title_getTextPos(pos, width) { +function getTextXPos(pos, width) { if (pos === void 0) { pos = "left"; } - var isNum = isNumber(width); - var position; + const isNum = isNumber(width); + let position; if (pos.indexOf("center") > -1) { position = isNum ? width / 2 : "middle"; } else if (pos.indexOf("right") > -1) { @@ -9417,12 +9559,12 @@ function title_getTextPos(pos, width) { * @private */ initTitle: function initTitle() { - var $$ = this, + const $$ = this, config = $$.config, $el = $$.$el; if (config.title_text) { $el.title = $el.svg.append("g"); - var text = $el.title.append("text").style("text-anchor", title_getTextPos(config.title_position)).attr("class", $TEXT.title); + const text = $el.title.append("text").style("text-anchor", getTextXPos(config.title_position)).attr("class", $TEXT.title); setTextValue(text, config.title_text, [.3, 1.5]); } }, @@ -9431,61 +9573,26 @@ function title_getTextPos(pos, width) { * @private */ redrawTitle: function redrawTitle() { - var $$ = this, + const $$ = this, config = $$.config, current = $$.state.current, title = $$.$el.title; if (title) { - var y = $$.yForTitle.call($$); - if (/g/i.test(title.node().tagName)) { - title.attr("transform", "translate(" + title_getTextPos(config.title_position, current.width) + ", " + y + ")"); - } else { - title.attr("x", $$.xForTitle.call($$)).attr("y", y); - } + const x = getTextXPos(config.title_position, current.width), + y = (config.title_padding.top || 0) + $$.getTextRect($$.$el.title, $TEXT.title).height; + title.attr("transform", "translate(" + x + ", " + y + ")"); } }, - /** - * Returns the x attribute value of the title - * @returns {number} x attribute value - * @private - */ - xForTitle: function xForTitle() { - var $$ = this, - config = $$.config, - current = $$.state.current, - position = config.title_position || "left", - textRectWidth = $$.getTextRect($$.$el.title, $TEXT.title).width; - var x; - if (/(right|center)/.test(position)) { - x = current.width - textRectWidth; - if (position.indexOf("right") >= 0) { - x = current.width - textRectWidth - config.title_padding.right; - } else if (position.indexOf("center") >= 0) { - x = (current.width - textRectWidth) / 2; - } - } else { - // left - x = config.title_padding.left || 0; - } - return x; - }, - /** - * Returns the y attribute value of the title - * @returns {number} y attribute value - * @private - */ - yForTitle: function yForTitle() { - var $$ = this; - return ($$.config.title_padding.top || 0) + $$.getTextRect($$.$el.title, $TEXT.title).height; - }, /** * Get title padding * @returns {number} padding value * @private */ getTitlePadding: function getTitlePadding() { - var $$ = this; - return $$.yForTitle() + ($$.config.title_padding.bottom || 0); + const $$ = this, + $el = $$.$el, + config = $$.config; + return (config.title_padding.top || 0) + $$.getTextRect($el.title, $TEXT.title).height + (config.title_padding.bottom || 0); } }); ;// CONCATENATED MODULE: ./src/ChartInternal/internals/tooltip.ts @@ -9504,7 +9611,7 @@ function title_getTextPos(pos, width) { * @private */ initTooltip: function initTooltip() { - var $$ = this, + const $$ = this, config = $$.config, $el = $$.$el; $el.tooltip = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(config.tooltip_contents.bindto); @@ -9513,9 +9620,13 @@ function title_getTextPos(pos, width) { } $$.bindTooltipResizePos(); }, + /** + * Show tooltip at initialization. + * Is called only when tooltip.init.show=true option is set + * @private + */ initShowTooltip: function initShowTooltip() { - var _this = this, - $$ = this, + const $$ = this, config = $$.config, $el = $$.$el, _$$$state = $$.state, @@ -9523,31 +9634,20 @@ function title_getTextPos(pos, width) { hasRadar = _$$$state.hasRadar; // Show tooltip if needed if (config.tooltip_init_show) { - var _$$$axis, - _$$$axis2, - isArc = !(hasAxis && hasRadar); + var _$$$axis, _data; if ((_$$$axis = $$.axis) != null && _$$$axis.isTimeSeries() && isString(config.tooltip_init_x)) { - var targets = $$.data.targets[0]; - var i, val; config.tooltip_init_x = parseDate.call($$, config.tooltip_init_x); - for (i = 0; val = targets.values[i]; i++) { - if (val.x - config.tooltip_init_x === 0) { - break; - } - } - config.tooltip_init_x = i; } - var data = $$.data.targets.map(function (d) { - _newArrowCheck(this, _this); - var x = isArc ? 0 : config.tooltip_init_x; - return $$.addName(d.values[x]); - }.bind(this)); - if (isArc) { - data = [data[config.tooltip_init_x]]; - } - $el.tooltip.html($$.getTooltipHTML(data, (_$$$axis2 = $$.axis) == null ? void 0 : _$$$axis2.getXAxisTickFormat(), $$.getDefaultValueFormat(), $$.color)); - if (!config.tooltip_contents.bindto) { - $el.tooltip.style("top", config.tooltip_init_position.top).style("left", config.tooltip_init_position.left).style("display", null); + $$.api.tooltip.show({ + data: (_data = {}, _data[!(hasAxis || hasRadar) ? "index" : "x"] = config.tooltip_init_x, _data) + }); + const position = config.tooltip_init_position; + if (!config.tooltip_contents.bindto && !isEmpty(position)) { + const _position$top = position.top, + top = _position$top === void 0 ? 0 : _position$top, + _position$left = position.left, + left = _position$left === void 0 ? 50 : _position$left; + $el.tooltip.style("top", isString(top) ? top : top + "px").style("left", isString(left) ? left : left + "px").style("display", null); } } }, @@ -9558,7 +9658,7 @@ function title_getTextPos(pos, width) { * @private */ getTooltipHTML: function getTooltipHTML() { - var $$ = this, + const $$ = this, api = $$.api, config = $$.config; return isFunction(config.tooltip_contents) ? config.tooltip_contents.bind(api).apply(void 0, arguments) : $$.getTooltipContent.apply($$, arguments); @@ -9572,54 +9672,71 @@ function title_getTextPos(pos, width) { * @returns {string} html * @private */ - getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, _color) { - var _this2 = this, - $$ = this, + getTooltipContent: function getTooltipContent(d, defaultTitleFormat, defaultValueFormat, color) { + var _this = this; + const $$ = this, api = $$.api, config = $$.config, state = $$.state, $el = $$.$el, _map = ["title", "name", "value"].map(function (v) { - _newArrowCheck(this, _this2); - var fn = config["tooltip_format_" + v]; + _newArrowCheck(this, _this); + const fn = config["tooltip_format_" + v]; return isFunction(fn) ? fn.bind(api) : fn; }.bind(this)), - titleFormat = _map[0], - nameFormat = _map[1], - valueFormat = _map[2]; - titleFormat = titleFormat || defaultTitleFormat; - nameFormat = nameFormat || function (name) { - _newArrowCheck(this, _this2); - return name; - }.bind(this); - valueFormat = valueFormat || (state.hasTreemap || $$.isStackNormalized() ? function (v, ratio) { - _newArrowCheck(this, _this2); - return (ratio * 100).toFixed(2) + "%"; - }.bind(this) : defaultValueFormat); - var order = config.tooltip_order, + titleFn = _map[0], + nameFn = _map[1], + valueFn = _map[2], + titleFormat = function () { + _newArrowCheck(this, _this); + return sanitize((titleFn || defaultTitleFormat).apply(void 0, arguments)); + }.bind(this), + nameFormat = function () { + var _this2 = this; + _newArrowCheck(this, _this); + return sanitize((nameFn || function (name) { + _newArrowCheck(this, _this2); + return name; + }.bind(this)).apply(void 0, arguments)); + }.bind(this), + valueFormat = function () { + var _this3 = this; + _newArrowCheck(this, _this); + const fn = valueFn || (state.hasTreemap || $$.isStackNormalized() ? function (v, ratio) { + _newArrowCheck(this, _this3); + return (ratio * 100).toFixed(2) + "%"; + }.bind(this) : defaultValueFormat); + return sanitize(fn.apply(void 0, arguments)); + }.bind(this), + order = config.tooltip_order, getRowValue = function (row) { - _newArrowCheck(this, _this2); + _newArrowCheck(this, _this); return $$.axis && $$.isBubbleZType(row) ? $$.getBubbleZData(row.value, "z") : $$.getBaseValue(row); }.bind(this), getBgColor = $$.levelColor ? function (row) { - _newArrowCheck(this, _this2); + _newArrowCheck(this, _this); return $$.levelColor(row.value); }.bind(this) : function (row) { - _newArrowCheck(this, _this2); - return _color(row); + _newArrowCheck(this, _this); + return color(row); }.bind(this), contents = config.tooltip_contents, tplStr = contents.template, targetIds = $$.mapToTargetIds(); + + // get formatter function + + // determine fotmatter function with sanitization + if (order === null && config.data_groups.length) { // for stacked data, order should aligned with the visually displayed data - var ids = $$.orderTargets($$.data.targets).map(function (i2) { - _newArrowCheck(this, _this2); + const ids = $$.orderTargets($$.data.targets).map(function (i2) { + _newArrowCheck(this, _this); return i2.id; }.bind(this)).reverse(); d.sort(function (a, b) { - _newArrowCheck(this, _this2); - var v1 = a ? a.value : null, + _newArrowCheck(this, _this); + let v1 = a ? a.value : null, v2 = b ? b.value : null; if (v1 > 0 && v2 > 0) { v1 = a.id ? ids.indexOf(a.id) : null; @@ -9629,25 +9746,24 @@ function title_getTextPos(pos, width) { }.bind(this)); } else if (/^(asc|desc)$/.test(order)) { d.sort(function (a, b) { - _newArrowCheck(this, _this2); - var v1 = a ? getRowValue(a) : null, + _newArrowCheck(this, _this); + const v1 = a ? getRowValue(a) : null, v2 = b ? getRowValue(b) : null; return order === "asc" ? v1 - v2 : v2 - v1; }.bind(this)); } else if (isFunction(order)) { d.sort(order.bind(api)); } - var tpl = $$.getTooltipContentTemplate(tplStr), + const tpl = $$.getTooltipContentTemplate(tplStr), len = d.length; - var text, row, param, value, i; - var _loop = function () { - var _this3 = this; + let text, row, param, value, i; + for (i = 0; i < len; i++) { row = d[i]; if (!row || !(getRowValue(row) || getRowValue(row) === 0)) { - return "continue"; + continue; } if (isUndefined(text)) { - var title = (state.hasAxis || state.hasRadar) && sanitise(titleFormat ? titleFormat(row.x) : row.x); + const title = (state.hasAxis || state.hasRadar) && titleFormat(row.x); text = tplProcess(tpl[0], { CLASS_TOOLTIP: $TOOLTIP.tooltip, TITLE: isValue(title) ? tplStr ? title : "" + title + "" : "" @@ -9657,59 +9773,61 @@ function title_getTextPos(pos, width) { param = ["arc", $$.$el.arcs.select("path." + $ARC.arc + "-" + row.id).data()[0]]; row.ratio = $$.getRatio.apply($$, param); } - param = [row.ratio, row.id, row.index, d]; - value = sanitise(valueFormat.apply(void 0, [getRowValue(row)].concat(param))); + + // arrange param to be passed to formatter + param = [row.ratio, row.id, row.index]; if ($$.isAreaRangeType(row)) { - var _map2 = ["high", "low"].map(function (v) { - _newArrowCheck(this, _this3); - return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v)].concat(param))); + const _map2 = ["high", "low"].map(function (v) { + _newArrowCheck(this, _this); + return valueFormat.apply(void 0, [$$.getRangedData(row, v)].concat(param)); }.bind(this)), high = _map2[0], - low = _map2[1]; - value = "Mid: " + value + " High: " + high + " Low: " + low; + low = _map2[1], + mid = valueFormat.apply(void 0, [getRowValue(row)].concat(param)); + value = "Mid: " + mid + " High: " + high + " Low: " + low; } else if ($$.isCandlestickType(row)) { - var _map3 = ["open", "high", "low", "close", "volume"].map(function (v) { - _newArrowCheck(this, _this3); - return sanitise(valueFormat.apply(void 0, [$$.getRangedData(row, v, "candlestick")].concat(param))); + const _map3 = ["open", "high", "low", "close", "volume"].map(function (v) { + _newArrowCheck(this, _this); + const value = $$.getRangedData(row, v, "candlestick"); + return value ? valueFormat.apply(void 0, [$$.getRangedData(row, v, "candlestick")].concat(param)) : undefined; }.bind(this)), open = _map3[0], - _high = _map3[1], - _low = _map3[2], + high = _map3[1], + low = _map3[2], close = _map3[3], volume = _map3[4]; - value = "Open: " + open + " High: " + _high + " Low: " + _low + " Close: " + close + (volume ? " Volume: " + volume : ""); + value = "Open: " + open + " High: " + high + " Low: " + low + " Close: " + close + (volume ? " Volume: " + volume : ""); } else if ($$.isBarRangeType(row)) { - var _row$value = row.value, - start = _row$value[0], - end = _row$value[1]; - value = valueFormat(start) + " ~ " + valueFormat(end); + const _row = row, + rangeValue = _row.value, + id = _row.id, + index = _row.index; + value = "" + valueFormat(rangeValue, undefined, id, index); + } else { + value = valueFormat.apply(void 0, [getRowValue(row)].concat(param)); } if (value !== undefined) { // Skip elements when their name is set to null if (row.name === null) { - return "continue"; + continue; } - var name = sanitise(nameFormat.apply(void 0, [row.name].concat(param))), - _color = getBgColor(row), + const name = nameFormat.apply(void 0, [row.name].concat(param)), + color = getBgColor(row), contentValue = { CLASS_TOOLTIP_NAME: $TOOLTIP.tooltipName + $$.getTargetSelectorSuffix(row.id), - COLOR: tplStr || !$$.patterns ? _color : "", + COLOR: tplStr || !$$.patterns ? color : "", NAME: name, VALUE: value }; if (tplStr && isObject(contents.text)) { - var index = targetIds.indexOf(row.id); + const index = targetIds.indexOf(row.id); Object.keys(contents.text).forEach(function (key) { - _newArrowCheck(this, _this3); + _newArrowCheck(this, _this); contentValue[key] = contents.text[key][index]; }.bind(this)); } text += tplProcess(tpl[1], contentValue); } - }; - for (i = 0; i < len; i++) { - var _ret = _loop(); - if (_ret === "continue") continue; } return text + ""; }, @@ -9722,18 +9840,86 @@ function title_getTextPos(pos, width) { getTooltipContentTemplate: function getTooltipContentTemplate(tplStr) { return (tplStr || "\n\t\t\t\t{=TITLE}\n\t\t\t\t{{\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}}\n\t\t\t
" + (this.patterns ? "{=COLOR}" : "") + "{=NAME}{=VALUE}
").replace(/(\r?\n|\t)/g, "").split(/{{(.*)}}/); }, + /** + * Update tooltip position coordinate + * @param {object} dataToShow Data object + * @param {SVGElement} eventTarget Event element + * @private + */ + setTooltipPosition: function setTooltipPosition(dataToShow, eventTarget) { + var _this4 = this; + const $$ = this, + config = $$.config, + scale = $$.scale, + state = $$.state, + _$$$$el = $$.$el, + eventRect = _$$$$el.eventRect, + tooltip = _$$$$el.tooltip, + bindto = config.tooltip_contents.bindto, + isRotated = config.axis_rotated, + datum = tooltip == null ? void 0 : tooltip.datum(); + if (!bindto && datum) { + var _config$tooltip_posit, _config$tooltip_posit2; + const data = dataToShow != null ? dataToShow : JSON.parse(datum.current), + _getPointer = getPointer(state.event, eventTarget != null ? eventTarget : eventRect == null ? void 0 : eventRect.node()), + x = _getPointer[0], + y = _getPointer[1], + currPos = { + x: x, + y: y + }; + // get mouse event position + + if (state.hasAxis && scale.x && datum && "x" in datum) { + const getYPos = function (value, id, axisId) { + var _$$$axis2; + if (value === void 0) { + value = 0; + } + if (axisId === void 0) { + axisId = "y"; + } + _newArrowCheck(this, _this4); + const scaleFn = scale[id ? (_$$$axis2 = $$.axis) == null ? void 0 : _$$$axis2.getId(id) : axisId]; + return scaleFn ? scaleFn(value) + (isRotated ? state.margin.left : state.margin.top) : 0; + }.bind(this); + currPos.xAxis = scale.x(datum.x) + ( + // add margin only when user specified tooltip.position function + config.tooltip_position ? isRotated ? state.margin.top : state.margin.left : 0); + if (data.length === 1) { + currPos.yAxis = getYPos(data[0].value, data[0].id); + } else { + currPos.yAxis = getYPos; + } + } + const _datum$width = datum.width, + width = _datum$width === void 0 ? 0 : _datum$width, + _datum$height = datum.height, + height = _datum$height === void 0 ? 0 : _datum$height, + pos = (_config$tooltip_posit = (_config$tooltip_posit2 = config.tooltip_position) == null ? void 0 : _config$tooltip_posit2.bind($$.api)(data, width, height, eventRect == null ? void 0 : eventRect.node(), currPos)) != null ? _config$tooltip_posit : $$.getTooltipPosition.bind($$)(width, height, currPos); // Get tooltip position + ["top", "left"].forEach(function (v) { + _newArrowCheck(this, _this4); + const value = pos[v]; + tooltip.style(v, value + "px"); + + // Remember left pos in percentage to be used on resize call + if (v === "left" && !datum.xPosInPercent) { + datum.xPosInPercent = value / state.current.width * 100; + } + }.bind(this)); + } + }, /** * Returns the position of the tooltip - * @param {object} dataToShow data * @param {string} tWidth Width value of tooltip element * @param {string} tHeight Height value of tooltip element - * @param {HTMLElement} element Tooltip element + * @param {object} currPos Current mouse position * @returns {object} top, left value * @private */ - tooltipPosition: function tooltipPosition(dataToShow, tWidth, tHeight, element) { - var _this4 = this, - $$ = this, + getTooltipPosition: function getTooltipPosition(tWidth, tHeight, currPos) { + var _this5 = this; + const $$ = this, config = $$.config, scale = $$.scale, state = $$.state, @@ -9743,51 +9929,54 @@ function title_getTextPos(pos, width) { current = _state.current, isLegendRight = _state.isLegendRight, inputType = _state.inputType, - event = _state.event, hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle, hasTreemap = state.hasTreemap, isRotated = config.axis_rotated, - svgLeft = $$.getSvgLeft(!0), - chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(), - chartLeft = $$.getCurrentPaddingLeft(!0), - _getPointer = getPointer(event, element), - x = _getPointer[0], - y = _getPointer[1]; + hasArcType = $$.hasArcType(), + svgLeft = $$.getSvgLeft(!0); + let chartRight = svgLeft + current.width - $$.getCurrentPaddingByDirection("right"); + const size = 20; + let x = currPos.x, + y = currPos.y; + // Determine tooltip position - if ($$.hasArcType()) { - var raw = inputType === "touch" || $$.hasType("radar"); + if (hasArcType) { + const raw = inputType === "touch" || $$.hasType("radar"); if (!raw) { - y += hasGauge ? height : height / 2; x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2; + y += hasGauge ? height : height / 2; } } else if (!hasTreemap) { - var dataScale = scale.x(dataToShow[0].x); + const padding = { + top: $$.getCurrentPaddingByDirection("top", !0), + left: $$.getCurrentPaddingByDirection("left", !0) + }; if (isRotated) { - y = dataScale + 20; - x += svgLeft; + x += svgLeft + padding.left + size; + y = padding.top + currPos.xAxis + size; chartRight -= svgLeft; } else { - y -= 5; - x = svgLeft + chartLeft + 20 + (scale.zoom ? x : dataScale); + x = svgLeft + padding.left + size + (scale.zoom ? x : currPos.xAxis); + y += padding.top - 5; } } // when tooltip left + tWidth > chart's width if (x + tWidth + 15 > chartRight) { - x -= isRotated ? tWidth - chartLeft : tWidth + (hasTreemap ? 0 : chartLeft); + x -= tWidth + (hasTreemap || hasArcType ? 0 : isRotated ? 40 : 38); } if (y + tHeight > current.height) { - var gap = hasTreemap ? 0 : 30; + const gap = hasTreemap ? 0 : 30; y -= hasGauge ? tHeight * 3 : tHeight + gap; } - var pos = { + const pos = { top: y, left: x }; // make sure to not be positioned out of viewport Object.keys(pos).forEach(function (v) { - _newArrowCheck(this, _this4); + _newArrowCheck(this, _this5); if (pos[v] < 0) { pos[v] = 0; } @@ -9797,33 +9986,27 @@ function title_getTextPos(pos, width) { /** * Show the tooltip * @param {object} selectedData Data object - * @param {SVGElement} eventRect Event element + * @param {SVGElement} eventTarget Event element * @private */ - showTooltip: function showTooltip(selectedData, eventRect) { - var _this5 = this, - $$ = this, + showTooltip: function showTooltip(selectedData, eventTarget) { + var _this6 = this; + const $$ = this, config = $$.config, - scale = $$.scale, - state = $$.state, tooltip = $$.$el.tooltip, - bindto = config.tooltip_contents.bindto, dataToShow = selectedData.filter(function (d) { - _newArrowCheck(this, _this5); + _newArrowCheck(this, _this6); return d && isValue($$.getBaseValue(d)); }.bind(this)); if (!tooltip || dataToShow.length === 0 || !config.tooltip_show) { return; } - var datum = tooltip.datum(), - _ref = datum || {}, - _ref$width = _ref.width, - width = _ref$width === void 0 ? 0 : _ref$width, - _ref$height = _ref.height, - height = _ref$height === void 0 ? 0 : _ref$height; - var dataStr = JSON.stringify(selectedData); + let datum = tooltip.datum(); + const dataStr = JSON.stringify(selectedData); if (!datum || datum.current !== dataStr) { - var index = selectedData.concat().sort()[0].index; + const _selectedData$concat$ = selectedData.concat().sort()[0], + index = _selectedData$concat$.index, + x = _selectedData$concat$.x; callFn(config.tooltip_onshow, $$.api, selectedData); // set tooltip content @@ -9837,70 +10020,41 @@ function title_getTextPos(pos, width) { )).style("display", null).style("visibility", null) // for IE9 .datum(datum = { index: index, + x: x, current: dataStr, - width: width = tooltip.property("offsetWidth"), - height: height = tooltip.property("offsetHeight") + width: tooltip.property("offsetWidth"), + height: tooltip.property("offsetHeight") }); callFn(config.tooltip_onshown, $$.api, selectedData); $$._handleLinkedCharts(!0, index); } - if (!bindto) { - var _config$tooltip_posit, - _selectedData$filter, - fnPos = ((_config$tooltip_posit = config.tooltip_position) == null ? void 0 : _config$tooltip_posit.bind($$.api)) || $$.tooltipPosition.bind($$), - _getPointer2 = getPointer(state.event, eventRect), - x = _getPointer2[0], - y = _getPointer2[1], - currPos = { - x: x, - y: y - }, - data = (_selectedData$filter = selectedData.filter(Boolean)) == null ? void 0 : _selectedData$filter.shift(); - // get mouse event position - - if (scale.x && data && "x" in data) { - currPos.xAxis = scale.x(data.x); - } - - // Get tooltip dimensions - var pos = fnPos(dataToShow, width, height, eventRect, currPos); - ["top", "left"].forEach(function (v) { - _newArrowCheck(this, _this5); - var value = pos[v]; - tooltip.style(v, value + "px"); - - // Remember left pos in percentage to be used on resize call - if (v === "left" && !datum.xPosInPercent) { - datum.xPosInPercent = value / state.current.width * 100; - } - }.bind(this)); - } + $$.setTooltipPosition(dataToShow, eventTarget); }, /** * Adjust tooltip position on resize event * @private */ bindTooltipResizePos: function bindTooltipResizePos() { - var _this6 = this, - $$ = this, + var _this7 = this; + const $$ = this, resizeFunction = $$.resizeFunction, state = $$.state, tooltip = $$.$el.tooltip; resizeFunction.add(function () { - _newArrowCheck(this, _this6); + _newArrowCheck(this, _this7); if (tooltip.style("display") === "block") { - var current = state.current, + const current = state.current, _tooltip$datum = tooltip.datum(), width = _tooltip$datum.width, xPosInPercent = _tooltip$datum.xPosInPercent; - var _value = current.width / 100 * xPosInPercent; - var diff = current.width - (_value + width); + let value = current.width / 100 * xPosInPercent; + const diff = current.width - (value + width); // if tooltip size overs current viewport size if (diff < 0) { - _value += diff; + value += diff; } - tooltip.style("left", _value + "px"); + tooltip.style("left", value + "px"); } }.bind(this)); }, @@ -9910,12 +10064,13 @@ function title_getTextPos(pos, width) { * @private */ hideTooltip: function hideTooltip(force) { - var $$ = this, + const $$ = this, api = $$.api, config = $$.config, tooltip = $$.$el.tooltip; if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) { - var selectedData = JSON.parse(tooltip.datum().current); + var _tooltip$datum$curren; + const selectedData = JSON.parse((_tooltip$datum$curren = tooltip.datum().current) != null ? _tooltip$datum$curren : {}); callFn(config.tooltip_onhide, api, selectedData); // hide tooltip @@ -9931,28 +10086,28 @@ function title_getTextPos(pos, width) { * @private */ _handleLinkedCharts: function _handleLinkedCharts(show, index) { - var _this7 = this, - $$ = this, + var _this8 = this; + const $$ = this, charts = $$.charts, config = $$.config, event = $$.state.event; // Prevent propagation among instances if isn't instantiated from the user's event // https://github.com/naver/billboard.js/issues/1979 if (event != null && event.isTrusted && config.tooltip_linked && charts.length > 1) { - var linkedName = config.tooltip_linked_name; + const linkedName = config.tooltip_linked_name; charts.filter(function (c) { - _newArrowCheck(this, _this7); + _newArrowCheck(this, _this8); return c !== $$.api; }.bind(this)).forEach(function (c) { - _newArrowCheck(this, _this7); - var _c$internal = c.internal, + _newArrowCheck(this, _this8); + const _c$internal = c.internal, config = _c$internal.config, $el = _c$internal.$el, isLinked = config.tooltip_linked, name = config.tooltip_linked_name, isInDom = browser_doc.body.contains($el.chart.node()); if (isLinked && linkedName === name && isInDom) { - var data = $el.tooltip.data()[0], + const data = $el.tooltip.data()[0], isNotSameIndex = index !== (data == null ? void 0 : data.index); try { c.tooltip[show && isNotSameIndex ? "show" : "hide"]({ @@ -9962,6 +10117,64 @@ function title_getTextPos(pos, width) { } }.bind(this)); } + }, + /** + * Update tooltip content on redraw + * - In a situation where tooltip is displayed and data load happens, it should reflect loaded data to tooltip + * @param {d3Selection} context Event rect element + * @param {number} index Data index + * @private + */ + updateTooltipOnRedraw: function updateTooltipOnRedraw(context, index) { + var _this9 = this; + const $$ = this, + config = $$.config, + _$$$$el2 = $$.$el, + eventRect = _$$$$el2.eventRect, + svg = _$$$$el2.svg, + tooltip = _$$$$el2.tooltip, + _$$$state2 = $$.state, + event = _$$$state2.event, + hasAxis = _$$$state2.hasAxis, + hasRadar = _$$$state2.hasRadar, + hasTreemap = _$$$state2.hasTreemap; + // Update tooltip, when tooltip is in shown state + if ((tooltip == null ? void 0 : tooltip.style("display")) === "block" && event) { + var _ref; + const rect = context != null ? context : (_ref = hasRadar ? svg : eventRect) == null ? void 0 : _ref.node(); + + // for Axis based & Radar + if (hasAxis || hasRadar) { + if ($$.isMultipleX()) { + $$.selectRectForMultipleXs(rect, !1); + } else { + const idx = index != null ? index : $$.getDataIndexFromEvent(event); + if (index === -1) { + $$.api.tooltip.hide(); + } else { + $$.selectRectForSingle(rect, idx); + $$.setExpand(idx, null, !0); + } + } + + // for Arc & Treemap + } else { + const clientX = event.clientX, + clientY = event.clientY; + setTimeout(function () { + _newArrowCheck(this, _this9); + let target = browser_doc.elementFromPoint(clientX, clientY); + const data = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum(); + if (data) { + const d = $$.hasArcType() ? $$.convertToArcData($$.updateAngle(data)) : data == null ? void 0 : data.data; + hasTreemap && (target = svg.node()); + d && $$.showTooltip([d], target); + } else { + $$.api.tooltip.hide(); + } + }.bind(this), config.transition_duration); + } + } } }); ;// CONCATENATED MODULE: ./src/ChartInternal/internals/transform.ts @@ -9976,11 +10189,11 @@ function title_getTextPos(pos, width) { if (index === void 0) { index = 0; } - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, isRotated = config.axis_rotated; - var padding = 0, + let padding = 0, x, y; if (index && /^(x|y2?)$/.test(target)) { @@ -10003,7 +10216,7 @@ function title_getTextPos(pos, width) { y = isRotated ? state.height + padding : 0; } else if (target === "y2") { x = isRotated ? 0 : state.width + padding; - y = isRotated && padding ? 1 - padding : 0; + y = isRotated ? -padding - 1 : 0; } else if (target === "subX") { x = 0; y = isRotated ? 0 : state.height2; @@ -10014,7 +10227,7 @@ function title_getTextPos(pos, width) { x = state.arcWidth / 2; y = state.arcHeight / 2; } else if (target === "radar") { - var _$$$getRadarSize = $$.getRadarSize(), + const _$$$getRadarSize = $$.getRadarSize(), width = _$$$getRadarSize[0]; x = state.width / 2 - width; y = asHalfPixel(state.margin.top); @@ -10022,7 +10235,7 @@ function title_getTextPos(pos, width) { return "translate(" + x + ", " + y + ")"; }, transformMain: function transformMain(withTransition, transitions) { - var $$ = this, + const $$ = this, main = $$.$el.main, $T = $$.$T, xAxis = transitions != null && transitions.axisX ? transitions.axisX : $T(main.select("." + $AXIS.axisX), withTransition), @@ -10035,7 +10248,7 @@ function title_getTextPos(pos, width) { main.select("." + $ARC.chartArcs).attr("transform", $$.getTranslate("arc")); }, transformAll: function transformAll(withTransition, transitions) { - var $$ = this, + const $$ = this, config = $$.config, _$$$state = $$.state, hasAxis = _$$$state.hasAxis, @@ -10065,8 +10278,8 @@ function title_getTextPos(pos, width) { return !!(type && Object.values(TYPE).indexOf(type) > -1); }, setTargetType: function setTargetType(targetIds, type) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, withoutFadeIn = $$.state.withoutFadeIn; $$.mapToTargetIds(targetIds).forEach(function (id) { @@ -10083,12 +10296,12 @@ function title_getTextPos(pos, width) { * @private */ updateTypesElements: function updateTypesElements() { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, current = $$.state.current; Object.keys(TYPE).forEach(function (v) { _newArrowCheck(this, _this2); - var t = TYPE[v], + const t = TYPE[v], has = $$.hasType(t, null, !0), idx = current.types.indexOf(t); if (idx === -1 && has) { @@ -10115,18 +10328,18 @@ function title_getTextPos(pos, width) { if (checkFromData === void 0) { checkFromData = !1; } - var $$ = this, + const $$ = this, config = $$.config, current = $$.state.current, types = config.data_types, targets = targetsValue || $$.data.targets; - var has = !1; + let has = !1; if (!checkFromData && ((_current$types = current.types) == null ? void 0 : _current$types.indexOf(type)) > -1) { has = !0; } else if (targets != null && targets.length) { targets.forEach(function (target) { _newArrowCheck(this, _this3); - var t = types[target.id]; + const t = types[target.id]; if (t === type || !t && type === "line") { has = !0; } @@ -10175,12 +10388,12 @@ function title_getTextPos(pos, width) { * @private */ isTypeOf: function isTypeOf(d, type) { - var id = isString(d) ? d : d.id, + const id = isString(d) ? d : d.id, dataType = this.config.data_types[id] || this.config.data_type; return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type; }, hasPointType: function hasPointType() { - var $$ = this; + const $$ = this; return $$.hasTypeOf("Line") || $$.hasType("bubble") || $$.hasType("scatter"); }, /** @@ -10197,7 +10410,7 @@ function title_getTextPos(pos, width) { return this.hasType("gauge") && this.config.gauge_type === "multi"; }, isLineType: function isLineType(d) { - var id = isString(d) ? d : d.id; + const id = isString(d) ? d : d.id; return !this.config.data_types[id] || this.isTypeOf(id, TYPE_BY_CATEGORY.Line); }, isStepType: function isStepType(d) { @@ -10247,9 +10460,9 @@ function title_getTextPos(pos, width) { }, // determine if is 'circle' data point isCirclePoint: function isCirclePoint(node) { - var config = this.config, + const config = this.config, pattern = config.point_pattern; - var isCircle = !1; + let isCircle = !1; if ((node == null ? void 0 : node.tagName) === "circle") { isCircle = !0; } else { @@ -10335,7 +10548,7 @@ function title_getTextPos(pos, width) { * @ignore * @private */ -var ChartInternal = /*#__PURE__*/function () { +let ChartInternal = /*#__PURE__*/function () { function ChartInternal(api) { this.api = void 0; // API interface @@ -10389,11 +10602,11 @@ var ChartInternal = /*#__PURE__*/function () { axisTime: null // axisTimeFormat }; - var $$ = this; + const $$ = this; $$.api = api; // Chart class instance alias $$.config = new Options(); $$.cache = new Cache(); - var store = new Store(); + const store = new Store(); $$.$el = store.getStore("element"); $$.state = store.getStore("state"); $$.$T = $$.$T.bind($$); @@ -10409,11 +10622,11 @@ var ChartInternal = /*#__PURE__*/function () { */ var _proto = ChartInternal.prototype; _proto.$T = function $T(selection, force, name) { - var config = this.config, + const config = this.config, state = this.state, duration = config.transition_duration, subchart = config.subchart_show; - var t = selection; + let t = selection; if (t) { // in case of non d3 selection, wrap with d3 selection if ("tagName" in t) { @@ -10425,27 +10638,27 @@ var ChartInternal = /*#__PURE__*/function () { // - when has no subchart // - initialization // - resizing - var transit = (force !== !1 && duration || force) && (!state.zooming || state.dragging) && !state.resizing && state.rendered && !subchart; + const transit = (force !== !1 && duration || force) && (!state.zooming || state.dragging) && !state.resizing && state.rendered && !subchart; t = transit ? t.transition(name).duration(duration) : t; } return t; }; _proto.beforeInit = function beforeInit() { - var $$ = this; + const $$ = this; $$.callPluginHook("$beforeInit"); // can do something callFn($$.config.onbeforeinit, $$.api); }; _proto.afterInit = function afterInit() { - var $$ = this; + const $$ = this; $$.callPluginHook("$afterInit"); // can do something callFn($$.config.onafterinit, $$.api); }; _proto.init = function init() { - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, $el = $$.$el, @@ -10459,7 +10672,7 @@ var ChartInternal = /*#__PURE__*/function () { state.datetimeId = "bb-" + +new Date() * getRandom(); if (useCssRule) { // append style element - var styleEl = browser_doc.createElement("style"); + const styleEl = browser_doc.createElement("style"); // styleEl.id = styleId; styleEl.type = "text/css"; @@ -10472,7 +10685,7 @@ var ChartInternal = /*#__PURE__*/function () { // used on .destroy() $el.style = styleEl; } - var bindto = { + const bindto = { element: config.bindto, classname: "bb" }; @@ -10497,8 +10710,8 @@ var ChartInternal = /*#__PURE__*/function () { * @private */; _proto.initToRender = function initToRender(forced) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, state = $$.state, chart = $$.$el.chart, @@ -10529,8 +10742,8 @@ var ChartInternal = /*#__PURE__*/function () { } }; _proto.initParams = function initParams() { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, format = $$.format, state = $$.state, @@ -10554,10 +10767,10 @@ var ChartInternal = /*#__PURE__*/function () { format.extraLineClasses = $$.generateExtraLineClass(); format.dataTime = config.data_xLocaltime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeParse : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcParse; format.axisTime = config.axis_x_localtime ? external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.timeFormat : external_commonjs_d3_time_format_commonjs2_d3_time_format_amd_d3_time_format_root_d3_.utcFormat; - var isDragZoom = $$.config.zoom_enabled && $$.config.zoom_type === "drag"; + const isDragZoom = $$.config.zoom_enabled && $$.config.zoom_type === "drag"; format.defaultAxisTime = function (d) { _newArrowCheck(this, _this2); - var _$$$scale = $$.scale, + const _$$$scale = $$.scale, x = _$$$scale.x, zoom = _$$$scale.zoom, isZoomed = isDragZoom ? zoom : zoom && x.orgDomain().toString() !== zoom.domain().toString(), @@ -10574,8 +10787,8 @@ var ChartInternal = /*#__PURE__*/function () { state.inputType = convertInputType(config.interaction_inputType_mouse, config.interaction_inputType_touch); }; _proto.initWithData = function initWithData(data) { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, config = $$.config, scale = $$.scale, state = $$.state, @@ -10614,7 +10827,7 @@ var ChartInternal = /*#__PURE__*/function () { // retrieve scale after the 'updateScales()' is called if (hasAxis) { - var x = scale.x, + const x = scale.x, y = scale.y, y2 = scale.y2, subX = scale.subX, @@ -10642,7 +10855,7 @@ var ChartInternal = /*#__PURE__*/function () { // -- Basic Elements -- $el.svg = $el.chart.append("svg").style("overflow", "hidden").style("display", "block"); if (hasInteraction && state.inputType) { - var isTouch = state.inputType === "touch", + const isTouch = state.inputType === "touch", onclick = config.onclick, onover = config.onover, onout = config.onout; @@ -10651,7 +10864,7 @@ var ChartInternal = /*#__PURE__*/function () { config.svg_classname && $el.svg.attr("class", config.svg_classname); // Define defs - var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns; + const hasColorPatterns = isFunction(config.color_tiles) && $$.patterns; if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || config.data_labels_backgroundColors) { $el.defs = $el.svg.append("defs"); if (hasAxis) { @@ -10682,7 +10895,7 @@ var ChartInternal = /*#__PURE__*/function () { $$.bindResize(); // Define regions - var main = $el.svg.append("g").classed($COMMON.main, !0).attr("transform", hasTreemap ? null : $$.getTranslate("main")); + const main = $el.svg.append("g").classed($COMMON.main, !0).attr("transform", hasTreemap ? null : $$.getTranslate("main")); $el.main = main; // initialize subchart when subchart show option is set @@ -10745,7 +10958,7 @@ var ChartInternal = /*#__PURE__*/function () { // data.onmin/max callback if (config.data_onmin || config.data_onmax) { - var minMax = $$.getMinMaxData(); + const minMax = $$.getMinMaxData(); callFn(config.data_onmin, $$.api, minMax.min); callFn(config.data_onmax, $$.api, minMax.max); } @@ -10758,21 +10971,21 @@ var ChartInternal = /*#__PURE__*/function () { * @private */; _proto.initChartElements = function initChartElements() { - var _this5 = this, - $$ = this, + var _this5 = this; + const $$ = this, _$$$state = $$.state, hasAxis = _$$$state.hasAxis, hasRadar = _$$$state.hasRadar, hasTreemap = _$$$state.hasTreemap, types = []; if (hasAxis) { - var shapes = ["bar", "bubble", "candlestick", "line"]; + const shapes = ["bar", "bubble", "candlestick", "line"]; if ($$.config.bar_front) { shapes.push(shapes.shift()); } shapes.forEach(function (v) { _newArrowCheck(this, _this5); - var name = capitalize(v); + const name = capitalize(v); if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) { types.push(name); } @@ -10780,7 +10993,7 @@ var ChartInternal = /*#__PURE__*/function () { } else if (hasTreemap) { types.push("Treemap"); } else { - var hasPolar = $$.hasType("polar"); + const hasPolar = $$.hasType("polar"); if (!hasRadar) { types.push("Arc", "Pie"); } @@ -10804,7 +11017,7 @@ var ChartInternal = /*#__PURE__*/function () { * @private */; _proto.setChartElements = function setChartElements() { - var $$ = this, + const $$ = this, _$$$$el = $$.$el, chart = _$$$$el.chart, svg = _$$$$el.svg, @@ -10854,12 +11067,12 @@ var ChartInternal = /*#__PURE__*/function () { * @private */; _proto.setBackground = function setBackground() { - var $$ = this, + const $$ = this, bg = $$.config.background, state = $$.state, svg = $$.$el.svg; if (notEmpty(bg)) { - var element = svg.select("g").insert(bg.imgUrl ? "image" : "rect", ":first-child"); + const element = svg.select("g").insert(bg.imgUrl ? "image" : "rect", ":first-child"); if (bg.imgUrl) { element.attr("href", bg.imgUrl); } else if (bg.color) { @@ -10875,8 +11088,8 @@ var ChartInternal = /*#__PURE__*/function () { * @private */; _proto.updateTargets = function updateTargets(targets) { - var _this6 = this, - $$ = this, + var _this6 = this; + const $$ = this, _$$$state2 = $$.state, hasAxis = _$$$state2.hasAxis, hasRadar = _$$$state2.hasRadar, @@ -10890,7 +11103,7 @@ var ChartInternal = /*#__PURE__*/function () { if (hasAxis) { ["bar", "candlestick", "line"].forEach(function (v) { _newArrowCheck(this, _this6); - var name = capitalize(v); + const name = capitalize(v); if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) { helper(name); } @@ -10901,7 +11114,7 @@ var ChartInternal = /*#__PURE__*/function () { // Arc, Polar, Radar } else if ($$.hasArcType(targets)) { - var type = "Arc"; + let type = "Arc"; if (hasRadar) { type = "Radar"; } else if ($$.hasType("polar")) { @@ -10914,9 +11127,9 @@ var ChartInternal = /*#__PURE__*/function () { } // Point types - var hasPointType = $$.hasType("bubble") || $$.hasType("scatter"); + const hasPointType = $$.hasType("bubble") || $$.hasType("scatter"); if (hasPointType) { - $$.updateTargetForCircle == null ? void 0 : $$.updateTargetForCircle(); + $$.updateTargetForCircle == null || $$.updateTargetForCircle(); } // Fade-in each chart @@ -10933,10 +11146,10 @@ var ChartInternal = /*#__PURE__*/function () { if (hasPointType === void 0) { hasPointType = !1; } - var $$ = this, + const $$ = this, svg = $$.$el.svg, $T = $$.$T; - var selector = "." + $COMMON.target; + let selector = "." + $COMMON.target; if (hasPointType) { selector += ", ." + $CIRCLE.chartCircles + " > ." + $CIRCLE.circles; } @@ -10946,25 +11159,25 @@ var ChartInternal = /*#__PURE__*/function () { }.bind(this))).style("opacity", null); }; _proto.getWithOption = function getWithOption(options) { - var _this8 = this, - withOptions = { - Dimension: !0, - EventRect: !0, - Legend: !1, - Subchart: !0, - Transform: !1, - Transition: !0, - TrimXDomain: !0, - UpdateXAxis: "UpdateXDomain", - UpdateXDomain: !1, - UpdateOrgXDomain: !1, - TransitionForExit: "Transition", - TransitionForAxis: "Transition", - Y: !0 - }; + var _this8 = this; + const withOptions = { + Dimension: !0, + EventRect: !0, + Legend: !1, + Subchart: !0, + Transform: !1, + Transition: !0, + TrimXDomain: !0, + UpdateXAxis: "UpdateXDomain", + UpdateXDomain: !1, + UpdateOrgXDomain: !1, + TransitionForExit: "Transition", + TransitionForAxis: "Transition", + Y: !0 + }; Object.keys(withOptions).forEach(function (key) { _newArrowCheck(this, _this8); - var defVal = withOptions[key]; + let defVal = withOptions[key]; if (isString(defVal)) { defVal = withOptions[defVal]; } @@ -10973,14 +11186,14 @@ var ChartInternal = /*#__PURE__*/function () { return withOptions; }; _proto.initialOpacity = function initialOpacity(d) { - var $$ = this, + const $$ = this, withoutFadeIn = $$.state.withoutFadeIn, r = $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0"; return r; }; _proto.bindResize = function bindResize() { - var _this9 = this, - $$ = this, + var _this9 = this; + const $$ = this, config = $$.config, state = $$.state, resizeFunction = generateResize(config.resize_timer), @@ -11057,22 +11270,20 @@ convert, data_data, load, category, internals_class, internals_color, domain, in * @private */ function loadConfig(config) { - var _this = this, - thisConfig = this.config, - target, - keys, - read, - _find = function find() { - _newArrowCheck(this, _this); - var key = keys.shift(); - if (key && target && isObjectType(target) && key in target) { - target = target[key]; - return _find(); - } else if (!key) { - return target; - } - return undefined; - }.bind(this); + var _this = this; + const thisConfig = this.config; + let target, keys, read; + const _find = function find() { + _newArrowCheck(this, _this); + const key = keys.shift(); + if (key && target && isObjectType(target) && key in target) { + target = target[key]; + return _find(); + } else if (!key) { + return target; + } + return undefined; + }.bind(this); Object.keys(thisConfig).forEach(function (key) { _newArrowCheck(this, _this); target = config; @@ -11113,7 +11324,7 @@ function loadConfig(config) { * }); */ resize: function resize(size) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config, state = $$.state; if (state.rendered) { @@ -11138,7 +11349,7 @@ function loadConfig(config) { * chart.flush(true); */ flush: function flush(soft) { - var $$ = this.internal, + const $$ = this.internal, state = $$.state, zoomResetBtn = $$.$el.zoomResetBtn; if (state.rendered) { @@ -11147,16 +11358,16 @@ function loadConfig(config) { if (state.resizing) { var _$$$brush; // arguments[1] is given when is called from resize - (_$$$brush = $$.brush) == null ? void 0 : _$$$brush.updateResize(); + (_$$$brush = $$.brush) == null || _$$$brush.updateResize(); } else { var _$$$axis; // re-update config info - (_$$$axis = $$.axis) == null ? void 0 : _$$$axis.setOrient(); + (_$$$axis = $$.axis) == null || _$$$axis.setOrient(); } // hide possible reset zoom button // https://github.com/naver/billboard.js/issues/2201 - zoomResetBtn == null ? void 0 : zoomResetBtn.style("display", "none"); + zoomResetBtn == null || zoomResetBtn.style("display", "none"); $$.scale.zoom = null; soft ? $$.redraw({ withTransform: !0, @@ -11188,8 +11399,8 @@ function loadConfig(config) { * chart.destroy(); */ destroy: function destroy() { - var _this = this, - $$ = this.internal, + var _this = this; + const $$ = this.internal, _$$$$el = $$.$el, chart = _$$$$el.chart, style = _$$$$el.style, @@ -11223,7 +11434,7 @@ function loadConfig(config) { }.bind(this)); // release prototype chains - for (var key in this) { + for (const key in this) { this[key] = function () { _newArrowCheck(this, _this); }.bind(this); @@ -11267,11 +11478,11 @@ function loadConfig(config) { * chart.config("gauge.max", 100, true); */ config: function (name, value, redraw) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config, state = $$.state, key = name == null ? void 0 : name.replace(/\./g, "_"); - var res; + let res; if (name && key in config) { if (isDefined(value)) { config[key] = value; @@ -11332,11 +11543,11 @@ function loadConfig(config) { * // Get all data * chart.data(); */ -var api_data_data = function (targetIds) { - var _this = this, - targets = this.internal.data.targets; +const api_data_data = function (targetIds) { + var _this = this; + const targets = this.internal.data.targets; if (!isUndefined(targetIds)) { - var ids = isArray(targetIds) ? targetIds : [targetIds]; + const ids = isArray(targetIds) ? targetIds : [targetIds]; return targets.filter(function (t) { var _this2 = this; _newArrowCheck(this, _this); @@ -11388,15 +11599,15 @@ extend(api_data_data, { if (flat === void 0) { flat = !0; } - var values = null; + let values = null; if (targetIds) { - var targets = this.data(targetIds); + const targets = this.data(targetIds); if (isArray(targets)) { values = []; targets.forEach(function (v) { var _this4 = this; _newArrowCheck(this, _this3); - var dataValue = v.values.map(function (d) { + const dataValue = v.values.map(function (d) { _newArrowCheck(this, _this4); return d.value; }.bind(this)); @@ -11425,7 +11636,7 @@ extend(api_data_data, { *}); */ names: function names(_names) { - var $$ = this.internal; + const $$ = this.internal; return $$.updateDataAttributes("names", _names); }, /** @@ -11520,7 +11731,7 @@ var export_this = undefined; * @private * @see https://developer.mozilla.org/ko/docs/Web/API/WindowBase64/Base64_encoding_and_decoding */ -var b64EncodeUnicode = function (str) { +const b64EncodeUnicode = function (str) { var _this2 = this; _newArrowCheck(this, export_this); return win.btoa == null ? void 0 : win.btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p) { @@ -11538,8 +11749,8 @@ var b64EncodeUnicode = function (str) { * @private */ function nodeToSvgDataUrl(node, option, orgSize) { - var _this3 = this, - _ref = option || orgSize, + var _this3 = this; + const _ref = option || orgSize, width = _ref.width, height = _ref.height, serializer = new XMLSerializer(), @@ -11564,11 +11775,11 @@ function nodeToSvgDataUrl(node, option, orgSize) { t.innerHTML = ""; }.bind(this)); } - var nodeXml = serializer.serializeToString(clone), + const nodeXml = serializer.serializeToString(clone), style = browser_doc.createElement("style"); // escape css for XML style.appendChild(browser_doc.createTextNode(cssText.join("\n"))); - var styleXml = serializer.serializeToString(style), - dataStr = ("\n\t\t\t\n\t\t\t\t" + styleXml + "\n\t\t\t\t" + nodeXml.replace(/(url\()[^#]+/g, "$1") + "\n\t\t\t").replace("/\n/g", "%0A"); // foreignObject not supported in IE11 and below + const styleXml = serializer.serializeToString(style), + dataStr = "\n\t\t\t\n\t\t\t\t" + styleXml + "\n\t\t\t\t" + nodeXml.replace(/(url\()[^#]+/g, "$1") + "\n\t\t\t"; // foreignObject not supported in IE11 and below // https://msdn.microsoft.com/en-us/library/hh834675(v=vs.85).aspx return "data:image/svg+xml;base64," + b64EncodeUnicode(dataStr); } @@ -11581,7 +11792,7 @@ function nodeToSvgDataUrl(node, option, orgSize) { * @private */ function getCoords(elem, svgOffset) { - var top = svgOffset.top, + const top = svgOffset.top, left = svgOffset.left, _elem$getBBox = elem.getBBox(), x = _elem$getBBox.x, @@ -11611,8 +11822,8 @@ function getCoords(elem, svgOffset) { * @private */ function getGlyph(svg) { - var _this4 = this, - _svg$getBoundingClien = svg.getBoundingClientRect(), + var _this4 = this; + const _svg$getBoundingClien = svg.getBoundingClientRect(), left = _svg$getBoundingClien.left, top = _svg$getBoundingClien.top, filterFn = function (t) { @@ -11624,10 +11835,10 @@ function getGlyph(svg) { var _this5 = this; _newArrowCheck(this, _this4); // eslint-disable-line - var getStyleFn = function (ts) { + const getStyleFn = function (ts) { var _ref2; _newArrowCheck(this, _this5); - var _window$getComputedSt = win.getComputedStyle(ts), + const _window$getComputedSt = win.getComputedStyle(ts), fill = _window$getComputedSt.fill, fontFamily = _window$getComputedSt.fontFamily, fontSize = _window$getComputedSt.fontSize, @@ -11681,7 +11892,7 @@ function renderText(ctx, glyph) { Object.keys(g).forEach(function (key) { var _this8 = this; _newArrowCheck(this, _this7); - var _g$key = g[key], + const _g$key = g[key], x = _g$key.x, y = _g$key.y, width = _g$key.width, @@ -11696,7 +11907,7 @@ function renderText(ctx, glyph) { if (transform === "none") { ctx.fillText(key, x, y); } else { - var args = transform.replace(/(matrix|\(|\))/g, "").split(","); + const args = transform.replace(/(matrix|\(|\))/g, "").split(","); if (args.splice(4).every(function (v) { _newArrowCheck(this, _this8); return +v === 0; @@ -11764,8 +11975,8 @@ function renderText(ctx, glyph) { * ); */ export: function _export(option, callback) { - var _this9 = this, - $$ = this.internal, + var _this9 = this; + const $$ = this.internal, state = $$.state, _$$$$el = $$.$el, chart = _$$$$el.chart, @@ -11786,11 +11997,11 @@ function renderText(ctx, glyph) { }), glyph = opt.preserveFontStyle ? getGlyph(svg.node()) : []; if (callback && isFunction(callback)) { - var img = new Image(); + const img = new Image(); img.crossOrigin = "Anonymous"; img.onload = function () { _newArrowCheck(this, _this9); - var canvas = browser_doc.createElement("canvas"), + const canvas = browser_doc.createElement("canvas"), ctx = canvas.getContext("2d"); canvas.width = opt.width || width; canvas.height = opt.height || height; @@ -11835,8 +12046,8 @@ function renderText(ctx, glyph) { * chart.focus(); */ focus: function focus(targetIdsValue) { - var _this = this, - $$ = this.internal, + var _this = this; + const $$ = this.internal, state = $$.state, targetIds = $$.mapToTargetIds(targetIdsValue), candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))); @@ -11872,8 +12083,8 @@ function renderText(ctx, glyph) { * chart.defocus(); */ defocus: function defocus(targetIdsValue) { - var _this2 = this, - $$ = this.internal, + var _this2 = this; + const $$ = this.internal, state = $$.state, targetIds = $$.mapToTargetIds(targetIdsValue), candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))); @@ -11907,7 +12118,7 @@ function renderText(ctx, glyph) { * chart.revert(); */ revert: function revert(targetIdsValue) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config, state = $$.state, $el = $$.$el, @@ -11936,7 +12147,7 @@ function renderText(ctx, glyph) { * Define legend * @ignore */ -var legend_legend = { +const legend_legend = { /** * Show legend for each target. * - **NOTE:** Legend APIs aren't supported for `treemap` type. @@ -11958,7 +12169,7 @@ var legend_legend = { * chart.legend.show(); */ show: function show(targetIds) { - var $$ = this.internal; + const $$ = this.internal; $$.showLegend($$.mapToTargetIds(targetIds)); $$.updateAndRedraw({ withLegend: !0 @@ -11984,7 +12195,7 @@ var legend_legend = { * chart.legend.hide(); */ hide: function hide(targetIds) { - var $$ = this.internal; + const $$ = this.internal; $$.hideLegend($$.mapToTargetIds(targetIds)); $$.updateAndRedraw({ withLegend: !0 @@ -12141,8 +12352,8 @@ var legend_legend = { * }); */ load: function load(args) { - var _this = this, - $$ = this.internal, + var _this = this; + const $$ = this.internal, config = $$.config; // update xs if specified args.xs && $$.addXs(args.xs); @@ -12187,7 +12398,6 @@ var legend_legend = { }.bind(this)); }.bind(this)); } else { - $$.api.tooltip.hide(); $$.loadFromArgs(args); } }, @@ -12217,9 +12427,12 @@ var legend_legend = { * }); */ unload: function unload(argsValue) { - var _this3 = this, - $$ = this.internal, - args = argsValue || {}; + var _this3 = this; + const $$ = this.internal; + let args = argsValue || {}; + + // hide possible tooltip display when data is completely unloaded + isEmpty(args) && this.tooltip.hide(); if (isArray(args)) { args = { ids: args @@ -12229,7 +12442,7 @@ var legend_legend = { ids: [args] }; } - var ids = $$.mapToTargetIds(args.ids); + const ids = $$.mapToTargetIds(args.ids); $$.unload(ids, function () { _newArrowCheck(this, _this3); $$.redraw({ @@ -12258,8 +12471,8 @@ var legend_legend = { * @private */ function showHide(show, targetIdsValue, options) { - var _this = this, - $$ = this.internal, + var _this = this; + const $$ = this.internal, targetIds = $$.mapToTargetIds(targetIdsValue), hiddenIds = $$.state.hiddenTargetIds.map(function (v) { _newArrowCheck(this, _this); @@ -12267,7 +12480,7 @@ function showHide(show, targetIdsValue, options) { }.bind(this)).filter(Boolean); $$.state.toggling = !0; $$[(show ? "remove" : "add") + "HiddenTargetIds"](targetIds); - var targets = $$.$el.svg.selectAll($$.selectorTargets(targetIds)), + const targets = $$.$el.svg.selectAll($$.selectorTargets(targetIds)), opacity = show ? null : "0"; if (show && hiddenIds.length) { targets.style("display", null); @@ -12365,7 +12578,7 @@ function showHide(show, targetIdsValue, options) { if (options === void 0) { options = {}; } - var $$ = this.internal, + const $$ = this.internal, targets = { show: [], hide: [] @@ -12397,7 +12610,7 @@ function showHide(show, targetIdsValue, options) { * Define tooltip * @ignore */ -var tooltip_tooltip = { +const tooltip_tooltip = { /** * Show tooltip * @function tooltip․show @@ -12437,6 +12650,10 @@ var tooltip_tooltip = { * } * }); * + * // for Arc types, specify 'id' or 'index' + * chart.tooltip.show({ data: { id: "data2" }}); + * chart.tooltip.show({ data: { index: 2 }}); + * * // when data.xs is used * chart.tooltip.show({ * data: { @@ -12456,16 +12673,15 @@ var tooltip_tooltip = { * }); */ show: function show(args) { - var _this = this, - $$ = this.internal, + var _this = this; + const $$ = this.internal, $el = $$.$el, config = $$.config, _$$$state = $$.state, eventReceiver = _$$$state.eventReceiver, hasTreemap = _$$$state.hasTreemap, - inputType = _$$$state.inputType, - index, - mouse; + inputType = _$$$state.inputType; + let index, mouse; // determine mouse position on the chart if (args.mouse) { mouse = args.mouse; @@ -12473,18 +12689,20 @@ var tooltip_tooltip = { // determine focus data if (args.data) { - var data = args.data, - y = $$.getYScaleById(data.id)(data.value); + var _$$$getYScaleById; + const data = args.data, + y = (_$$$getYScaleById = $$.getYScaleById(data.id)) == null ? void 0 : _$$$getYScaleById(data.value); if (hasTreemap && data.id) { eventReceiver.rect = $el.main.select("" + $$.selectorTarget(data.id, undefined, "rect")); } else if ($$.isMultipleX()) { // if multiple xs, target point will be determined by mouse mouse = [$$.xx(data), y]; } else { + var _data$index, _$$$getArcElementById; if (!config.tooltip_grouped) { mouse = [0, y]; } - index = isValue(data.index) ? data.index : $$.getIndexByX(data.x); + index = (_data$index = data.index) != null ? _data$index : $$.hasArcType() && data.id ? (_$$$getArcElementById = $$.getArcElementByIdOrIndex(data.id)) == null ? void 0 : _$$$getArcElementById.datum().index : $$.getIndexByX(data.x); } } else if (isDefined(args.x)) { index = $$.getIndexByX(args.x); @@ -12503,13 +12721,13 @@ var tooltip_tooltip = { * @memberof Chart */ hide: function hide() { - var _this2 = this, - $$ = this.internal, + var _this2 = this; + const $$ = this.internal, inputType = $$.state.inputType, tooltip = $$.$el.tooltip, data = tooltip == null ? void 0 : tooltip.datum(); if (data) { - var index = JSON.parse(data.current)[0].index; + const index = JSON.parse(data.current)[0].index; // make to finalize, possible pending event flow set from '.tooltip.show()' call (inputType === "mouse" ? ["mouseout"] : ["touchend"]).forEach(function (eventName) { @@ -12521,9 +12739,9 @@ var tooltip_tooltip = { // reset last touch point index inputType === "touch" && $$.callOverOutForTouch(); $$.hideTooltip(!0); - $$.hideGridFocus == null ? void 0 : $$.hideGridFocus(); - $$.unexpandCircles == null ? void 0 : $$.unexpandCircles(); - $$.expandBarTypeShapes == null ? void 0 : $$.expandBarTypeShapes(!1); + $$.hideGridFocus == null || $$.hideGridFocus(); + $$.unexpandCircles == null || $$.unexpandCircles(); + $$.expandBarTypeShapes == null || $$.expandBarTypeShapes(!1); } }; /* harmony default export */ var api_tooltip = ({ @@ -12636,10 +12854,10 @@ var tooltip_tooltip = { * * chart.plugins; // [Stanford, PluginA] - instance array */ -var Chart = function Chart(options) { +let Chart = function Chart(options) { this.plugins = []; this.internal = void 0; - var $$ = new ChartInternal(this); + const $$ = new ChartInternal(this); this.internal = $$; // bind to namespaced APIs @@ -12647,7 +12865,7 @@ var Chart = function Chart(options) { var _this = this; Object.keys(fn).forEach(function (key) { _newArrowCheck(this, _this); - var isFunc = isFunction(fn[key]), + const isFunc = isFunction(fn[key]), isChild = target !== argThis, isNotNil = notEmpty(fn[key]), hasChild = isNotNil && Object.keys(fn[key]).length > 0; @@ -12682,11 +12900,11 @@ extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus, api_ * @private */ function setMinMax($$, type, value) { - var _this = this, - config = $$.config, + var _this = this; + const config = $$.config, helper = function (key, value) { _newArrowCheck(this, _this); - var v = isNumber(value) ? value : value === !1 ? undefined : null; + const v = isNumber(value) ? value : value === !1 ? undefined : null; if (v !== null) { config["axis_" + key + "_" + type] = v; } @@ -12719,7 +12937,7 @@ function setMinMax($$, type, value) { * @private */ function axis_getMinMax($$, type) { - var config = $$.config; + const config = $$.config; return { x: config["axis_x_" + type], y: config["axis_y_" + type], @@ -12731,9 +12949,10 @@ function axis_getMinMax($$, type) { * Define axis * @ignore */ -var axis = { +const axis = { /** * Get and set axis labels. + * - **NOTE:** Only applicable for chart types which has x and y axes. * @function axis․labels * @instance * @memberof Chart @@ -12758,9 +12977,9 @@ var axis = { * // } */ labels: function labels(_labels) { - var _this2 = this, - $$ = this.internal, - labelText; + var _this2 = this; + const $$ = this.internal; + let labelText; if (_labels) { Object.keys(_labels).forEach(function (axisId) { _newArrowCheck(this, _this2); @@ -12770,7 +12989,7 @@ var axis = { } ["x", "y", "y2"].forEach(function (v) { _newArrowCheck(this, _this2); - var text = $$.axis.getLabelText(v); + const text = $$.axis.getLabelText(v); if (text) { labelText || (labelText = {}); labelText[v] = text; @@ -12780,6 +12999,7 @@ var axis = { }, /** * Get and set axis min value. + * - **NOTE:** Only applicable for chart types which has x and y axes. * @function axis․min * @instance * @memberof Chart @@ -12808,11 +13028,12 @@ var axis = { * chart.axis.min(false); */ min: function min(_min) { - var $$ = this.internal; + const $$ = this.internal; return isValue(_min) || _min === !1 ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min"); }, /** * Get and set axis max value. + * - **NOTE:** Only applicable for chart types which has x and y axes. * @function axis․max * @instance * @memberof Chart @@ -12841,11 +13062,12 @@ var axis = { * chart.axis.max(false); */ max: function max(_max) { - var $$ = this.internal; + const $$ = this.internal; return isValue(_max) || _max === !1 ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max"); }, /** * Get and set axis min and max value. + * - **NOTE:** Only applicable for chart types which has x and y axes. * @function axis․range * @instance * @memberof Chart @@ -12887,9 +13109,9 @@ var axis = { * chart.axis.range({ min: false, max: false }); */ range: function range(_range) { - var axis = this.axis; + const axis = this.axis; if (arguments.length) { - var min = _range.min, + const min = _range.min, max = _range.max; isDefined(max) && axis.max(max); isDefined(min) && axis.min(min); @@ -12910,6 +13132,7 @@ var axis = { * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license */ + /* harmony default export */ var api_category = ({ /** * Set specified category name on category axis. @@ -12923,7 +13146,7 @@ var axis = { * chart.category(2, "Category 3"); */ category: function category(i, _category) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config; if (arguments.length > 1) { config.axis_x_categories[i] = _category; @@ -12932,7 +13155,7 @@ var axis = { return config.axis_x_categories[i]; }, /** - * Set category names on category axis. + * Set or get category names on category axis. * @function categories * @instance * @memberof Chart @@ -12944,10 +13167,11 @@ var axis = { * ]); */ categories: function categories(_categories) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config; - if (!arguments.length) { - return config.axis_x_categories; + if (!_categories || !Array.isArray(_categories)) { + const cat = config.axis_x_categories; + return isEmpty(cat) ? Object.values($$.data.xs)[0] : cat; } config.axis_x_categories = _categories; $$.redraw(); @@ -12968,7 +13192,7 @@ var axis = { * @private */ function grid(grids, axisId) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config, withTransition = config.transition_duration && isTabVisible(), gridPropLines = "grid_" + axisId + "_lines"; @@ -13017,7 +13241,7 @@ function _remove(grids, isXAxis) { * ]); * // --> Returns: [{value: 1, text: "Label 1"}, {value: 4, text: "Label 4"}] */ -var xgrids = function (grids) { +const xgrids = function (grids) { return grid.bind(this)(grids, "x"); }; extend(xgrids, { @@ -13087,7 +13311,7 @@ extend(xgrids, { * ]); * // --> Returns: [{value: 100, text: "Label 1"}, {value: 400, text: "Label 4"}] */ -var ygrids = function (grids) { +const ygrids = function (grids) { return grid.bind(this)(grids, "y"); }; extend(ygrids, { @@ -13166,7 +13390,7 @@ extend(ygrids, { * ]); */ groups: function groups(_groups) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config; if (isUndefined(_groups)) { return config.data_groups; @@ -13195,7 +13419,7 @@ function regionsFn(regions, isAdd) { if (isAdd === void 0) { isAdd = !1; } - var $$ = this.internal, + const $$ = this.internal, config = $$.config, withTransition = config.transition_duration && isTabVisible(); if (!regions) { @@ -13221,7 +13445,7 @@ function regionsFn(regions, isAdd) { * {axis: "y", end: 50, class: "regionY"} * ]); */ -var regions = function (_regions) { +const regions = function (_regions) { return regionsFn.bind(this)(_regions); }; extend(regions, { @@ -13268,23 +13492,23 @@ extend(regions, { * chart.regions.remove(); */ remove: function remove(optionsValue) { - var _this = this, - $$ = this.internal, + var _this = this; + const $$ = this.internal, config = $$.config, $T = $$.$T, options = optionsValue || {}, - classes = getOption(options, "classes", [$REGION.region]), - regions = $$.$el.main.select("." + $REGION.regions).selectAll(classes.map(function (c) { - _newArrowCheck(this, _this); - return "." + c; - }.bind(this))); + classes = getOption(options, "classes", [$REGION.region]); + let regions = $$.$el.main.select("." + $REGION.regions).selectAll(classes.map(function (c) { + _newArrowCheck(this, _this); + return "." + c; + }.bind(this))); $T(regions).style("opacity", "0").remove(); regions = config.regions; if (Object.keys(options).length) { regions = regions.filter(function (region) { var _this2 = this; _newArrowCheck(this, _this); - var found = !1; + let found = !1; if (!region.class) { return !0; } @@ -13328,7 +13552,7 @@ extend(regions, { * chart.x([100, 200, 300, 400, ...]); */ x: function x(_x) { - var $$ = this.internal, + const $$ = this.internal, axis = $$.axis, data = $$.data, isCategorized = axis.isCustomX() && axis.isCategorized(); @@ -13363,7 +13587,7 @@ extend(regions, { * }); */ xs: function xs(_xs) { - var $$ = this.internal; + const $$ = this.internal; if (isObject(_xs)) { $$.updateTargetXs($$.data.targets, _xs); $$.redraw({ @@ -13432,9 +13656,9 @@ extend(regions, { * }); */ flow: function flow(args) { - var _this = this, - $$ = this.internal, - data; + var _this = this; + const $$ = this.internal; + let data; if (args.json || args.rows || args.columns) { $$.convertData(args, function (res) { _newArrowCheck(this, _this); @@ -13448,8 +13672,8 @@ extend(regions, { * @private */ function _() { - var _this2 = this, - domain, + var _this2 = this; + let domain, length = 0, tail = 0, diff, @@ -13457,22 +13681,22 @@ extend(regions, { if ($$.state.redrawing || !data || !isTabVisible()) { return; } - var notfoundIds = [], + const notfoundIds = [], orgDataCount = $$.getMaxDataCount(), targets = $$.convertDataToTargets(data, !0), isTimeSeries = $$.axis.isTimeSeries(); // Update/Add data $$.data.targets.forEach(function (t) { _newArrowCheck(this, _this2); - var found = !1; - for (var i = 0; i < targets.length; i++) { + let found = !1; + for (let i = 0; i < targets.length; i++) { if (t.id === targets[i].id) { found = !0; if (t.values[t.values.length - 1]) { tail = t.values[t.values.length - 1].index + 1; } length = targets[i].values.length; - for (var j = 0; j < length; j++) { + for (let j = 0; j < length; j++) { targets[i].values[j].index = tail + j; if (!isTimeSeries) { targets[i].values[j].x = tail + j; @@ -13489,10 +13713,10 @@ extend(regions, { // Append null for not found targets $$.data.targets.forEach(function (t) { _newArrowCheck(this, _this2); - for (var i = 0; i < notfoundIds.length; i++) { + for (let i = 0; i < notfoundIds.length; i++) { if (t.id === notfoundIds[i]) { tail = t.values[t.values.length - 1].index + 1; - for (var j = 0; j < length; j++) { + for (let j = 0; j < length; j++) { t.values.push({ id: t.id, index: tail + j, @@ -13509,8 +13733,8 @@ extend(regions, { targets.forEach(function (t) { var _this3 = this; _newArrowCheck(this, _this2); - var missing = []; - for (var i = $$.data.targets[0].values[0].index; i < tail; i++) { + const missing = []; + for (let i = $$.data.targets[0].values[0].index; i < tail; i++) { missing.push({ id: t.id, index: i, @@ -13532,7 +13756,7 @@ extend(regions, { // check data count because behavior needs to change when it"s only one // const dataCount = $$.getMaxDataCount(); - var baseTarget = $$.data.targets[0], + const baseTarget = $$.data.targets[0], baseValue = baseTarget.values[0]; // Update length to flow if needed if (isDefined(args.to)) { @@ -13591,12 +13815,12 @@ var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack */ -var AxisRendererHelper = /*#__PURE__*/function () { +let AxisRendererHelper = /*#__PURE__*/function () { function AxisRendererHelper(owner) { this.owner = void 0; this.config = void 0; this.scale = void 0; - var scale = getScale(), + const scale = getScale(), config = owner.config, params = owner.params; this.owner = owner; @@ -13617,15 +13841,16 @@ var AxisRendererHelper = /*#__PURE__*/function () { * @private */ AxisRendererHelper.getSizeFor1Char = function getSizeFor1Char(node) { - var _this = this, - size = { - w: 5.5, - h: 11.5 - }; // default size for one character + var _this = this; + // default size for one character + const size = { + w: 5.5, + h: 11.5 + }; node.empty() || node.select("text").text("0").call(function (el) { _newArrowCheck(this, _this); try { - var _el$node$getBBox = el.node().getBBox(), + const _el$node$getBBox = el.node().getBBox(), width = _el$node$getBBox.width, height = _el$node$getBBox.height; if (width && height) { @@ -13651,8 +13876,8 @@ var AxisRendererHelper = /*#__PURE__*/function () { */; var _proto = AxisRendererHelper.prototype; _proto.getTickTransformSetter = function getTickTransformSetter(id) { - var _this2 = this, - config = this.config, + var _this2 = this; + const config = this.config, fn = id === "x" ? function (value) { _newArrowCheck(this, _this2); return "translate(" + (value + config.tickOffset) + ",0)"; @@ -13670,34 +13895,35 @@ var AxisRendererHelper = /*#__PURE__*/function () { }.bind(this); }; _proto.scaleExtent = function scaleExtent(domain) { - var start = domain[0], + const start = domain[0], stop = domain[domain.length - 1]; return start < stop ? [start, stop] : [stop, start]; }; _proto.generateTicks = function generateTicks(scale, isYAxes) { - var _this4 = this, - tickStepSize = this.owner.params.tickStepSize, + var _this4 = this; + const tickStepSize = this.owner.params.tickStepSize, _scale$domain = scale.domain(), start = _scale$domain[0], - end = _scale$domain[1], - ticks = []; + end = _scale$domain[1]; + let ticks = []; + // When 'axis[y|y2].tick.stepSize' option is set if (isYAxes && tickStepSize) { - var interval = Math.round(start); + let interval = Math.round(start); while (interval <= end) { ticks.push(interval); interval += tickStepSize; } } else if (scale.ticks) { - var tickArguments = this.config.tickArguments; + const tickArguments = this.config.tickArguments; // adjust excessive tick count show if (scale.type === "log" && !tickArguments) { // nicer symlog ticks didn't implemented yet: https://github.com/d3/d3-scale/issues/162 // get ticks values from logScale - var s = getScale("_log").domain([start > 0 ? start : 1, end]).range(scale.range()); + const s = getScale("_log").domain([start > 0 ? start : 1, end]).range(scale.range()); ticks = s.ticks(); - for (var cnt = end.toFixed().length; ticks.length > 15; cnt--) { + for (let cnt = end.toFixed().length; ticks.length > 15; cnt--) { ticks = s.ticks(cnt); } ticks.splice(0, 1, start); @@ -13708,21 +13934,14 @@ var AxisRendererHelper = /*#__PURE__*/function () { ticks = ticks.map(function (v) { _newArrowCheck(this, _this4); // round the tick value if is number - var r = isString(v) && isNumber(v) && !isNaN(v) && Math.round(v * 10) / 10 || v; + const r = isString(v) && isNumber(v) && !isNaN(v) && Math.round(v * 10) / 10 || v; return r; }.bind(this)); - } else { - for (var i = Math.ceil(start); i < end; i++) { - ticks.push(i); - } - if (ticks.length > 0 && ticks[0] > 0) { - ticks.unshift(ticks[0] - (ticks[1] - ticks[0])); - } } return ticks; }; _proto.copyScale = function copyScale() { - var newScale = this.scale.copy(); + const newScale = this.scale.copy(); if (!newScale.domain().length) { newScale.domain(this.scale.domain()); } @@ -13730,7 +13949,7 @@ var AxisRendererHelper = /*#__PURE__*/function () { return newScale; }; _proto.textFormatted = function textFormatted(v) { - var tickFormat = this.config.tickFormat, + const tickFormat = this.config.tickFormat, value = /\d+\.\d+0{5,}\d$/.test(v) ? +(v + "").replace(/0+\d$/, "") : v, formatted = tickFormat ? tickFormat(value) : value; // to round float numbers from 'binary floating point' // https://en.wikipedia.org/wiki/Double-precision_floating-point_format @@ -13738,8 +13957,8 @@ var AxisRendererHelper = /*#__PURE__*/function () { return isDefined(formatted) ? formatted : ""; }; _proto.transitionise = function transitionise(selection) { - var config = this.config; - var transitionSelection = selection; + const config = this.config; + let transitionSelection = selection; if (config.withoutTransition) { transitionSelection = selection.interrupt(); } else if (config.transition || !this.owner.params.noTransition) { @@ -13764,7 +13983,7 @@ var AxisRendererHelper = /*#__PURE__*/function () { -var AxisRenderer = /*#__PURE__*/function () { +let AxisRenderer = /*#__PURE__*/function () { function AxisRenderer(params) { if (params === void 0) { params = {}; @@ -13774,7 +13993,7 @@ var AxisRenderer = /*#__PURE__*/function () { this.params = void 0; this.g = void 0; this.generatedTicks = void 0; - var config = { + const config = { innerTickSize: 6, outerTickSize: params.outerTick ? 6 : 0, orient: "bottom", @@ -13803,7 +14022,7 @@ var AxisRenderer = /*#__PURE__*/function () { */ var _proto = AxisRenderer.prototype; _proto.create = function create(g) { - var ctx = this, + const ctx = this, config = ctx.config, helper = ctx.helper, params = ctx.params, @@ -13822,7 +14041,7 @@ var AxisRenderer = /*#__PURE__*/function () { // tick text helpers this.config.range = scale.rangeExtent ? scale.rangeExtent() : helper.scaleExtent((params.orgXScale || scale).range()); - var innerTickSize = config.innerTickSize, + const innerTickSize = config.innerTickSize, tickLength = config.tickLength, range = config.range, id = params.id, @@ -13837,50 +14056,50 @@ var AxisRenderer = /*#__PURE__*/function () { text: axisShow ? params.config[prefix + "_tick_text_show"] : !1 }; // // get the axis' tick position configuration // tick visiblity - var $g; + let $g; g.each(function () { - var _this = this, - g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), - scale0 = this.__chart__ || scale, + var _this = this; + const g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); + let scale0 = this.__chart__ || scale, scale1 = helper.copyScale(); $g = g; this.__chart__ = scale1; config.tickOffset = params.isCategory ? Math.ceil((scale1(1) - scale1(0)) / 2) : 0; // update selection - data join - var path = g.selectAll(".domain").data([0]); + const path = g.selectAll(".domain").data([0]); // enter + update selection path.enter().append("path").attr("class", "domain") // https://observablehq.com/@d3/d3-selection-2-0 .merge(path).attr("d", function () { _newArrowCheck(this, _this); - var outerTickSized = config.outerTickSize * sign; + const outerTickSized = config.outerTickSize * sign; return isTopBottom ? "M" + range[0] + "," + outerTickSized + "V0H" + range[1] + "V" + outerTickSized : "M" + outerTickSized + "," + range[0] + "H0V" + range[1] + "H" + outerTickSized; }.bind(this)); if (tickShow.tick || tickShow.text) { // count of tick data in array - var ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight); + const ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight); // set generated ticks ctx.generatedTicks = ticks; // update selection - var tick = g.selectAll(".tick").data(ticks, scale1); + let tick = g.selectAll(".tick").data(ticks, scale1); // enter selection - var tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick"), + const tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick"), tickExit = tick.exit().remove(); // MEMO: No exit transition. The reason is this transition affects max tick width calculation because old tick will be included in the ticks. // enter + update selection tick = tickEnter.merge(tick); tickShow.tick && tickEnter.append("line"); tickShow.text && tickEnter.append("text"); - var sizeFor1Char = AxisRendererHelper.getSizeFor1Char(tick), + const sizeFor1Char = AxisRendererHelper.getSizeFor1Char(tick), counts = []; - var tspan = tick.select("text").selectAll("tspan").data(function (d, index) { + let tspan = tick.select("text").selectAll("tspan").data(function (d, index) { var _this2 = this; _newArrowCheck(this, _this); - var split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helper.textFormatted(d)) ? helper.textFormatted(d).concat() : [helper.textFormatted(d)]; + const split = params.tickMultiline ? splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w) : isArray(helper.textFormatted(d)) ? helper.textFormatted(d).concat() : [helper.textFormatted(d)]; counts[index] = split.length; return split.map(function (splitted) { _newArrowCheck(this, _this2); @@ -13899,14 +14118,14 @@ var AxisRenderer = /*#__PURE__*/function () { // set 's position tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", function () { _newArrowCheck(this, _this); - var dx = 0; + let dx = 0; if (/(top|bottom)/.test(orient) && rotate) { dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1); } return dx + (tickTextPos.x || 0); }.bind(this)()).attr("dy", function (d, i) { _newArrowCheck(this, _this); - var dy = 0; + let dy = 0; if (orient !== "top") { dy = sizeFor1Char.h; if (i === 0) { @@ -13915,7 +14134,7 @@ var AxisRenderer = /*#__PURE__*/function () { } return isNumber(dy) && tickTextPos.y ? dy + tickTextPos.y : dy || ".71em"; }.bind(this)); - var lineUpdate = tick.select("line"), + const lineUpdate = tick.select("line"), textUpdate = tick.select("text"); tickEnter.select("line").attr(axisPx + "2", innerTickSize * sign); tickEnter.select("text").attr(axisPx, tickLength * sign); @@ -13923,14 +14142,14 @@ var AxisRenderer = /*#__PURE__*/function () { // Append for tooltip display if (params.tickTitle) { - var title = textUpdate.select("title"); + const title = textUpdate.select("title"); (title.empty() ? textUpdate.append("title") : title).text(function (index) { _newArrowCheck(this, _this); return params.tickTitle[index]; }.bind(this)); } if (scale1.bandwidth) { - var x = scale1, + const x = scale1, dx = x.bandwidth() / 2; scale0 = function (d) { _newArrowCheck(this, _this); @@ -13961,11 +14180,11 @@ var AxisRenderer = /*#__PURE__*/function () { */; _proto.getGeneratedTicks = function getGeneratedTicks(count) { var _this$generatedTicks, - _this3 = this, - len = ((_this$generatedTicks = this.generatedTicks) == null ? void 0 : _this$generatedTicks.length) - 1, - res = this.generatedTicks; + _this3 = this; + const len = ((_this$generatedTicks = this.generatedTicks) == null ? void 0 : _this$generatedTicks.length) - 1; + let res = this.generatedTicks; if (len > count) { - var interval = Math.round(len / count + .1); + const interval = Math.round(len / count + .1); res = this.generatedTicks.map(function (v, i) { _newArrowCheck(this, _this3); return i % interval === 0 ? v : null; @@ -13983,7 +14202,7 @@ var AxisRenderer = /*#__PURE__*/function () { * @private */; _proto.getTickXY = function getTickXY() { - var config = this.config, + const config = this.config, pos = { x: 0, y: 0 @@ -14002,7 +14221,7 @@ var AxisRenderer = /*#__PURE__*/function () { * @private */; _proto.getTickSize = function getTickSize(d) { - var scale = this.helper.scale, + const scale = this.helper.scale, config = this.config, _config2 = config, innerTickSize = _config2.innerTickSize, @@ -14018,8 +14237,8 @@ var AxisRenderer = /*#__PURE__*/function () { * @private */; _proto.setTickLineTextPosition = function setTickLineTextPosition(lineUpdate, textUpdate) { - var _this4 = this, - tickPos = this.getTickXY(), + var _this4 = this; + const tickPos = this.getTickXY(), _this$config = this.config, innerTickSize = _this$config.innerTickSize, orient = _this$config.orient, @@ -14028,7 +14247,7 @@ var AxisRenderer = /*#__PURE__*/function () { rotate = this.params.tickTextRotate, textAnchorForText = function (r) { _newArrowCheck(this, _this4); - var value = ["start", "end"]; + const value = ["start", "end"]; orient === "top" && value.reverse(); return !r ? "middle" : value[r > 0 ? 0 : 1]; }.bind(this), @@ -14038,7 +14257,7 @@ var AxisRenderer = /*#__PURE__*/function () { }.bind(this), yForText = function (r) { _newArrowCheck(this, _this4); - var r2 = r / (orient === "bottom" ? 15 : 23); + const r2 = r / (orient === "bottom" ? 15 : 23); return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength; }.bind(this); switch (orient) { @@ -14063,7 +14282,7 @@ var AxisRenderer = /*#__PURE__*/function () { // this should be called only when category axis ; _proto.splitTickText = function splitTickText(d, scale, ticks, isLeftRight, charWidth) { - var params = this.params, + const params = this.params, tickText = this.helper.textFormatted(d), splitted = isString(tickText) && tickText.indexOf("\n") > -1 ? tickText.split("\n") : []; if (splitted.length) { @@ -14072,7 +14291,7 @@ var AxisRenderer = /*#__PURE__*/function () { if (isArray(tickText)) { return tickText; } - var tickWidth = params.tickWidth; + let tickWidth = params.tickWidth; if (!tickWidth || tickWidth <= 0) { tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(params.isInverted ? scale(ticks[0]) - scale(ticks[1]) : scale(ticks[1]) - scale(ticks[0])) - 12 : 110; } @@ -14080,8 +14299,8 @@ var AxisRenderer = /*#__PURE__*/function () { // split given text by tick width size // eslint-disable-next-line function split(splitted, text) { - var subtext, spaceIndex, textWidth; - for (var i = 1; i < text.length; i++) { + let subtext, spaceIndex, textWidth; + for (let i = 1; i < text.length; i++) { if (text.charAt(i) === " ") { spaceIndex = i; } @@ -14117,7 +14336,7 @@ var AxisRenderer = /*#__PURE__*/function () { return this; }; _proto.tickFormat = function tickFormat(format) { - var config = this.config; + const config = this.config; if (!arguments.length) { return config.tickFormat; } @@ -14125,7 +14344,7 @@ var AxisRenderer = /*#__PURE__*/function () { return this; }; _proto.tickCentered = function tickCentered(isCentered) { - var config = this.config; + const config = this.config; if (!arguments.length) { return config.tickCentered; } @@ -14150,22 +14369,22 @@ var AxisRenderer = /*#__PURE__*/function () { * @returns {number} */; _proto.tickInterval = function tickInterval(size) { - var _this5 = this, - _this$config2 = this.config, + var _this5 = this; + const _this$config2 = this.config, outerTickSize = _this$config2.outerTickSize, tickOffset = _this$config2.tickOffset, - tickValues = _this$config2.tickValues, - interval; + tickValues = _this$config2.tickValues; + let interval; if (this.params.isCategory) { interval = tickOffset * 2; } else { - var length = this.g.select("path.domain").node().getTotalLength() - outerTickSize * 2; + const length = this.g.select("path.domain").node().getTotalLength() - outerTickSize * 2; interval = length / (size || this.g.selectAll("line").size()); // get the interval by its values - var intervalByValue = tickValues ? tickValues.map(function (v, i, arr) { + const intervalByValue = tickValues ? tickValues.map(function (v, i, arr) { _newArrowCheck(this, _this5); - var next = i + 1; + const next = i + 1; return next < arr.length ? this.helper.scale(arr[next]) - this.helper.scale(v) : null; }.bind(this)).filter(Boolean) : []; interval = Math.min.apply(Math, intervalByValue.concat([interval])); @@ -14173,7 +14392,7 @@ var AxisRenderer = /*#__PURE__*/function () { return interval === Infinity ? 0 : interval; }; _proto.ticks = function ticks() { - var config = this.config; + const config = this.config; for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } @@ -14184,7 +14403,7 @@ var AxisRenderer = /*#__PURE__*/function () { return this; }; _proto.tickCulling = function tickCulling(culling) { - var config = this.config; + const config = this.config; if (!arguments.length) { return config.tickCulling; } @@ -14192,8 +14411,8 @@ var AxisRenderer = /*#__PURE__*/function () { return this; }; _proto.tickValues = function tickValues(x) { - var _this6 = this, - config = this.config; + var _this6 = this; + const config = this.config; if (isFunction(x)) { config.tickValues = function () { _newArrowCheck(this, _this6); @@ -14230,7 +14449,7 @@ var AxisRenderer = /*#__PURE__*/function () { return this.axis || new Axis_Axis(this); } }); -var Axis_Axis = /*#__PURE__*/function () { +let Axis_Axis = /*#__PURE__*/function () { function Axis(owner) { this.owner = void 0; this.x = void 0; @@ -14258,17 +14477,17 @@ var Axis_Axis = /*#__PURE__*/function () { return $AXIS.axis + " " + $AXIS["axis" + capitalize(id)]; }; _proto.isHorizontal = function isHorizontal($$, forHorizontal) { - var isRotated = $$.config.axis_rotated; + const isRotated = $$.config.axis_rotated; return forHorizontal ? isRotated : !isRotated; }; _proto.isCategorized = function isCategorized() { - var _this$owner = this.owner, + const _this$owner = this.owner, config = _this$owner.config, state = _this$owner.state; return config.axis_x_type.indexOf("category") >= 0 || state.hasRadar; }; _proto.isCustomX = function isCustomX() { - var config = this.owner.config; + const config = this.owner.config; return !this.isTimeSeries() && (config.data_x || notEmpty(config.data_xs)); }; _proto.isTimeSeries = function isTimeSeries(id) { @@ -14290,7 +14509,7 @@ var Axis_Axis = /*#__PURE__*/function () { if (id === void 0) { id = "x"; } - var type = "linear"; + let type = "linear"; if (this.isTimeSeries(id)) { type = this.owner.config.axis_x_localtime ? "time" : "utc"; } else if (this.isLog(id)) { @@ -14299,8 +14518,8 @@ var Axis_Axis = /*#__PURE__*/function () { return type; }; _proto.init = function init() { - var _this = this, - $$ = this.owner, + var _this = this; + const $$ = this.owner, config = $$.config, _$$$$el = $$.$el, main = _$$$$el.main, @@ -14312,15 +14531,15 @@ var Axis_Axis = /*#__PURE__*/function () { target.forEach(function (v) { var _this2 = this; _newArrowCheck(this, _this); - var classAxis = this.getAxisClassName(v), + const classAxis = this.getAxisClassName(v), classLabel = $AXIS["axis" + v.toUpperCase() + "Label"]; axis[v] = main.append("g").attr("class", classAxis).attr("clip-path", function () { _newArrowCheck(this, _this2); - var res = null; + let res = null; if (v === "x") { res = clip.pathXAxis; } else if (v === "y") { - // && config.axis_y_inner) { + // || v === "y2") { res = clip.pathYAxis; } return res; @@ -14338,7 +14557,7 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */; _proto.setOrient = function setOrient() { - var $$ = this.owner, + const $$ = this.owner, _$$$config = $$.config, isRotated = _$$$config.axis_rotated, yInner = _$$$config.axis_y_inner, @@ -14358,13 +14577,13 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */; _proto.generateAxes = function generateAxes(id) { - var _this3 = this, - $$ = this.owner, + var _this3 = this; + const $$ = this.owner, config = $$.config, axes = [], axesConfig = config["axis_" + id + "_axes"], - isRotated = config.axis_rotated, - d3Axis; + isRotated = config.axis_rotated; + let d3Axis; if (id === "x") { d3Axis = isRotated ? external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisLeft : external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_.axisBottom; } else if (id === "y") { @@ -14376,7 +14595,7 @@ var Axis_Axis = /*#__PURE__*/function () { axesConfig.forEach(function (v) { var _this4 = this; _newArrowCheck(this, _this3); - var tick = v.tick || {}, + const tick = v.tick || {}, scale = $$.scale[id].copy(); v.domain && scale.domain(v.domain); axes.push(d3Axis(scale).ticks(tick.count).tickFormat(isFunction(tick.format) ? tick.format.bind($$.api) : function (x) { @@ -14393,21 +14612,21 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */; _proto.updateAxes = function updateAxes() { - var _this5 = this, - $$ = this.owner, + var _this5 = this; + const $$ = this.owner, config = $$.config, main = $$.$el.main, $T = $$.$T; Object.keys(this.axesList).forEach(function (id) { var _this6 = this; _newArrowCheck(this, _this5); - var axesConfig = config["axis_" + id + "_axes"], + const axesConfig = config["axis_" + id + "_axes"], scale = $$.scale[id].copy(), range = scale.range(); this.axesList[id].forEach(function (v, i) { var _this7 = this; _newArrowCheck(this, _this6); - var axisRange = v.scale().range(); + const axisRange = v.scale().range(); // adjust range value with the current // https://github.com/naver/billboard.js/issues/859 @@ -14417,8 +14636,8 @@ var Axis_Axis = /*#__PURE__*/function () { }.bind(this))) { v.scale().range(range); } - var className = this.getAxisClassName(id) + "-" + (i + 1); - var g = main.select("." + className.replace(/\s/, ".")); + const className = this.getAxisClassName(id) + "-" + (i + 1); + let g = main.select("." + className.replace(/\s/, ".")); if (g.empty()) { g = main.append("g").attr("class", className).style("visibility", config["axis_" + id + "_show"] ? null : "hidden").call(v); } else { @@ -14440,7 +14659,7 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */; _proto.setAxis = function setAxis(id, scale, outerTick, noTransition) { - var $$ = this.owner; + const $$ = this.owner; if (id !== "subX") { this.tick[id] = this.getTickValues(id); } @@ -14452,28 +14671,28 @@ var Axis_Axis = /*#__PURE__*/function () { id === "x" && ($$.scale.zoom || $$.config.subchart_show || $$.state.resizing) ? !0 : noTransition); } - // called from : getMaxTickWidth() + // called from : getMaxTickSize() ; _proto.getAxis = function getAxis(id, scale, outerTick, noTransition, noTickTextRotate) { - var _this8 = this, - $$ = this.owner, + var _this8 = this; + const $$ = this.owner, config = $$.config, isX = /^(x|subX)$/.test(id), type = isX ? "x" : id, isCategory = isX && this.isCategorized(), orient = this.orient[id], - tickTextRotate = noTickTextRotate ? 0 : $$.getAxisTickRotate(type), - tickFormat; + tickTextRotate = noTickTextRotate ? 0 : $$.getAxisTickRotate(type); + let tickFormat; if (isX) { tickFormat = id === "subX" ? $$.format.subXAxisTick : $$.format.xAxisTick; } else { - var fn = config["axis_" + id + "_tick_format"]; + const fn = config["axis_" + id + "_tick_format"]; if (isFunction(fn)) { tickFormat = fn.bind($$.api); } } - var tickValues = this.tick[type]; - var axisParams = mergeObj({ + let tickValues = this.tick[type]; + const axisParams = mergeObj({ outerTick: outerTick, noTransition: noTransition, config: config, @@ -14491,12 +14710,12 @@ var Axis_Axis = /*#__PURE__*/function () { if (!isX) { axisParams.tickStepSize = config["axis_" + type + "_tick_stepSize"]; } - var axis = new AxisRenderer(axisParams).scale(isX && $$.scale.zoom || scale).orient(orient); + const axis = new AxisRenderer(axisParams).scale(isX && $$.scale.zoom || scale).orient(orient); if (isX && this.isTimeSeries() && tickValues && !isFunction(tickValues)) { - var _fn = parseDate.bind($$); + const fn = parseDate.bind($$); tickValues = tickValues.map(function (v) { _newArrowCheck(this, _this8); - return _fn(v); + return fn(v); }.bind(this)); } else if (!isX && this.isTimeSeriesY()) { // https://github.com/d3/d3/blob/master/CHANGES.md#time-intervals-d3-time @@ -14516,15 +14735,15 @@ var Axis_Axis = /*#__PURE__*/function () { config.axis_x_tick_culling = !1; } } - var tickCount = config["axis_" + type + "_tick_count"]; + const tickCount = config["axis_" + type + "_tick_count"]; tickCount && axis.ticks(tickCount); return axis; }; _proto.updateXAxisTickValues = function updateXAxisTickValues(targets, axis) { - var $$ = this.owner, + const $$ = this.owner, config = $$.config, fit = config.axis_x_tick_fit; - var count = config.axis_x_tick_count, + let count = config.axis_x_tick_count, values; if (fit || count && fit) { values = $$.mapTargetsToUniqueXs(targets); @@ -14540,15 +14759,15 @@ var Axis_Axis = /*#__PURE__*/function () { } else if (this.x) { var _this$subX; this.x.tickValues(values); - (_this$subX = this.subX) == null ? void 0 : _this$subX.tickValues(values); + (_this$subX = this.subX) == null || _this$subX.tickValues(values); } return values; }; _proto.getId = function getId(id) { - var _this$owner2 = this.owner, + const _this$owner2 = this.owner, config = _this$owner2.config, scale = _this$owner2.scale; - var axis = config.data_axes[id]; + let axis = config.data_axes[id]; // when data.axes option has 'y2', but 'axis.y2.show=true' isn't set will return 'y' if (!axis || !scale[axis]) { @@ -14557,14 +14776,17 @@ var Axis_Axis = /*#__PURE__*/function () { return axis; }; _proto.getXAxisTickFormat = function getXAxisTickFormat(forSubchart) { - var _this9 = this, - $$ = this.owner, + var _this9 = this; + const $$ = this.owner, config = $$.config, format = $$.format, tickFormat = forSubchart ? config.subchart_axis_x_tick_format || config.axis_x_tick_format : config.axis_x_tick_format, isTimeSeries = this.isTimeSeries(), - isCategorized = this.isCategorized(), - currFormat; // enable different tick format for x and subX - subX format defaults to x format if not defined + isCategorized = this.isCategorized(); + + // enable different tick format for x and subX - subX format defaults to x format if not defined + + let currFormat; if (tickFormat) { if (isFunction(tickFormat)) { currFormat = tickFormat.bind($$.api); @@ -14586,7 +14808,7 @@ var Axis_Axis = /*#__PURE__*/function () { }.bind(this) : currFormat; }; _proto.getTickValues = function getTickValues(id) { - var $$ = this.owner, + const $$ = this.owner, tickValues = $$.config["axis_" + id + "_tick_values"], axis = $$[id + "Axis"]; return (isFunction(tickValues) ? tickValues.call($$.api) : tickValues) || (axis ? axis.tickValues() : undefined); @@ -14595,11 +14817,11 @@ var Axis_Axis = /*#__PURE__*/function () { return this.owner.config["axis_" + id + "_label"]; }; _proto.getLabelText = function getLabelText(id) { - var option = this.getLabelOptionByAxisId(id); + const option = this.getLabelOptionByAxisId(id); return isString(option) ? option : option ? option.text : null; }; _proto.setLabelText = function setLabelText(id, text) { - var $$ = this.owner, + const $$ = this.owner, config = $$.config, option = this.getLabelOptionByAxisId(id); if (isString(option)) { @@ -14609,8 +14831,8 @@ var Axis_Axis = /*#__PURE__*/function () { } }; _proto.getLabelPosition = function getLabelPosition(id, defaultPosition) { - var _this10 = this, - isRotated = this.owner.config.axis_rotated, + var _this10 = this; + const isRotated = this.owner.config.axis_rotated, option = this.getLabelOptionByAxisId(id), position = isObjectType(option) && option.position ? option.position : defaultPosition[+!isRotated], has = function (v) { @@ -14635,12 +14857,12 @@ var Axis_Axis = /*#__PURE__*/function () { return this.getAxisLabelPosition(id); }; _proto.xForAxisLabel = function xForAxisLabel(id) { - var $$ = this.owner, + const $$ = this.owner, _$$$state = $$.state, width = _$$$state.width, height = _$$$state.height, position = this.getAxisLabelPosition(id); - var x = position.isMiddle ? -height / 2 : 0; + let x = position.isMiddle ? -height / 2 : 0; if (this.isHorizontal($$, id !== "x")) { x = position.isLeft ? 0 : position.isCenter ? width / 2 : width; } else if (position.isBottom) { @@ -14649,9 +14871,9 @@ var Axis_Axis = /*#__PURE__*/function () { return x; }; _proto.dxForAxisLabel = function dxForAxisLabel(id) { - var $$ = this.owner, + const $$ = this.owner, position = this.getAxisLabelPosition(id); - var dx = position.isBottom ? "0.5em" : "0"; + let dx = position.isBottom ? "0.5em" : "0"; if (this.isHorizontal($$, id !== "x")) { dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0"; } else if (position.isTop) { @@ -14660,9 +14882,9 @@ var Axis_Axis = /*#__PURE__*/function () { return dx; }; _proto.textAnchorForAxisLabel = function textAnchorForAxisLabel(id) { - var $$ = this.owner, + const $$ = this.owner, position = this.getAxisLabelPosition(id); - var anchor = position.isMiddle ? "middle" : "end"; + let anchor = position.isMiddle ? "middle" : "end"; if (this.isHorizontal($$, id !== "x")) { anchor = position.isLeft ? "start" : position.isCenter ? "middle" : "end"; } else if (position.isBottom) { @@ -14671,15 +14893,16 @@ var Axis_Axis = /*#__PURE__*/function () { return anchor; }; _proto.dyForAxisLabel = function dyForAxisLabel(id) { - var $$ = this.owner, + const $$ = this.owner, config = $$.config, isRotated = config.axis_rotated, isInner = this.getAxisLabelPosition(id).isInner, tickRotate = config["axis_" + id + "_tick_rotate"] ? $$.getHorizontalAxisHeight(id) : 0, - maxTickWidth = this.getMaxTickWidth(id); - var dy; + _this$getMaxTickSize = this.getMaxTickSize(id), + maxTickWidth = _this$getMaxTickSize.width; + let dy; if (id === "x") { - var xHeight = config.axis_x_height; + const xHeight = config.axis_x_height; if (isRotated) { dy = isInner ? "1.2em" : -25 - maxTickWidth; } else if (isInner) { @@ -14709,22 +14932,34 @@ var Axis_Axis = /*#__PURE__*/function () { } } return dy; - }; - _proto.getMaxTickWidth = function getMaxTickWidth(id, withoutRecompute) { - var _this11 = this, - $$ = this.owner, + } + + /** + * Get max tick size + * @param {string} id axis id string + * @param {boolean} withoutRecompute wheather or not to recompute + * @returns {object} {width, height} + * @private + */; + _proto.getMaxTickSize = function getMaxTickSize(id, withoutRecompute) { + var _this11 = this; + const $$ = this.owner, config = $$.config, current = $$.state.current, _$$$$el2 = $$.$el, svg = _$$$$el2.svg, chart = _$$$$el2.chart, - currentTickMax = current.maxTickWidths[id], - maxWidth = 0; - if (withoutRecompute || !config["axis_" + id + "_show"] || currentTickMax.size > 0 && $$.filterTargetsToShow().length === 0) { - return currentTickMax.size; + currentTickMax = current.maxTickSize[id], + configPrefix = "axis_" + id, + max = { + width: 0, + height: 0 + }; + if (withoutRecompute || !config[configPrefix + "_show"] || currentTickMax.width > 0 && $$.filterTargetsToShow().length === 0) { + return currentTickMax; } if (svg) { - var isYAxis = /^y2?$/.test(id), + const isYAxis = /^y2?$/.test(id), targetsToShow = $$.filterTargetsToShow($$.data.targets), scale = $$.scale[id].copy().domain($$["get" + (isYAxis ? "Y" : "X") + "Domain"](targetsToShow, id)), domain = scale.domain(), @@ -14747,9 +14982,10 @@ var Axis_Axis = /*#__PURE__*/function () { if (!isYAxis) { currentTickMax.ticks.splice(0); } - var axis = this.getAxis(id, scale, !1, !1, !0), - tickCount = config["axis_" + id + "_tick_count"], - tickValues = config["axis_" + id + "_tick_values"]; + const axis = this.getAxis(id, scale, !1, !1, !0), + tickRotate = config[configPrefix + "_tick_rotate"], + tickCount = config[configPrefix + "_tick_count"], + tickValues = config[configPrefix + "_tick_values"]; // Make to generate the final tick text to be rendered // https://github.com/naver/billboard.js/issues/920 // Do not generate if 'tick values' option is given @@ -14758,31 +14994,38 @@ var Axis_Axis = /*#__PURE__*/function () { axis.tickValues(this.generateTickValues(domain, tickCount, isYAxis ? this.isTimeSeriesY() : this.isTimeSeries())); } isYAxis || this.updateXAxisTickValues(targetsToShow, axis); - var dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0").style("left", "0"); + const dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0").style("left", "0"); axis.create(dummy); - dummy.selectAll("text").each(function (d, i) { - var currentTextWidth = this.getBoundingClientRect().width; - maxWidth = Math.max(maxWidth, currentTextWidth); + dummy.selectAll("text").attr("transform", isNumber(tickRotate) ? "rotate(" + tickRotate + ")" : null).each(function (d, i) { + const _this$getBoundingClie = this.getBoundingClientRect(), + width = _this$getBoundingClie.width, + height = _this$getBoundingClie.height; + max.width = Math.max(max.width, width); + max.height = Math.max(max.height, height); + // cache tick text width for getXAxisTickTextY2Overflow() if (!isYAxis) { - currentTickMax.ticks[i] = currentTextWidth; + currentTickMax.ticks[i] = width; } }); dummy.remove(); } - if (maxWidth > 0) { - currentTickMax.size = maxWidth; - } - return currentTickMax.size; + Object.keys(max).forEach(function (key) { + _newArrowCheck(this, _this11); + if (max[key] > 0) { + currentTickMax[key] = max[key]; + } + }.bind(this)); + return currentTickMax; }; _proto.getXAxisTickTextY2Overflow = function getXAxisTickTextY2Overflow(defaultPadding) { - var $$ = this.owner, + const $$ = this.owner, axis = $$.axis, config = $$.config, state = $$.state, xAxisTickRotate = $$.getAxisTickRotate("x"); - if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && !config.axis_x_tick_culling && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) { - var widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingLeft(), + if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && (!config.axis_x_tick_culling || isEmpty(config.axis_x_tick_culling)) && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) { + const widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingByDirection("left"), maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding), xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding; // for display inconsistencies between browsers @@ -14792,45 +15035,40 @@ var Axis_Axis = /*#__PURE__*/function () { return 0; }; _proto.getXAxisTickMaxOverflow = function getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft) { - var $$ = this.owner, + const $$ = this.owner, axis = $$.axis, config = $$.config, state = $$.state, isTimeSeries = axis.isTimeSeries(), - tickTextWidths = state.current.maxTickWidths.x.ticks, + tickTextWidths = state.current.maxTickSize.x.ticks, tickCount = tickTextWidths.length, _state$axis$x$padding = state.axis.x.padding, left = _state$axis$x$padding.left, right = _state$axis$x$padding.right; - var maxOverflow = 0; - var remaining = tickCount - (isTimeSeries && config.axis_x_tick_fit ? .5 : 0); - for (var i = 0; i < tickCount; i++) { - var tickIndex = i + 1, + let maxOverflow = 0; + const remaining = tickCount - (isTimeSeries && config.axis_x_tick_fit ? .5 : 0); + for (let i = 0; i < tickCount; i++) { + const tickIndex = i + 1, rotatedTickTextWidth = Math.cos(Math.PI * xAxisTickRotate / 180) * tickTextWidths[i], ticksBeforeTickText = tickIndex - (isTimeSeries ? 1 : .5) + left; // Skip ticks if there are no ticks before them if (ticksBeforeTickText <= 0) { continue; } - var xAxisLengthWithoutTickTextWidth = widthWithoutCurrentPaddingLeft - rotatedTickTextWidth, - tickLength = xAxisLengthWithoutTickTextWidth / ticksBeforeTickText, - remainingTicks = remaining - tickIndex, - paddingRightLength = right * tickLength, - remainingTickWidth = remainingTicks * tickLength + paddingRightLength, - overflow = rotatedTickTextWidth - tickLength / 2 - remainingTickWidth; - maxOverflow = Math.max(maxOverflow, overflow); + const tickLength = (widthWithoutCurrentPaddingLeft - rotatedTickTextWidth) / ticksBeforeTickText; + maxOverflow = Math.max(maxOverflow, rotatedTickTextWidth - tickLength / 2 - ((remaining - tickIndex) * tickLength + right * tickLength)); } - var filteredTargets = $$.filterTargetsToShow($$.data.targets); - var tickOffset = 0; + const filteredTargets = $$.filterTargetsToShow($$.data.targets); + let tickOffset = 0; if (!isTimeSeries && config.axis_x_tick_count <= filteredTargets.length && filteredTargets[0].values.length) { - var _scale2 = getScale($$.axis.getAxisType("x"), 0, widthWithoutCurrentPaddingLeft - maxOverflow).domain([left * -1, $$.getXDomainMax($$.data.targets) + 1 + right]); - tickOffset = Math.ceil((_scale2(1) - _scale2(0)) / 2); + const scale = getScale($$.axis.getAxisType("x"), 0, widthWithoutCurrentPaddingLeft - maxOverflow).domain([left * -1, $$.getXDomainMax($$.data.targets) + 1 + right]); + tickOffset = Math.ceil((scale(1) - scale(0)) / 2); } return maxOverflow + tickOffset; }; _proto.updateLabels = function updateLabels(withTransition) { - var _this12 = this, - $$ = this.owner, + var _this12 = this; + const $$ = this.owner, main = $$.$el.main, $T = $$.$T, labels = { @@ -14844,7 +15082,7 @@ var Axis_Axis = /*#__PURE__*/function () { }.bind(this)).forEach(function (v) { var _this13 = this; _newArrowCheck(this, _this12); - var node = labels[v]; + const node = labels[v]; // @check $$.$T(node, withTransition) $T(node, withTransition).attr("x", function () { @@ -14873,17 +15111,17 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */; _proto.getPadding = function getPadding(padding, key, defaultValue, domainLength) { - var p = isNumber(padding) ? padding : padding[key]; + const p = isNumber(padding) ? padding : padding[key]; if (!isValue(p)) { return defaultValue; } return this.owner.convertPixelToScale(/(bottom|top)/.test(key) ? "y" : "x", p, domainLength); }; _proto.generateTickValues = function generateTickValues(values, tickCount, forTimeSeries) { - var _this14 = this, - tickValues = values; + var _this14 = this; + let tickValues = values; if (tickCount) { - var targetCount = isFunction(tickCount) ? tickCount() : tickCount; + const targetCount = isFunction(tickCount) ? tickCount() : tickCount; // compute ticks according to tickCount if (targetCount === 1) { @@ -14891,15 +15129,15 @@ var Axis_Axis = /*#__PURE__*/function () { } else if (targetCount === 2) { tickValues = [values[0], values[values.length - 1]]; } else if (targetCount > 2) { - var isCategorized = this.isCategorized(), + const isCategorized = this.isCategorized(), count = targetCount - 2, start = values[0], end = values[values.length - 1]; - var tickValue; + let tickValue; // re-construct unique values tickValues = [start]; - for (var i = 0; i < count; i++) { + for (let i = 0; i < count; i++) { tickValue = +start + (end - start) / (count + 1) * (i + 1); tickValues.push(forTimeSeries ? new Date(tickValue) : isCategorized ? Math.round(tickValue) : tickValue); } @@ -14915,8 +15153,8 @@ var Axis_Axis = /*#__PURE__*/function () { return tickValues; }; _proto.generateTransitions = function generateTransitions(withTransition) { - var _this15 = this, - $$ = this.owner, + var _this15 = this; + const $$ = this.owner, axis = $$.$el.axis, $T = $$.$T, _map = ["x", "y", "y2", "subX"].map(function (v) { @@ -14935,14 +15173,14 @@ var Axis_Axis = /*#__PURE__*/function () { }; }; _proto.redraw = function redraw(transitions, isHidden, isInit) { - var _this16 = this, - $$ = this.owner, + var _this16 = this; + const $$ = this.owner, config = $$.config, $el = $$.$el, opacity = isHidden ? "0" : null; ["x", "y", "y2", "subX"].forEach(function (id) { _newArrowCheck(this, _this16); - var axis = this[id], + const axis = this[id], $axis = $el.axis[id]; if (axis && $axis) { if (!isInit && !config.transition_duration) { @@ -14965,13 +15203,13 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */; _proto.redrawAxis = function redrawAxis(targetsToShow, wth, transitions, flow, isInit) { - var _this17 = this, - $$ = this.owner, + var _this17 = this; + const $$ = this.owner, config = $$.config, scale = $$.scale, $el = $$.$el, - hasZoom = !!scale.zoom, - xDomainForZoom; + hasZoom = !!scale.zoom; + let xDomainForZoom; if (!hasZoom && this.isCategorized() && targetsToShow.length === 0) { scale.x.domain([0, $el.axis.x.selectAll(".tick").size()]); } @@ -14983,7 +15221,7 @@ var Axis_Axis = /*#__PURE__*/function () { } else if (this.x) { var _this$subX2; this.x.tickValues([]); - (_this$subX2 = this.subX) == null ? void 0 : _this$subX2.tickValues([]); + (_this$subX2 = this.subX) == null || _this$subX2.tickValues([]); } if (config.zoom_rescale && !flow) { xDomainForZoom = scale.x.orgDomain(); @@ -14991,14 +15229,14 @@ var Axis_Axis = /*#__PURE__*/function () { ["y", "y2"].forEach(function (key) { var _this18 = this; _newArrowCheck(this, _this17); - var prefix = "axis_" + key + "_", + const prefix = "axis_" + key + "_", axisScale = scale[key]; if (axisScale) { - var tickValues = config[prefix + "tick_values"], + const tickValues = config[prefix + "tick_values"], tickCount = config[prefix + "tick_count"]; axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom)); if (!tickValues && tickCount) { - var axis = $$.axis[key], + const axis = $$.axis[key], domain = axisScale.domain(); axis.tickValues(this.generateTickValues(domain, domain.every(function (v) { _newArrowCheck(this, _this18); @@ -15022,8 +15260,8 @@ var Axis_Axis = /*#__PURE__*/function () { // Update sub domain if (wth.Y) { var _scale$subY, _scale$subY2; - (_scale$subY = scale.subY) == null ? void 0 : _scale$subY.domain($$.getYDomain(targetsToShow, "y")); - (_scale$subY2 = scale.subY2) == null ? void 0 : _scale$subY2.domain($$.getYDomain(targetsToShow, "y2")); + (_scale$subY = scale.subY) == null || _scale$subY.domain($$.getYDomain(targetsToShow, "y")); + (_scale$subY2 = scale.subY2) == null || _scale$subY2.domain($$.getYDomain(targetsToShow, "y2")); } } @@ -15032,8 +15270,8 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */; _proto.setCulling = function setCulling() { - var _this19 = this, - $$ = this.owner, + var _this19 = this; + const $$ = this.owner, config = $$.config, _$$$state2 = $$.state, clip = _$$$state2.clip, @@ -15041,26 +15279,26 @@ var Axis_Axis = /*#__PURE__*/function () { $el = $$.$el; ["subX", "x", "y", "y2"].forEach(function (type) { _newArrowCheck(this, _this19); - var axis = $el.axis[type], + const axis = $el.axis[type], id = type === "subX" ? "x" : type, cullingOptionPrefix = "axis_" + id + "_tick_culling", toCull = config[cullingOptionPrefix]; // subchart x axis should be aligned with x axis culling if (axis && toCull) { - var tickNodes = axis.selectAll(".tick"), + const tickNodes = axis.selectAll(".tick"), tickValues = sortValue(tickNodes.data()), tickSize = tickValues.length, cullingMax = config[cullingOptionPrefix + "_max"], lines = config[cullingOptionPrefix + "_lines"]; - var intervalForCulling; + let intervalForCulling; if (tickSize) { - for (var i = 1; i < tickSize; i++) { + for (let i = 1; i < tickSize; i++) { if (tickSize / i < cullingMax) { intervalForCulling = i; break; } } tickNodes.each(function (d) { - var node = lines ? this.querySelector("text") : this; + const node = lines ? this.querySelector("text") : this; if (node) { node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null; } @@ -15071,7 +15309,7 @@ var Axis_Axis = /*#__PURE__*/function () { // set/unset x_axis_tick_clippath if (type === "x") { - var clipPath = current.maxTickWidths.x.clipPath ? clip.pathXAxisTickTexts : null; + const clipPath = current.maxTickSize.x.clipPath ? clip.pathXAxisTickTexts : null; $el.svg.selectAll("." + $AXIS.axisX + " .tick text").attr("clip-path", clipPath); } } @@ -15094,7 +15332,7 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */ initEventRect: function initEventRect() { - var $$ = this; + const $$ = this; $$.$el.main.select("." + $COMMON.chart).append("g").attr("class", $EVENT.eventRects).style("fill-opacity", "0"); }, /** @@ -15102,8 +15340,8 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */ redrawEventRect: function redrawEventRect() { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, state = $$.state, $el = $$.$el, @@ -15114,7 +15352,7 @@ var Axis_Axis = /*#__PURE__*/function () { // do not initialize eventRect when data is empty } else if ($$.data.targets.length) { - var eventRects = $$.$el.main.select("." + $EVENT.eventRects).style("cursor", config.zoom_enabled && config.zoom_type !== "drag" ? config.axis_rotated ? "ns-resize" : "ew-resize" : null).classed($EVENT.eventRectsMultiple, isMultipleX).classed($EVENT.eventRectsSingle, !isMultipleX), + const eventRects = $$.$el.main.select("." + $EVENT.eventRects).style("cursor", config.zoom_enabled && config.zoom_type !== "drag" ? config.axis_rotated ? "ns-resize" : "ew-resize" : null).classed($EVENT.eventRectsMultiple, isMultipleX).classed($EVENT.eventRectsSingle, !isMultipleX), eventRectUpdate = eventRects.selectAll("." + $EVENT.eventRect).data([0]).enter().append("rect"); // append event <rect> $$.updateEventRect(eventRectUpdate); @@ -15125,7 +15363,7 @@ var Axis_Axis = /*#__PURE__*/function () { eventRectUpdate.call($$.getDraggableSelection()); $el.eventRect = eventRectUpdate; if ($$.state.inputType === "touch" && !$el.svg.on("touchstart.eventRect") && !$$.hasArcType()) { - $$.bindTouchOnEventRect(isMultipleX); + $$.bindTouchOnEventRect(); } // when initilazed with empty data and data loaded later, need to update eventRect @@ -15133,7 +15371,7 @@ var Axis_Axis = /*#__PURE__*/function () { } if (!isMultipleX) { // Set data and update eventReceiver.data - var xAxisTickValues = $$.getMaxDataCountTarget(); + const xAxisTickValues = $$.getMaxDataCountTarget(); if (!config.data_xSort || isInverted) { xAxisTickValues.sort(function (a, b) { _newArrowCheck(this, _this); @@ -15144,14 +15382,14 @@ var Axis_Axis = /*#__PURE__*/function () { // update data's index value to be alinged with the x Axis $$.updateDataIndexByX(xAxisTickValues); $$.updateXs(xAxisTickValues); - $$.updatePointClass == null ? void 0 : $$.updatePointClass(!0); + $$.updatePointClass == null || $$.updatePointClass(!0); state.eventReceiver.data = xAxisTickValues; } $$.updateEventRectData(); }, - bindTouchOnEventRect: function bindTouchOnEventRect(isMultipleX) { - var _this2 = this, - $$ = this, + bindTouchOnEventRect: function bindTouchOnEventRect() { + var _this2 = this; + const $$ = this, config = $$.config, state = $$.state, _$$$$el = $$.$el, @@ -15159,12 +15397,12 @@ var Axis_Axis = /*#__PURE__*/function () { svg = _$$$$el.svg, selectRect = function (context) { _newArrowCheck(this, _this2); - if (isMultipleX) { + if ($$.isMultipleX()) { $$.selectRectForMultipleXs(context); } else { - var index = $$.getDataIndexFromEvent(state.event); + const index = $$.getDataIndexFromEvent(state.event); $$.callOverOutForTouch(index); - index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, eventRect, index); + index === -1 ? $$.unselectRect() : $$.selectRectForSingle(context, index); } }.bind(this), unselectRect = function () { @@ -15174,29 +15412,33 @@ var Axis_Axis = /*#__PURE__*/function () { }.bind(this), preventDefault = config.interaction_inputType_touch.preventDefault, isPrevented = isboolean(preventDefault) && preventDefault || !1, - preventThreshold = !isNaN(preventDefault) && preventDefault || null, - startPx, - preventEvent = function (event) { - _newArrowCheck(this, _this2); - var eventType = event.type, - touch = event.changedTouches[0], - currentXY = touch["client" + (config.axis_rotated ? "Y" : "X")]; - // prevent document scrolling - if (eventType === "touchstart") { - if (isPrevented) { - event.preventDefault(); - } else if (preventThreshold !== null) { - startPx = currentXY; - } - } else if (eventType === "touchmove") { - if (isPrevented || startPx === !0 || preventThreshold !== null && Math.abs(startPx - currentXY) >= preventThreshold) { - // once prevented, keep prevented during whole 'touchmove' context - startPx = !0; - event.preventDefault(); - } - } - }.bind(this); // call event.preventDefault() + preventThreshold = !isNaN(preventDefault) && preventDefault || null; + + // call event.preventDefault() // according 'interaction.inputType.touch.preventDefault' option + + let startPx; + const preventEvent = function (event) { + _newArrowCheck(this, _this2); + const eventType = event.type, + touch = event.changedTouches[0], + currentXY = touch["client" + (config.axis_rotated ? "Y" : "X")]; + // prevent document scrolling + if (eventType === "touchstart") { + if (isPrevented) { + event.preventDefault(); + } else if (preventThreshold !== null) { + startPx = currentXY; + } + } else if (eventType === "touchmove") { + if (isPrevented || startPx === !0 || preventThreshold !== null && Math.abs(startPx - currentXY) >= preventThreshold) { + // once prevented, keep prevented during whole 'touchmove' context + startPx = !0; + event.preventDefault(); + } + } + }.bind(this); + // bind touch events eventRect.on("touchstart", function (event) { _newArrowCheck(this, _this2); @@ -15227,7 +15469,7 @@ var Axis_Axis = /*#__PURE__*/function () { svg.on("touchstart", function (event) { _newArrowCheck(this, _this2); state.event = event; - var target = event.target; + const target = event.target; if (target && target !== eventRect.node()) { unselectRect(); } @@ -15244,7 +15486,7 @@ var Axis_Axis = /*#__PURE__*/function () { if (force === void 0) { force = !1; } - var $$ = this, + const $$ = this, state = $$.state, $el = $$.$el, _state = state, @@ -15273,17 +15515,14 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */ updateEventRectData: function updateEventRectData() { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, config = $$.config, scale = $$.scale, state = $$.state, xScale = scale.zoom || scale.x, - isRotated = config.axis_rotated, - x, - y, - w, - h; + isRotated = config.axis_rotated; + let x, y, w, h; if ($$.isMultipleX()) { // TODO: rotated not supported yet x = 0; @@ -15291,7 +15530,7 @@ var Axis_Axis = /*#__PURE__*/function () { w = state.width; h = state.height; } else { - var rectW, rectX; + let rectW, rectX; if ($$.axis.isCategorized()) { rectW = $$.getEventRectWidth(); rectX = function (d) { @@ -15299,8 +15538,8 @@ var Axis_Axis = /*#__PURE__*/function () { return xScale(d.x) - rectW / 2; }.bind(this); } else { - var getPrevNextX = function (_ref) { - var index = _ref.index; + const getPrevNextX = function (_ref) { + let index = _ref.index; _newArrowCheck(this, _this4); return { prev: $$.getPrevX(index), @@ -15310,9 +15549,9 @@ var Axis_Axis = /*#__PURE__*/function () { rectW = function (d) { var _this5 = this; _newArrowCheck(this, _this4); - var x = getPrevNextX(d), + const x = getPrevNextX(d), xDomain = xScale.domain(); - var val; + let val; // if there this is a single data point make the eventRect full width (or height) if (x.prev === null && x.next === null) { @@ -15333,8 +15572,8 @@ var Axis_Axis = /*#__PURE__*/function () { }.bind(this); rectX = function (d) { _newArrowCheck(this, _this4); - var x = getPrevNextX(d); - var val; + const x = getPrevNextX(d); + let val; // if there this is a single data point position the eventRect at 0 if (x.prev === null && x.next === null) { @@ -15352,7 +15591,7 @@ var Axis_Axis = /*#__PURE__*/function () { w = isRotated ? state.width : rectW; h = isRotated ? rectW : state.height; } - var eventReceiver = state.eventReceiver, + const eventReceiver = state.eventReceiver, call = function (fn, v) { _newArrowCheck(this, _this4); return isFunction(fn) ? fn(v) : fn; @@ -15369,9 +15608,72 @@ var Axis_Axis = /*#__PURE__*/function () { }; }.bind(this)); }, - selectRectForMultipleXs: function selectRectForMultipleXs(context) { - var _this6 = this, - $$ = this, + /** + * Seletct rect for single x value + * @param {d3Selection} context Event rect element + * @param {number} index x Axis index + * @private + */ + selectRectForSingle: function selectRectForSingle(context, index) { + var _this6 = this; + const $$ = this, + config = $$.config, + _$$$$el2 = $$.$el, + main = _$$$$el2.main, + circle = _$$$$el2.circle, + isSelectionEnabled = config.data_selection_enabled, + isSelectionGrouped = config.data_selection_grouped, + isSelectable = config.data_selection_isselectable, + isTooltipGrouped = config.tooltip_grouped, + selectedData = $$.getAllValuesOnIndex(index); + if (isTooltipGrouped) { + $$.showTooltip(selectedData, context); + $$.showGridFocus == null || $$.showGridFocus(selectedData); + if (!isSelectionEnabled || isSelectionGrouped) { + return; + } + } + + // remove possible previous focused state + circle || main.selectAll("." + $COMMON.EXPANDED + ":not(." + $SHAPE.shape + "-" + index + ")").classed($COMMON.EXPANDED, !1); + const shapeAtIndex = main.selectAll("." + $SHAPE.shape + "-" + index).classed($COMMON.EXPANDED, !0).style("cursor", isSelectable ? "pointer" : null).filter(function (d) { + return $$.isWithinShape(this, d); + }); + if (shapeAtIndex.empty() && !isTooltipGrouped) { + $$.hideGridFocus == null || $$.hideGridFocus(); + $$.hideTooltip(); + isSelectionGrouped || $$.setExpand(index); + } + shapeAtIndex.call(function (selected) { + var _this7 = this; + _newArrowCheck(this, _this6); + const d = selected.data(); + if (isSelectionEnabled && (isSelectionGrouped || isSelectable != null && isSelectable.bind($$.api)(d))) { + context.style.cursor = "pointer"; + } + if (!isTooltipGrouped) { + $$.showTooltip(d, context); + $$.showGridFocus == null || $$.showGridFocus(d); + $$.unexpandCircles == null || $$.unexpandCircles(); + selected.each(function (d) { + _newArrowCheck(this, _this7); + return $$.setExpand(index, d.id); + }.bind(this)); + } + }.bind(this)); + }, + /** + * Select rect for multiple x values + * @param {d3Selection} context Event rect element + * @param {boolean} [triggerEvent=true] Whether trigger event or not + * @private + */ + selectRectForMultipleXs: function selectRectForMultipleXs(context, triggerEvent) { + var _this8 = this; + if (triggerEvent === void 0) { + triggerEvent = !0; + } + const $$ = this, config = $$.config, state = $$.state, targetsToShow = $$.filterTargetsToShow($$.data.targets); @@ -15379,9 +15681,9 @@ var Axis_Axis = /*#__PURE__*/function () { if (state.dragging || $$.hasArcType(targetsToShow)) { return; } - var mouse = getPointer(state.event, context), + const mouse = getPointer(state.event, context), closest = $$.findClosestFromTargets(targetsToShow, mouse); - if (state.mouseover && (!closest || closest.id !== state.mouseover.id)) { + if (triggerEvent && state.mouseover && (!closest || closest.id !== state.mouseover.id)) { config.data_onout.call($$.api, state.mouseover); state.mouseover = undefined; } @@ -15389,9 +15691,9 @@ var Axis_Axis = /*#__PURE__*/function () { $$.unselectRect(); return; } - var sameXData = $$.isBubbleType(closest) || $$.isScatterType(closest) || !config.tooltip_grouped ? [closest] : $$.filterByX(targetsToShow, closest.x), + const sameXData = $$.isBubbleType(closest) || $$.isScatterType(closest) || !config.tooltip_grouped ? [closest] : $$.filterByX(targetsToShow, closest.x), selectedData = sameXData.map(function (d) { - _newArrowCheck(this, _this6); + _newArrowCheck(this, _this8); return $$.addName(d); }.bind(this)); // show tooltip when cursor is close to some point $$.showTooltip(selectedData, context); @@ -15401,11 +15703,12 @@ var Axis_Axis = /*#__PURE__*/function () { // Show xgrid focus line $$.showGridFocus(selectedData); + const dist = $$.dist(closest, mouse); // Show cursor as pointer if point is close to mouse position - if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) { + if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) { $$.$el.svg.select("." + $EVENT.eventRect).style("cursor", "pointer"); - if (!state.mouseover) { + if (triggerEvent && !state.mouseover) { config.data_onover.call($$.api, closest); state.mouseover = closest; } @@ -15416,18 +15719,17 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */ unselectRect: function unselectRect() { - var $$ = this, - config = $$.config, - _$$$$el2 = $$.$el, - circle = _$$$$el2.circle, - tooltip = _$$$$el2.tooltip; + const $$ = this, + _$$$$el3 = $$.$el, + circle = _$$$$el3.circle, + tooltip = _$$$$el3.tooltip; $$.$el.svg.select("." + $EVENT.eventRect).style("cursor", null); $$.hideGridFocus(); if (tooltip) { $$.hideTooltip(); $$._handleLinkedCharts(!1); } - circle && !config.point_focus_only && $$.unexpandCircles(); + circle && !$$.isPointFocusOnly() && $$.unexpandCircles(); $$.expandBarTypeShapes(!1); }, /** @@ -15438,40 +15740,40 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */ generateEventRectsForSingleX: function generateEventRectsForSingleX(eventRectEnter) { - var _this7 = this, - $$ = this, + var _this9 = this; + const $$ = this, config = $$.config, state = $$.state, eventReceiver = state.eventReceiver, rect = eventRectEnter.style("cursor", config.data_selection_enabled && config.data_selection_grouped ? "pointer" : null).on("click", function (event) { state.event = event; - var currentIdx = eventReceiver.currentIdx, + const currentIdx = eventReceiver.currentIdx, data = eventReceiver.data, d = data[currentIdx === -1 ? $$.getDataIndexFromEvent(event) : currentIdx]; $$.clickHandlerForSingleX.bind(this)(d, $$); }); if (state.inputType === "mouse") { - var getData = function (event) { - _newArrowCheck(this, _this7); - var index = event ? $$.getDataIndexFromEvent(event) : eventReceiver.currentIdx; + const getData = function (event) { + _newArrowCheck(this, _this9); + const index = event ? $$.getDataIndexFromEvent(event) : eventReceiver.currentIdx; return index > -1 ? eventReceiver.data[index] : null; }.bind(this); rect.on("mouseover", function (event) { - _newArrowCheck(this, _this7); + _newArrowCheck(this, _this9); state.event = event; $$.updateEventRect(); }.bind(this)).on("mousemove", function (event) { - var d = getData(event); + const d = getData(event); state.event = event; if (!d) { return; } - var index = d.index; - var stepType = config.line_step_type; + let index = d.index; + const stepType = config.line_step_type; // tooltip position match for step-before & step-after if (config.line_step_tooltipMatch && $$.hasType("step") && /^step\-(before|after)$/.test(stepType)) { - var scale = $$.scale.zoom || $$.scale.x, + const scale = $$.scale.zoom || $$.scale.x, xs = $$.axis.xs[index], inverted = scale.invert(getPointer(event, this)[0]); if (stepType === "step-after" && inverted < xs) { @@ -15480,22 +15782,24 @@ var Axis_Axis = /*#__PURE__*/function () { index += 1; } } + const eventOnSameIdx = config.tooltip_grouped && index === eventReceiver.currentIdx; // do nothing while dragging/flowing - if (state.dragging || state.flowing || $$.hasArcType() || config.tooltip_grouped && index === eventReceiver.currentIdx) { + if (state.dragging || state.flowing || $$.hasArcType() || eventOnSameIdx) { + config.tooltip_show && eventOnSameIdx && $$.setTooltipPosition(); return; } if (index !== eventReceiver.currentIdx) { $$.setOverOut(!1, eventReceiver.currentIdx); eventReceiver.currentIdx = index; } - index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, rect, index); + index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, index); // As of individual data point(or <path>) element can't bind mouseover/out event // to determine current interacting element, so use 'mousemove' event instead. $$.setOverOut(index !== -1, index); }).on("mouseout", function (event) { - _newArrowCheck(this, _this7); + _newArrowCheck(this, _this9); state.event = event; // chart is destroyed @@ -15512,7 +15816,7 @@ var Axis_Axis = /*#__PURE__*/function () { return rect; }, clickHandlerForSingleX: function clickHandlerForSingleX(d, ctx) { - var $$ = ctx, + const $$ = ctx, config = $$.config, state = $$.state, main = $$.$el.main; @@ -15520,10 +15824,10 @@ var Axis_Axis = /*#__PURE__*/function () { state.cancelClick && (state.cancelClick = !1); return; } - var index = d.index; + const index = d.index; main.selectAll("." + $SHAPE.shape + "-" + index).each(function (d2) { if (config.data_selection_grouped || $$.isWithinShape(this, d2)) { - $$.toggleShape == null ? void 0 : $$.toggleShape(this, d2, index); + $$.toggleShape == null || $$.toggleShape(this, d2, index); config.data_onclick.bind($$.api)(d2, this); } }); @@ -15535,8 +15839,8 @@ var Axis_Axis = /*#__PURE__*/function () { * @private */ generateEventRectsForMultipleXs: function generateEventRectsForMultipleXs(eventRectEnter) { - var _this8 = this, - $$ = this, + var _this10 = this; + const $$ = this, state = $$.state; eventRectEnter.on("click", function (event) { state.event = event; @@ -15547,7 +15851,7 @@ var Axis_Axis = /*#__PURE__*/function () { state.event = event; $$.selectRectForMultipleXs(this); }).on("mouseout", function (event) { - _newArrowCheck(this, _this8); + _newArrowCheck(this, _this10); state.event = event; // chart is destroyed @@ -15559,24 +15863,25 @@ var Axis_Axis = /*#__PURE__*/function () { } }, clickHandlerForMultipleXS: function clickHandlerForMultipleXS(ctx) { - var $$ = ctx, + const $$ = ctx, config = $$.config, state = $$.state, targetsToShow = $$.filterTargetsToShow($$.data.targets); if ($$.hasArcType(targetsToShow)) { return; } - var mouse = getPointer(state.event, this), - closest = $$.findClosestFromTargets(targetsToShow, mouse); + const mouse = getPointer(state.event, this), + closest = $$.findClosestFromTargets(targetsToShow, mouse), + sensitivity = config.point_sensitivity === "radius" ? closest.r : config.point_sensitivity; if (!closest) { return; } // select if selection enabled - if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < config.point_sensitivity) { + if ($$.isBarType(closest.id) || $$.dist(closest, mouse) < sensitivity) { $$.$el.main.selectAll("." + $SHAPE.shapes + $$.getTargetSelectorSuffix(closest.id)).selectAll("." + $SHAPE.shape + "-" + closest.index).each(function () { if (config.data_selection_grouped || $$.isWithinShape(this, closest)) { - $$.toggleShape == null ? void 0 : $$.toggleShape(this, closest, closest.index); + $$.toggleShape == null || $$.toggleShape(this, closest, closest.index); config.data_onclick.bind($$.api)(closest, this); } }); @@ -15603,13 +15908,14 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack * @private */ generateFlow: function generateFlow(args) { - var $$ = this, + const $$ = this, data = $$.data, state = $$.state, $el = $$.$el; return function () { - var _this = this, - flowLength = args.flow.length; + var _this = this; + const flowLength = args.flow.length; + // set flag state.flowing = !0; @@ -15625,12 +15931,12 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack } // target elements - var elements = {}; + const elements = {}; ["axis.x", "grid.x", "gridLines.x", "region.list", "text", "bar", "line", "area", "circle"].forEach(function (v) { var _node; _newArrowCheck(this, _this); - var name = v.split("."); - var node = $el[name[0]]; + const name = v.split("."); + let node = $el[name[0]]; if (node && name.length > 1) { node = node[name[1]]; } @@ -15649,8 +15955,8 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack * @private */ setFlowList: function setFlowList(elements, args) { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, flow = args.flow, targets = args.targets, _flow = flow, @@ -15660,8 +15966,8 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack flowLength = _flow.length, orgDataCount = _flow.orgDataCount, transform = $$.getFlowTransform(targets, orgDataCount, flowIndex, flowLength), - wait = generateWait(), - n; + wait = generateWait(); + let n; wait.add(Object.keys(elements).map(function (v) { var _this3 = this; _newArrowCheck(this, _this2); @@ -15690,8 +15996,8 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack * @private */ cleanUpFlow: function cleanUpFlow(elements, args) { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, config = $$.config, state = $$.state, svg = $$.$el.svg, @@ -15714,8 +16020,8 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack if (flowLength) { ["circle", "text", "shape", "eventRect"].forEach(function (v) { _newArrowCheck(this, _this4); - var target = []; - for (var i = 0; i < flowLength; i++) { + const target = []; + for (let i = 0; i < flowLength; i++) { target.push("." + classes[v] + "-" + i); } svg.selectAll("." + classes[v + "s"]) // circles, shapes, texts, eventRects @@ -15728,7 +16034,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack Object.keys(elements).forEach(function (v) { var _this5 = this; _newArrowCheck(this, _this4); - var n = elements[v]; + const n = elements[v]; if (v !== "axis.x") { n.attr("transform", null); } @@ -15736,8 +16042,6 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack n.attr(state.xgridAttr); } else if (v === "gridLines.x") { n.attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? state.width : xv); - } else if (v === "gridLines.x") { - n.select("line").attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? state.width : xv); n.select("text").attr("x", isRotated ? state.width : 0).attr("y", xv); } else if (/^(area|bar|line)$/.test(v)) { n.attr("d", shape.type[v]); @@ -15747,7 +16051,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack if ($$.isCirclePoint()) { n.attr("cx", cx).attr("cy", cy); } else { - var xFunc = function (d) { + const xFunc = function (d) { _newArrowCheck(this, _this5); return cx(d) - config.point_r; }.bind(this), @@ -15755,8 +16059,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack _newArrowCheck(this, _this5); return cy(d) - config.point_r; }.bind(this); - n.attr("x", xFunc).attr("y", yFunc).attr("cx", cx) // when pattern is used, it possibly contain 'circle' also. - .attr("cy", cy); + n.attr("x", xFunc).attr("y", yFunc); } } else if (v === "region.list") { n.select("rect").filter($$.isRegionOnX).attr("x", $$.regionX.bind($$)).attr("width", $$.regionWidth.bind($$)); @@ -15778,17 +16081,17 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack * @private */ getFlowTransform: function getFlowTransform(targets, orgDataCount, flowIndex, flowLength) { - var _flowStart, - _flowEnd, - $$ = this, + var _flowStart, _flowEnd; + const $$ = this, data = $$.data, x = $$.scale.x, - dataValues = data.targets[0].values, - flowStart = $$.getValueOnIndex(dataValues, flowIndex), + dataValues = data.targets[0].values; + let flowStart = $$.getValueOnIndex(dataValues, flowIndex), flowEnd = $$.getValueOnIndex(dataValues, flowIndex + flowLength), - translateX, - orgDomain = x.domain(), - domain = $$.updateXDomain(targets, !0, !0); // update x domain to generate axis elements for flow + translateX; + // update x domain to generate axis elements for flow + const orgDomain = x.domain(), + domain = $$.updateXDomain(targets, !0, !0); // generate transform to flow if (!orgDataCount) { // if empty @@ -15809,7 +16112,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack var _flowStart2; translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(((_flowStart2 = flowStart) == null ? void 0 : _flowStart2.x) || 0) - x(flowEnd.x); } - var scaleX = diffDomain(orgDomain) / diffDomain(domain); + const scaleX = diffDomain(orgDomain) / diffDomain(domain); return "translate(" + translateX + ",0) scale(" + scaleX + ",1)"; } }); @@ -15821,7 +16124,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack /* harmony default export */ var clip = ({ initClip: function initClip() { - var $$ = this, + const $$ = this, _$$$state = $$.state, clip = _$$$state.clip, datetimeId = _$$$state.datetimeId; @@ -15838,12 +16141,12 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack clip.pathGrid = $$.getClipPath(clip.idGrid); }, getClipPath: function getClipPath(id) { - var $$ = this, + const $$ = this, config = $$.config; if (!config.clipPath && /-clip$/.test(id) || !config.axis_x_clipPath && /-clip-xaxis$/.test(id) || !config.axis_y_clipPath && /-clip-yaxis$/.test(id)) { return null; } - var isIE9 = win.navigator ? win.navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0 : !1; + const isIE9 = win.navigator ? win.navigator.appVersion.toLowerCase().indexOf("msie 9.") >= 0 : !1; return "url(" + (isIE9 ? "" : browser_doc.URL.split("#")[0]) + "#" + id + ")"; }, appendClip: function appendClip(parent, id) { @@ -15855,7 +16158,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack * @private */ setXAxisClipPath: function setXAxisClipPath(node) { - var $$ = this, + const $$ = this, config = $$.config, _$$$state2 = $$.state, margin = _$$$state2.margin, @@ -15863,23 +16166,23 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack height = _$$$state2.height, isRotated = config.axis_rotated, left = Math.max(30, margin.left) - (isRotated ? 0 : 20), + h = (isRotated ? margin.top + height + 10 : margin.bottom) + 20, x = isRotated ? -(1 + left) : -(left - 1), - y = -Math.max(15, margin.top), - w = isRotated ? margin.left + 20 : width + 10 + left, - h = (isRotated ? margin.top + height + 10 : margin.bottom) + 20; + w = isRotated ? margin.left + 20 : width + 10 + left; // less than 20 is not enough to show the axis label 'outer' without legend - node.attr("x", x).attr("y", y).attr("width", w).attr("height", h); + // -Math.max(15, margin.top); + + node.attr("x", x).attr("y", -15).attr("width", w).attr("height", h); }, /** * Set y Axis clipPath dimension - * @param {d3Selecton} node clipPath <rect> selection + * @param {d3Selection} node clipPath <rect> selection * @private */ setYAxisClipPath: function setYAxisClipPath(node) { - var _config$padding, - $$ = this, + const $$ = this, config = $$.config, _$$$state3 = $$.state, margin = _$$$state3.margin, @@ -15891,11 +16194,11 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack x = isInner && !isRotated ? config.axis_y_label.text ? -20 : -1 : isRotated ? -(1 + left) : -(left - 1), y = -(isRotated ? 20 : margin.top), w = (isRotated ? width + 15 + left : margin.left + 20) + (isInner ? 20 : 0), - h = (isRotated ? margin.bottom + (((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit" ? 10 : 0) : margin.top + height) + 10; + h = (isRotated ? margin.bottom + 10 : margin.top + height) + 10; node.attr("x", x).attr("y", y).attr("width", w).attr("height", h); }, updateXAxisTickClip: function updateXAxisTickClip() { - var $$ = this, + const $$ = this, config = $$.config, _$$$state4 = $$.state, clip = _$$$state4.clip, @@ -15903,7 +16206,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack defs = $$.$el.defs, newXAxisHeight = $$.getHorizontalAxisHeight("x"); if (defs && !clip.idXAxisTickTexts) { - var clipId = clip.id + "-xaxisticktexts"; + const clipId = clip.id + "-xaxisticktexts"; $$.appendClip(defs, clipId); clip.pathXAxisTickTexts = $$.getClipPath(clip.idXAxisTickTexts); clip.idXAxisTickTexts = clipId; @@ -15915,25 +16218,25 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack $$.state.xAxisHeight = newXAxisHeight; }, setXAxisTickClipWidth: function setXAxisTickClipWidth() { - var $$ = this, + const $$ = this, config = $$.config, - maxTickWidths = $$.state.current.maxTickWidths, + maxTickSize = $$.state.current.maxTickSize, xAxisTickRotate = $$.getAxisTickRotate("x"); if (!config.axis_x_tick_multiline && xAxisTickRotate) { - var sinRotation = Math.sin(Math.PI / 180 * Math.abs(xAxisTickRotate)); - maxTickWidths.x.clipPath = ($$.getHorizontalAxisHeight("x") - 20) / sinRotation; + const sinRotation = Math.sin(Math.PI / 180 * Math.abs(xAxisTickRotate)); + maxTickSize.x.clipPath = ($$.getHorizontalAxisHeight("x") - 20) / sinRotation; } else { - maxTickWidths.x.clipPath = null; + maxTickSize.x.clipPath = null; } }, setXAxisTickTextClipPathWidth: function setXAxisTickTextClipPathWidth() { - var $$ = this, + const $$ = this, _$$$state5 = $$.state, clip = _$$$state5.clip, current = _$$$state5.current, svg = $$.$el.svg; if (svg) { - svg.select("#" + clip.idXAxisTickTexts + " rect").attr("width", current.maxTickWidths.x.clipPath).attr("height", 30); + svg.select("#" + clip.idXAxisTickTexts + " rect").attr("width", current.maxTickSize.x.clipPath).attr("height", 30); } } }); @@ -15949,7 +16252,7 @@ var grid_this = undefined; // Grid position and text anchor helpers -var getGridTextAnchor = function (d) { +const getGridTextAnchor = function (d) { _newArrowCheck(this, grid_this); return isValue(d.position) || "end"; }.bind(undefined), @@ -15969,7 +16272,7 @@ function getGridTextX(isX, width, height) { var _this2 = this; return function (d) { _newArrowCheck(this, _this2); - var x = isX ? 0 : width; + let x = isX ? 0 : width; if (d.position === "start") { x = isX ? -height : 0; } else if (d.position === "middle") { @@ -15988,8 +16291,8 @@ function getGridTextX(isX, width, height) { function smoothLines(el, type) { if (type === "grid") { el.each(function () { - var _this3 = this, - g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); + var _this3 = this; + const g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); ["x1", "x2", "y1", "y2"].forEach(function (v) { _newArrowCheck(this, _this3); return g.attr(v, Math.ceil(+g.attr(v))); @@ -15999,20 +16302,20 @@ function smoothLines(el, type) { } /* harmony default export */ var internals_grid = ({ hasGrid: function hasGrid() { - var _this4 = this, - config = this.config; + var _this4 = this; + const config = this.config; return ["x", "y"].some(function (v) { _newArrowCheck(this, _this4); return config["grid_" + v + "_show"] || config["grid_" + v + "_lines"].length; }.bind(this)); }, initGrid: function initGrid() { - var $$ = this; + const $$ = this; $$.hasGrid() && $$.initGridLines(); $$.initFocusGrid(); }, initGridLines: function initGridLines() { - var $$ = this, + const $$ = this, config = $$.config, clip = $$.state.clip, $el = $$.$el; @@ -16024,8 +16327,8 @@ function smoothLines(el, type) { } }, updateXGrid: function updateXGrid(withoutUpdate) { - var _this5 = this, - $$ = this, + var _this5 = this; + const $$ = this, config = $$.config, scale = $$.scale, state = $$.state, @@ -16055,8 +16358,8 @@ function smoothLines(el, type) { grid.x = grid.x.enter().append("line").attr("class", $GRID.xgrid).merge(grid.x); if (!withoutUpdate) { grid.x.each(function () { - var _this6 = this, - grid = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); + var _this6 = this; + const grid = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); Object.keys(state.xgridAttr).forEach(function (id) { var _this7 = this; _newArrowCheck(this, _this6); @@ -16069,8 +16372,8 @@ function smoothLines(el, type) { } }, updateYGrid: function updateYGrid() { - var _this8 = this, - $$ = this, + var _this8 = this; + const $$ = this, axis = $$.axis, config = $$.config, scale = $$.scale, @@ -16091,7 +16394,7 @@ function smoothLines(el, type) { smoothLines(grid.y, "grid"); }, updateGrid: function updateGrid() { - var $$ = this, + const $$ = this, _$$$$el3 = $$.$el, grid = _$$$$el3.grid, gridLines = _$$$$el3.gridLines; @@ -16100,101 +16403,73 @@ function smoothLines(el, type) { // hide if arc type grid.main.style("visibility", $$.hasArcType() ? "hidden" : null); $$.hideGridFocus(); - $$.updateXGridLines(); - $$.updateYGridLines(); + $$.updateGridLines("x"); + $$.updateGridLines("y"); }, /** - * Update X Grid lines + * Update Grid lines + * @param {string} type x | y * @private */ - updateXGridLines: function updateXGridLines() { - var _this9 = this, - $$ = this, + updateGridLines: function updateGridLines(type) { + var _this9 = this; + const $$ = this, config = $$.config, _$$$$el4 = $$.$el, gridLines = _$$$$el4.gridLines, main = _$$$$el4.main, $T = $$.$T, isRotated = config.axis_rotated; - config.grid_x_show && $$.updateXGrid(); - var xLines = main.select("." + $GRID.xgridLines).selectAll("." + $GRID.xgridLine).data(config.grid_x_lines); + config["grid_" + type + "_show"] && $$["update" + type.toUpperCase() + "Grid"](); + let lines = main.select("." + $GRID[type + "gridLines"]).selectAll("." + $GRID[type + "gridLine"]).data(config["grid_" + type + "_lines"]); // exit - $T(xLines.exit()).style("opacity", "0").remove(); + $T(lines.exit()).style("opacity", "0").remove(); // enter - var xgridLine = xLines.enter().append("g"); - xgridLine.append("line").style("opacity", "0"); - xgridLine.append("text").attr("transform", isRotated ? null : "rotate(-90)").attr("dy", -5).style("opacity", "0"); - xLines = xgridLine.merge(xLines); - $T(xLines.attr("class", function (d) { + const gridLine = lines.enter().append("g"); + gridLine.append("line").style("opacity", "0"); + lines = gridLine.merge(lines); + lines.each(function (d) { + const g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); + if (g.select("text").empty() && d.text) { + g.append("text").style("opacity", "0"); + } + }); + $T(lines.attr("class", function (d) { _newArrowCheck(this, _this9); - return ($GRID.xgridLine + " " + (d.class || "")).trim(); - }.bind(this)).select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx)).text(function (d) { + return ($GRID[type + "gridLine"] + " " + (d.class || "")).trim(); + }.bind(this)).select("text").attr("text-anchor", getGridTextAnchor).attr("transform", function () { _newArrowCheck(this, _this9); - return d.text; - }.bind(this)).style("opacity", null); - gridLines.x = xLines; + return type === "x" ? isRotated ? null : "rotate(-90)" : isRotated ? "rotate(-90)" : null; + }.bind(this)).attr("dx", getGridTextDx).attr("dy", -5)).text(function (d) { + var _d$text; + return (_d$text = d.text) != null ? _d$text : this.remove(); + }); + gridLines[type] = lines; }, - /** - * Update Y Grid lines - * @private - */ - updateYGridLines: function updateYGridLines() { - var _this10 = this, - $$ = this, - config = $$.config, + redrawGrid: function redrawGrid(withTransition) { + const $$ = this, + isRotated = $$.config.axis_rotated, _$$$state = $$.state, width = _$$$state.width, height = _$$$state.height, - $el = $$.$el, - $T = $$.$T, - isRotated = config.axis_rotated; - config.grid_y_show && $$.updateYGrid(); - var ygridLines = $el.main.select("." + $GRID.ygridLines).selectAll("." + $GRID.ygridLine).data(config.grid_y_lines); - - // exit - $T(ygridLines.exit()).style("opacity", "0").remove(); - - // enter - var ygridLine = ygridLines.enter().append("g"); - ygridLine.append("line").style("opacity", "0"); - ygridLine.append("text").attr("transform", isRotated ? "rotate(-90)" : "").style("opacity", "0"); - ygridLines = ygridLine.merge(ygridLines); - - // update - var yv = $$.yv.bind($$); - $T(ygridLines.attr("class", function (d) { - _newArrowCheck(this, _this10); - return ($GRID.ygridLine + " " + (d.class || "")).trim(); - }.bind(this)).select("line")).attr("x1", isRotated ? yv : 0).attr("x2", isRotated ? yv : width).attr("y1", isRotated ? 0 : yv).attr("y2", isRotated ? height : yv).style("opacity", null); - $T(ygridLines.select("text").attr("text-anchor", getGridTextAnchor).attr("dx", getGridTextDx)).attr("dy", -5).attr("x", getGridTextX(isRotated, width, height)).attr("y", yv).text(function (d) { - _newArrowCheck(this, _this10); - return d.text; - }.bind(this)).style("opacity", null); - $el.gridLines.y = ygridLines; - }, - redrawGrid: function redrawGrid(withTransition) { - var _this11 = this, - $$ = this, - isRotated = $$.config.axis_rotated, - _$$$state2 = $$.state, - width = _$$$state2.width, - height = _$$$state2.height, gridLines = $$.$el.gridLines, $T = $$.$T, xv = $$.xv.bind($$), - lines = gridLines.x.select("line"), - texts = gridLines.x.select("text"); - lines = $T(lines, withTransition).attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? width : xv).attr("y1", isRotated ? xv : 0).attr("y2", isRotated ? xv : height); - texts = $T(texts, withTransition).attr("x", getGridTextX(!isRotated, width, height)).attr("y", xv).text(function (d) { - _newArrowCheck(this, _this11); - return d.text; - }.bind(this)); - return [lines.style("opacity", null), texts.style("opacity", null)]; + yv = $$.yv.bind($$); + let xLines = gridLines.x.select("line"), + xTexts = gridLines.x.select("text"), + yLines = gridLines.y.select("line"), + yTexts = gridLines.y.select("text"); + xLines = $T(xLines, withTransition).attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? width : xv).attr("y1", isRotated ? xv : 0).attr("y2", isRotated ? xv : height); + xTexts = $T(xTexts, withTransition).attr("x", getGridTextX(!isRotated, width, height)).attr("y", xv); + yLines = $T(yLines, withTransition).attr("x1", isRotated ? yv : 0).attr("x2", isRotated ? yv : width).attr("y1", isRotated ? 0 : yv).attr("y2", isRotated ? height : yv); + yTexts = $T(yTexts, withTransition).attr("x", getGridTextX(isRotated, width, height)).attr("y", yv); + return [xLines.style("opacity", null), xTexts.style("opacity", null), yLines.style("opacity", null), yTexts.style("opacity", null)]; }, initFocusGrid: function initFocusGrid() { - var $$ = this, + const $$ = this, config = $$.config, clip = $$.state.clip, $el = $$.$el, @@ -16219,32 +16494,32 @@ function smoothLines(el, type) { * @private */ showGridFocus: function showGridFocus(data) { - var _this12 = this, - $$ = this, + var _this10 = this; + const $$ = this, config = $$.config, - _$$$state3 = $$.state, - width = _$$$state3.width, - height = _$$$state3.height, + _$$$state2 = $$.state, + width = _$$$state2.width, + height = _$$$state2.height, isRotated = config.axis_rotated, focusEl = $$.$el.main.selectAll("line." + $FOCUS.xgridFocus + ", line." + $FOCUS.ygridFocus), dataToShow = (data || [focusEl.datum()]).filter(function (d) { - _newArrowCheck(this, _this12); + _newArrowCheck(this, _this10); return d && isValue($$.getBaseValue(d)); }.bind(this)); // Hide when bubble/scatter/stanford plot exists if (!config.tooltip_show || dataToShow.length === 0 || $$.hasType("bubble") || $$.hasArcType()) { return; } - var isEdge = config.grid_focus_edge && !config.tooltip_grouped, + const isEdge = config.grid_focus_edge && !config.tooltip_grouped, xx = $$.xx.bind($$); focusEl.style("visibility", null).data(dataToShow.concat(dataToShow)).each(function (d) { - var _this13 = this, - el = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), + var _this11 = this; + const el = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), pos = { x: xx(d), y: $$.getYScaleById(d.id)(d.value) - }, - xy; + }; + let xy; if (el.classed($FOCUS.xgridFocus)) { // will contain 'x1, y1, x2, y2' order xy = isRotated ? [null, @@ -16256,7 +16531,7 @@ function smoothLines(el, type) { pos.x // y2 ] : [pos.x, isEdge ? pos.y : null, pos.x, height]; } else { - var isY2 = $$.axis.getId(d.id) === "y2"; + const isY2 = $$.axis.getId(d.id) === "y2"; xy = isRotated ? [pos.y, // x1 isEdge && !isY2 ? pos.x : null, @@ -16267,31 +16542,31 @@ function smoothLines(el, type) { ] : [isEdge && isY2 ? pos.x : null, pos.y, isEdge && !isY2 ? pos.x : width, pos.y]; } ["x1", "y1", "x2", "y2"].forEach(function (v, i) { - _newArrowCheck(this, _this13); + _newArrowCheck(this, _this11); return el.attr(v, xy[i]); }.bind(this)); }); smoothLines(focusEl, "grid"); - $$.showCircleFocus == null ? void 0 : $$.showCircleFocus(data); + $$.showCircleFocus == null || $$.showCircleFocus(data); }, hideGridFocus: function hideGridFocus() { - var $$ = this, - _$$$state4 = $$.state, - inputType = _$$$state4.inputType, - resizing = _$$$state4.resizing, + const $$ = this, + _$$$state3 = $$.state, + inputType = _$$$state3.inputType, + resizing = _$$$state3.resizing, main = $$.$el.main; if (inputType === "mouse" || !resizing) { main.selectAll("line." + $FOCUS.xgridFocus + ", line." + $FOCUS.ygridFocus).style("visibility", "hidden"); - $$.hideCircleFocus == null ? void 0 : $$.hideCircleFocus(); + $$.hideCircleFocus == null || $$.hideCircleFocus(); } }, updateGridFocus: function updateGridFocus() { - var $$ = this, - _$$$state5 = $$.state, - inputType = _$$$state5.inputType, - width = _$$$state5.width, - height = _$$$state5.height, - resizing = _$$$state5.resizing, + const $$ = this, + _$$$state4 = $$.state, + inputType = _$$$state4.inputType, + width = _$$$state4.width, + height = _$$$state4.height, + resizing = _$$$state4.resizing, grid = $$.$el.grid, xgridFocus = grid.main.select("line." + $FOCUS.xgridFocus); if (inputType === "touch") { @@ -16301,8 +16576,8 @@ function smoothLines(el, type) { $$.showGridFocus(); } } else { - var _isRotated = $$.config.axis_rotated; - xgridFocus.attr("x1", _isRotated ? 0 : -10).attr("x2", _isRotated ? width : -10).attr("y1", _isRotated ? -10 : 0).attr("y2", _isRotated ? -10 : height); + const isRotated = $$.config.axis_rotated; + xgridFocus.attr("x1", isRotated ? 0 : -10).attr("x2", isRotated ? width : -10).attr("y1", isRotated ? -10 : 0).attr("y2", isRotated ? -10 : height); } // need to return 'true' as of being pushed to the redraw list @@ -16310,19 +16585,19 @@ function smoothLines(el, type) { return !0; }, generateGridData: function generateGridData(type, scale) { - var _this14 = this, - $$ = this, - tickNum = $$.$el.main.select("." + $AXIS.axisX).selectAll(".tick").size(), - gridData = []; + var _this12 = this; + const $$ = this, + tickNum = $$.$el.main.select("." + $AXIS.axisX).selectAll(".tick").size(); + let gridData = []; if (type === "year") { - var xDomain = $$.getXDomain(), + const xDomain = $$.getXDomain(), _xDomain$map = xDomain.map(function (v) { - _newArrowCheck(this, _this14); + _newArrowCheck(this, _this12); return v.getFullYear(); }.bind(this)), firstYear = _xDomain$map[0], lastYear = _xDomain$map[1]; - for (var i = firstYear; i <= lastYear; i++) { + for (let i = firstYear; i <= lastYear; i++) { gridData.push(new Date(i + "-01-01 00:00:00")); } } else { @@ -16330,7 +16605,7 @@ function smoothLines(el, type) { if (gridData.length > tickNum) { // use only int gridData = gridData.filter(function (d) { - _newArrowCheck(this, _this14); + _newArrowCheck(this, _this12); return (d + "").indexOf(".") < 0; }.bind(this)); } @@ -16338,37 +16613,37 @@ function smoothLines(el, type) { return gridData; }, getGridFilterToRemove: function getGridFilterToRemove(params) { - var _this15 = this; + var _this13 = this; return params ? function (line) { - var _this16 = this; - _newArrowCheck(this, _this15); - var found = !1; + var _this14 = this; + _newArrowCheck(this, _this13); + let found = !1; (isArray(params) ? params.concat() : [params]).forEach(function (param) { - _newArrowCheck(this, _this16); + _newArrowCheck(this, _this14); if ("value" in param && line.value === param.value || "class" in param && line.class === param.class) { found = !0; } }.bind(this)); return found; }.bind(this) : function () { - _newArrowCheck(this, _this15); + _newArrowCheck(this, _this13); return !0; }.bind(this); }, removeGridLines: function removeGridLines(params, forX) { - var _this17 = this, - $$ = this, + var _this15 = this; + const $$ = this, config = $$.config, $T = $$.$T, toRemove = $$.getGridFilterToRemove(params), toShow = function (line) { - _newArrowCheck(this, _this17); + _newArrowCheck(this, _this15); return !toRemove(line); }.bind(this), classLines = forX ? $GRID.xgridLines : $GRID.ygridLines, classLine = forX ? $GRID.xgridLine : $GRID.ygridLine; $T($$.$el.main.select("." + classLines).selectAll("." + classLine).filter(toRemove)).style("opacity", "0").remove(); - var gridLines = "grid_" + (forX ? "x" : "y") + "_lines"; + const gridLines = "grid_" + (forX ? "x" : "y") + "_lines"; config[gridLines] = config[gridLines].filter(toShow); } }); @@ -16383,12 +16658,12 @@ function smoothLines(el, type) { /* harmony default export */ var region = ({ initRegion: function initRegion() { - var $$ = this, + const $$ = this, $el = $$.$el; $el.region.main = $el.main.insert("g", ":first-child").attr("clip-path", $$.state.clip.path).attr("class", $REGION.regions); }, updateRegion: function updateRegion() { - var $$ = this, + const $$ = this, config = $$.config, region = $$.$el.region, $T = $$.$T; @@ -16400,34 +16675,66 @@ function smoothLines(el, type) { region.main.style("visibility", $$.hasArcType() ? "hidden" : null); // select <g> element - var regions = region.main.selectAll("." + $REGION.region).data(config.regions); + const regions = region.main.selectAll("." + $REGION.region).data(config.regions); $T(regions.exit()).style("opacity", "0").remove(); - var regionsEnter = regions.enter().append("g"); + const regionsEnter = regions.enter().append("g"); regionsEnter.append("rect").style("fill-opacity", "0"); region.list = regionsEnter.merge(regions).attr("class", $$.classRegion.bind($$)); + region.list.each(function (d) { + var _d$label; + const g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); + if (g.select("text").empty() && (_d$label = d.label) != null && _d$label.text) { + (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).append("text").style("opacity", "0"); + } + }); }, redrawRegion: function redrawRegion(withTransition) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, region = $$.$el.region, - $T = $$.$T, - regions = region.list.select("rect"); + $T = $$.$T; + let regions = region.list.select("rect"), + label = region.list.selectAll("text"); regions = $T(regions, withTransition).attr("x", $$.regionX.bind($$)).attr("y", $$.regionY.bind($$)).attr("width", $$.regionWidth.bind($$)).attr("height", $$.regionHeight.bind($$)); + label = $T(label, withTransition).attr("transform", function (d) { + var _d$label2; + _newArrowCheck(this, _this); + const _ref = (_d$label2 = d.label) != null ? _d$label2 : {}, + _ref$x = _ref.x, + x = _ref$x === void 0 ? 0 : _ref$x, + _ref$y = _ref.y, + y = _ref$y === void 0 ? 0 : _ref$y, + _ref$rotated = _ref.rotated, + rotated = _ref$rotated === void 0 ? !1 : _ref$rotated; + return "translate(" + ($$.regionX.bind($$)(d) + x) + ", " + ($$.regionY.bind($$)(d) + y) + ")" + (rotated ? " rotate(-90)" : ""); + }.bind(this)).attr("text-anchor", function (d) { + var _d$label3; + _newArrowCheck(this, _this); + return (_d$label3 = d.label) != null && _d$label3.rotated ? "end" : null; + }.bind(this)).attr("dy", "1em").style("fill", function (d) { + var _d$label$color, _d$label4; + _newArrowCheck(this, _this); + return (_d$label$color = (_d$label4 = d.label) == null ? void 0 : _d$label4.color) != null ? _d$label$color : null; + }.bind(this)).text(function (d) { + var _d$label5; + _newArrowCheck(this, _this); + return (_d$label5 = d.label) == null ? void 0 : _d$label5.text; + }.bind(this)); return [regions.style("fill-opacity", function (d) { _newArrowCheck(this, _this); return isValue(d.opacity) ? d.opacity : null; }.bind(this)).on("end", function () { // remove unnecessary rect after transition (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode).selectAll("rect:not([x])").remove(); - })]; + }), label.style("opacity", null)]; }, getRegionXY: function getRegionXY(type, d) { - var $$ = this, + const $$ = this, config = $$.config, scale = $$.scale, isRotated = config.axis_rotated, isX = type === "x"; - var key = "start", + let key = "start", currScale, pos = 0; if (d.axis === "y" || d.axis === "y2") { @@ -16451,14 +16758,14 @@ function smoothLines(el, type) { return this.getRegionXY("y", d); }, getRegionSize: function getRegionSize(type, d) { - var $$ = this, + const $$ = this, config = $$.config, scale = $$.scale, state = $$.state, isRotated = config.axis_rotated, isWidth = type === "width", start = $$[isWidth ? "regionX" : "regionY"](d); - var currScale, + let currScale, key = "end", end = state[type]; if (d.axis === "y" || d.axis === "y2") { @@ -16499,43 +16806,41 @@ function smoothLines(el, type) { * @private */ getAxisSize: function getAxisSize(id) { - var $$ = this, + const $$ = this, isRotated = $$.config.axis_rotated; return isRotated && id === "x" || !isRotated && /y2?/.test(id) ? $$.getAxisWidthByAxisId(id, !0) : $$.getHorizontalAxisHeight(id); }, getAxisWidthByAxisId: function getAxisWidthByAxisId(id, withoutRecompute) { - var $$ = this; + const $$ = this; if ($$.axis) { - var _$$$axis, - position = (_$$$axis = $$.axis) == null ? void 0 : _$$$axis.getLabelPositionById(id), - width = $$.axis.getMaxTickWidth(id, withoutRecompute), - gap = width === 0 ? .5 : 0, - _$$$config$padding; + var _$$$axis, _$$$config$padding; + const position = (_$$$axis = $$.axis) == null ? void 0 : _$$$axis.getLabelPositionById(id), + _$$$axis$getMaxTickSi = $$.axis.getMaxTickSize(id, withoutRecompute), + width = _$$$axis$getMaxTickSi.width, + gap = width === 0 ? .5 : 0; return width + (((_$$$config$padding = $$.config.padding) == null ? void 0 : _$$$config$padding.mode) === "fit" ? position.isInner ? 10 + gap : 10 : position.isInner ? 20 + gap : 40); } else { return 40; } }, getHorizontalAxisHeight: function getHorizontalAxisHeight(id) { - var _config$padding, - $$ = this, + var _config$padding, _config$padding2; + const $$ = this, config = $$.config, state = $$.state, _state = state, - current = _state.current, rotatedPadding = _state.rotatedPadding, isLegendRight = _state.isLegendRight, isLegendInset = _state.isLegendInset, isRotated = config.axis_rotated, isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit", isInner = config["axis_" + id + "_inner"], - hasLabelText = config["axis_" + id + "_label"].text, - _config$padding2, - h = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit" ? isInner && !hasLabelText ? id === "y" ? 1 : 0 : 20 : 30; + hasLabelText = config["axis_" + id + "_label"].text; + let h = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit" ? isInner && !hasLabelText ? id === "y" ? 1 : 0 : 20 : 30; if (id === "x" && !config.axis_x_show) { return 8; } - if (id === "x" && config.axis_x_height) { + if (id === "x" && isNumber(config.axis_x_height)) { return config.axis_x_height; } if (id === "y" && !config.axis_y_show) { @@ -16544,21 +16849,14 @@ function smoothLines(el, type) { if (id === "y2" && !config.axis_y2_show) { return isFitPadding ? 0 : rotatedPadding.top; } - var rotate = $$.getAxisTickRotate(id); - - // Calculate x/y axis height when tick rotated - if ((id === "x" && !isRotated || /y2?/.test(id) && isRotated) && rotate) { - h = 30 + $$.axis.getMaxTickWidth(id) * Math.cos(Math.PI * (90 - Math.abs(rotate)) / 180); - if (!config.axis_x_tick_multiline && current.height) { - if (h > current.height / 2) { - h = current.height / 2; - } - } + const maxtickSize = $$.axis.getMaxTickSize(id); + if (maxtickSize.height > 13) { + h += maxtickSize.height - 13; } return h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id === "y2" && !isRotated ? -10 : 0); }, getEventRectWidth: function getEventRectWidth() { - var $$ = this, + const $$ = this, config = $$.config, axis = $$.axis, isInverted = config.axis_x_inverted, @@ -16572,30 +16870,30 @@ function smoothLines(el, type) { * @private */ getAxisTickRotate: function getAxisTickRotate(id) { - var $$ = this, + const $$ = this, axis = $$.axis, config = $$.config, state = $$.state, $el = $$.$el; - var rotate = config["axis_" + id + "_tick_rotate"]; + let rotate = config["axis_" + id + "_tick_rotate"]; if (id === "x") { - var allowedXAxisTypes = axis.isCategorized() || axis.isTimeSeries(); + const allowedXAxisTypes = axis.isCategorized() || axis.isTimeSeries(); if (config.axis_x_tick_fit && allowedXAxisTypes) { - var xTickCount = config.axis_x_tick_count, - currentXTicksLength = state.current.maxTickWidths.x.ticks.length; - var tickCount = 0; + const xTickCount = config.axis_x_tick_count, + currentXTicksLength = state.current.maxTickSize.x.ticks.length; + let tickCount = 0; if (xTickCount) { tickCount = xTickCount > currentXTicksLength ? currentXTicksLength : xTickCount; } else if (currentXTicksLength) { tickCount = currentXTicksLength; } if (tickCount !== state.axis.x.tickCount) { - var targets = $$.data.targets; + const targets = $$.data.targets; state.axis.x.padding = $$.getXDomainPadding([$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")], tickCount); } state.axis.x.tickCount = tickCount; } - if ($el.svg && config.axis_x_tick_fit && !config.axis_x_tick_multiline && !config.axis_x_tick_culling && config.axis_x_tick_autorotate && allowedXAxisTypes) { + if ($el.svg && config.axis_x_tick_autorotate && config.axis_x_tick_fit && !config.axis_x_tick_multiline && !config.axis_x_tick_culling && allowedXAxisTypes) { rotate = $$.needToRotateXAxisTickTexts() ? config.axis_x_tick_rotate : 0; } } @@ -16607,15 +16905,16 @@ function smoothLines(el, type) { * @private */ needToRotateXAxisTickTexts: function needToRotateXAxisTickTexts() { - var $$ = this, + const $$ = this, _$$$state = $$.state, axis = _$$$state.axis, current = _$$$state.current, - xAxisLength = current.width - $$.getCurrentPaddingLeft(!1) - $$.getCurrentPaddingRight(), + xAxisLength = current.width - $$.getCurrentPaddingByDirection("left") - $$.getCurrentPaddingByDirection("right"), tickCountWithPadding = axis.x.tickCount + axis.x.padding.left + axis.x.padding.right, - maxTickWidth = $$.axis.getMaxTickWidth("x"), + _$$$axis$getMaxTickSi2 = $$.axis.getMaxTickSize("x"), + width = _$$$axis$getMaxTickSi2.width, tickLength = tickCountWithPadding ? xAxisLength / tickCountWithPadding : 0; - return maxTickWidth > tickLength; + return width > tickLength; } }); ;// CONCATENATED MODULE: ./src/config/Options/data/axis.ts @@ -16623,6 +16922,7 @@ function smoothLines(el, type) { * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license */ + /** * Axis based chart data config options */ @@ -16664,7 +16964,7 @@ function smoothLines(el, type) { * type: "timeseries" * } * } - * @see [D3's time specifier](https://github.com/d3/d3-time-format#locale_format) + * @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format) */ data_xFormat: "%Y-%m-%d", /** @@ -16812,6 +17112,7 @@ function smoothLines(el, type) { * - **log** type: * - the x values specified by [`data.x`](#.data%25E2%2580%25A4x)(or by any equivalent option), must be exclusively-positive. * - x axis min value should be >= 0. + * - for 'category' type, `data.xs` option isn't supported. * * @name axis․x․type * @memberof Options @@ -16881,7 +17182,7 @@ function smoothLines(el, type) { * @memberof Options * @type {Function|string} * @default undefined - * @see [D3's time specifier](https://github.com/d3/d3-time-format#locale_format) + * @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format) * @example * axis: { * x: { @@ -18386,8 +18687,8 @@ function smoothLines(el, type) { }); ;// CONCATENATED MODULE: ./src/config/Options/axis/axis.ts -function axis_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function axis_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? axis_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : axis_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function axis_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function axis_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? axis_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : axis_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license @@ -18523,13 +18824,16 @@ function axis_objectSpread(target) { for (var i = 1, source; i < arguments.lengt -var api = [api_axis, api_category, flow, api_grid, group, api_regions, x]; -var internal = [Axis, clip, eventrect, interactions_flow, internals_grid, region, size_axis]; -var options = [data_axis, axis_axis, common_grid]; +const api = [api_axis, api_category, flow, api_grid, group, api_regions, x]; +const internal = [Axis, clip, eventrect, interactions_flow, internals_grid, region, size_axis]; +const options = [data_axis, axis_axis, common_grid]; // EXTERNAL MODULE: external {"commonjs":"d3-interpolate","commonjs2":"d3-interpolate","amd":"d3-interpolate","root":"d3"} var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(12); ;// CONCATENATED MODULE: ./src/ChartInternal/shape/arc.ts + +function arc_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function arc_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? arc_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : arc_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license @@ -18552,7 +18856,7 @@ function getRadiusFn(expandRate) { if (expandRate === void 0) { expandRate = 0; } - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, hasMultiArcGauge = $$.hasMultiArcGauge(), @@ -18566,7 +18870,7 @@ function getRadiusFn(expandRate) { * @private */ inner: function inner(d) { - var _$$$getRadius = $$.getRadius(d), + const _$$$getRadius = $$.getRadius(d), innerRadius = _$$$getRadius.innerRadius; return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0; }, @@ -18577,9 +18881,9 @@ function getRadiusFn(expandRate) { * @private */ outer: function outer(d) { - var _$$$getRadius2 = $$.getRadius(d), + const _$$$getRadius2 = $$.getRadius(d), outerRadius = _$$$getRadius2.outerRadius; - var radius; + let radius; if (hasMultiArcGauge) { radius = state.radius - singleArcWidth * d.index + expandWidth; } else if ($$.hasType("polar") && !expandRate) { @@ -18587,7 +18891,7 @@ function getRadiusFn(expandRate) { } else { radius = outerRadius; if (expandRate) { - var radiusExpanded = state.radiusExpanded; + let radiusExpanded = state.radiusExpanded; if (state.radius !== outerRadius) { radiusExpanded -= Math.abs(state.radius - outerRadius); } @@ -18604,13 +18908,13 @@ function getRadiusFn(expandRate) { * @private */ corner: function (d, outerRadius) { - var _config$arc_cornerRad = config.arc_cornerRadius_ratio, + const _config$arc_cornerRad = config.arc_cornerRadius_ratio, ratio = _config$arc_cornerRad === void 0 ? 0 : _config$arc_cornerRad, _config$arc_cornerRad2 = config.arc_cornerRadius, cornerRadius = _config$arc_cornerRad2 === void 0 ? 0 : _config$arc_cornerRad2, id = d.data.id, value = d.value; - var corner = 0; + let corner = 0; if (ratio) { corner = ratio * outerRadius; } else { @@ -18629,34 +18933,58 @@ function getRadiusFn(expandRate) { */ function getAttrTweenFn(fn) { return function (d) { - var interpolate = (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolate)(this._current, d); + var _this2 = this; + const getAngleKeyValue = function (_ref) { + let _ref$startAngle = _ref.startAngle, + startAngle = _ref$startAngle === void 0 ? 0 : _ref$startAngle, + _ref$endAngle = _ref.endAngle, + endAngle = _ref$endAngle === void 0 ? 0 : _ref$endAngle, + _ref$padAngle = _ref.padAngle, + padAngle = _ref$padAngle === void 0 ? 0 : _ref$padAngle; + _newArrowCheck(this, _this2); + return { + startAngle: startAngle, + endAngle: endAngle, + padAngle: padAngle + }; + }.bind(this), + interpolate = (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolate)(getAngleKeyValue(this._current), getAngleKeyValue(d)); // d3.interpolate interpolates id value, if id is given as color string(ex. gold, silver, etc) + // to avoid unexpected behavior, interpolate only angle values + // https://github.com/naver/billboard.js/issues/3321 this._current = d; return function (t) { - var interpolated = interpolate(t); - return fn(interpolated); + const interpolated = interpolate(t), + data = d.data, + index = d.index, + value = d.value; + return fn(arc_objectSpread(arc_objectSpread({}, interpolated), {}, { + data: data, + index: index, + value: value + })); }; }; } /* harmony default export */ var arc = ({ initPie: function initPie() { - var _this2 = this, - $$ = this, + var _this3 = this; + const $$ = this, config = $$.config, dataType = config.data_type, padding = config[dataType + "_padding"], startingAngle = config[dataType + "_startingAngle"] || 0, padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0; $$.pie = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.pie)().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) { - var _this3 = this; - _newArrowCheck(this, _this2); + var _this4 = this; + _newArrowCheck(this, _this3); return d.values.reduce(function (a, b) { - _newArrowCheck(this, _this3); + _newArrowCheck(this, _this4); return a + b.value; }.bind(this), 0); }.bind(this)).sort($$.getSortCompareFn.bind($$)(!0)); }, updateRadius: function updateRadius() { - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, dataType = config.data_type, @@ -18668,7 +18996,7 @@ function getAttrTweenFn(fn) { state.radius = state.radiusExpanded * .95; state.innerRadiusRatio = w ? (state.radius - w) / state.radius : .6; state.gaugeArcWidth = w || (gaugeArcWidth <= state.radius - state.innerRadius ? state.radius - state.innerRadius : gaugeArcWidth <= state.radius ? gaugeArcWidth : state.radius); - var innerRadius = config.pie_innerRadius || (padding ? padding * (state.innerRadiusRatio + .1) : 0); + const innerRadius = config.pie_innerRadius || (padding ? padding * (state.innerRadiusRatio + .1) : 0); // NOTE: inner/outerRadius can be an object by user setting, only for 'pie' type state.outerRadius = config.pie_outerRadius; @@ -18681,9 +19009,9 @@ function getAttrTweenFn(fn) { * @private */ getRadius: function getRadius(d) { - var $$ = this, + const $$ = this, data = d == null ? void 0 : d.data; - var _$$$state = $$.state, + let _$$$state = $$.state, innerRadius = _$$$state.innerRadius, outerRadius = _$$$state.outerRadius; if (!isNumber(innerRadius) && data) { @@ -18700,16 +19028,16 @@ function getAttrTweenFn(fn) { }; }, updateArc: function updateArc() { - var $$ = this; + const $$ = this; $$.updateRadius(); $$.svgArc = $$.getSvgArc(); $$.svgArcExpanded = $$.getSvgArcExpanded(); }, getArcLength: function getArcLength() { - var $$ = this, + const $$ = this, config = $$.config, arcLengthInPercent = config.gauge_arcLength * 3.6; - var len = 2 * (arcLengthInPercent / 360); + let len = 2 * (arcLengthInPercent / 360); if (arcLengthInPercent < -360) { len = -2; } else if (arcLengthInPercent > 360) { @@ -18718,12 +19046,12 @@ function getAttrTweenFn(fn) { return len * Math.PI; }, getGaugeStartAngle: function getGaugeStartAngle() { - var $$ = this, + const $$ = this, config = $$.config, isFullCircle = config.gauge_fullCircle, defaultStartAngle = -1 * Math.PI / 2, defaultEndAngle = Math.PI / 2; - var startAngle = config.gauge_startingAngle; + let startAngle = config.gauge_startingAngle; if (!isFullCircle && startAngle <= defaultStartAngle) { startAngle = defaultStartAngle; } else if (!isFullCircle && startAngle >= defaultEndAngle) { @@ -18734,20 +19062,20 @@ function getAttrTweenFn(fn) { return startAngle; }, updateAngle: function updateAngle(dValue) { - var _this4 = this, - $$ = this, + var _this5 = this; + const $$ = this, config = $$.config, - state = $$.state, - pie = $$.pie, + state = $$.state; + let pie = $$.pie, d = dValue, found = !1; if (!config) { return null; } - var gStart = $$.getGaugeStartAngle(), + const gStart = $$.getGaugeStartAngle(), radius = config.gauge_fullCircle ? $$.getArcLength() : gStart * -2; if (d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge()) { - var min = config.gauge_min, + const min = config.gauge_min, max = config.gauge_max, totalSum = $$.getTotalDataSum(state.rendered); // to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value // https://github.com/naver/billboard.js/issues/2123 @@ -18755,7 +19083,7 @@ function getAttrTweenFn(fn) { } pie($$.filterTargetsToShow()).forEach(function (t, i) { var _d$data; - _newArrowCheck(this, _this4); + _newArrowCheck(this, _this5); if (!found && t.data.id === ((_d$data = d.data) == null ? void 0 : _d$data.id)) { found = !0; d = t; @@ -18769,7 +19097,7 @@ function getAttrTweenFn(fn) { d.endAngle = d.startAngle; } if (d.data && $$.hasMultiArcGauge()) { - var gMin = config.gauge_min, + const gMin = config.gauge_min, gMax = config.gauge_max, gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : gMax - gMin; d.startAngle = gStart; @@ -18778,17 +19106,17 @@ function getAttrTweenFn(fn) { return found ? d : null; }, getSvgArc: function getSvgArc() { - var $$ = this, + const $$ = this, _getRadiusFn$call = getRadiusFn.call($$), inner = _getRadiusFn$call.inner, outer = _getRadiusFn$call.outer, corner = _getRadiusFn$call.corner, arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(inner).outerRadius(outer), newArc = function (d, withoutUpdate) { - var path = "M 0 0"; + let path = "M 0 0"; if (d.value || d.data) { - var _$$$updateAngle, - data = withoutUpdate ? d : (_$$$updateAngle = $$.updateAngle(d)) != null ? _$$$updateAngle : null; + var _$$$updateAngle; + const data = withoutUpdate ? d : (_$$$updateAngle = $$.updateAngle(d)) != null ? _$$$updateAngle : null; if (data) { path = arc.cornerRadius(corner(data, outer(data)))(data); } @@ -18806,21 +19134,21 @@ function getAttrTweenFn(fn) { * @private */ getSvgArcExpanded: function getSvgArcExpanded(rate) { - var _this5 = this; + var _this6 = this; if (rate === void 0) { rate = 1; } - var $$ = this, + const $$ = this, _getRadiusFn$call2 = getRadiusFn.call($$, rate), inner = _getRadiusFn$call2.inner, outer = _getRadiusFn$call2.outer, corner = _getRadiusFn$call2.corner, arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(inner).outerRadius(outer); return function (d) { - _newArrowCheck(this, _this5); - var updated = $$.updateAngle(d), + _newArrowCheck(this, _this6); + const updated = $$.updateAngle(d), outerR = outer(updated); - var cornerR = 0; + let cornerR = 0; if (updated) { cornerR = corner(updated, outerR); } @@ -18837,35 +19165,35 @@ function getAttrTweenFn(fn) { * @private */ transformForArcLabel: function transformForArcLabel(d) { - var _this6 = this, - $$ = this, + var _this7 = this; + const $$ = this, config = $$.config, radiusExpanded = $$.state.radiusExpanded, - updated = $$.updateAngle(d), - translate = ""; + updated = $$.updateAngle(d); + let translate = ""; if (updated) { if ($$.hasMultiArcGauge()) { - var y1 = Math.sin(updated.endAngle - Math.PI / 2), + const y1 = Math.sin(updated.endAngle - Math.PI / 2), x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + 25), y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3; translate = "translate(" + x + "," + y + ")"; } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) { - var _filter$map, - _$$$getRadius3 = $$.getRadius(d), + var _filter$map; + let _$$$getRadius3 = $$.getRadius(d), outerRadius = _$$$getRadius3.outerRadius; if ($$.hasType("polar")) { outerRadius = $$.getPolarOuterRadius(d, outerRadius); } - var c = this.svgArc.centroid(updated), + const c = this.svgArc.centroid(updated), _c$map = c.map(function (v) { - _newArrowCheck(this, _this6); + _newArrowCheck(this, _this7); return isNaN(v) ? 0 : v; }.bind(this)), x = _c$map[0], y = _c$map[1], h = Math.sqrt(x * x + y * y); - var ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) { - _newArrowCheck(this, _this6); + let ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) { + _newArrowCheck(this, _this7); return config[v + "_label_ratio"]; }.bind(this))) == null ? void 0 : _filter$map[0]; if (ratio) { @@ -18887,17 +19215,17 @@ function getAttrTweenFn(fn) { }); }, textForArcLabel: function textForArcLabel(selection) { - var $$ = this, + const $$ = this, hasGauge = $$.hasType("gauge"); if ($$.shouldShowArcLabel()) { - selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBacgroundColor.bind($$)).each(function (d) { - var _filter, - node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), + selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBackgroundColor.bind($$)).each(function (d) { + var _filter; + const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), updated = $$.updateAngle(d), ratio = $$.getRatio("arc", updated), isUnderThreshold = $$.meetsLabelThreshold(ratio, (_filter = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _filter[0]); if (isUnderThreshold) { - var value = (updated || d).value, + const value = (updated || d).value, text = ($$.getArcLabelFormat() || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString(); setTextValue(node, text, [-1, 1], hasGauge); } else { @@ -18907,14 +19235,14 @@ function getAttrTweenFn(fn) { } }, expandArc: function expandArc(targetIds) { - var _this7 = this, - $$ = this, + var _this8 = this; + const $$ = this, transiting = $$.state.transiting, $el = $$.$el; // MEMO: avoid to cancel transition if (transiting) { - var interval = setInterval(function () { - _newArrowCheck(this, _this7); + const interval = setInterval(function () { + _newArrowCheck(this, _this8); if (!transiting) { clearInterval(interval); $el.legend.selectAll("." + $FOCUS.legendItemFocused).size() > 0 && $$.expandArc(targetIds); @@ -18922,27 +19250,27 @@ function getAttrTweenFn(fn) { }.bind(this), 10); return; } - var newTargetIds = $$.mapToTargetIds(targetIds); + const newTargetIds = $$.mapToTargetIds(targetIds); $el.svg.selectAll($$.selectorTargets(newTargetIds, "." + $ARC.chartArc)).each(function (d) { if (!$$.shouldExpand(d.data.id)) { return; } - var expandDuration = $$.getExpandConfig(d.data.id, "duration"), + const expandDuration = $$.getExpandConfig(d.data.id, "duration"), svgArcExpandedSub = $$.getSvgArcExpanded($$.getExpandConfig(d.data.id, "rate")); (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).selectAll("path").transition().duration(expandDuration).attrTween("d", getAttrTweenFn($$.svgArcExpanded.bind($$))).transition().duration(expandDuration * 2).attrTween("d", getAttrTweenFn(svgArcExpandedSub.bind($$))); }); }, unexpandArc: function unexpandArc(targetIds) { - var _this8 = this, - $$ = this, + var _this9 = this; + const $$ = this, transiting = $$.state.transiting, svg = $$.$el.svg; if (transiting) { return; } - var newTargetIds = $$.mapToTargetIds(targetIds); + const newTargetIds = $$.mapToTargetIds(targetIds); svg.selectAll($$.selectorTargets(newTargetIds, "." + $ARC.chartArc)).selectAll("path").transition().duration(function (d) { - _newArrowCheck(this, _this8); + _newArrowCheck(this, _this9); return $$.getExpandConfig(d.data.id, "duration"); }.bind(this)).attrTween("d", getAttrTweenFn($$.svgArc.bind($$))); svg.selectAll("" + $ARC.arc).style("opacity", null); @@ -18955,9 +19283,9 @@ function getAttrTweenFn(fn) { * @private */ getExpandConfig: function getExpandConfig(id, key) { - var $$ = this, + const $$ = this, config = $$.config; - var type; + let type; if ($$.isDonutType(id)) { type = "donut"; } else if ($$.isGaugeType(id)) { @@ -18971,36 +19299,36 @@ function getAttrTweenFn(fn) { }[key]; }, shouldExpand: function shouldExpand(id) { - var $$ = this, + const $$ = this, config = $$.config; return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand; }, shouldShowArcLabel: function shouldShowArcLabel() { - var _this9 = this, - $$ = this, + var _this10 = this; + const $$ = this, config = $$.config; return ["donut", "gauge", "pie", "polar"].some(function (v) { - _newArrowCheck(this, _this9); + _newArrowCheck(this, _this10); return $$.hasType(v) && config[v + "_label_show"]; }.bind(this)); }, getArcLabelFormat: function getArcLabelFormat() { - var _this10 = this, - $$ = this, - config = $$.config, - format = function (v) { - _newArrowCheck(this, _this10); - return v; - }.bind(this); + var _this11 = this; + const $$ = this, + config = $$.config; + let format = function (v) { + _newArrowCheck(this, _this11); + return v; + }.bind(this); ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) { - _newArrowCheck(this, _this10); + _newArrowCheck(this, _this11); format = config[v + "_label_format"]; }.bind(this)); return isFunction(format) ? format.bind($$.api) : format; }, updateTargetsForArc: function updateTargetsForArc(targets) { - var _this11 = this, - $$ = this, + var _this12 = this; + const $$ = this, $el = $$.$el, hasGauge = $$.hasType("gauge"), classChartArc = $$.getChartClass("Arc"), @@ -19008,7 +19336,7 @@ function getAttrTweenFn(fn) { classFocus = $$.classFocus.bind($$), chartArcs = $el.main.select("." + $ARC.chartArcs), mainPieUpdate = chartArcs.selectAll("." + $ARC.chartArc).data($$.pie(targets)).attr("class", function (d) { - _newArrowCheck(this, _this11); + _newArrowCheck(this, _this12); return classChartArc(d) + classFocus(d.data); }.bind(this)), mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc).call(this.setCssRule(!1, "." + $ARC.chartArcs + " text", ["pointer-events:none", "text-anchor:middle"])); @@ -19019,7 +19347,7 @@ function getAttrTweenFn(fn) { // mainPieUpdate.exit().remove(); }, initArc: function initArc() { - var $$ = this, + const $$ = this, $el = $$.$el; $el.arcs = $el.main.select("." + $COMMON.chart).append("g").attr("class", $ARC.chartArcs).attr("transform", $$.getTranslate("arc")); $$.setArcTitle(); @@ -19030,12 +19358,12 @@ function getAttrTweenFn(fn) { * @private */ setArcTitle: function setArcTitle(str) { - var $$ = this, + const $$ = this, title = str || $$.getArcTitle(), hasGauge = $$.hasType("gauge"); if (title) { - var className = hasGauge ? $GAUGE.chartArcsGaugeTitle : $ARC.chartArcsTitle; - var text = $$.$el.arcs.select("." + className); + const className = hasGauge ? $GAUGE.chartArcsGaugeTitle : $ARC.chartArcsTitle; + let text = $$.$el.arcs.select("." + className); if (text.empty()) { text = $$.$el.arcs.append("text").attr("class", className).style("text-anchor", "middle"); } @@ -19049,7 +19377,7 @@ function getAttrTweenFn(fn) { * @private */ getArcTitle: function getArcTitle() { - var $$ = this, + const $$ = this, type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge"; return type ? $$.config[type + "_title"] : ""; }, @@ -19059,12 +19387,12 @@ function getAttrTweenFn(fn) { * @private */ getArcTitleWithNeedleValue: function getArcTitleWithNeedleValue() { - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, title = $$.getArcTitle(); if (title && $$.config.arc_needle_show && /{=[A-Z_]+}/.test(title)) { - var value = state.current.needle; + let value = state.current.needle; if (!isNumber(value)) { value = config.arc_needle_value; } @@ -19075,20 +19403,20 @@ function getAttrTweenFn(fn) { return !1; }, redrawArc: function redrawArc(duration, durationForExit, withTransform) { - var _this12 = this, - $$ = this, + var _this13 = this; + const $$ = this, config = $$.config, state = $$.state, main = $$.$el.main, hasInteraction = config.interaction_enabled, - isSelectable = hasInteraction && config.data_selection_isselectable, - mainArc = main.selectAll("." + $ARC.arcs).selectAll("." + $ARC.arc).data($$.arcData.bind($$)); + isSelectable = hasInteraction && config.data_selection_isselectable; + let mainArc = main.selectAll("." + $ARC.arcs).selectAll("." + $ARC.arc).data($$.arcData.bind($$)); mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove(); mainArc = mainArc.enter().append("path").attr("class", $$.getClass("arc", !0)).style("fill", function (d) { - _newArrowCheck(this, _this12); + _newArrowCheck(this, _this13); return $$.color(d.data); }.bind(this)).style("cursor", function (d) { - _newArrowCheck(this, _this12); + _newArrowCheck(this, _this13); return isSelectable != null && isSelectable.bind != null && isSelectable.bind($$.api)(d) ? "pointer" : null; }.bind(this)).style("opacity", "0").each(function (d) { if ($$.isGaugeType(d.data)) { @@ -19102,19 +19430,19 @@ function getAttrTweenFn(fn) { $$.hasMultiArcGauge() && $$.redrawMultiArcGauge(); } mainArc.attr("transform", function (d) { - _newArrowCheck(this, _this12); + _newArrowCheck(this, _this13); return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : ""; }.bind(this)).style("opacity", function (d) { return d === this._current ? "0" : null; }).each(function () { - _newArrowCheck(this, _this12); + _newArrowCheck(this, _this13); state.transiting = !0; }.bind(this)).transition().duration(duration).attrTween("d", function (d) { - var _this13 = this, - updated = $$.updateAngle(d); + var _this14 = this; + const updated = $$.updateAngle(d); if (!updated) { return function () { - _newArrowCheck(this, _this13); + _newArrowCheck(this, _this14); return "M 0 0"; }.bind(this); } @@ -19124,17 +19452,17 @@ function getAttrTweenFn(fn) { if (isNaN(this._current.endAngle)) { this._current.endAngle = this._current.startAngle; } - var interpolate = (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolate)(this._current, updated); + const interpolate = (0,external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_.interpolate)(this._current, updated); this._current = interpolate(0); return function (t) { - var interpolated = interpolate(t); + const interpolated = interpolate(t); interpolated.data = d.data; // data.id will be updated by interporator return $$.getArc(interpolated, !0); }; }).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) { - _newArrowCheck(this, _this12); - var color; + _newArrowCheck(this, _this13); + let color; if ($$.levelColor) { color = $$.levelColor(d.data.values[0].value); @@ -19148,8 +19476,8 @@ function getAttrTweenFn(fn) { // Where gauge reading color would receive customization. .style("opacity", null).call(endall, function () { if ($$.levelColor) { - var path = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), - d = path.datum(); + const path = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), + d = path.datum(this._current); $$.updateLegendItemColor(d.data.id, path.style("fill")); } state.transiting = !1; @@ -19168,17 +19496,19 @@ function getAttrTweenFn(fn) { * @private */ redrawNeedle: function redrawNeedle() { - var _this14 = this, - $$ = this, + var _this15 = this; + const $$ = this, $el = $$.$el, config = $$.config, _$$$state2 = $$.state, hiddenTargetIds = _$$$state2.hiddenTargetIds, radius = _$$$state2.radius, length = (radius - 1) / 100 * config.arc_needle_length, - hasDataToShow = hiddenTargetIds.length !== $$.data.targets.length, - needle = $$.$el.arcs.select("." + $ARC.needle), - pathFn = config.arc_needle_path, + hasDataToShow = hiddenTargetIds.length !== $$.data.targets.length; + let needle = $$.$el.arcs.select("." + $ARC.needle); + + // needle options + const pathFn = config.arc_needle_path, baseWidth = config.arc_needle_bottom_width / 2, topWidth = config.arc_needle_top_width / 2, topRx = config.arc_needle_top_rx, @@ -19188,10 +19518,10 @@ function getAttrTweenFn(fn) { bottomRy = config.arc_needle_bottom_ry, needleAngle = $$.getNeedleAngle(), updateNeedleValue = function () { - _newArrowCheck(this, _this14); - var title = $$.getArcTitleWithNeedleValue(); + _newArrowCheck(this, _this15); + const title = $$.getArcTitleWithNeedleValue(); title && $$.setArcTitle(title); - }.bind(this); // needle options + }.bind(this); updateNeedleValue(); if (needle.empty()) { needle = $el.arcs.append("path").classed($ARC.needle, !0); @@ -19204,14 +19534,14 @@ function getAttrTweenFn(fn) { * @private */ $el.needle.updateHelper = function (v, updateConfig) { - var _this15 = this; + var _this16 = this; if (updateConfig === void 0) { updateConfig = !1; } - _newArrowCheck(this, _this14); + _newArrowCheck(this, _this15); if ($el.needle.style("display") !== "none") { $$.$T($el.needle).style("transform", "rotate(" + $$.getNeedleAngle(v) + "deg)").call(endall, function () { - _newArrowCheck(this, _this15); + _newArrowCheck(this, _this16); updateConfig && (config.arc_needle_value = v); updateNeedleValue(); }.bind(this)); @@ -19219,7 +19549,7 @@ function getAttrTweenFn(fn) { }.bind(this); } if (hasDataToShow) { - var path = isFunction(pathFn) ? pathFn.call($$, length) : "M-" + baseWidth + " " + bottomLen + " A" + bottomRx + " " + bottomRy + " 0 0 0 " + baseWidth + " " + bottomLen + " L" + topWidth + " -" + length + " A" + topRx + " " + topRy + " 0 0 0 -" + topWidth + " -" + length + " L-" + baseWidth + " " + bottomLen + " Z"; + const path = isFunction(pathFn) ? pathFn.call($$, length) : "M-" + baseWidth + " " + bottomLen + " A" + bottomRx + " " + bottomRy + " 0 0 0 " + baseWidth + " " + bottomLen + " L" + topWidth + " -" + length + " A" + topRx + " " + topRy + " 0 0 0 -" + topWidth + " -" + length + " L-" + baseWidth + " " + bottomLen + " Z"; $$.$T(needle).attr("d", path).style("fill", config.arc_needle_color).style("display", null).style("transform", "rotate(" + needleAngle + "deg)"); } else { needle.style("display", "none"); @@ -19232,13 +19562,13 @@ function getAttrTweenFn(fn) { * @private */ getNeedleAngle: function getNeedleAngle(v) { - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, arcLength = $$.getArcLength(), hasGauge = $$.hasType("gauge"), total = $$.getTotalDataSum(!0); - var value = isDefined(v) ? v : config.arc_needle_value, + let value = isDefined(v) ? v : config.arc_needle_value, startingAngle = config[config.data_type + "_startingAngle"] || 0, radian = 0; if (!isNumber(value)) { @@ -19247,39 +19577,39 @@ function getAttrTweenFn(fn) { state.current.needle = value; if (hasGauge) { startingAngle = $$.getGaugeStartAngle(); - var _radius = config.gauge_fullCircle ? arcLength : startingAngle * -2, + const radius = config.gauge_fullCircle ? arcLength : startingAngle * -2, min = config.gauge_min, max = config.gauge_max; - radian = _radius * ((value - min) / (max - min)); + radian = radius * ((value - min) / (max - min)); } else { radian = arcLength * (value / total); } return (startingAngle + radian) * (180 / Math.PI); }, redrawBackgroundArcs: function redrawBackgroundArcs() { - var _this16 = this, - $$ = this, + var _this17 = this; + const $$ = this, config = $$.config, state = $$.state, hasMultiArcGauge = $$.hasMultiArcGauge(), isFullCircle = config.gauge_fullCircle, showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 && !!config.data_empty_label_text, startAngle = $$.getGaugeStartAngle(), - endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1, - backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground); + endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1; + let backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground); if (hasMultiArcGauge) { - var index = 0; + let index = 0; backgroundArc = backgroundArc.selectAll("path." + $ARC.chartArcsBackground).data($$.data.targets); backgroundArc.enter().append("path").attr("class", function (d, i) { - _newArrowCheck(this, _this16); + _newArrowCheck(this, _this17); return $ARC.chartArcsBackground + " " + $ARC.chartArcsBackground + "-" + i; - }.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref2) { - var id = _ref2.id; - _newArrowCheck(this, _this16); + }.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref3) { + let id = _ref3.id; + _newArrowCheck(this, _this17); if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) { return "M 0 0"; } - var d = { + const d = { data: [{ value: config.gauge_max }], @@ -19292,8 +19622,8 @@ function getAttrTweenFn(fn) { backgroundArc.exit().remove(); } else { backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () { - _newArrowCheck(this, _this16); - var d = { + _newArrowCheck(this, _this17); + const d = { data: [{ value: config.gauge_max }], @@ -19305,8 +19635,8 @@ function getAttrTweenFn(fn) { } }, bindArcEvent: function bindArcEvent(arc) { - var _this17 = this, - $$ = this, + var _this18 = this; + const $$ = this, config = $$.config, state = $$.state, isTouch = state.inputType === "touch", @@ -19322,18 +19652,18 @@ function getAttrTweenFn(fn) { // eslint-disable-next-line function unselectArc(arcData) { - var id = (arcData == null ? void 0 : arcData.id) || undefined; + const id = (arcData == null ? void 0 : arcData.id) || undefined; $$.unexpandArc(id); $$.api.revert(); $$.revertLegend(); $$.hideTooltip(); } arc.on("click", function (event, d, i) { - var updated = $$.updateAngle(d); - var arcData; + const updated = $$.updateAngle(d); + let arcData; if (updated) { arcData = $$.convertToArcData(updated); - $$.toggleShape == null ? void 0 : $$.toggleShape(this, arcData, i); + $$.toggleShape == null || $$.toggleShape(this, arcData, i); config.data_onclick.bind($$.api)(arcData, this); } }); @@ -19347,24 +19677,24 @@ function getAttrTweenFn(fn) { return; } state.event = event; - var updated = $$.updateAngle(d), + const updated = $$.updateAngle(d), arcData = updated ? $$.convertToArcData(updated) : null, id = ((_arcData = arcData) == null ? void 0 : _arcData.id) || undefined; selectArc(this, arcData, id); $$.setOverOut(!0, arcData); }).on("mouseout", function (event, d) { - _newArrowCheck(this, _this17); + _newArrowCheck(this, _this18); if (state.transiting) { // skip while transiting return; } state.event = event; - var updated = $$.updateAngle(d), + const updated = $$.updateAngle(d), arcData = updated ? $$.convertToArcData(updated) : null; unselectArc(); $$.setOverOut(!1, arcData); }.bind(this)).on("mousemove", function (event, d) { - var updated = $$.updateAngle(d), + const updated = $$.updateAngle(d), arcData = updated ? $$.convertToArcData(updated) : null; state.event = event; $$.showTooltip([arcData], this); @@ -19373,10 +19703,16 @@ function getAttrTweenFn(fn) { // touch events if (isTouch && $$.hasArcType() && !$$.radars) { - var getEventArc = function (event) { - _newArrowCheck(this, _this17); - var touch = event.changedTouches[0], - eventArc = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.elementFromPoint(touch.clientX, touch.clientY)); + const getEventArc = function (event) { + var _event$changedTouches, _event$changedTouches2; + _newArrowCheck(this, _this18); + const _ref4 = (_event$changedTouches = (_event$changedTouches2 = event.changedTouches) == null ? void 0 : _event$changedTouches2[0]) != null ? _event$changedTouches : { + clientX: 0, + clientY: 0 + }, + clientX = _ref4.clientX, + clientY = _ref4.clientY, + eventArc = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.elementFromPoint(clientX, clientY)); return eventArc; }.bind(this); $$.$el.svg.on("touchstart touchmove", function (event) { @@ -19386,7 +19722,7 @@ function getAttrTweenFn(fn) { return; } state.event = event; - var eventArc = getEventArc(event), + const eventArc = getEventArc(event), datum = eventArc.datum(), updated = (_datum = datum) != null && _datum.data && datum.data.id ? $$.updateAngle(datum) : null, arcData = updated ? $$.convertToArcData(updated) : null, @@ -19397,34 +19733,35 @@ function getAttrTweenFn(fn) { } }, redrawArcText: function redrawArcText(duration) { - var _this18 = this, - $$ = this, + var _this19 = this; + const $$ = this, config = $$.config, state = $$.state, _$$$$el = $$.$el, main = _$$$$el.main, arcs = _$$$$el.arcs, hasGauge = $$.hasType("gauge"), - hasMultiArcGauge = $$.hasMultiArcGauge(), - text; + hasMultiArcGauge = $$.hasMultiArcGauge(); + let text; + // for gauge type, update text when has no title & multi data if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) { text = main.selectAll("." + $ARC.chartArc).select("text").style("opacity", "0").attr("class", function (d) { - _newArrowCheck(this, _this18); + _newArrowCheck(this, _this19); return $$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null; }.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) { - _newArrowCheck(this, _this18); + _newArrowCheck(this, _this19); return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? Math.round(state.radius / 5) + "px" : null; }.bind(this)).transition().duration(duration).style("opacity", function (d) { - _newArrowCheck(this, _this18); + _newArrowCheck(this, _this19); return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0"; }.bind(this)); hasMultiArcGauge && text.attr("dy", "-.1em"); } main.select("." + $ARC.chartArcsTitle).style("opacity", $$.hasType("donut") || hasGauge ? null : "0"); if (hasGauge) { - var _text, - isFullCircle = config.gauge_fullCircle; + var _text; + const isFullCircle = config.gauge_fullCircle; isFullCircle && ((_text = text) == null ? void 0 : _text.attr("dy", "" + (hasMultiArcGauge ? 0 : Math.round(state.radius / 14)))); if (config.gauge_label_show) { arcs.select("." + $GAUGE.chartArcsGaugeUnit).attr("dy", (isFullCircle ? 1.5 : .75) + "em").text(config.gauge_units); @@ -19434,6 +19771,25 @@ function getAttrTweenFn(fn) { isFullCircle || arcs.select("." + $GAUGE.chartArcsGaugeMax).attr("dx", state.innerRadius + (state.radius - state.innerRadius) / 2 + "px").attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, !0)); } } + }, + /** + * Get Arc element by id or index + * @param {string|number} value id or index of Arc + * @returns {d3Selection} Arc path element + * @private + */ + getArcElementByIdOrIndex: function getArcElementByIdOrIndex(value) { + var _this20 = this; + const $$ = this, + arcs = $$.$el.arcs, + filterFn = isNumber(value) ? function (d) { + _newArrowCheck(this, _this20); + return d.index === value; + }.bind(this) : function (d) { + _newArrowCheck(this, _this20); + return d.data.id === value; + }.bind(this); + return arcs == null ? void 0 : arcs.selectAll("." + $COMMON.target + " path").filter(filterFn); } }); ;// CONCATENATED MODULE: ./src/ChartInternal/shape/area.ts @@ -19448,7 +19804,7 @@ function getAttrTweenFn(fn) { /* harmony default export */ var shape_area = ({ initArea: function initArea(mainLine) { - var $$ = this, + const $$ = this, config = $$.config; mainLine.insert("g", "." + (config.area_front ? $CIRCLE.circles : $LINE.lines)).attr("class", $$.getClass("areas", !0)); }, @@ -19459,7 +19815,7 @@ function getAttrTweenFn(fn) { * @private */ updateAreaColor: function updateAreaColor(d) { - var $$ = this; + const $$ = this; return $$.config.area_linearGradient ? $$.getGradienColortUrl(d.id) : $$.color(d); }, /** @@ -19472,14 +19828,14 @@ function getAttrTweenFn(fn) { if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, $el = $$.$el, $T = $$.$T, $root = isSub ? $el.subchart : $el; config.area_linearGradient && $$.updateLinearGradient(); - var area = $root.main.selectAll("." + $AREA.areas).selectAll("." + $AREA.area).data($$.lineData.bind($$)); + const area = $root.main.selectAll("." + $AREA.areas).selectAll("." + $AREA.area).data($$.lineData.bind($$)); $T(area.exit(), withTransition).style("opacity", "0").remove(); $root.area = area.enter().append("path").attr("class", $$.getClass("area", !0)).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function () { state.orgAreaOpacity = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).style("opacity"); @@ -19502,7 +19858,7 @@ function getAttrTweenFn(fn) { if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, _ref = isSub ? this.$el.subchart : this.$el, area = _ref.area, orgAreaOpacity = $$.state.orgAreaOpacity; @@ -19519,8 +19875,8 @@ function getAttrTweenFn(fn) { * @private */ generateDrawArea: function generateDrawArea(areaIndices, isSub) { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, lineConnectNull = config.line_connectNull, isRotated = config.axis_rotated, @@ -19541,12 +19897,12 @@ function getAttrTweenFn(fn) { return function (d) { var _this3 = this; _newArrowCheck(this, _this2); - var values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values, + let values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values, x0 = 0, y0 = 0, path; if ($$.isAreaType(d)) { - var area = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.area)(); + let area = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.area)(); area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : config.area_below ? $$.state.height : value0).y1(value1); if (!lineConnectNull) { area = area.defined(function (d) { @@ -19570,18 +19926,18 @@ function getAttrTweenFn(fn) { }, generateGetAreaPoints: function generateGetAreaPoints(areaIndices, isSub) { // partial duplication of generateGetBarPoints - var $$ = this, + const $$ = this, config = $$.config, x = $$.getShapeX(0, areaIndices, isSub), y = $$.getShapeY(!!isSub), areaOffset = $$.getShapeOffset($$.isAreaType, areaIndices, isSub), yScale = $$.getYScaleById.bind($$); return function (d, i) { - var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)), + const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)), offset = areaOffset(d, i) || y0, posX = x(d), value = d.value; // offset is for stacked area chart - var posY = y(d); + let posY = y(d); // fix posY not to overflow opposite quadrant if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) { @@ -19607,7 +19963,7 @@ function getAttrTweenFn(fn) { /* harmony default export */ var bar = ({ initBar: function initBar() { - var $el = this.$el, + const $el = this.$el, config = this.config, clip = this.state.clip; $el.bar = $el.main.select("." + $COMMON.chart); @@ -19621,8 +19977,8 @@ function getAttrTweenFn(fn) { } }, updateTargetsForBar: function updateTargetsForBar(targets) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, $el = $$.$el, classChartBar = $$.getChartClass("Bar"), @@ -19632,7 +19988,7 @@ function getAttrTweenFn(fn) { if (!$el.bar) { $$.initBar(); } - var mainBarUpdate = $el.main.select("." + $BAR.chartBars).selectAll("." + $BAR.chartBar).data( + const mainBarUpdate = $el.main.select("." + $BAR.chartBars).selectAll("." + $BAR.chartBar).data( // remove targets.filter(function (v) { var _this2 = this; @@ -19662,7 +20018,7 @@ function getAttrTweenFn(fn) { if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, config = $$.config, $el = $$.$el, $T = $$.$T, @@ -19670,7 +20026,7 @@ function getAttrTweenFn(fn) { classBar = $$.getClass("bar", !0), initialOpacity = $$.initialOpacity.bind($$); config.bar_linearGradient && $$.updateLinearGradient(); - var bar = $root.main.selectAll("." + $BAR.bars).selectAll("." + $BAR.bar).data($$.labelishData.bind($$)); + const bar = $root.main.selectAll("." + $BAR.bars).selectAll("." + $BAR.bar).data($$.labelishData.bind($$)); $T(bar.exit(), withTransition).style("opacity", "0").remove(); $root.bar = bar.enter().append("path").attr("class", classBar).style("fill", $$.updateBarColor.bind($$)).merge(bar).style("opacity", initialOpacity); @@ -19684,7 +20040,7 @@ function getAttrTweenFn(fn) { * @private */ updateBarColor: function updateBarColor(d) { - var $$ = this, + const $$ = this, fn = $$.getStylePropValue($$.color); return $$.config.bar_linearGradient ? $$.getGradienColortUrl(d.id) : fn ? fn(d) : null; }, @@ -19701,7 +20057,7 @@ function getAttrTweenFn(fn) { if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, _ref = isSub ? $$.$el.subchart : $$.$el, bar = _ref.bar; return [$$.$T(bar, withTransition, getRandom()).attr("d", function (d) { @@ -19730,8 +20086,8 @@ function getAttrTweenFn(fn) { * @private */ generateDrawBar: function generateDrawBar(barIndices, isSub) { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, config = $$.config, getPoints = $$.generateGetBarPoints(barIndices, isSub), isRotated = config.axis_rotated, @@ -19744,26 +20100,27 @@ function getAttrTweenFn(fn) { _newArrowCheck(this, _this4); return w * barRadiusRatio; }.bind(this) : null; + // get the bar radius return function (d, i) { _newArrowCheck(this, _this4); // 4 points that make a bar - var points = getPoints(d, i), + const points = getPoints(d, i), indexX = +isRotated, indexY = +!indexX, isUnderZero = d.value < 0, isInverted = config["axis_" + $$.axis.getId(d.id) + "_inverted"], isNegative = !isInverted && isUnderZero || isInverted && !isUnderZero, pathRadius = ["", ""]; // switch points if axis is rotated, not applicable for sub chart - var radius = 0; - var isGrouped = $$.isGrouped(d.id), + let radius = 0; + const isGrouped = $$.isGrouped(d.id), isRadiusData = getRadius && isGrouped ? $$.isStackingRadiusData(d) : !1; if (getRadius) { - var index = isRotated ? indexY : indexX, + const index = isRotated ? indexY : indexX, barW = points[2][index] - points[0][index]; radius = !isGrouped || isRadiusData ? getRadius(barW) : 0; - var arc = "a" + radius + "," + radius + " " + (isNegative ? "1 0 0" : "0 0 1") + " "; + const arc = "a" + radius + "," + radius + " " + (isNegative ? "1 0 0" : "0 0 1") + " "; pathRadius[+!isRotated] = "" + arc + radius + "," + radius; pathRadius[+isRotated] = "" + arc + [-radius, radius][isRotated ? "sort" : "reverse"](); isNegative && pathRadius.reverse(); @@ -19771,7 +20128,7 @@ function getAttrTweenFn(fn) { // path string data shouldn't be containing new line chars // https://github.com/naver/billboard.js/issues/530 - var path = isRotated ? "H" + (points[1][indexX] + (isNegative ? radius : -radius)) + " " + pathRadius[0] + "V" + (points[2][indexY] - radius) + " " + pathRadius[1] + "H" + points[3][indexX] : "V" + (points[1][indexY] + (isNegative ? -radius : radius)) + " " + pathRadius[0] + "H" + (points[2][indexX] - radius) + " " + pathRadius[1] + "V" + points[3][indexY]; + const path = isRotated ? "H" + (points[1][indexX] + (isNegative ? radius : -radius)) + " " + pathRadius[0] + "V" + (points[2][indexY] - radius) + " " + pathRadius[1] + "H" + points[3][indexX] : "V" + (points[1][indexY] + (isNegative ? -radius : radius)) + " " + pathRadius[0] + "H" + (points[2][indexX] - radius) + " " + pathRadius[1] + "V" + points[3][indexY]; return "M" + points[0][indexX] + "," + points[0][indexY] + path + "z"; }.bind(this); }, @@ -19781,8 +20138,8 @@ function getAttrTweenFn(fn) { * @returns {boolean} */ isStackingRadiusData: function isStackingRadiusData(d) { - var _this5 = this, - $$ = this, + var _this5 = this; + const $$ = this, $el = $$.$el, config = $$.config, data = $$.data, @@ -19792,7 +20149,7 @@ function getAttrTweenFn(fn) { value = d.value; // when the data is hidden, check if has rounded edges if (state.hiddenTargetIds.indexOf(id) > -1) { - var target = $el.bar.filter(function (d) { + const target = $el.bar.filter(function (d) { _newArrowCheck(this, _this5); return d.id === id && d.value === value; }.bind(this)); @@ -19800,7 +20157,7 @@ function getAttrTweenFn(fn) { } // Find same grouped ids - var keys = config.data_groups.find(function (v) { + const keys = config.data_groups.find(function (v) { _newArrowCheck(this, _this5); return v.indexOf(id) > -1; }.bind(this)), @@ -19831,8 +20188,8 @@ function getAttrTweenFn(fn) { * @private */ generateGetBarPoints: function generateGetBarPoints(barIndices, isSub) { - var _this7 = this, - $$ = this, + var _this7 = this; + const $$ = this, config = $$.config, axis = isSub ? $$.axis.subX : $$.axis.x, barTargetsNum = $$.getIndicesMax(barIndices) + 1, @@ -19843,7 +20200,7 @@ function getAttrTweenFn(fn) { yScale = $$.getYScaleById.bind($$); return function (d, i) { _newArrowCheck(this, _this7); - var id = d.id, + const id = d.id, y0 = yScale.call($$, id, isSub)($$.getShapeYMin(id)), offset = barOffset(d, i) || y0, width = isNumber(barW) ? barW : barW[d.id] || barW._$width, @@ -19853,7 +20210,7 @@ function getAttrTweenFn(fn) { // offset is for stacked bar chart - var posY = barY(d); + let posY = barY(d); // fix posY not to overflow opposite quadrant if (config.axis_rotated && !isInverted && (value > 0 && posY < y0 || value < 0 && y0 < posY)) { @@ -19862,7 +20219,7 @@ function getAttrTweenFn(fn) { if (!$$.isBarRangeType(d)) { posY -= y0 - offset; } - var startPosX = posX + width; + const startPosX = posX + width; // 4 points that make a bar return [[posX, offset], [posX, posY], [startPosX, posY], [startPosX, offset]]; @@ -19872,8 +20229,8 @@ function getAttrTweenFn(fn) { ;// CONCATENATED MODULE: ./src/ChartInternal/shape/candlestick.ts -function candlestick_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function candlestick_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? candlestick_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : candlestick_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function candlestick_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function candlestick_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? candlestick_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : candlestick_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license @@ -19883,7 +20240,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument /* harmony default export */ var candlestick = ({ initCandlestick: function initCandlestick() { - var $el = this.$el; + const $el = this.$el; $el.candlestick = $el.main.select("." + $COMMON.chart) // should positioned at the beginning of the shape node to not overlap others .append("g").attr("class", $CANDLESTICK.chartCandlesticks); @@ -19895,18 +20252,13 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @private */ updateTargetsForCandlestick: function updateTargetsForCandlestick(targets) { - var _this = this, - $$ = this, + const $$ = this, $el = $$.$el, - classChart = $$.getChartClass("Candlestick"), - classFocus = $$.classFocus.bind($$); + classChart = $$.getChartClass("Candlestick"); if (!$el.candlestick) { $$.initCandlestick(); } - var mainUpdate = $$.$el.main.select("." + $CANDLESTICK.chartCandlesticks).selectAll("." + $CANDLESTICK.chartCandlestick).data(targets).attr("class", function (d) { - _newArrowCheck(this, _this); - return classChart(d) + classFocus(d); - }.bind(this)); + const mainUpdate = $$.$el.main.select("." + $CANDLESTICK.chartCandlesticks).selectAll("." + $CANDLESTICK.chartCandlestick).data(targets); mainUpdate.enter().append("g").attr("class", classChart).style("pointer-events", "none"); }, /** @@ -19916,11 +20268,11 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @private */ updateCandlestick: function updateCandlestick(withTransition, isSub) { - var _this2 = this; + var _this = this; if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, $el = $$.$el, $T = $$.$T, $root = isSub ? $el.subchart : $el, @@ -19928,15 +20280,12 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument initialOpacity = $$.initialOpacity.bind($$), candlestick = $root.main.selectAll("." + $CANDLESTICK.chartCandlestick).selectAll("." + $CANDLESTICK.candlestick).data($$.labelishData.bind($$)); $T(candlestick.exit(), withTransition).style("opacity", "0").remove(); - var candlestickEnter = candlestick.enter().filter(function (d) { - _newArrowCheck(this, _this2); + const candlestickEnter = candlestick.enter().filter(function (d) { + _newArrowCheck(this, _this); return d.value; }.bind(this)).append("g").attr("class", classSetter); candlestickEnter.append("line"); candlestickEnter.append("path"); - if (!$root.candlestick) { - $root.candlestick = {}; - } $root.candlestick = candlestick.merge(candlestickEnter).style("opacity", initialOpacity); }, /** @@ -19947,32 +20296,32 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @private */ generateDrawCandlestick: function generateDrawCandlestick(indices, isSub) { - var _this3 = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, getPoints = $$.generateGetCandlestickPoints(indices, isSub), isRotated = config.axis_rotated, downColor = config.candlestick_color_down; return function (d, i, g) { var _value, - _this4 = this; - _newArrowCheck(this, _this3); - var points = getPoints(d, i), + _this3 = this; + _newArrowCheck(this, _this2); + const points = getPoints(d, i), value = $$.getCandlestickData(d), isUp = (_value = value) == null ? void 0 : _value._isUp, indexX = +isRotated; // switch points if axis is rotated, not applicable for sub chart if (g.classed) { g.classed($CANDLESTICK[isUp ? "valueUp" : "valueDown"], !0); } - var path = isRotated ? "H" + points[1][1] + " V" + points[1][0] + " H" + points[0][1] : "V" + points[1][1] + " H" + points[1][0] + " V" + points[0][1]; + const path = isRotated ? "H" + points[1][1] + " V" + points[1][0] + " H" + points[0][1] : "V" + points[1][1] + " H" + points[1][0] + " V" + points[0][1]; g.select("path").attr("d", "M" + points[0][indexX] + "," + points[0][+!indexX] + path + "z").style("fill", function (d) { - _newArrowCheck(this, _this4); - var color = isUp ? $$.color(d) : isObject(downColor) ? downColor[d.id] : downColor; + _newArrowCheck(this, _this3); + const color = isUp ? $$.color(d) : isObject(downColor) ? downColor[d.id] : downColor; return color || $$.color(d); }.bind(this)); // set line position - var line = g.select("line"), + const line = g.select("line"), pos = isRotated ? { x1: points[2][1], x2: points[2][2], @@ -19984,7 +20333,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument y1: points[2][1], y2: points[2][2] }; - for (var x in pos) { + for (const x in pos) { line.attr(x, pos[x]); } }.bind(this); @@ -19996,12 +20345,11 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @returns {Function} */ generateGetCandlestickPoints: function generateGetCandlestickPoints(indices, isSub) { - var _this5 = this; + var _this4 = this; if (isSub === void 0) { isSub = !1; } - var $$ = this, - config = $$.config, + const $$ = this, axis = isSub ? $$.axis.subX : $$.axis.x, targetsNum = $$.getIndicesMax(indices) + 1, barW = $$.getBarW("candlestick", axis, targetsNum), @@ -20010,19 +20358,19 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument shapeOffset = $$.getShapeOffset($$.isBarType, indices, !!isSub), yScale = $$.getYScaleById.bind($$); return function (d, i) { - _newArrowCheck(this, _this5); - var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)), + _newArrowCheck(this, _this4); + const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)), offset = shapeOffset(d, i) || y0, width = isNumber(barW) ? barW : barW[d.id] || barW._$width, value = $$.getCandlestickData(d); // offset is for stacked bar chart - var points; - if (value) { - var posX = { + let points; + if (value && isNumber(value.open) && isNumber(value.close)) { + const posX = { start: x(d), end: 0 }; posX.end = posX.start + width; - var posY = { + const posY = { start: y(value.open), end: y(value.close) }, @@ -20031,10 +20379,6 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument high: y(value.high), low: y(value.low) }; - // fix posY not to overflow opposite quadrant - if (config.axis_rotated && (d.value > 0 && posY.start < y0 || d.value < 0 && y0 < posY.start)) { - posY.start = y0; - } posY.start -= y0 - offset; points = [[posX.start, posY.start], [posX.end, posY.end], [posLine.x, posLine.low, posLine.high]]; } else { @@ -20054,14 +20398,14 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, $el = $$.$el, $T = $$.$T, _ref = isSub ? $el.subchart : $el, candlestick = _ref.candlestick, rand = getRandom(!0); return [candlestick.each(function (d, i) { - var g = $T((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), withTransition, rand); + const g = $T((0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), withTransition, rand); drawFn(d, i, g); }).style("opacity", null)]; }, @@ -20073,10 +20417,10 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @private */ getCandlestickData: function getCandlestickData(_ref2) { - var value = _ref2.value, + let value = _ref2.value, d; if (isArray(value)) { - var open = value[0], + const open = value[0], high = value[1], low = value[2], close = value[3], @@ -20111,8 +20455,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument /* harmony default export */ var gauge = ({ initGauge: function initGauge() { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, arcs = $$.$el.arcs, appendText = function (className) { @@ -20120,7 +20464,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none"); }.bind(this); if ($$.hasType("gauge")) { - var hasMulti = $$.hasMultiArcGauge(); + const hasMulti = $$.hasMultiArcGauge(); arcs.append(hasMulti ? "g" : "path").attr("class", $ARC.chartArcsBackground).style("fill", !hasMulti && config.gauge_background || null); config.gauge_units && appendText($GAUGE.chartArcsGaugeUnit); if (config.gauge_label_show) { @@ -20130,7 +20474,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument } }, updateGaugeMax: function updateGaugeMax() { - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, hasMultiGauge = $$.hasMultiArcGauge(), @@ -20144,8 +20488,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument } }, redrawMultiArcGauge: function redrawMultiArcGauge() { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, state = $$.state, $el = $$.$el, @@ -20159,12 +20503,12 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument _newArrowCheck(this, _this2); return $$.levelColor ? $$.levelColor(d.data.values[0].value) : $$.color(d.data); }.bind(this)).style("display", config.gauge_label_show ? null : "none").each(function (d) { - var lineLength = 0; - var x = 0, + let lineLength = 0; + let x = 0, y = 0, transform = ""; if (hiddenTargetIds.indexOf(d.data.id) < 0) { - var updated = $$.updateAngle(d), + const updated = $$.updateAngle(d), innerLineLength = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length * (updated.index + 1), lineAngle = updated.endAngle - Math.PI / 2, arcInnerRadius = state.radius - innerLineLength, @@ -20178,17 +20522,17 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument }); }, textForGaugeMinMax: function textForGaugeMinMax(value, isMax) { - var $$ = this, + const $$ = this, config = $$.config, format = config.gauge_label_extents; return isFunction(format) ? format.bind($$.api)(value, isMax) : value; }, getGaugeLabelHeight: function getGaugeLabelHeight() { - var config = this.config; + const config = this.config; return this.config.gauge_label_show && !config.gauge_fullCircle ? 20 : 0; }, getPaddingBottomForGauge: function getPaddingBottomForGauge() { - var $$ = this; + const $$ = this; return $$.getGaugeLabelHeight() * ($$.config.gauge_label_show ? 2 : 2.5); } }); @@ -20206,7 +20550,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @private */ initBubble: function initBubble() { - var $$ = this, + const $$ = this, config = $$.config; if ($$.hasType("bubble")) { config.point_show = !0; @@ -20219,12 +20563,12 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @private */ getBaseLength: function getBaseLength() { - var $$ = this, + const $$ = this, _$$$state = $$.state, width = _$$$state.width, height = _$$$state.height, cacheKey = KEY.bubbleBaseLength; - var baseLength = $$.cache.get(cacheKey); + let baseLength = $$.cache.get(cacheKey); if (!baseLength) { $$.cache.add(cacheKey, baseLength = getMinMax("min", [width, height])); } @@ -20237,15 +20581,15 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @private */ getBubbleR: function getBubbleR(d) { - var _this = this, - $$ = this, - maxR = $$.config.bubble_maxR; + var _this = this; + const $$ = this; + let maxR = $$.config.bubble_maxR; if (isFunction(maxR)) { maxR = maxR.bind($$.api)(d); } else if (!isNumber(maxR)) { maxR = $$.getBaseLength() / ($$.getMaxDataCount() * 2) + 12; } - var max = getMinMax("max", $$.getMinMaxData().max.map(function (d) { + const max = getMinMax("max", $$.getMinMaxData().max.map(function (d) { _newArrowCheck(this, _this); return $$.isBubbleZType(d) ? $$.getBubbleZData(d.value, "y") : isObject(d.value) ? d.value.mid : d.value; }.bind(this))), @@ -20276,12 +20620,12 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument /* harmony default export */ var line = ({ initLine: function initLine() { - var $el = this.$el; + const $el = this.$el; $el.line = $el.main.select("." + $COMMON.chart).append("g").attr("class", $LINE.chartLines).call(this.setCssRule(!1, "." + $LINE.chartLines, ["pointer-events:none"])); }, updateTargetsForLine: function updateTargetsForLine(t) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, _$$$$el = $$.$el, area = _$$$$el.area, line = _$$$$el.line, @@ -20292,7 +20636,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument if (!line) { $$.initLine(); } - var targets = t.filter(function (d) { + const targets = t.filter(function (d) { _newArrowCheck(this, _this); return !($$.isScatterType(d) || $$.isBubbleType(d)); }.bind(this)), @@ -20306,7 +20650,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument // Areas if ($$.hasTypeOf("Area")) { - var mainLine = (!area && mainLineEnter.empty() ? mainLineUpdate : mainLineEnter).filter($$.isAreaType.bind($$)); + const mainLine = (!area && mainLineEnter.empty() ? mainLineUpdate : mainLineEnter).filter($$.isAreaType.bind($$)); $$.initArea(mainLine); } $$.updateTargetForCircle(targets, mainLineEnter); @@ -20322,7 +20666,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, extraLineClasses = $$.format.extraLineClasses, $el = $$.$el, $T = $$.$T, @@ -20332,10 +20676,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument $root.line = line.enter().append("path").attr("class", function (d) { _newArrowCheck(this, _this2); return $$.getClass("line", !0)(d) + " " + (extraLineClasses(d) || ""); - }.bind(this)).style("stroke", $$.color).merge(line).style("opacity", $$.initialOpacity.bind($$)).style("shape-rendering", function (d) { - _newArrowCheck(this, _this2); - return $$.isStepType(d) ? "crispEdges" : ""; - }.bind(this)).attr("transform", null); + }.bind(this)).style("stroke", $$.color).merge(line).style("opacity", $$.initialOpacity.bind($$)).attr("transform", null); }, /** * Redraw function @@ -20348,7 +20689,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, $el = $$.$el, $T = $$.$T, _ref = isSub ? $el.subchart : $el, @@ -20362,14 +20703,14 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument * @private */ getCurve: function getCurve(d) { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, isRotatedStepType = $$.config.axis_rotated && $$.isStepType(d); // when is step & rotated, should be computed in different way // https://github.com/naver/billboard.js/issues/471 return isRotatedStepType ? function (context) { _newArrowCheck(this, _this3); - var step = $$.getInterpolate(d)(context); + const step = $$.getInterpolate(d)(context); // keep the original method step.orgPoint = step.point; @@ -20377,7 +20718,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument // to get rotated path data step.pointRotated = function (x, y) { this._point === 1 && (this._point = 2); - var y1 = this._y * (1 - this._t) + y * this._t; + const y1 = this._y * (1 - this._t) + y * this._t; this._context.lineTo(this._x, y1); this._context.lineTo(x, y1); this._x = x; @@ -20390,8 +20731,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument }.bind(this) : $$.getInterpolate(d); }, generateDrawLine: function generateDrawLine(lineIndices, isSub) { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, config = $$.config, scale = $$.scale, lineConnectNull = config.line_connectNull, @@ -20405,8 +20746,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument yValue = function (d, i) { _newArrowCheck(this, _this4); return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.getBaseValue(d)); - }.bind(this), - line = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.line)(); + }.bind(this); + let line = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.line)(); line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue); if (!lineConnectNull) { line = line.defined(function (d) { @@ -20414,16 +20755,16 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument return $$.getBaseValue(d) !== null; }.bind(this)); } - var x = isSub ? scale.subX : scale.x; + const x = isSub ? scale.subX : scale.x; return function (d) { _newArrowCheck(this, _this4); - var y = yScale(d.id, isSub); - var values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values, + const y = yScale(d.id, isSub); + let values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values, x0 = 0, y0 = 0, path; if ($$.isLineType(d)) { - var regions = config.data_regions[d.id]; + const regions = config.data_regions[d.id]; if (regions) { path = $$.lineWithRegions(values, scale.zoom || x, y, regions); } else { @@ -20443,27 +20784,26 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument }.bind(this); }, lineWithRegions: function lineWithRegions(d, x, y, _regions) { - var _this5 = this, - $$ = this, + var _this5 = this; + const $$ = this, config = $$.config, isRotated = config.axis_rotated, isTimeSeries = $$.axis.isTimeSeries(), regions = [], - xp, - yp, - diff, - diffx2; // default value + dasharray = "2 2"; + // default value + let xp, yp, diff, diffx2; // Check start/end of regions if (isDefined(_regions)) { - var getValue = function (v, def) { + const getValue = function (v, def) { _newArrowCheck(this, _this5); return isUndefined(v) ? def : isTimeSeries ? parseDate.call($$, v) : v; }.bind(this); - for (var i = 0, reg; reg = _regions[i]; i++) { - var start = getValue(reg.start, d[0].x), + for (let i = 0, reg; reg = _regions[i]; i++) { + const start = getValue(reg.start, d[0].x), end = getValue(reg.end, d[d.length - 1].x), style = reg.style || { - dasharray: "2 2" + dasharray: dasharray }; regions[i] = { start: start, @@ -20474,7 +20814,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument } // Set scales - var xValue = isRotated ? function (dt) { + const xValue = isRotated ? function (dt) { _newArrowCheck(this, _this5); return y(dt.value); }.bind(this) : function (dt) { @@ -20494,7 +20834,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument }.bind(this), sWithRegion = isTimeSeries ? function (d0, d1, k, timeseriesDiff) { _newArrowCheck(this, _this5); - var x0 = d0.x.getTime(), + const x0 = d0.x.getTime(), xDiff = d1.x - d0.x, xv0 = new Date(x0 + xDiff * k), xv1 = new Date(x0 + xDiff * (k + timeseriesDiff)), @@ -20502,7 +20842,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument return generateM(points); }.bind(this) : function (d0, d1, k, otherDiff) { _newArrowCheck(this, _this5); - var points = isRotated ? [[y(yp(k), !0), x(xp(k))], [y(yp(k + otherDiff), !0), x(xp(k + otherDiff))]] : [[x(xp(k), !0), y(yp(k))], [x(xp(k + otherDiff), !0), y(yp(k + otherDiff))]]; + const points = isRotated ? [[y(yp(k), !0), x(xp(k))], [y(yp(k + otherDiff), !0), x(xp(k + otherDiff))]] : [[x(xp(k), !0), y(yp(k))], [x(xp(k + otherDiff), !0), y(yp(k + otherDiff))]]; return generateM(points); }.bind(this), axisType = { @@ -20510,11 +20850,11 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument y: $$.axis.getAxisType("y") }; // Define svg generator function for region // Generate - var path = ""; - for (var _i = 0, data; data = d[_i]; _i++) { - var prevData = d[_i - 1], + let path = ""; + for (let i = 0, data; data = d[i]; i++) { + const prevData = d[i - 1], hasPrevData = prevData && isValue(prevData.value); - var style = $$.isWithinRegions(data.x, regions); + let style = $$.isWithinRegions(data.x, regions); // https://github.com/naver/billboard.js/issues/1172 if (!isValue(data.value)) { @@ -20523,23 +20863,23 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument // Draw as normal if (isUndefined(regions) || !style || !hasPrevData) { - path += "" + (_i && hasPrevData ? "L" : "M") + xValue(data) + "," + yValue(data); + path += "" + (i && hasPrevData ? "L" : "M") + xValue(data) + "," + yValue(data); } else if (hasPrevData) { try { style = style.dasharray.split(" "); } catch (e) { - style = "2 2".split(" "); + style = dasharray.split(" "); } // Draw with region // TODO: Fix for horizotal charts xp = getScale(axisType.x, prevData.x, data.x); yp = getScale(axisType.y, prevData.value, data.value); - var dx = x(data.x) - x(prevData.x), + const dx = x(data.x) - x(prevData.x), dy = y(data.value) - y(prevData.value), dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2)); diff = style[0] / dd; diffx2 = diff * style[1]; - for (var j = diff; j <= 1; j += diffx2) { + for (let j = diff; j <= 1; j += diffx2) { path += sWithRegion(prevData, data, j, diff); // to make sure correct line drawing @@ -20552,7 +20892,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument return path; }, isWithinRegions: function isWithinRegions(withinX, withinRegions) { - for (var i = 0, reg; reg = withinRegions[i]; i++) { + for (let i = 0, reg; reg = withinRegions[i]; i++) { if (reg.start < withinX && withinX <= reg.end) { return reg.style; } @@ -20563,7 +20903,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument return Math.abs(y - getPointer(this.state.event, that)[1]) < 30; }, shouldDrawPointsForLine: function shouldDrawPointsForLine(d) { - var linePoint = this.config.line_point; + const linePoint = this.config.line_point; return linePoint === !0 || isArray(linePoint) && linePoint.indexOf(d.id) !== -1; } }); @@ -20578,7 +20918,7 @@ var point_this = undefined; -var getTransitionName = function () { +const getTransitionName = function () { _newArrowCheck(this, point_this); return getRandom(); }.bind(undefined); @@ -20587,29 +20927,30 @@ var getTransitionName = function () { return /^(circle|rect(angle)?|polygon|ellipse|use)$/i.test(type || this.config.point_type); }, hasValidPointDrawMethods: function hasValidPointDrawMethods(type) { - var pointType = type || this.config.point_type; + const pointType = type || this.config.point_type; return isObjectType(pointType) && isFunction(pointType.create) && isFunction(pointType.update); }, initialOpacityForCircle: function initialOpacityForCircle(d) { - var config = this.config, + const config = this.config, withoutFadeIn = this.state.withoutFadeIn; - var opacity = config.point_opacity; + let opacity = config.point_opacity; if (isUndefined(opacity)) { opacity = this.getBaseValue(d) !== null && withoutFadeIn[d.id] ? this.opacityForCircle(d) : "0"; } return opacity; }, opacityForCircle: function opacityForCircle(d) { - var config = this.config; - var opacity = config.point_opacity; + const config = this.config; + let opacity = config.point_opacity; if (isUndefined(opacity)) { - opacity = config.point_show && !config.point_focus_only ? null : "0"; + var _this$isPointFocusOnl; + opacity = config.point_show && !((_this$isPointFocusOnl = this.isPointFocusOnly) != null && _this$isPointFocusOnl.call(this)) ? null : "0"; opacity = isValue(this.getBaseValue(d)) ? this.isBubbleType(d) || this.isScatterType(d) ? "0.5" : opacity : "0"; } return opacity; }, initCircle: function initCircle() { - var $$ = this, + const $$ = this, main = $$.$el.main; $$.point = $$.generatePoint(); if (($$.hasType("bubble") || $$.hasType("scatter")) && main.select("." + $CIRCLE.chartCircles).empty()) { @@ -20617,8 +20958,8 @@ var getTransitionName = function () { } }, updateTargetForCircle: function updateTargetForCircle(targetsValue, enterNodeValue) { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, data = $$.data, $el = $$.$el, @@ -20629,7 +20970,7 @@ var getTransitionName = function () { return; } $el.circle || $$.initCircle(); - var targets = targetsValue, + let targets = targetsValue, enterNode = enterNodeValue; // only for scatter & bubble type should generate seprate <g> node if (!targets) { @@ -20637,7 +20978,7 @@ var getTransitionName = function () { _newArrowCheck(this, _this2); return this.isScatterType(d) || this.isBubbleType(d); }.bind(this)); - var mainCircle = $el.main.select("." + $CIRCLE.chartCircles).style("pointer-events", "none").selectAll("." + $CIRCLE.circles).data(targets); + const mainCircle = $el.main.select("." + $CIRCLE.chartCircles).style("pointer-events", "none").selectAll("." + $CIRCLE.circles).data(targets); mainCircle.exit().remove(); enterNode = mainCircle.enter(); } @@ -20652,7 +20993,7 @@ var getTransitionName = function () { $$.setCssRule(!0, "." + $CIRCLE.circles, ["cursor:pointer"], isSelectable)(selection); $$.setCssRule(!0, " ." + $CIRCLE.circle, ["fill", "stroke"], $$.color)(selection); }.bind(this)).style("opacity", function () { - var parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode); + const parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode); // if the parent node is .bb-chart-circles (bubble, scatter), initialize <g bb-circles> with opacity "0" return parent.attr("class").indexOf($CIRCLE.chartCircles) > -1 ? "0" : null; @@ -20673,27 +21014,39 @@ var getTransitionName = function () { if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, $el = $$.$el, - focusOnly = config.point_focus_only, + focusOnly = $$.isPointFocusOnly(), $root = isSub ? $el.subchart : $el; if (config.point_show && !state.toggling) { - var circles = $root.main.selectAll("." + $CIRCLE.circles).selectAll("." + $CIRCLE.circle).data(function (d) { + config.point_radialGradient && $$.updateLinearGradient(); + const circles = $root.main.selectAll("." + $CIRCLE.circles).selectAll("." + $CIRCLE.circle).data(function (d) { _newArrowCheck(this, _this4); return $$.isLineType(d) && $$.shouldDrawPointsForLine(d) || $$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ? focusOnly ? [d.values[0]] : d.values : []; }.bind(this)); circles.exit().remove(); - circles.enter().filter(Boolean).append($$.point("create", this, $$.pointR.bind($$), $$.getStylePropValue($$.color))); + circles.enter().filter(Boolean).append($$.point("create", this, $$.pointR.bind($$), $$.updateCircleColor.bind($$))); $root.circle = $root.main.selectAll("." + $CIRCLE.circles + " ." + $CIRCLE.circle).style("stroke", $$.getStylePropValue($$.color)).style("opacity", $$.initialOpacityForCircle.bind($$)); } }, + /** + * Update circle color + * @param {object} d Data object + * @returns {string} Color string + * @private + */ + updateCircleColor: function updateCircleColor(d) { + const $$ = this, + fn = $$.getStylePropValue($$.color); + return $$.config.point_radialGradient ? $$.getGradienColortUrl(d.id) : fn ? fn(d) : null; + }, redrawCircle: function redrawCircle(cx, cy, withTransition, flow, isSub) { if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, rendered = $$.state.rendered, $el = $$.$el, $T = $$.$T, @@ -20702,13 +21055,13 @@ var getTransitionName = function () { if (!$$.config.point_show) { return []; } - var fn = $$.point("update", $$, cx, cy, $$.getStylePropValue($$.color), withTransition, flow, selectedCircles), + const fn = $$.point("update", $$, cx, cy, $$.updateCircleColor.bind($$), withTransition, flow, selectedCircles), posAttr = $$.isCirclePoint() ? "c" : "", t = getRandom(), opacityStyleFn = $$.opacityForCircle.bind($$), mainCircles = []; $root.circle.each(function (d) { - var result = fn.bind(this)(d); + let result = fn.bind(this)(d); result = $T(result, withTransition || !rendered, t).style("opacity", opacityStyleFn); mainCircles.push(result); }); @@ -20720,35 +21073,34 @@ var getTransitionName = function () { * @private */ showCircleFocus: function showCircleFocus(d) { - var $$ = this, - config = $$.config, + const $$ = this, _$$$state = $$.state, hasRadar = _$$$state.hasRadar, resizing = _$$$state.resizing, toggling = _$$$state.toggling, transiting = _$$$state.transiting, $el = $$.$el; - var circle = $el.circle; - if (transiting === !1 && config.point_focus_only && circle) { - var cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$), + let circle = $el.circle; + if (transiting === !1 && circle && $$.isPointFocusOnly()) { + const cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$), cy = (hasRadar ? $$.radarCircleY : $$.circleY).bind($$), withTransition = toggling || isUndefined(d), fn = $$.point("update", $$, cx, cy, $$.getStylePropValue($$.color), resizing ? !1 : withTransition); if (d) { circle = circle.filter(function (t) { - var _this5 = this, - data = d.filter == null ? void 0 : d.filter(function (v) { - _newArrowCheck(this, _this5); - return v.id === t.id; - }.bind(this)); + var _this5 = this; + const data = d.filter == null ? void 0 : d.filter(function (v) { + _newArrowCheck(this, _this5); + return v.id === t.id; + }.bind(this)); return data.length ? (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).datum(data[0]) : !1; }); } circle.attr("class", this.updatePointClass.bind(this)).style("opacity", null).each(function (d) { - var id = d.id, + const id = d.id, index = d.index, value = d.value; - var visibility = "hidden"; + let visibility = "hidden"; if (isValue(value)) { fn.bind(this)(d); $$.expandCircles(index, id); @@ -20763,10 +21115,9 @@ var getTransitionName = function () { * @private */ hideCircleFocus: function hideCircleFocus() { - var $$ = this, - config = $$.config, + const $$ = this, circle = $$.$el.circle; - if (config.point_focus_only && circle) { + if ($$.isPointFocusOnly() && circle) { $$.unexpandCircles(); circle.style("visibility", "hidden"); } @@ -20779,19 +21130,19 @@ var getTransitionName = function () { if (isSub === void 0) { isSub = !1; } - var $$ = this, + const $$ = this, getPoints = $$.generateGetLinePoints($$.getShapeIndices($$.isLineType), isSub); return function (d, i) { _newArrowCheck(this, _this6); - var id = d.id; + const id = d.id; return $$.isGrouped(id) ? getPoints(d, i)[0][1] : $$.getYScaleById(id, isSub)($$.getBaseValue(d)); }.bind(this); }, expandCircles: function expandCircles(i, id, reset) { - var $$ = this, + const $$ = this, r = $$.pointExpandedR.bind($$); reset && $$.unexpandCircles(); - var circles = $$.getShapeByIndex("circle", i, id).classed($COMMON.EXPANDED, !0), + const circles = $$.getShapeByIndex("circle", i, id).classed($COMMON.EXPANDED, !0), scale = r(circles) / $$.config.point_r, ratio = 1 - scale; if ($$.isCirclePoint()) { @@ -20799,11 +21150,11 @@ var getTransitionName = function () { } else { // transform must be applied to each node individually circles.each(function () { - var point = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); + const point = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); if (this.tagName === "circle") { point.attr("r", r); } else { - var _this$getBBox = this.getBBox(), + const _this$getBBox = this.getBBox(), width = _this$getBBox.width, height = _this$getBBox.height, x = ratio * (+point.attr("x") + width / 2), @@ -20814,22 +21165,22 @@ var getTransitionName = function () { } }, unexpandCircles: function unexpandCircles(i) { - var $$ = this, + const $$ = this, r = $$.pointR.bind($$), circles = $$.getShapeByIndex("circle", i).filter(function () { return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($COMMON.EXPANDED); }).classed($COMMON.EXPANDED, !1); circles.attr("r", r); if (!$$.isCirclePoint()) { - var _scale = r(circles) / $$.config.point_r; - circles.attr("transform", _scale !== 1 ? "scale(" + _scale + ")" : null); + const scale = r(circles) / $$.config.point_r; + circles.attr("transform", scale !== 1 ? "scale(" + scale + ")" : null); } }, pointR: function (d) { - var $$ = this, + const $$ = this, config = $$.config, pointR = config.point_r; - var r = pointR; + let r = pointR; if ($$.isBubbleType(d)) { r = $$.getBubbleR(d); } else if (isFunction(pointR)) { @@ -20839,52 +21190,80 @@ var getTransitionName = function () { return r; }, pointExpandedR: function pointExpandedR(d) { - var $$ = this, + const $$ = this, config = $$.config, scale = $$.isBubbleType(d) ? 1.15 : 1.75; return config.point_focus_expand_enabled ? config.point_focus_expand_r || $$.pointR(d) * scale : $$.pointR(d); }, pointSelectR: function pointSelectR(d) { - var $$ = this, + const $$ = this, selectR = $$.config.point_select_r; return isFunction(selectR) ? selectR(d) : selectR || $$.pointR(d) * 4; }, + /** + * Check if point.focus.only option can be applied. + * @returns {boolean} + * @private + */ + isPointFocusOnly: function isPointFocusOnly() { + const $$ = this; + return $$.config.point_focus_only && !$$.hasType("bubble") && !$$.hasType("scatter") && !$$.hasArcType(null, ["radar"]); + }, isWithinCircle: function isWithinCircle(node, r) { - var mouse = getPointer(this.state.event, node), + const config = this.config, + state = this.state, + mouse = getPointer(state.event, node), element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(node), - prefix = this.isCirclePoint(node) ? "c" : ""; - var cx = +element.attr(prefix + "x"), + prefix = this.isCirclePoint(node) ? "c" : "", + sensitivity = config.point_sensitivity === "radius" ? node.getAttribute("r") : config.point_sensitivity; + let cx = +element.attr(prefix + "x"), cy = +element.attr(prefix + "y"); // if node don't have cx/y or x/y attribute value if (!(cx || cy) && node.nodeType === 1) { - var _getBoundingRect = getBoundingRect(node), + const _getBoundingRect = getBoundingRect(node), x = _getBoundingRect.x, y = _getBoundingRect.y; cx = x; cy = y; } - return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || this.config.point_sensitivity); + return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || sensitivity); + }, + /** + * Get data point sensitivity radius + * @param {object} d Data point object + * @returns {number} return the sensitivity value + */ + getPointSensitivity: function getPointSensitivity(d) { + const $$ = this; + let sensitivity = $$.config.point_sensitivity; + if (isFunction(sensitivity)) { + sensitivity = sensitivity.call($$.api, d); + } else if (sensitivity === "radius") { + sensitivity = d.r; + } + return sensitivity; }, insertPointInfoDefs: function insertPointInfoDefs(point, id) { var _this7 = this, - $$ = this, + _node$childNodes; + const $$ = this, copyAttr = function (from, target) { _newArrowCheck(this, _this7); - for (var attribs = from.attributes, i = 0, name; name = attribs[i]; i++) { + const attribs = from.attributes; + for (let i = 0, name; name = attribs[i]; i++) { name = name.name; target.setAttribute(name, from.getAttribute(name)); } }.bind(this), doc = new DOMParser().parseFromString(point, "image/svg+xml"), node = doc.documentElement, - clone = browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, node.nodeName.toLowerCase()), - _node$childNodes; + clone = browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, node.nodeName.toLowerCase()); clone.id = id; clone.style.fill = "inherit"; clone.style.stroke = "inherit"; copyAttr(node, clone); if ((_node$childNodes = node.childNodes) != null && _node$childNodes.length) { - var parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(clone); + const parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(clone); if ("innerHTML" in clone) { parent.html(node.innerHTML); } else { @@ -20900,12 +21279,12 @@ var getTransitionName = function () { return this.$el.defs.select("#" + id); }, updatePointClass: function updatePointClass(d) { - var $$ = this, + const $$ = this, circle = $$.$el.circle; - var pointClass = !1; + let pointClass = !1; if (isObject(d) || circle) { pointClass = d === !0 ? circle.each(function (d) { - var className = $$.getClass("circle", !0)(d); + let className = $$.getClass("circle", !0)(d); if (this.getAttribute("class").indexOf($COMMON.EXPANDED) > -1) { className += " " + $COMMON.EXPANDED; } @@ -20915,19 +21294,20 @@ var getTransitionName = function () { return pointClass; }, generateGetLinePoints: function generateGetLinePoints(lineIndices, isSub) { - var _this8 = this, - $$ = this, + var _this8 = this; + // partial duplication of generateGetBarPoints + const $$ = this, config = $$.config, x = $$.getShapeX(0, lineIndices, isSub), y = $$.getShapeY(isSub), lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, isSub), - yScale = $$.getYScaleById.bind($$); // partial duplication of generateGetBarPoints + yScale = $$.getYScaleById.bind($$); return function (d, i) { _newArrowCheck(this, _this8); - var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)), + const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)), offset = lineOffset(d, i) || y0, posX = x(d); // offset is for stacked area chart - var posY = y(d); + let posY = y(d); // fix posY not to overflow opposite quadrant if (config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY)) { @@ -20935,14 +21315,14 @@ var getTransitionName = function () { } // 1 point that marks the line position - var point = [posX, posY - (y0 - offset)]; + const point = [posX, posY - (y0 - offset)]; return [point, point, // from here and below, needed for compatibility point, point]; }.bind(this); }, generatePoint: function generatePoint() { - var $$ = this, + const $$ = this, config = $$.config, datetimeId = $$.state.datetimeId, ids = [], @@ -20952,15 +21332,15 @@ var getTransitionName = function () { args[_key - 2] = arguments[_key]; } return function (d) { - var _d$data, - id = $$.getTargetSelectorSuffix(d.id || ((_d$data = d.data) == null ? void 0 : _d$data.id) || d), + var _d$data; + const id = $$.getTargetSelectorSuffix(d.id || ((_d$data = d.data) == null ? void 0 : _d$data.id) || d), element = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); ids.indexOf(id) < 0 && ids.push(id); - var point = pattern[ids.indexOf(id) % pattern.length]; + let point = pattern[ids.indexOf(id) % pattern.length]; if ($$.hasValidPointType(point)) { point = $$[point]; } else if (!$$.hasValidPointDrawMethods(point)) { - var pointId = datetimeId + "-point" + id, + const pointId = datetimeId + "-point" + id, pointFromDefs = $$.pointFromDefs(pointId); if (pointFromDefs.size() < 1) { $$.insertPointInfoDefs(point, pointId); @@ -20980,8 +21360,8 @@ var getTransitionName = function () { return element.append("use").attr("xlink:href", "#" + id).attr("class", this.updatePointClass.bind(this)).style("fill", fillStyleFn).node(); }, update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) { - var _this9 = this, - $$ = this, + var _this9 = this; + const $$ = this, _element$node$getBBox = element.node().getBBox(), width = _element$node$getBBox.width, height = _element$node$getBBox.height, @@ -20992,8 +21372,8 @@ var getTransitionName = function () { yPosFn2 = function (d) { _newArrowCheck(this, _this9); return isValue(d.value) ? yPosFn(d) - height / 2 : 0; - }.bind(this), - mainCircles = element; + }.bind(this); + let mainCircles = element; if (withTransition) { flow && mainCircles.attr("x", xPosFn2); mainCircles = $$.$T(mainCircles, withTransition, getTransitionName()); @@ -21008,8 +21388,8 @@ var getTransitionName = function () { return element.append("circle").attr("class", this.updatePointClass.bind(this)).attr("r", sizeFn).style("fill", fillStyleFn).node(); }, update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) { - var $$ = this; - var mainCircles = element; + const $$ = this; + let mainCircles = element; // when '.load()' called, bubble size should be updated if ($$.hasType("bubble")) { @@ -21028,16 +21408,16 @@ var getTransitionName = function () { // 'rectangle' data point rectangle: { create: function create(element, sizeFn, fillStyleFn) { - var _this10 = this, - rectSizeFn = function (d) { - _newArrowCheck(this, _this10); - return sizeFn(d) * 2; - }.bind(this); + var _this10 = this; + const rectSizeFn = function (d) { + _newArrowCheck(this, _this10); + return sizeFn(d) * 2; + }.bind(this); return element.append("rect").attr("class", this.updatePointClass.bind(this)).attr("width", rectSizeFn).attr("height", rectSizeFn).style("fill", fillStyleFn).node(); }, update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) { - var _this11 = this, - $$ = this, + var _this11 = this; + const $$ = this, r = $$.config.point_r, rectXPosFn = function (d) { _newArrowCheck(this, _this11); @@ -21046,8 +21426,8 @@ var getTransitionName = function () { rectYPosFn = function (d) { _newArrowCheck(this, _this11); return yPosFn(d) - r; - }.bind(this), - mainCircles = element; + }.bind(this); + let mainCircles = element; if (withTransition) { flow && mainCircles.attr("x", rectXPosFn); mainCircles = $$.$T(mainCircles, withTransition, getTransitionName()); @@ -21072,8 +21452,8 @@ var getTransitionName = function () { * @private */ function getDataMax($$) { - var levelMax = $$.config.polar_level_max; - var dataMax = $$.getMinMaxData().max[0].value; + const levelMax = $$.config.polar_level_max; + let dataMax = $$.getMinMaxData().max[0].value; // Apply level max only when is greater than the data max value if (levelMax && levelMax > dataMax) { @@ -21087,7 +21467,7 @@ function getDataMax($$) { * @private */ initPolar: function initPolar() { - var $$ = this, + const $$ = this, arcs = $$.$el.arcs, config = $$.config, levelTextShow = config.polar_level_text_show, @@ -21108,8 +21488,8 @@ function getDataMax($$) { * @private */ getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) { - var _d$data$values$0$valu, - dataMax = getDataMax(this); + var _d$data$values$0$valu; + const dataMax = getDataMax(this); return ((_d$data$values$0$valu = d == null ? void 0 : d.data.values[0].value) != null ? _d$data$values$0$valu : 0) / dataMax * outerRadius; }, /** @@ -21126,7 +21506,7 @@ function getDataMax($$) { * @private */ redrawPolar: function redrawPolar() { - var $$ = this, + const $$ = this, config = $$.config; config.polar_level_show && $$.updatePolarLevel(); }, @@ -21135,8 +21515,8 @@ function getDataMax($$) { * @private */ updatePolarLevel: function updatePolarLevel() { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, state = $$.state, levels = $$.$el.arcs.levels, @@ -21151,7 +21531,7 @@ function getDataMax($$) { levelTextFormat = (config.polar_level_text_format || function () {}).bind($$.api), level = levels.selectAll("." + $LEVEL.level).data(levelData); level.exit().remove(); - var levelEnter = level.enter().append("g").attr("class", function (d, i) { + const levelEnter = level.enter().append("g").attr("class", function (d, i) { _newArrowCheck(this, _this); return $LEVEL.level + " " + $LEVEL.level + "-" + i; }.bind(this)); @@ -21163,7 +21543,7 @@ function getDataMax($$) { return levelRatio[d]; }.bind(this)); if (config.polar_level_text_show) { - var levelTextBackgroundColor = config.polar_level_text_backgroundColor, + const levelTextBackgroundColor = config.polar_level_text_backgroundColor, defsId = "#" + state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(levelTextBackgroundColor); levelEnter.append("text").style("text-anchor", "middle"); levelEnter.merge(level).selectAll("text").attr("dy", function (d) { @@ -21199,17 +21579,17 @@ function getDataMax($$) { * @private */ function getPosition(isClockwise, type, edge, pos, range, ratio) { - var index = isClockwise && pos > 0 ? edge - pos : pos, + const index = isClockwise && pos > 0 ? edge - pos : pos, r = 2 * Math.PI, func = type === "x" ? Math.sin : Math.cos; return range * (1 - ratio * func(index * r / edge)); } // cache key -var cacheKey = KEY.radarPoints; +const cacheKey = KEY.radarPoints; /* harmony default export */ var radar = ({ initRadar: function initRadar() { - var $$ = this, + const $$ = this, config = $$.config, current = $$.state.current, $el = $$.$el; @@ -21228,7 +21608,7 @@ var cacheKey = KEY.radarPoints; } }, getRadarSize: function getRadarSize() { - var $$ = this, + const $$ = this, config = $$.config, _$$$state = $$.state, arcWidth = _$$$state.arcWidth, @@ -21238,8 +21618,8 @@ var cacheKey = KEY.radarPoints; return [size, size]; }, updateTargetsForRadar: function updateTargetsForRadar(targets) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config; if (isEmpty(config.axis_x_categories)) { config.axis_x_categories = getRange(0, getMinMax("max", targets.map(function (v) { @@ -21250,8 +21630,8 @@ var cacheKey = KEY.radarPoints; $$.generateRadarPoints(); }, getRadarPosition: function getRadarPosition(type, index, range, ratio) { - var _this2 = this, - $$ = this, + var _this2 = this; + const $$ = this, config = $$.config, _$$$getRadarSize = $$.getRadarSize(), width = _$$$getRadarSize[0], @@ -21269,8 +21649,8 @@ var cacheKey = KEY.radarPoints; * @private */ generateRadarPoints: function generateRadarPoints() { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, targets = $$.data.targets, _$$$getRadarSize2 = $$.getRadarSize(), width = _$$$getRadarSize2[0], @@ -21295,7 +21675,7 @@ var cacheKey = KEY.radarPoints; } }, redrawRadar: function redrawRadar() { - var $$ = this, + const $$ = this, _$$$$el = $$.$el, radar = _$$$$el.radar, main = _$$$$el.main, @@ -21311,17 +21691,17 @@ var cacheKey = KEY.radarPoints; } }, generateGetRadarPoints: function generateGetRadarPoints() { - var _this5 = this, - points = this.cache.get(cacheKey); + var _this5 = this; + const points = this.cache.get(cacheKey); return function (d, i) { _newArrowCheck(this, _this5); - var point = points[d.id][i]; + const point = points[d.id][i]; return [point, point, point, point]; }.bind(this); }, updateRadarLevel: function updateRadarLevel() { - var _this6 = this, - $$ = this, + var _this6 = this; + const $$ = this, config = $$.config, state = $$.state, radar = $$.$el.radar, @@ -21342,7 +21722,7 @@ var cacheKey = KEY.radarPoints; points = levelData.map(function (v) { var _this7 = this; _newArrowCheck(this, _this6); - var range = levelRatio[v], + const range = levelRatio[v], pos = getRange(0, edge).map(function (i) { _newArrowCheck(this, _this7); return $$.getRadarPosition(["x", "y"], i, range, 1).join(","); @@ -21350,10 +21730,11 @@ var cacheKey = KEY.radarPoints; return pos.join(" "); }.bind(this)), level = radarLevels.selectAll("." + $LEVEL.level).data(levelData); + // Generate points level.exit().remove(); - var levelEnter = level.enter().append("g").attr("class", function (d, i) { + const levelEnter = level.enter().append("g").attr("class", function (d, i) { _newArrowCheck(this, _this6); return $LEVEL.level + " " + $LEVEL.level + "-" + i; }.bind(this)); @@ -21390,17 +21771,17 @@ var cacheKey = KEY.radarPoints; } }, updateRadarAxes: function updateRadarAxes() { - var _this8 = this, - $$ = this, + var _this8 = this; + const $$ = this, config = $$.config, radar = $$.$el.radar, _$$$getRadarSize4 = $$.getRadarSize(), width = _$$$getRadarSize4[0], height = _$$$getRadarSize4[1], - categories = config.axis_x_categories, - axis = radar.axes.selectAll("g").data(categories); + categories = config.axis_x_categories; + let axis = radar.axes.selectAll("g").data(categories); axis.exit().remove(); - var axisEnter = axis.enter().append("g").attr("class", function (d, i) { + const axisEnter = axis.enter().append("g").attr("class", function (d, i) { _newArrowCheck(this, _this8); return $AXIS.axis + "-" + i; }.bind(this)); @@ -21421,7 +21802,7 @@ var cacheKey = KEY.radarPoints; // axis text if (config.radar_axis_text_show) { - var _config$radar_axis_te = config.radar_axis_text_position, + const _config$radar_axis_te = config.radar_axis_text_position, _config$radar_axis_te2 = _config$radar_axis_te.x, x = _config$radar_axis_te2 === void 0 ? 0 : _config$radar_axis_te2, _config$radar_axis_te3 = _config$radar_axis_te.y, @@ -21441,7 +21822,7 @@ var cacheKey = KEY.radarPoints; // cache evaluated axis text width this.width = this.getBoundingClientRect().width / 2; } - var posX = $$.getRadarPosition("x", d.index, undefined, 1), + let posX = $$.getRadarPosition("x", d.index, undefined, 1), posY = Math.round($$.getRadarPosition("y", d.index, undefined, 1)); if (posX > width) { posX += this.width + x; @@ -21463,34 +21844,25 @@ var cacheKey = KEY.radarPoints; $$.bindRadarEvent(); }, bindRadarEvent: function bindRadarEvent() { - var _this9 = this, - $$ = this, + var _this9 = this; + const $$ = this, config = $$.config, state = $$.state, _$$$$el2 = $$.$el, radar = _$$$$el2.radar, svg = _$$$$el2.svg, - focusOnly = config.point_focus_only, + focusOnly = $$.isPointFocusOnly(), _state = state, inputType = _state.inputType, transiting = _state.transiting; if (config.interaction_enabled) { - var isMouse = inputType === "mouse", - getIndex = function (event) { - _newArrowCheck(this, _this9); - var target = event.target; - - // in case of multilined axis text - if (/tspan/i.test(target.tagName)) { - target = target.parentNode; - } - var d = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum(); - return d && Object.keys(d).length === 1 ? d.index : undefined; - }.bind(this), + const isMouse = inputType === "mouse", hide = function (event) { _newArrowCheck(this, _this9); state.event = event; - var index = getIndex(event), + + // const index = getIndex(event); + const index = $$.getDataIndexFromEvent(event), noIndex = isUndefined(index); if (isMouse || noIndex) { $$.hideTooltip(); @@ -21509,8 +21881,8 @@ var cacheKey = KEY.radarPoints; return; } state.event = event; - var index = getIndex(event); - $$.selectRectForSingle(svg.node(), null, index); + const index = $$.getDataIndexFromEvent(event); + $$.selectRectForSingle(svg.node(), index); isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index); }.bind(this)).on("mouseout", isMouse ? hide : null); if (!isMouse) { @@ -21519,8 +21891,8 @@ var cacheKey = KEY.radarPoints; } }, updateRadarShape: function updateRadarShape() { - var _this10 = this, - $$ = this, + var _this10 = this; + const $$ = this, targets = $$.data.targets.filter(function (d) { _newArrowCheck(this, _this10); return $$.isRadarType(d); @@ -21576,8 +21948,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len * @private */ function position(group, root) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, _$$$scale = $$.scale, x = _$$$scale.x, y = _$$$scale.y, @@ -21601,11 +21973,11 @@ function position(group, root) { * @private */ function convertDataToTreemapData(data) { - var _this2 = this, - $$ = this; + var _this2 = this; + const $$ = this; return data.map(function (d) { _newArrowCheck(this, _this2); - var id = d.id, + const id = d.id, values = d.values, value = values[0].value; return { @@ -21619,8 +21991,8 @@ function convertDataToTreemapData(data) { } /* harmony default export */ var treemap = ({ initTreemap: function initTreemap() { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, $el = $$.$el, _$$$state = $$.state, _$$$state$current = _$$$state.current, @@ -21633,7 +22005,7 @@ function convertDataToTreemapData(data) { $$.treemapFn = function (data) { var _this4 = this; _newArrowCheck(this, _this3); - var hierarchyData = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.hierarchy)(data).sum(function (d) { + const hierarchyData = (0,external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.hierarchy)(data).sum(function (d) { _newArrowCheck(this, _this4); return d.value; }.bind(this)), @@ -21649,16 +22021,16 @@ function convertDataToTreemapData(data) { * @private */ bindTreemapEvent: function bindTreemapEvent() { - var _this5 = this, - $$ = this, + var _this5 = this; + const $$ = this, $el = $$.$el, config = $$.config, state = $$.state, getTarget = function (event) { var _state$eventReceiver$, _data; _newArrowCheck(this, _this5); - var target = event.isTrusted ? event.target : (_state$eventReceiver$ = state.eventReceiver.rect) == null ? void 0 : _state$eventReceiver$.node(), - data; + const target = event.isTrusted ? event.target : (_state$eventReceiver$ = state.eventReceiver.rect) == null ? void 0 : _state$eventReceiver$.node(); + let data; if (/^rect$/i.test(target.tagName)) { state.event = event; data = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(target).datum(); @@ -21666,17 +22038,17 @@ function convertDataToTreemapData(data) { return (_data = data) == null ? void 0 : _data.data; }.bind(this); if (config.interaction_enabled) { - var isTouch = state.inputType === "touch"; - $el.treemap.on(isTouch ? "touchstart" : "mousemove", function (event) { + const isTouch = state.inputType === "touch"; + $el.treemap.on(isTouch ? "touchstart" : "mouseover mousemove", function (event) { _newArrowCheck(this, _this5); - var data = getTarget(event); + const data = getTarget(event); if (data) { $$.showTooltip([data], event.currentTarget); - event.type === "mouseover" && $$.setOverOut(!0, data); + /^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(!0, data); } }.bind(this)).on(isTouch ? "touchend" : "mouseout", function (event) { _newArrowCheck(this, _this5); - var data = getTarget(event); + const data = getTarget(event); $$.hideTooltip(); $$.setOverOut(!1, data); }.bind(this)); @@ -21690,7 +22062,8 @@ function convertDataToTreemapData(data) { getTreemapTile: function getTreemapTile() { var _binary$dice$slice$sl, _config$treemap_tile, - $$ = this, + _this6 = this; + const $$ = this, config = $$.config, _$$$state$current2 = $$.state.current, width = _$$$state$current2.width, @@ -21702,13 +22075,12 @@ function convertDataToTreemapData(data) { "sliceDice": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapSliceDice, "squarify": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapSquarify, "resquarify": external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapResquarify - }[(_config$treemap_tile = config.treemap_tile) != null ? _config$treemap_tile : "binary"]) != null ? _binary$dice$slice$sl : external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapBinary, - _this6 = this; + }[(_config$treemap_tile = config.treemap_tile) != null ? _config$treemap_tile : "binary"]) != null ? _binary$dice$slice$sl : external_commonjs_d3_hierarchy_commonjs2_d3_hierarchy_amd_d3_hierarchy_root_d3_.treemapBinary; return function (node, x0, y0, x1, y1) { _newArrowCheck(this, _this6); tile(node, 0, 0, width, height); for (var _iterator = _createForOfIteratorHelperLoose(node.children), _step; !(_step = _iterator()).done;) { - var child = _step.value; + const child = _step.value; child.x0 = x0 + child.x0 / width * (x1 - x0); child.x1 = x0 + child.x1 / width * (x1 - x0); child.y0 = y0 + child.y0 / height * (y1 - y0); @@ -21723,7 +22095,7 @@ function convertDataToTreemapData(data) { * @private */ getTreemapData: function getTreemapData(targets) { - var $$ = this; + const $$ = this; return { name: "root", children: convertDataToTreemapData.bind($$)($$.filterTargetsToShow(targets.filter($$.isTreemapType, $$))) @@ -21735,7 +22107,7 @@ function convertDataToTreemapData(data) { * @private */ updateTargetsForTreemap: function updateTargetsForTreemap(targets) { - var $$ = this, + const $$ = this, treemap = $$.$el.treemap, treemapData = $$.treemapFn($$.getTreemapData(targets != null ? targets : $$.data.targets)); // using $el.treemap reference can alter data, so select treemap <g> again @@ -21747,8 +22119,8 @@ function convertDataToTreemapData(data) { * @private */ updateTreemap: function updateTreemap(durationForExit) { - var _this7 = this, - $$ = this, + var _this7 = this; + const $$ = this, $el = $$.$el, $T = $$.$T, data = $el.treemap.datum(), @@ -21767,8 +22139,8 @@ function convertDataToTreemapData(data) { * @private */ generateGetTreemapPoints: function generateGetTreemapPoints() { - var _this8 = this, - $$ = this, + var _this8 = this; + const $$ = this, $el = $$.$el, _$$$scale2 = $$.scale, x = _$$$scale2.x, @@ -21790,7 +22162,7 @@ function convertDataToTreemapData(data) { * @private */ redrawTreemap: function redrawTreemap(withTransition) { - var $$ = this, + const $$ = this, $el = $$.$el, _$$$state$current3 = $$.state.current, width = _$$$state$current3.width, @@ -21806,7 +22178,7 @@ function convertDataToTreemapData(data) { * @private */ treemapDataLabelFormat: function treemapDataLabelFormat(d) { - var $$ = this, + const $$ = this, config = $$.config, id = d.id, value = d.value, @@ -21839,6 +22211,13 @@ function convertDataToTreemapData(data) { * @property {boolean} [point.show=true] Whether to show each point in line. * @property {number|Function} [point.r=2.5] The radius size of each point. * - **NOTE:** Disabled for 'bubble' type + * @property {boolean|object} [point.radialGradient=false] Set the radial gradient on point.<br><br> + * Or customize by giving below object value: + * - cx {number}: `cx` value (default: `0.3`) + * - cy {number}: `cy` value (default: `0.3`) + * - r {number}: `r` value (default: `0.7`) + * - stops {Array}: Each item should be having `[offset, stop-color, stop-opacity]` values. + * - (default: `[[0.1, $DATA_COLOR, 1], [0.9, $DATA_COLOR, 0]]`) * @property {boolean} [point.focus.expand.enabled=true] Whether to expand each point on focus. * @property {number} [point.focus.expand.r=point.r*1.75] The radius size of each point on focus. * - **NOTE:** For 'bubble' type, the default is `bubbleSize*1.15` @@ -21881,6 +22260,7 @@ function convertDataToTreemapData(data) { * (ex. `<polygon points='2.5 0 0 5 5 5'></polygon>`) * @see [Demo: point type](https://naver.github.io/billboard.js/demo/#Point.RectanglePoints) * @see [Demo: point focus only](https://naver.github.io/billboard.js/demo/#Point.FocusOnly) + * @see [Demo: point radialGradient](https://naver.github.io/billboard.js/demo/#Point.RadialGradientPoint) * @see [Demo: point sensitivity](https://naver.github.io/billboard.js/demo/#Point.PointSensitivity) * @example * point: { @@ -21893,6 +22273,32 @@ function convertDataToTreemapData(data) { * return r; * }, * + * // will generate follwing radialGradient: + * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient + * // <radualGradient cx="0.3" cy="0.3" r="0.7"> + * // <stop offset="0.1" stop-color="$DATA_COLOR" stop-opacity="1"></stop> + * // <stop offset="0.9" stop-color="$DATA_COLOR" stop-opacity="0"></stop> + * // </radialrGradient> + * radialGradient: true, + * + * // Or customized gradient + * radialGradient: { + * cx: 0.3, // cx attributes + * cy: 0.5, // cy attributes + * r: 0.7, // r attributes + * stops: [ + * // offset, stop-color, stop-opacity + * [0, "#7cb5ec", 1], + * + * // setting 'null' for stop-color, will set its original data color + * [0.5, null, 0], + * + * // setting 'function' for stop-color, will pass data id as argument. + * // It should return color string or null value + * [1, function(id) { return id === "data1" ? "red" : "blue"; }, 0], + * ] + * }, + * * focus: { * expand: { * enabled: true, @@ -21939,6 +22345,7 @@ function convertDataToTreemapData(data) { */ point_show: !0, point_r: 2.5, + point_radialGradient: !1, point_sensitivity: 10, point_focus_expand_enabled: !0, point_focus_expand_r: undefined, @@ -21969,9 +22376,10 @@ function convertDataToTreemapData(data) { * @property {boolean} [area.front=true] Set area node to be positioned over line node. * @property {boolean|object} [area.linearGradient=false] Set the linear gradient on area.<br><br> * Or customize by giving below object value: - * - x {Array}: `x1`, `x2` value - * - y {Array}: `y1`, `y2` value + * - x {Array}: `x1`, `x2` value (default: `[0, 0]`) + * - y {Array}: `y1`, `y2` value (default: `[0, 1]`) * - stops {Array}: Each item should be having `[offset, stop-color, stop-opacity]` values. + * - (default: `[[0, $DATA_COLOR, 1], [1, $DATA_COLOR, 0]]`) * @property {boolean} [area.zerobased=true] Set if min or max value will be 0 on area chart. * @see [MDN's <linearGradient>](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient), [<stop>](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/stop) * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.AreaChart) @@ -21988,6 +22396,7 @@ function convertDataToTreemapData(data) { * front: false, * * // will generate follwing linearGradient: + * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient * // <linearGradient x1="0" x2="0" y1="0" y2="1"> * // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop> * // <stop offset="1" stop-color="$DATA_COLOR" stop-opacity="0"></stop> @@ -22038,9 +22447,10 @@ function convertDataToTreemapData(data) { * @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels. * @property {boolean|object} [bar.linearGradient=false] Set the linear gradient on bar.<br><br> * Or customize by giving below object value: - * - x {Array}: `x1`, `x2` value - * - y {Array}: `y1`, `y2` value + * - x {Array}: `x1`, `x2` value (default: `[0, 0]`) + * - y {Array}: `y1`, `y2` value (default: `[0, 1]`) * - stops {Array}: Each item should be having `[offset, stop-color, stop-opacity]` values. + * - (default: `[[0, $DATA_COLOR, 1], [1, $DATA_COLOR, 0]]`) * @property {boolean} [bar.overlap=false] Bars will be rendered at same position, which will be overlapped each other. (for non-grouped bars only) * @property {number} [bar.padding=0] The padding pixel value between each bar. * @property {number} [bar.radius] Set the radius of bar edge in pixel. @@ -22074,6 +22484,7 @@ function convertDataToTreemapData(data) { * }, * * // will generate follwing linearGradient: + * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient * // <linearGradient x1="0" x2="0" y1="0" y2="1"> * // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop> * // <stop offset="1" stop-color="$DATA_COLOR" stop-opacity="0"></stop> @@ -23128,7 +23539,7 @@ function extendArc(module, option) { } // Area types -var _area = function area() { +let _area = function area() { var _this2 = this; _newArrowCheck(this, shape_this); return extendLine(shape_area, [Options_shape_area]), (_area = function () { @@ -23296,7 +23707,7 @@ function setSelection(isSelection, ids, indices, resetOther) { if (isSelection === void 0) { isSelection = !1; } - var $$ = this, + const $$ = this, config = $$.config, main = $$.$el.main, selectionGrouped = config.data_selection_grouped, @@ -23305,7 +23716,7 @@ function setSelection(isSelection, ids, indices, resetOther) { return; } main.selectAll("." + $SHAPE.shapes).selectAll("." + $SHAPE.shape).each(function (d) { - var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), + const shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), _ref = d.data ? d.data : d, id = _ref.id, index = _ref.index, @@ -23348,8 +23759,8 @@ function setSelection(isSelection, ids, indices, resetOther) { * chart.selected("data1"); */ selected: function selected(targetId) { - var _this = this, - $$ = this.internal, + var _this = this; + const $$ = this.internal, dataPoint = []; $$.$el.main.selectAll("." + ($SHAPE.shapes + $$.getTargetSelectorSuffix(targetId))).selectAll("." + $SHAPE.shape).filter(function () { return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($SELECT.SELECTED); @@ -23384,7 +23795,7 @@ function setSelection(isSelection, ids, indices, resetOther) { * chart.select("data1", [0, 3, 5]); */ select: function select(ids, indices, resetOther) { - var $$ = this.internal; + const $$ = this.internal; setSelection.bind($$)(!0, ids, indices, resetOther); }, /** @@ -23405,102 +23816,168 @@ function setSelection(isSelection, ids, indices, resetOther) { * chart.unselect("data1", [2]); */ unselect: function unselect(ids, indices) { - var $$ = this.internal; + const $$ = this.internal; setSelection.bind($$)(!1, ids, indices); } }); ;// CONCATENATED MODULE: ./src/Chart/api/subchart.ts + /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license */ -/* harmony default export */ var subchart = ({ - subchart: { - /** - * Show subchart - * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`. - * @function subchart․show - * @instance - * @memberof Chart - * @example - * // for ESM imports, needs to import 'subchart' and must be instantiated first to enable subchart's API. - * import {subchart} from "billboard.js"; - * - * const chart = bb.generate({ - * ... - * subchart: { - * // need to be instantiated by calling 'subchart()' - * enabled: subchart() - * - * // in case don't want subchart to be shown at initialization, instantiate with '!subchart()' - * enabled: !subchart() - * } - * }); - * - * chart.subchart.show(); - */ - show: function () { - var $$ = this.internal, - subchart = $$.$el.subchart, - config = $$.config, - show = config.subchart_show; - if (!show) { - var _$target, _subchart$main2; - // unbind zoom event bound to chart rect area - $$.unbindZoomEvent(); - config.subchart_show = !show; - subchart.main || $$.initSubchart(); - var $target = subchart.main.selectAll("." + $COMMON.target); - // need to cover when new data has been loaded - if ($$.data.targets.length !== $target.size()) { - var _subchart$main; - $$.updateSizes(); - $$.updateTargetsForSubchart($$.data.targets); - $target = (_subchart$main = subchart.main) == null ? void 0 : _subchart$main.selectAll("." + $COMMON.target); - } - (_$target = $target) == null ? void 0 : _$target.style("opacity", null); - (_subchart$main2 = subchart.main) == null ? void 0 : _subchart$main2.style("display", null); - this.resize(); +/** + * Select subchart by giving x domain range. + * - **ℹ️ NOTE:** + * - Due to the limitations of floating point precision, domain value may not be exact returning approximately values. + * @function subchart + * @instance + * @memberof Chart + * @param {Array} domainValue If domain range is given, the subchart will be seleted to the given domain. If no argument is given, the current subchart selection domain will be returned. + * @returns {Array} domain value in array + * @example + * // Specify domain for subchart selection + * chart.subchart([1, 2]); + * + * // Get the current subchart selection domain range + * // Domain value may not be exact returning approximately values. + * chart.subchart(); + */ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc. +const subchart = function (domainValue) { + var _this = this; + const $$ = this.internal, + axis = $$.axis, + brush = $$.brush, + config = $$.config, + _$$$scale = $$.scale, + x = _$$$scale.x, + subX = _$$$scale.subX, + state = $$.state; + let domain; + if (config.subchart_show) { + domain = domainValue; + if (Array.isArray(domain)) { + if (axis.isTimeSeries()) { + domain = domain.map(function (x) { + _newArrowCheck(this, _this); + return parseDate.bind($$)(x); + }.bind(this)); } - }, - /** - * Hide generated subchart - * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`. - * @function subchart․hide - * @instance - * @memberof Chart - * @example - * chart.subchart.hide(); - */ - hide: function hide() { - var $$ = this.internal, - main = $$.$el.subchart.main, - config = $$.config; - if (config.subchart_show && (main == null ? void 0 : main.style("display")) !== "none") { - config.subchart_show = !1; - main.style("display", "none"); - this.resize(); + const isWithinRange = $$.withinRange(domain, $$.getZoomDomain("subX", !0), $$.getZoomDomain("subX")); + if (isWithinRange) { + state.domain = domain; + brush.move(brush.getSelection(), domain.map(subX)); } - }, - /** - * Toggle the visiblity of subchart - * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`. - * @function subchart․toggle - * @instance - * @memberof Chart - * @example - * // When subchart is hidden, will be shown - * // When subchart is shown, will be hidden - * chart.subchart.toggle(); - */ - toggle: function toggle() { - var $$ = this.internal, - config = $$.config; - this.subchart[config.subchart_show ? "hide" : "show"](); + } else { + var _state$domain; + domain = (_state$domain = state.domain) != null ? _state$domain : x.orgDomain(); } } + return domain; +}; +extend(subchart, { + /** + * Show subchart + * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`. + * @function subchart․show + * @instance + * @memberof Chart + * @example + * // for ESM imports, needs to import 'subchart' and must be instantiated first to enable subchart's API. + * import {subchart} from "billboard.js"; + * + * const chart = bb.generate({ + * ... + * subchart: { + * // need to be instantiated by calling 'subchart()' + * enabled: subchart() + * + * // in case don't want subchart to be shown at initialization, instantiate with '!subchart()' + * enabled: !subchart() + * } + * }); + * + * chart.subchart.show(); + */ + show: function () { + const $$ = this.internal, + subchart = $$.$el.subchart, + config = $$.config, + show = config.subchart_show; + if (!show) { + var _$target, _subchart$main2; + // unbind zoom event bound to chart rect area + $$.unbindZoomEvent(); + config.subchart_show = !show; + subchart.main || $$.initSubchart(); + let $target = subchart.main.selectAll("." + $COMMON.target); + + // need to cover when new data has been loaded + if ($$.data.targets.length !== $target.size()) { + var _subchart$main; + $$.updateSizes(); + $$.updateTargetsForSubchart($$.data.targets); + $target = (_subchart$main = subchart.main) == null ? void 0 : _subchart$main.selectAll("." + $COMMON.target); + } + (_$target = $target) == null || _$target.style("opacity", null); + (_subchart$main2 = subchart.main) == null || _subchart$main2.style("display", null); + this.resize(); + } + }, + /** + * Hide generated subchart + * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`. + * @function subchart․hide + * @instance + * @memberof Chart + * @example + * chart.subchart.hide(); + */ + hide: function hide() { + const $$ = this.internal, + main = $$.$el.subchart.main, + config = $$.config; + if (config.subchart_show && (main == null ? void 0 : main.style("display")) !== "none") { + config.subchart_show = !1; + main.style("display", "none"); + this.resize(); + } + }, + /** + * Toggle the visiblity of subchart + * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`. + * @function subchart․toggle + * @instance + * @memberof Chart + * @example + * // When subchart is hidden, will be shown + * // When subchart is shown, will be hidden + * chart.subchart.toggle(); + */ + toggle: function toggle() { + const $$ = this.internal, + config = $$.config; + this.subchart[config.subchart_show ? "hide" : "show"](); + }, + /** + * Reset subchart selection + * @function subchart․reset + * @instance + * @memberof Chart + * @example + * // Reset subchart selection + * chart.subchart.reset(); + */ + reset: function reset() { + const $$ = this.internal, + brush = $$.brush; + brush.clear(brush.getSelection()); + } +}); +/* harmony default export */ var api_subchart = ({ + subchart: subchart }); // EXTERNAL MODULE: external {"commonjs":"d3-zoom","commonjs2":"d3-zoom","amd":"d3-zoom","root":"d3"} var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack_require__(14); @@ -23512,38 +23989,13 @@ var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack */ - -/** - * Check if the given domain is within zoom range - * @param {Array} domain Target domain value - * @param {Array} current Current zoom domain value - * @param {Array} range Zoom range value - * @param {boolean} isInverted Whether the axis is inverted or not - * @returns {boolean} - * @private - */ -function withinRange(domain, current, range, isInverted) { - var _this = this; - if (isInverted === void 0) { - isInverted = !1; - } - var min = range[0], - max = range[1]; - return domain.every(function (v, i) { - var _this2 = this; - _newArrowCheck(this, _this); - return (i === 0 ? isInverted ? +v <= min : +v >= min : isInverted ? +v >= max : +v <= max) && !domain.every(function (v, i) { - _newArrowCheck(this, _this2); - return v === current[i]; - }.bind(this)); - }.bind(this)); -} - /** * Zoom by giving x domain range. - * - **NOTE:** + * - **ℹ️ NOTE:** * - For `wheel` type zoom, the minimum zoom range will be set as the given domain range. To get the initial state, [.unzoom()](#unzoom) should be called. * - To be used [zoom.enabled](Options.html#.zoom) option should be set as `truthy`. + * - When x axis type is `category`, domain range should be specified as index numbers. + * - Due to the limitations of floating point precision, domain value may not be exact returning approximately values. * @function zoom * @instance * @memberof Chart @@ -23553,62 +24005,70 @@ function withinRange(domain, current, range, isInverted) { * // Zoom to specified domain range * chart.zoom([10, 20]); * - * // For timeseries, the domain value can be string, but the format should match with the 'data.xFormat' option. + * // For timeseries x axis, the domain value can be string, but the format should match with the 'data.xFormat' option. * chart.zoom(["2021-02-03", "2021-02-08"]); * + * // For category x axis, the domain value should be index number. + * chart.zoom([0, 3]); + * * // Get the current zoomed domain range + * // Domain value may not be exact returning approximately values. * chart.zoom(); - */ -var zoom = function (domainValue) { - var _this3 = this, - $$ = this.internal, + */ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc. +const zoom = function (domainValue) { + var _this = this, + _state$domain; + const $$ = this.internal, $el = $$.$el, axis = $$.axis, config = $$.config, org = $$.org, scale = $$.scale, + state = $$.state, isRotated = config.axis_rotated, - isInverted = config.axis_x_inverted, - isCategorized = axis.isCategorized(), + isCategorized = axis.isCategorized(); + let domain; + if (config.zoom_enabled) { domain = domainValue; - if (config.zoom_enabled && domain) { - if (axis.isTimeSeries()) { - domain = domain.map(function (x) { - _newArrowCheck(this, _this3); - return parseDate.bind($$)(x); - }.bind(this)); - } - var isWithinRange = withinRange(domain, $$.getZoomDomain(!0), $$.getZoomDomain(), isInverted); - if (isWithinRange) { - if (isCategorized) { - domain = domain.map(function (v, i) { - _newArrowCheck(this, _this3); - return +v + (i === 0 ? 0 : 1); + if (Array.isArray(domain)) { + if (axis.isTimeSeries()) { + domain = domain.map(function (x) { + _newArrowCheck(this, _this); + return parseDate.bind($$)(x); }.bind(this)); } + const isWithinRange = $$.withinRange(domain, $$.getZoomDomain("zoom", !0), $$.getZoomDomain("zoom")); + if (isWithinRange) { + state.domain = domain; + if (isCategorized) { + domain = domain.map(function (v, i) { + _newArrowCheck(this, _this); + return +v + (i === 0 ? 0 : 1); + }.bind(this)); + } - // hide any possible tooltip show before the zoom - $$.api.tooltip.hide(); - if (config.subchart_show) { - var x = scale.zoom || scale.x; - $$.brush.getSelection().call($$.brush.move, domain.map(x)); - // resultDomain = domain; - } else { - var _d3ZoomIdentity$scale, - _x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x, - translate = [-_x(domain[0]), 0], - transform = (_d3ZoomIdentity$scale = external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.scale(_x.range()[1] / (_x(domain[1]) - _x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate); // in case of 'config.zoom_rescale=true', use org.xScale - // Get transform from given domain value - // https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951 - - $el.eventRect.call($$.zoom.transform, transform); + // hide any possible tooltip show before the zoom + $$.api.tooltip.hide(); + if (config.subchart_show) { + const x = scale.zoom || scale.x; + $$.brush.getSelection().call($$.brush.move, domain.map(x)); + // resultDomain = domain; + } else { + var _d3ZoomIdentity$scale; + // in case of 'config.zoom_rescale=true', use org.xScale + const x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x, + translate = [-x(domain[0]), 0], + transform = (_d3ZoomIdentity$scale = external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.scale(x.range()[1] / (x(domain[1]) - x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate); // Get transform from given domain value + // https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951 + $el.eventRect.call($$.zoom.transform, transform); + } + $$.setZoomResetButton(); } - $$.setZoomResetButton(); + } else { + domain = $$.zoom.getDomain(); } - } else { - domain = scale.zoom ? scale.zoom.domain() : scale.x.orgDomain(); } - return domain; + return (_state$domain = state.domain) != null ? _state$domain : domain; }; extend(zoom, { /** @@ -23630,7 +24090,7 @@ extend(zoom, { * chart.zoom.enable(false); */ enable: function enable(enabled) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config; if (/^(drag|wheel)$/.test(enabled)) { config.zoom_type = enabled; @@ -23656,7 +24116,7 @@ extend(zoom, { * chart.zoom.max(20); */ max: function max(_max) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config, xDomain = $$.org.xDomain; if (_max === 0 || _max) { @@ -23676,7 +24136,7 @@ extend(zoom, { * chart.zoom.min(-1); */ min: function min(_min) { - var $$ = this.internal, + const $$ = this.internal, config = $$.config, xDomain = $$.org.xDomain; if (_min === 0 || _min) { @@ -23702,9 +24162,9 @@ extend(zoom, { * }); */ range: function range(_range) { - var zoom = this.zoom; + const zoom = this.zoom; if (isObject(_range)) { - var min = _range.min, + const min = _range.min, max = _range.max; isDefined(min) && zoom.min(min); isDefined(max) && zoom.max(max); @@ -23727,20 +24187,22 @@ extend(zoom, { * chart.unzoom(); */ unzoom: function unzoom() { - var $$ = this.internal, + const $$ = this.internal, config = $$.config, _$$$$el = $$.$el, eventRect = _$$$$el.eventRect, - zoomResetBtn = _$$$$el.zoomResetBtn; + zoomResetBtn = _$$$$el.zoomResetBtn, + state = $$.state; if ($$.scale.zoom) { config.subchart_show ? $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity); $$.updateZoom(!0); - zoomResetBtn == null ? void 0 : zoomResetBtn.style("display", "none"); + zoomResetBtn == null || zoomResetBtn.style("display", "none"); // reset transform if ((0,external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomTransform)(eventRect.node()) !== external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity) { $$.zoom.transform(eventRect, external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity); } + state.domain = undefined; } } }); @@ -23765,8 +24227,8 @@ extend(zoom, { * @param {object} mouse Object */ drag: function drag(mouse) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, state = $$.state, main = $$.$el.main, @@ -23780,7 +24242,7 @@ extend(zoom, { ) { return; } - var _ref = state.dragStart || [0, 0], + const _ref = state.dragStart || [0, 0], sx = _ref[0], sy = _ref[1], mx = mouse[0], @@ -23796,24 +24258,24 @@ extend(zoom, { _newArrowCheck(this, _this); return isSelectable == null ? void 0 : isSelectable.bind($$.api)(d); }.bind(this)).each(function (d, i) { - var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), + const shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this), isSelected = shape.classed($SELECT.SELECTED), isIncluded = shape.classed($DRAG.INCLUDED); - var isWithin = !1, + let isWithin = !1, toggle; if (shape.classed($CIRCLE.circle)) { - var x = +shape.attr("cx") * 1, + const x = +shape.attr("cx") * 1, y = +shape.attr("cy") * 1; toggle = $$.togglePoint; isWithin = minX < x && x < maxX && minY < y && y < maxY; } else if (shape.classed($BAR.bar)) { - var _getPathBox = getPathBox(this), - _x = _getPathBox.x, + const _getPathBox = getPathBox(this), + x = _getPathBox.x, y = _getPathBox.y, width = _getPathBox.width, height = _getPathBox.height; toggle = $$.togglePath; - isWithin = !(maxX < _x || _x + width < minX) && !(maxY < y || y + height < minY); + isWithin = !(maxX < x || x + width < minX) && !(maxY < y || y + height < minY); } else { // line/area selection not supported yet return; @@ -23835,7 +24297,7 @@ extend(zoom, { * @param {object} mouse Object */ dragstart: function dragstart(mouse) { - var $$ = this, + const $$ = this, config = $$.config, state = $$.state, main = $$.$el.main; @@ -23852,7 +24314,7 @@ extend(zoom, { * @private */ dragend: function dragend() { - var $$ = this, + const $$ = this, config = $$.config, main = $$.$el.main, $T = $$.$T; @@ -23868,8 +24330,8 @@ extend(zoom, { ;// CONCATENATED MODULE: ./src/ChartInternal/internals/selection.ts -function selection_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } -function selection_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? selection_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : selection_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function selection_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r++) { t = null != arguments[r] ? arguments[r] : {}; r % 2 ? selection_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : selection_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /** * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license @@ -23887,8 +24349,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ selectPoint: function selectPoint(target, d, i) { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, main = $$.$el.main, $T = $$.$T, @@ -23915,7 +24377,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ unselectPoint: function unselectPoint(target, d, i) { - var $$ = this, + const $$ = this, config = $$.config, main = $$.$el.main, $T = $$.$T; @@ -23933,7 +24395,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ togglePoint: function togglePoint(selected, target, d, i) { - var method = (selected ? "" : "un") + "selectPoint"; + const method = (selected ? "" : "un") + "selectPoint"; this[method](target, d, i); }, /** @@ -23943,7 +24405,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ selectPath: function selectPath(target, d) { - var $$ = this, + const $$ = this, config = $$.config; callFn(config.data_onselected, $$.api, d, target.node()); if (config.interaction_brighten) { @@ -23957,7 +24419,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @param {object} d Data object */ unselectPath: function unselectPath(target, d) { - var $$ = this, + const $$ = this, config = $$.config; callFn(config.data_onunselected, $$.api, d, target.node()); if (config.interaction_brighten) { @@ -23983,8 +24445,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ getToggle: function getToggle(that, d) { - var _this2 = this, - $$ = this; + var _this2 = this; + const $$ = this; return that.nodeName === "path" ? $$.togglePath : $$.isStepType(d) ? function () { _newArrowCheck(this, _this2); }.bind(this) : @@ -23999,22 +24461,22 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ toggleShape: function toggleShape(that, d, i) { - var $$ = this, + const $$ = this, config = $$.config, main = $$.$el.main; if (config.data_selection_enabled && config.data_selection_isselectable.bind($$.api)(d)) { - var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that), + const shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(that), isSelected = shape.classed($SELECT.SELECTED), toggle = $$.getToggle(that, d).bind($$); - var toggledShape; + let toggledShape; if (!config.data_selection_multiple) { - var focusOnly = config.point_focus_only; - var selector = "." + (focusOnly ? $SELECT.selectedCircles : $SHAPE.shapes); + const focusOnly = $$.isPointFocusOnly == null ? void 0 : $$.isPointFocusOnly(); + let selector = "." + (focusOnly ? $SELECT.selectedCircles : $SHAPE.shapes); if (config.data_selection_grouped) { selector += $$.getTargetSelectorSuffix(d.id); } main.selectAll(selector).selectAll(focusOnly ? "." + $SELECT.selectedCircle : "." + $SHAPE.shape + "." + $SELECT.SELECTED).classed($SELECT.SELECTED, !1).each(function (d) { - var shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); + const shape = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this); toggledShape = shape; toggle(!1, shape, d, d.index); }); @@ -24042,42 +24504,44 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ initBrush: function initBrush() { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, scale = $$.scale, subchart = $$.$el.subchart, + state = $$.state, isRotated = config.axis_rotated, - lastDomain, - timeout; + height = config.subchart_size_height; + let lastDomain, lastSelection, timeout; // set the brush $$.brush = (isRotated ? (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushY)() : (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushX)()).handleSize(5); - var getBrushSize = function () { - _newArrowCheck(this, _this); - var brush = $$.$el.svg.select("." + classes.brush + " .overlay"), - brushSize = { - width: 0, - height: 0 - }; - if (brush.size()) { - brushSize.width = +brush.attr("width"); - brushSize.height = +brush.attr("height"); - } - return brushSize[isRotated ? "width" : "height"]; - }.bind(this); // bind brush event $$.brush.on("start brush end", function (event) { var _this2 = this; _newArrowCheck(this, _this); - var selection = event.selection, + const selection = event.selection, + sourceEvent = event.sourceEvent, target = event.target, type = event.type; if (type === "start") { $$.state.inputType === "touch" && $$.hideTooltip(); + lastSelection = sourceEvent ? selection : null; + // sourceEvent && (state.domain = null); } + + // if (type === "brush") { if (/(start|brush)/.test(type)) { - $$.redrawForBrush(); + var _lastSelection; + // when brush selection updates happens on one edge, update only chainging edge and + // is only for adjustment of given domain range to be used to return current domain range. + type === "brush" && sourceEvent && state.domain && ((_lastSelection = lastSelection) == null ? void 0 : _lastSelection.forEach(function (v, i) { + _newArrowCheck(this, _this2); + if (v !== selection[i]) { + state.domain[i] = scale.x.orgDomain()[i]; + } + }.bind(this))); + $$.redrawForBrush(type !== "start"); } if (type === "end") { lastDomain = scale.x.orgDomain(); @@ -24090,8 +24554,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. } else { $$.brush.handle.attr("display", null).attr("transform", function (d, i) { _newArrowCheck(this, _this2); - var pos = isRotated ? [33, selection[i] - (i === 0 ? 30 : 24)] : [selection[i], 3]; - return "translate(" + pos + ")"; + const pos = [selection[i], height / 2]; + return "translate(" + (isRotated ? pos.reverse() : pos) + ")"; }.bind(this)); } } @@ -24101,28 +24565,28 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. timeout && clearTimeout(timeout); timeout = setTimeout(function () { _newArrowCheck(this, _this3); - var selection = this.getSelection(); + const selection = this.getSelection(); lastDomain && (0,external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_.brushSelection)(selection.node()) && this.move(selection, lastDomain.map(scale.subX.orgScale())); }.bind(this), 0); }; $$.brush.update = function () { - var _this4 = this, - extent = this.extent()(); + var _this4 = this; + const extent = this.extent()(); if (extent[1].filter(function (v) { _newArrowCheck(this, _this4); return isNaN(v); }.bind(this)).length === 0) { var _subchart$main; - (_subchart$main = subchart.main) == null ? void 0 : _subchart$main.select("." + classes.brush).call(this); + (_subchart$main = subchart.main) == null || _subchart$main.select("." + classes.brush).call(this); } return this; }; // set the brush extent $$.brush.scale = function (scale) { - var _this5 = this, - h = config.subchart_size_height || getBrushSize(), - extent = $$.getExtent(); + var _this5 = this; + const h = config.subchart_size_height; + let extent = $$.getExtent(); if (!extent && scale.range) { extent = [[0, 0], [scale.range()[1], h]]; } else if (isArray(extent)) { @@ -24153,8 +24617,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ initSubchart: function initSubchart() { - var _this6 = this, - $$ = this, + var _this6 = this; + const $$ = this, config = $$.config, _$$$state = $$.state, clip = _$$$state.clip, @@ -24167,14 +24631,14 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. if (!hasAxis) { return; } - var visibility = config.subchart_show ? null : "hidden", + const visibility = config.subchart_show ? null : "hidden", clipId = clip.id + "-subchart", clipPath = $$.getClipPath(clipId); clip.idSubchart = clipId; $$.appendClip(defs, clipId); $$.initBrush(); subchart.main = svg.append("g").classed(classes.subchart, !0).attr("transform", $$.getTranslate("context")); - var main = subchart.main; + const main = subchart.main; main.style("visibility", visibility); // Define g for chart area @@ -24183,9 +24647,9 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. // Define g for chart types area ["bar", "line", "bubble", "candlestick", "scatter"].forEach(function (v) { _newArrowCheck(this, _this6); - var type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v); + const type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v); if ($$.hasType(v) || $$.hasTypeOf(type)) { - var chart = main.select("." + classes.chart), + const chart = main.select("." + classes.chart), chartClassName = classes["chart" + type + "s"]; if (chart.select("." + chartClassName).empty()) { chart.append("g").attr("class", chartClassName); @@ -24194,7 +24658,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. }.bind(this)); // Add extent rect for Brush - var brush = main.append("g").attr("clip-path", clipPath).attr("class", classes.brush).call($$.brush); + const brush = main.append("g").attr("clip-path", clipPath).attr("class", classes.brush).call($$.brush); config.subchart_showHandle && $$.addBrushHandle(brush); // ATTENTION: This must be called AFTER chart added @@ -24208,12 +24672,13 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ addBrushHandle: function addBrushHandle(brush) { - var _this7 = this, - $$ = this, + var _this7 = this; + const $$ = this, config = $$.config, isRotated = config.axis_rotated, initRange = config.subchart_init_range, - path = isRotated ? ["M 5.2491724,29.749209 a 6,6 0 0 0 -5.50000003,-6.5 H -5.7508276 a 6,6 0 0 0 -6.0000004,6.5 z m -5.00000003,-2 H -6.7508276 m 6.99999997,-2 H -6.7508276Z", "M 5.2491724,23.249172 a 6,-6 0 0 1 -5.50000003,6.5 H -5.7508276 a 6,-6 0 0 1 -6.0000004,-6.5 z m -5.00000003,2 H -6.7508276 m 6.99999997,2 H -6.7508276Z"] : ["M 0 18 A 6 6 0 0 0 -6.5 23.5 V 29 A 6 6 0 0 0 0 35 Z M -2 23 V 30 M -4 23 V 30Z", "M 0 18 A 6 6 0 0 1 6.5 23.5 V 29 A 6 6 0 0 1 0 35 Z M 2 23 V 30 M 4 23 V 30Z"]; + path = isRotated ? ["M8.5 0 a6 6 0 0 0 -6 -6.5 H-2.5 a 6 6 0 0 0 -6 6.5 z m-5 -2 H-3.5 m7 -2 H-3.5z", "M8.5 0 a6 -6 0 0 1 -6 6.5 H-2.5 a 6 -6 0 0 1 -6 -6.5z m-5 2 H-3.5 m7 2 H-3.5z"] : ["M0 -8.5 A6 6 0 0 0 -6.5 -3.5 V2.5 A6 6 0 0 0 0 8.5 Z M-2 -3.5 V3.5 M-4 -3.5 V3.5z", "M0 -8.5 A6 6 0 0 1 6.5 -3.5 V2.5 A6 6 0 0 1 0 8.5 Z M2 -3.5 V3.5 M4 -3.5 V3.5z"]; + // brush handle shape's path $$.brush.handle = brush.selectAll(".handle--custom").data(isRotated ? [{ @@ -24235,8 +24700,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ updateTargetsForSubchart: function updateTargetsForSubchart(targets) { - var _this8 = this, - $$ = this, + var _this8 = this; + const $$ = this, config = $$.config, state = $$.state, main = $$.$el.subchart.main; @@ -24246,17 +24711,17 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. return $$.hasType(v) || $$.hasTypeOf(capitalize(v)); }.bind(this)).forEach(function (v) { _newArrowCheck(this, _this8); - var isPointType = /^(bubble|scatter)$/.test(v), + const isPointType = /^(bubble|scatter)$/.test(v), name = capitalize(isPointType ? "circle" : v), chartClass = $$.getChartClass(name, !0), shapeClass = $$.getClass(isPointType ? "circles" : v + "s", !0), shapeChart = main.select("." + classes["chart" + (name + "s")]); if (isPointType) { - var circle = shapeChart.selectAll("." + classes.circles).data(targets.filter($$["is" + capitalize(v) + "Type"].bind($$))).attr("class", shapeClass); + const circle = shapeChart.selectAll("." + classes.circles).data(targets.filter($$["is" + capitalize(v) + "Type"].bind($$))).attr("class", shapeClass); circle.exit().remove(); circle.enter().append("g").attr("class", shapeClass); } else { - var shapeUpdate = shapeChart.selectAll("." + classes["chart" + name]).attr("class", chartClass).data(targets.filter($$["is" + name + "Type"].bind($$))), + const shapeUpdate = shapeChart.selectAll("." + classes["chart" + name]).attr("class", chartClass).data(targets.filter($$["is" + name + "Type"].bind($$))), shapeEnter = shapeUpdate.enter().append("g").style("opacity", "0").attr("class", chartClass).append("g").attr("class", shapeClass); shapeUpdate.exit().remove(); @@ -24277,8 +24742,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @param {object} shape Shape's info */ redrawSubchart: function redrawSubchart(withSubchart, duration, shape) { - var _this9 = this, - $$ = this, + var _this9 = this; + const $$ = this, config = $$.config, main = $$.$el.subchart.main, state = $$.state, @@ -24295,38 +24760,47 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. // update subchart elements if needed if (withSubchart) { - var initRange = config.subchart_init_range; + const initRange = config.subchart_init_range; // extent rect brushEmpty($$) || $$.brush.update(); Object.keys(shape.type).forEach(function (v) { _newArrowCheck(this, _this9); - var name = capitalize(v), + const name = capitalize(v), drawFn = $$["generateDraw" + name](shape.indices[v], !0); // call shape's update & redraw method $$["update" + name](withTransition, !0); $$["redraw" + name](drawFn, withTransition, !0); }.bind(this)); if ($$.hasType("bubble") || $$.hasType("scatter")) { - var cx = shape.pos.cx, + const cx = shape.pos.cx, cy = $$.updateCircleY(!0); $$.updateCircle(!0); $$.redrawCircle(cx, cy, withTransition, undefined, !0); } - !state.rendered && initRange && $$.brush.move($$.brush.getSelection(), initRange.map($$.scale.x)); + if (!state.rendered && initRange) { + state.domain = initRange; + $$.brush.move($$.brush.getSelection(), initRange.map($$.scale.x)); + } } } }, /** * Redraw the brush. + * @param {boolean} [callCallbck=true] Call 'onbrush' callback or not. * @private */ - redrawForBrush: function redrawForBrush() { - var $$ = this, + redrawForBrush: function redrawForBrush(callCallbck) { + var _state$domain; + if (callCallbck === void 0) { + callCallbck = !0; + } + const $$ = this, _$$$config = $$.config, onBrush = _$$$config.subchart_onbrush, withY = _$$$config.zoom_rescale, - scale = $$.scale; + scale = $$.scale, + state = $$.state; $$.redraw({ withTransition: !1, withY: withY, @@ -24334,7 +24808,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. withUpdateXDomain: !0, withDimension: !1 }); - onBrush.bind($$.api)(scale.x.orgDomain()); + callCallbck && state.rendered && onBrush.bind($$.api)((_state$domain = state.domain) != null ? _state$domain : scale.x.orgDomain()); }, /** * Transform context @@ -24343,7 +24817,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ transformContext: function transformContext(withTransition, transitions) { - var $$ = this, + const $$ = this, subchart = $$.$el.subchart, $T = $$.$T, subXAxis = transitions != null && transitions.axisSubX ? transitions.axisSubX : $T(subchart.main.select("." + classes.axisX), withTransition); @@ -24356,16 +24830,16 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ getExtent: function getExtent() { - var _this10 = this, - $$ = this, + var _this10 = this; + const $$ = this, config = $$.config, - scale = $$.scale, - extent = config.axis_x_extent; + scale = $$.scale; + let extent = config.axis_x_extent; if (extent) { if (isFunction(extent)) { extent = extent.bind($$.api)($$.getXDomain($$.data.targets), scale.subX); } else if ($$.axis.isTimeSeries() && extent.every(isNaN)) { - var fn = parseDate.bind($$); + const fn = parseDate.bind($$); extent = extent.map(function (v) { _newArrowCheck(this, _this10); return scale.subX(fn(v)); @@ -24391,7 +24865,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ initZoom: function initZoom() { - var $$ = this; + const $$ = this; $$.scale.zoom = null; $$.generateZoom(); $$.initZoomBehaviour(); @@ -24405,7 +24879,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. if (bind === void 0) { bind = !0; } - var $$ = this, + const $$ = this, config = $$.config, zoomEnabled = config.zoom_enabled; if (zoomEnabled && bind) { @@ -24421,8 +24895,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ generateZoom: function generateZoom() { - var _this = this, - $$ = this, + var _this = this; + const $$ = this, config = $$.config, org = $$.org, scale = $$.scale, @@ -24431,13 +24905,13 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. // @ts-ignore zoom.orgScaleExtent = function () { _newArrowCheck(this, _this); - var extent = config.zoom_extent || [1, 10]; + const extent = config.zoom_extent || [1, 10]; return [extent[0], Math.max($$.getMaxDataCount() / extent[1], extent[1])]; }.bind(this); // @ts-ignore zoom.updateScaleExtent = function () { - var ratio = diffDomain($$.scale.x.orgDomain()) / diffDomain($$.getZoomDomain()), + const ratio = diffDomain($$.scale.x.orgDomain()) / diffDomain($$.getZoomDomain()), extent = this.orgScaleExtent(); this.scaleExtent([extent[0] * ratio, extent[1] * ratio]); return this; @@ -24453,13 +24927,13 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. zoom.updateTransformScale = function (transform, correctTransform) { var _org$xScale; _newArrowCheck(this, _this); - var isRotated = config.axis_rotated; + const isRotated = config.axis_rotated; // in case of resize, update range of orgXScale - (_org$xScale = org.xScale) == null ? void 0 : _org$xScale.range(scale.x.range()); + (_org$xScale = org.xScale) == null || _org$xScale.range(scale.x.range()); // rescale from the original scale - var newScale = transform[isRotated ? "rescaleY" : "rescaleX"](org.xScale || scale.x), + const newScale = transform[isRotated ? "rescaleY" : "rescaleX"](org.xScale || scale.x), domain = $$.trimXDomain(newScale.domain()), rescale = config.zoom_rescale; newScale.domain(domain, org.xDomain); @@ -24467,7 +24941,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. // prevent chart from panning off the edge and feeling "stuck" // https://github.com/naver/billboard.js/issues/2588 if (correctTransform) { - var t = newScale(scale.x.domain()[0]), + const t = newScale(scale.x.domain()[0]), tX = isRotated ? transform.x : t, tY = isRotated ? t : transform.y; $$.$el.eventRect.property("__zoom", external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.translate(tX, tY).scale(transform.k)); @@ -24492,7 +24966,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. // @ts-ignore zoom.getDomain = function () { _newArrowCheck(this, _this); - var domain = scale[scale.zoom ? "zoom" : "subX"].domain(), + const domain = scale[scale.zoom ? "zoom" : "subX"].domain(), isCategorized = $$.axis.isCategorized(); if (isCategorized) { domain[1] -= 2; @@ -24507,7 +24981,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ onZoomStart: function onZoomStart(event) { - var $$ = this, + const $$ = this, sourceEvent = event.sourceEvent; if (sourceEvent) { $$.zoom.startEvent = sourceEvent; @@ -24522,7 +24996,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. */ onZoom: function onZoom(event) { var _this2 = this, - $$ = this, + _$$$state$domain; + const $$ = this, config = $$.config, scale = $$.scale, state = $$.state, @@ -24534,8 +25009,9 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. } if (event.sourceEvent) { state.zooming = !0; + state.domain = undefined; } - var isMousemove = (sourceEvent == null ? void 0 : sourceEvent.type) === "mousemove", + const isMousemove = (sourceEvent == null ? void 0 : sourceEvent.type) === "mousemove", isZoomOut = (sourceEvent == null ? void 0 : sourceEvent.wheelDelta) < 0, transform = event.transform; if (!isMousemove && isZoomOut && scale.x.domain().every(function (v, i) { @@ -24549,7 +25025,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. // do zoom transiton when: // - zoom type 'drag' // - when .unzoom() is called (event.transform === d3ZoomIdentity) - var doTransition = config.transition_duration > 0 && !config.subchart_show && (state.dragging || isUnZoom || !event.sourceEvent); + const doTransition = config.transition_duration > 0 && !config.subchart_show && (state.dragging || isUnZoom || !event.sourceEvent); $$.redraw({ withTransition: doTransition, withY: config.zoom_rescale, @@ -24560,7 +25036,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. $$.state.cancelClick = isMousemove; // do not call event cb when is .unzoom() is called - isUnZoom || callFn(config.zoom_onzoom, $$.api, $$.zoom.getDomain()); + isUnZoom || callFn(config.zoom_onzoom, $$.api, (_$$$state$domain = $$.state.domain) != null ? _$$$state$domain : $$.zoom.getDomain()); }, /** * 'end' event listener @@ -24568,17 +25044,17 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ onZoomEnd: function onZoomEnd(event) { - var _startEvent, - $$ = this, + var _startEvent, _$$$state$domain2; + const $$ = this, config = $$.config, - state = $$.state, - startEvent = $$.zoom.startEvent, - e = event == null ? void 0 : event.sourceEvent, - isUnZoom = (event == null ? void 0 : event.transform) === external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity; + state = $$.state; + let startEvent = $$.zoom.startEvent, + e = event == null ? void 0 : event.sourceEvent; + const isUnZoom = (event == null ? void 0 : event.transform) === external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity; if (((_startEvent = startEvent) == null ? void 0 : _startEvent.type.indexOf("touch")) > -1) { - var _e, _e$changedTouches; + var _e; startEvent = startEvent.changedTouches[0]; - e = (_e = e) == null ? void 0 : (_e$changedTouches = _e.changedTouches) == null ? void 0 : _e$changedTouches[0]; + e = (_e = e) == null || (_e = _e.changedTouches) == null ? void 0 : _e[0]; } // if click, do nothing. otherwise, click interaction will be canceled. @@ -24590,7 +25066,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. state.zooming = !1; // do not call event cb when is .unzoom() is called - !isUnZoom && (e || state.dragging) && callFn(config.zoom_onzoomend, $$.api, $$.zoom.getDomain()); + !isUnZoom && (e || state.dragging) && callFn(config.zoom_onzoomend, $$.api, (_$$$state$domain2 = $$.state.domain) != null ? _$$$state$domain2 : $$.zoom.getDomain()); }, /** * Update zoom @@ -24598,13 +25074,13 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ updateZoom: function updateZoom(force) { - var $$ = this, + const $$ = this, _$$$scale = $$.scale, subX = _$$$scale.subX, x = _$$$scale.x, zoom = _$$$scale.zoom; if (zoom) { - var zoomDomain = zoom.domain(), + const zoomDomain = zoom.domain(), xDomain = subX.domain(), delta = .015, isfullyShown = $$.config.axis_x_inverted ? (zoomDomain[0] >= xDomain[0] || zoomDomain[0] + delta >= xDomain[0]) && (xDomain[1] >= zoomDomain[1] || xDomain[1] >= zoomDomain[1] + delta) : (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta); // arbitrary value @@ -24621,8 +25097,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. * @private */ bindZoomOnEventRect: function bindZoomOnEventRect() { - var _this3 = this, - $$ = this, + var _this3 = this; + const $$ = this, config = $$.config, eventRect = $$.$el.eventRect, behaviour = config.zoom_type === "drag" ? $$.zoomBehaviour : $$.zoom; @@ -24631,26 +25107,26 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. $$.$el.svg.on("wheel", function () { _newArrowCheck(this, _this3); }.bind(this)); - eventRect.call(behaviour).on("dblclick.zoom", null); + eventRect == null || eventRect.call(behaviour).on("dblclick.zoom", null); }, /** * Initialize the drag behaviour used for zooming. * @private */ initZoomBehaviour: function initZoomBehaviour() { - var _this4 = this, - $$ = this, + var _this4 = this; + const $$ = this, config = $$.config, state = $$.state, - isRotated = config.axis_rotated, - start = 0, + isRotated = config.axis_rotated; + let start = 0, end = 0, - zoomRect, - prop = { - axis: isRotated ? "y" : "x", - attr: isRotated ? "height" : "width", - index: isRotated ? 1 : 0 - }; + zoomRect; + const prop = { + axis: isRotated ? "y" : "x", + attr: isRotated ? "height" : "width", + index: isRotated ? 1 : 0 + }; $$.zoomBehaviour = (0,external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_.drag)().clickDistance(4).on("start", function (event) { state.event = event; $$.setDragStatus(!0); @@ -24668,7 +25144,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. }).on("end", function (event) { var _this5 = this; _newArrowCheck(this, _this4); - var scale = $$.scale.zoom || $$.scale.x; + const scale = $$.scale.zoom || $$.scale.x; state.event = event; zoomRect.attr(prop.axis, 0).attr(prop.attr, 0); if (start > end) { @@ -24690,7 +25166,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments. }.bind(this)); }, setZoomResetButton: function setZoomResetButton() { - var $$ = this, + const $$ = this, config = $$.config, $el = $$.$el, resetButton = config.zoom_resetButton; @@ -25037,7 +25513,7 @@ var interaction_this = undefined; -var _selectionModule = function selectionModule() { +let _selectionModule = function selectionModule() { var _this2 = this; _newArrowCheck(this, interaction_this); extend(ChartInternal.prototype, internals_selection); @@ -25052,7 +25528,7 @@ var _selectionModule = function selectionModule() { var _this3 = this; _newArrowCheck(this, interaction_this); extend(ChartInternal.prototype, interactions_subchart); - extend(Chart.prototype, subchart); + extend(Chart.prototype, api_subchart); Options.setOptions([interaction_subchart]); return (subchartModule = function () { _newArrowCheck(this, _this3); @@ -25080,13 +25556,13 @@ var _selectionModule = function selectionModule() { // eslint-disable-next-line no-use-before-define -var _defaults = {}; +let _defaults = {}; /** * @namespace bb - * @version 3.9.0 + * @version 3.10.3 */ -var bb = { +const bb = { /** * Version information * @property {string} version version @@ -25094,7 +25570,7 @@ var bb = { * bb.version; // "1.0.0" * @memberof bb */ - version: "3.9.0", + version: "3.10.3", /** * Generate chart * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: @@ -25166,7 +25642,7 @@ var bb = { * }); */ generate: function generate(config) { - var options = mergeObj({}, _defaults, config), + const options = mergeObj({}, _defaults, config), inst = new Chart(options); inst.internal.charts = this.instance; this.instance.push(inst);