import{i as t,r as e,m as n,a as i,b as o,c as r,e as a,d as s,f as l,g as u,h as c,j as d,k as h,l as p,n as f,P as g,o as y,p as m,q as v,s as x,t as _,Z as b,u as S,v as w,w as M,x as I,y as D,z as T,A as C,B as A,T as L,C as k,D as P,E as N,F as O,G as R,S as E,R as V,H as z,I as B,J as G,L as F,K as W,M as H,N as Y,O as U,Q as Z,U as X,V as j,W as q,X as K,Y as J,_ as $,$ as Q,a0 as tt,a1 as et,a2 as nt,a3 as it,a4 as ot,a5 as rt,a6 as at,a7 as st,a8 as lt,a9 as ut,aa as ct,ab as dt,ac as ht,ad as pt,ae as ft,af as gt,ag as yt,ah as mt,ai as vt,aj as xt,ak as _t,al as bt,am as St,an as wt,ao as Mt,ap as It,aq as Dt,ar as Tt,as as Ct,at as At,au as Lt,av as kt,aw as Pt,ax as Nt,ay as Ot,az as Rt,aA as Et,aB as Vt,aC as zt,aD as Bt,aE as Gt,aF as Ft,aG as Wt,aH as Ht,aI as Yt,aJ as Ut,aK as Zt,aL as Xt,aM as jt,aN as qt,aO as Kt,aP as Jt,aQ as $t,aR as Qt,aS as te,aT as ee,aU as ne,aV as ie,aW as oe,aX as re,aY as ae,aZ as se,a_ as le,a$ as ue,b0 as ce,b1 as de,b2 as he,b3 as pe,b4 as fe,b5 as ge,b6 as ye,b7 as me,b8 as ve,b9 as xe,ba as _e,bb as be,bc as Se,bd as we,be as Me,bf as Ie,bg as De,bh as Te,bi as Ce,bj as Ae,bk as Le,bl as ke,bm as Pe,bn as Ne,bo as Oe,bp as Re,bq as Ee,br as Ve,bs as ze,bt as Be,bu as Ge,bv as Fe,bw as We,bx as He}from"./zrender-ee9f2f6d.js"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* global Reflect, Promise */var Ye=function(t,e){return Ye=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Ye(t,e)};function Ue(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Ye(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var Ze=1e-4; // Although chrome already enlarge this number to 100 for `toFixed`, but // we sill follow the spec for compatibility. /** * Linear mapping a value from domain to range * @param val * @param domain Domain extent domain[0] can be bigger than domain[1] * @param range Range extent range[0] can be bigger than range[1] * @param clamp Default to be false */ function Xe(t,e,n,i){var o=e[0],r=e[1],a=n[0],s=n[1],l=r-o,u=s-a;if(0===l)return 0===u?a:(a+s)/2; // Avoid accuracy problem in edge, such as // 146.39 - 62.83 === 83.55999999999999. // See echarts/test/ut/spec/util/number.js#linearMap#accuracyError // It is a little verbose for efficiency considering this method // is a hotspot. if(i)if(l>0){if(t<=o)return a;if(t>=r)return s}else{if(t>=o)return a;if(t<=r)return s}else{if(t===o)return a;if(t===r)return s}return(t-o)/l*u+a} /** * Convert a percent string to absolute number. * Returns NaN if percent is not a valid string or number */function je(e,n){switch(e){case"center":case"middle":e="50%";break;case"left":case"top":e="0%";break;case"right":case"bottom":e="100%"}return t(e)?(i=e,i.replace(/^\s+|\s+$/g,"")).match(/%$/)?parseFloat(e)/100*n:parseFloat(e):null==e?NaN:+e;var i}function qe(t,e,n){return null==e&&(e=10), // Avoid range error e=Math.min(Math.max(0,e),20), // PENDING: 1.005.toFixed(2) is '1.00' rather than '1.01' t=(+t).toFixed(e),n?t:+t} /** * Inplacd asc sort arr. * The input arr will be modified. */function Ke(t){return t.sort((function(t,e){return t-e})),t} /** * Get precision. */function Je(t){if(t=+t,isNaN(t))return 0; // It is much faster than methods converting number to string as follows // let tmp = val.toString(); // return tmp.length - 1 - tmp.indexOf('.'); // especially when precision is low // Notice: // (1) If the loop count is over about 20, it is slower than `getPrecisionSafe`. // (see https://jsbench.me/2vkpcekkvw/1) // (2) If the val is less than for example 1e-15, the result may be incorrect. // (see test/ut/spec/util/number.test.ts `getPrecision_equal_random`) if(t>1e-14)for(var e=1,n=0;n<15;n++,e*=10)if(Math.round(t*e)/e===t)return n;return $e(t)} /** * Get precision with slow but safe method */function $e(t){ // toLowerCase for: '3.4E-12' var e=t.toString().toLowerCase(),n=e.indexOf("e"),i=n>0?+e.slice(n+1):0,o=n>0?n:e.length,r=e.indexOf("."),a=r<0?0:o-1-r; // Consider scientific notation: '3.4e-12' '3.4e+12' return Math.max(0,a-i)} /** * Minimal dicernible data precisioin according to a single pixel. */function Qe(t,e){var n=Math.log,i=Math.LN10,o=Math.floor(n(t[1]-t[0])/i),r=Math.round(n(Math.abs(e[1]-e[0]))/i),a=Math.min(Math.max(-o+r,0),20);return isFinite(a)?a:20} /** * Get a data of given precision, assuring the sum of percentages * in valueList is 1. * The largest remainder method is used. * https://en.wikipedia.org/wiki/Largest_remainder_method * * @param valueList a list of all data * @param idx index of the data to be processed in valueList * @param precision integer number showing digits of precision * @return percent ranging from 0 to 100 */ /** * Get a data of given precision, assuring the sum of percentages * in valueList is 1. * The largest remainder method is used. * https://en.wikipedia.org/wiki/Largest_remainder_method * * @param valueList a list of all data * @param precision integer number showing digits of precision * @return {Array} */ function tn(t,i){var o=e(t,(function(t,e){return t+(isNaN(e)?0:e)}),0);if(0===o)return[]; // Has remainding votes. for(var r=Math.pow(10,i),a=n(t,(function(t){return(isNaN(t)?0:t)/o*r*100})),s=100*r,l=n(a,(function(t){ // Assign automatic seats. return Math.floor(t)})),u=e(l,(function(t,e){return t+e}),0),c=n(a,(function(t,e){return t-l[e]}));ud&&(d=c[p],h=p); // Add a vote to max remainder. ++l[h],c[h]=0,++u}return n(l,(function(t){return t/r}))} /** * Solve the floating point adding problem like 0.1 + 0.2 === 0.30000000000000004 * See */function en(t,e){var n=Math.max(Je(t),Je(e)),i=t+e; // const multiplier = Math.pow(10, maxPrecision); // return (Math.round(val0 * multiplier) + Math.round(val1 * multiplier)) / multiplier; // // PENDING: support more? return n>20?i:qe(i,n)} // Number.MAX_SAFE_INTEGER, ie do not support. var nn=9007199254740991; /** * To 0 - 2 * PI, considering negative radian. */function on(t){var e=2*Math.PI;return(t%e+e)%e} /** * @param {type} radian * @return {boolean} */function rn(t){return t>-1e-4&&t). * + Or other string format, including (all of which will be treated as local time): * '2012', '2012-3-1', '2012/3/1', '2012/03/01', * '2009/6/12 2:00', '2009/6/12 2:05:08', '2009/6/12 2:05:08.123' * + a timestamp, which represent a time in UTC. * @return date Never be null/undefined. If invalid, return `new Date(NaN)`. */function sn(e){if(e instanceof Date)return e;if(t(e)){ // Different browsers parse date in different way, so we parse it manually. // Some other issues: // new Date('1970-01-01') is UTC, // new Date('1970/01/01') and new Date('1970-1-01') is local. // See issue #3623 var n=an.exec(e);if(!n) // return Invalid Date. return new Date(NaN); // Use local time when no timezone offset is specified. if(n[8]){var i=+n[4]||0;return"Z"!==n[8].toUpperCase()&&(i-=+n[8].slice(0,3)),new Date(Date.UTC(+n[1],+(n[2]||1)-1,+n[3]||1,i,+(n[5]||0),+n[6]||0,n[7]?+n[7].substring(0,3):0))} // match[n] can only be string or undefined. // But take care of '12' + 1 => '121'. return new Date(+n[1],+(n[2]||1)-1,+n[3]||1,+n[4]||0,+(n[5]||0),+n[6]||0,n[7]?+n[7].substring(0,3):0)}return null==e?new Date(NaN):new Date(Math.round(e))} /** * Quantity of a number. e.g. 0.1, 1, 10, 100 * * @param val * @return */function ln(t){return Math.pow(10,un(t))} /** * Exponent of the quantity of a number * e.g., 1234 equals to 1.234*10^3, so quantityExponent(1234) is 3 * * @param val non-negative value * @return */function un(t){if(0===t)return 0;var e=Math.floor(Math.log(t)/Math.LN10); /** * exp is expected to be the rounded-down result of the base-10 log of val. * But due to the precision loss with Math.log(val), we need to restore it * using 10^exp to make sure we can get val back from exp. #11249 */return t/Math.pow(10,e)>=10&&e++,e} /** * find a “nice” number approximately equal to x. Round the number if round = true, * take ceiling if round = false. The primary observation is that the “nicest” * numbers in decimal are 1, 2, and 5, and all power-of-ten multiples of these numbers. * * See "Nice Numbers for Graph Labels" of Graphic Gems. * * @param val Non-negative value. * @param round * @return Niced number */function cn(t,e){var n=un(t),i=Math.pow(10,n),o=t/i; // Fix 3 * 0.1 === 0.30000000000000004 issue (see IEEE 754). // 20 is the uppper bound of toFixed. return t=(e?o<1.5?1:o<2.5?2:o<4?3:o<7?5:10:o<1?1:o<2?2:o<3?3:o<5?5:10)*i,n>=-20?+t.toFixed(n<0?-n:0):t} /** * This code was copied from "d3.js" * . * See the license statement at the head of this file. * @param ascArr */function dn(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),o=+t[i-1],r=n-i;return r?o+r*(t[i]-o):o} /** * Order intervals asc, and split them when overlap. * expect(numberUtil.reformIntervals([ * {interval: [18, 62], close: [1, 1]}, * {interval: [-Infinity, -70], close: [0, 0]}, * {interval: [-70, -26], close: [1, 1]}, * {interval: [-26, 18], close: [1, 1]}, * {interval: [62, 150], close: [1, 1]}, * {interval: [106, 150], close: [1, 1]}, * {interval: [150, Infinity], close: [0, 0]} * ])).toEqual([ * {interval: [-Infinity, -70], close: [0, 0]}, * {interval: [-70, -26], close: [1, 1]}, * {interval: [-26, 18], close: [0, 1]}, * {interval: [18, 62], close: [0, 1]}, * {interval: [62, 150], close: [0, 1]}, * {interval: [150, Infinity], close: [0, 0]} * ]); * @param list, where `close` mean open or close * of the interval, and Infinity can be used. * @return The origin list, which has been reformed. */function hn(t){t.sort((function(t,e){return s(t,e,0)?-1:1}));for(var e=-Infinity,n=1,i=0;i. */function Tn(t,e,n){var i="normalMerge"===n,l="replaceMerge"===n,u="replaceAll"===n;t=t||[],e=(e||[]).slice();var c=r(); // Validate id and name on user input option. a(e,(function(t,n){o(t)||(e[n]=null)}));var d,h,p=function(t,e,n){var i=[];if("replaceAll"===n)return i; // Do not use native `map` to in case that the array `existings` // contains elided items, which will be omitted. for(var o=0;o= result.length`. (i=t[o])&&(i.newOption||Pn(i.existing)|| // In mode "replaceMerge", here no not-mapped-non-internal-existing. i.existing&&null!=e.id&&!Cn("id",e,i.existing));)o++;i?(i.newOption=e,i.brandNew=n):t.push({newOption:e,brandNew:n,existing:null,keyInfo:null}),o++}}))}(p,e,l):u&&function(t,e){a(e,(function(e){ // The feature "reproduce" requires "hole" will also reproduced // in case that component index referring are broken. t.push({newOption:e,brandNew:!0,existing:null,keyInfo:null})}))} /** * Make id and name for mapping result (result of mappingToExists) * into `keyInfo` field. */(p,e),d=p,h=r(),a(d,(function(t){var e=t.existing;e&&h.set(e.id,t)})),a(d,(function(t){var e=t.newOption; // Force ensure id not duplicated. s(!e||null==e.id||!h.get(e.id)||h.get(e.id)===t,"id duplicates: "+(e&&e.id)),e&&null!=e.id&&h.set(e.id,t),!t.keyInfo&&(t.keyInfo={})})), // Make name and id. a(d,(function(t,e){var n=t.existing,i=t.newOption,r=t.keyInfo;if(o(i)){if( // Name can be overwritten. Consider case: axis.name = '20km'. // But id generated by name will not be changed, which affect // only in that case: setOption with 'not merge mode' and view // instance will be recreated, which can be accepted. r.name=null!=i.name?An(i.name):n?n.name:_n+e,n)r.id=An(n.id);else if(null!=i.id)r.id=An(i.id);else{ // Consider this situatoin: // optionA: [{name: 'a'}, {name: 'a'}, {..}] // optionB [{..}, {name: 'a'}, {name: 'a'}] // Series with the same name between optionA and optionB // should be mapped. var a=0;do{r.id="\0"+r.name+"\0"+a++}while(h.get(r.id))}h.set(r.id,t)}})),p}function Cn(t,e,n){var i=Ln(e[t],null),o=Ln(n[t],null); // See `MappingExistingItem`. `id` and `name` trade string equals to number. return null!=i&&null!=o&&i===o} /** * @return return null if not exist. */function An(t){return Ln(t,"")}function Ln(e,n){return null==e?n:t(e)?e:l(e)||u(e)?e+"":n}function kn(t){var e=t.name; // Is specified when `indexOf` get -1 or > 0. return!(!e||!e.indexOf(_n))} /** * @public * @param {Object} cmptOption * @return {boolean} */function Pn(t){return t&&null!=t.id&&0===An(t.id).indexOf(bn)} /** * @param payload Contains dataIndex (means rawIndex) / dataIndexInside / name * each of which can be Array or primary type. * @return dataIndex If not found, return undefined/null. */ function Nn(t,e){return null!=e.dataIndexInside?e.dataIndexInside:null!=e.dataIndex?i(e.dataIndex)?n(e.dataIndex,(function(e){return t.indexOfRawIndex(e)})):t.indexOfRawIndex(e.dataIndex):null!=e.name?i(e.name)?n(e.name,(function(e){return t.indexOfName(e)})):t.indexOfName(e.name):void 0} /** * Enable property storage to any host object. * Notice: Serialization is not supported. * * For example: * let inner = zrUitl.makeInner(); * * function some1(hostObj) { * inner(hostObj).someProperty = 1212; * ... * } * function some2() { * let fields = inner(this); * fields.someProperty1 = 1212; * fields.someProperty2 = 'xx'; * ... * } * * @return {Function} */function On(){var t="__ec_inner_"+Rn++;return function(e){return e[t]||(e[t]={})}}var Rn=gn(); /** * The same behavior as `component.getReferringComponents`. */function En(t,e,n){var i=Vn(e,n),o=i.mainTypeSpecified,r=i.queryOptionMap,a=i.others,s=n?n.defaultMainType:null;return!o&&s&&r.set(s,{}),r.each((function(e,i){var o=Gn(t,i,e,{useDefault:s===i,enableAll:!n||null==n.enableAll||n.enableAll,enableNone:!n||null==n.enableNone||n.enableNone});a[i+"Models"]=o.models,a[i+"Model"]=o.models[0]})),a}function Vn(e,n){var i;if(t(e)){var o={};o[e+"Index"]=0,i=o}else i=e;var s=r(),l={},u=!1;return a(i,(function(t,e){ // Exclude 'dataIndex' and other illgal keys. if("dataIndex"!==e&&"dataIndexInside"!==e){var i=e.match(/^(\w+)(Index|Id|Name)$/)||[],o=i[1],r=(i[2]||"").toLowerCase();if(o&&r&&!(n&&n.includeMainTypes&&c(n.includeMainTypes,o)<0))u=u||!!o,(s.get(o)||s.set(o,{}))[r]=t}else l[e]=t})),{mainTypeSpecified:u,queryOptionMap:s,others:l}}var zn={useDefault:!0,enableAll:!1,enableNone:!1},Bn={useDefault:!1,enableAll:!0,enableNone:!0};function Gn(t,e,n,i){i=i||zn;var o=n.index,r=n.id,a=n.name,l={models:null,specified:null!=o||null!=r||null!=a};if(!l.specified){ // Use the first as default if `useDefault`. var u=void 0;return l.models=i.useDefault&&(u=t.getComponent(e))?[u]:[],l}return"none"===o||!1===o?(s(i.enableNone,'`"none"` or `false` is not a valid value on index option.'),l.models=[],l):( // `queryComponents` will return all components if // both all of index/id/name are null/undefined. "all"===o&&(s(i.enableAll,'`"all"` is not a valid value on index option.'),o=r=a=null),l.models=t.queryComponents({mainType:e,index:o,id:r,name:a}),l)}function Fn(t,e,n){t.setAttribute?t.setAttribute(e,n):t[e]=n} /** * Group a list by key. */ function Wn(t,e){var n=r(),i=[];return a(t,(function(t){var o=e(t);(n.get(o)||(i.push(o),n.set(o,[]))).push(t)})),{keys:i,buckets:n}} /** * Interpolate raw values of a series with percent * * @param data data * @param labelModel label model of the text element * @param sourceValue start value. May be null/undefined when init. * @param targetValue end value * @param percent 0~1 percentage; 0 uses start value while 1 uses end value * @return interpolated values * If `sourceValue` and `targetValue` are `number`, return `number`. * If `sourceValue` and `targetValue` are `string`, return `string`. * If `sourceValue` and `targetValue` are `(string | number)[]`, return `(string | number)[]`. * Other cases do not supported. */function Hn(e,n,i,o,r){var a=null==n||"auto"===n;if(null==o)return o;if(l(o))return qe(y=xn(i||0,o,r),a?Math.max(Je(i||0),Je(o)):n);if(t(o))return r<1?i:o;for(var s=[],u=i,c=o,d=Math.max(u?u.length:0,c.length),h=0;h, when componentType is 'a.b' */ var e={};t.registerClass=function(t){ // `type` should not be a "instance member". // If using TS class, should better declared as `static type = 'series.pie'`. // otherwise users have to mount `type` on prototype manually. // For backward compat and enable instance visit type via `this.type`, // we still support fetch `type` from prototype. var n,i=t.type||t.prototype.type;if(i){s(/^[a-zA-Z0-9_]+([.][a-zA-Z0-9_]+)?$/.test(n=i),'componentType "'+n+'" illegal'), // If only static type declared, we assign it to prototype mandatorily. t.prototype.type=i;var o=Zn(i);if(o.sub){if(o.sub!==Yn){var r=function(t){var n=e[t.main];n&&n[Yn]||((n=e[t.main]={})[Yn]=!0);return n}(o);r[o.sub]=t}}else e[o.main]=t}return t},t.getClass=function(t,n,i){var o=e[t];if(o&&o[Yn]&&(o=n?o[n]:null),i&&!o)throw new Error(n?"Component "+t+"."+(n||"")+" is used but not imported.":t+".type should be specified.");return o},t.getClassesByMainType=function(t){var n=Zn(t),i=[],o=e[n.main];return o&&o[Yn]?a(o,(function(t,e){e!==Yn&&i.push(t)})):i.push(o),i},t.hasClass=function(t){ // Just consider componentType.main. var n=Zn(t);return!!e[n.main]}, /** * @return Like ['aa', 'bb'], but can not be ['aa.xx'] */ t.getAllClassMainTypes=function(){var t=[];return a(e,(function(e,n){t.push(n)})),t}, /** * If a main type is container and has sub types */ t.hasSubTypes=function(t){var n=Zn(t),i=e[n.main];return i&&i[Yn]}} // /** // * @param {string|Array.} properties // */ // export function setReadOnly(obj, properties) { // FIXME It seems broken in IE8 simulation of IE11 // if (!zrUtil.isArray(properties)) { // properties = properties != null ? [properties] : []; // } // zrUtil.each(properties, function (prop) { // let value = obj[prop]; // Object.defineProperty // && Object.defineProperty(obj, prop, { // value: value, writable: false // }); // zrUtil.isArray(obj[prop]) // && Object.freeze // && Object.freeze(obj[prop]); // }); // } function Qn(t,e){ // Normalize for(var n=0;n=0||o&&c(o,s)<0)){var l=n.getShallow(s,e);null!=l&&(r[t[a][0]]=l)}} // TODO Text or image? return r}}var ti=Qn([["fill","color"],["shadowBlur"],["shadowOffsetX"],["shadowOffsetY"],["opacity"],["shadowColor"]]),ei=/** @class */function(){function t(){}return t.prototype.getAreaStyle=function(t,e){return ti(this,t,e)},t}(),ni=On(),ii=function(t,e,n,i){if(i){var o=ni(i); // Add data index and series index for indexing the data by element // Useful in tooltip o.dataIndex=n,o.dataType=e,o.seriesIndex=t,o.ssrType="chart", // TODO: not store dataIndex on children. "group"===i.type&&i.traverse((function(i){var o=ni(i);o.seriesIndex=t,o.dataIndex=n,o.dataType=e,o.ssrType="chart"}))}},oi=1,ri={},ai=On(),si=On(),li=["emphasis","blur","select"],ui=["normal","emphasis","blur","select"],ci=10,di="highlight",hi="downplay",pi="select",fi="unselect",gi="toggleSelect";function yi(t){return null!=t&&"none"!==t}function mi(t,e,n){t.onHoverStateChange&&(t.hoverState||0)!==n&&t.onHoverStateChange(e),t.hoverState=n}function vi(t){ // Only mark the flag. // States will be applied in the echarts.ts in next frame. mi(t,"emphasis",2)}function xi(t){ // Only mark the flag. // States will be applied in the echarts.ts in next frame. 2===t.hoverState&&mi(t,"normal",0)}function _i(t){mi(t,"blur",1)}function bi(t){1===t.hoverState&&mi(t,"normal",0)}function Si(t){t.selected=!0}function wi(t){t.selected=!1}function Mi(t,e,n){e(t,n)}function Ii(t,e,n){Mi(t,e,n),t.isGroup&&t.traverse((function(t){Mi(t,e,n)}))}function Di(t,e){switch(e){case"emphasis":t.hoverState=2;break;case"normal":t.hoverState=0;break;case"blur":t.hoverState=1;break;case"select":t.selected=!0}}function Ti(t,e){var n=this.states[t];if(this.style){if("emphasis"===t)return function(t,e,n,i){var o=n&&c(n,"select")>=0,r=!1;if(t instanceof g){var a=ai(t),s=o&&a.selectFill||a.normalFill,l=o&&a.selectStroke||a.normalStroke;if(yi(s)||yi(l)){var u=(i=i||{}).style||{}; // inherit case "inherit"===u.fill?(r=!0,i=p({},i),(u=p({},u)).fill=s):!yi(u.fill)&&yi(s)?(r=!0, // Not modify the original value. i=p({},i), // Already being applied 'emphasis'. DON'T lift color multiple times. (u=p({},u)).fill=y(s)):!yi(u.stroke)&&yi(l)&&(r||(i=p({},i),u=p({},u)),u.stroke=y(l)),i.style=u}}if(i&&null==i.z2){r||(i=p({},i));var d=t.z2EmphasisLift;i.z2=t.z2+(null!=d?d:ci)}return i}(this,0,e,n);if("blur"===t)return function(t,e,n){var i=c(t.currentStates,e)>=0,o=t.style.opacity,r=i?null:function(t,e,n,i){for(var o=t.style,r={},a=0;a= 0; if(n&&null==n.z2){n=p({},n);var i=t.z2SelectLift;n.z2=t.z2+(null!=i?i:9)}return n}(this,0,n)}return n} /** * Set hover style (namely "emphasis style") of element. * @param el Should not be `zrender/graphic/Group`. * @param focus 'self' | 'selfInSeries' | 'series' */function Ci(t){t.stateProxy=Ti;var e=t.getTextContent(),n=t.getTextGuideLine();e&&(e.stateProxy=Ti),n&&(n.stateProxy=Ti)}function Ai(t,e){!Vi(t,e)&&!t.__highByOuter&&Ii(t,vi)}function Li(t,e){!Vi(t,e)&&!t.__highByOuter&&Ii(t,xi)}function ki(t,e){t.__highByOuter|=1<<(e||0),Ii(t,vi)}function Pi(t,e){!(t.__highByOuter&=~(1<<(e||0)))&&Ii(t,xi)}function Ni(t){Ii(t,_i)}function Oi(t){Ii(t,bi)}function Ri(t){Ii(t,Si)}function Ei(t){Ii(t,wi)}function Vi(t,e){return t.__highDownSilentOnTouch&&e.zrByTouch}function zi(t){var e=t.getModel(),n=[],i=[];e.eachComponent((function(e,o){var r=si(o),a="series"===e,s=a?t.getViewOfSeriesModel(o):t.getViewOfComponentModel(o);!a&&i.push(s),r.isBlured&&( // Leave blur anyway s.group.traverse((function(t){bi(t)})),a&&n.push(o)),r.isBlured=!1})),a(i,(function(t){t&&t.toggleBlurSeries&&t.toggleBlurSeries(n,!1,e)}))}function Bi(t,e,n,i){var r=i.getModel();function a(t,e){for(var n=0;n0){var r={dataIndex:o,seriesIndex:t.seriesIndex};null!=i&&(r.dataType=i),e.push(r)}}))})),e} /** * Enable the function that mouseover will trigger the emphasis state. * * NOTE: * This function should be used on the element with dataIndex, seriesIndex. * */function Yi(t,e,n){Ki(t,!0),Ii(t,Ci),Zi(t,e,n)}function Ui(t,e,n,i){i?function(t){Ki(t,!1)}(t):Yi(t,e,n)}function Zi(t,e,n){var i=ni(t);null!=e?( // TODO dataIndex may be set after this function. This check is not useful. // if (ecData.dataIndex == null) { // if (__DEV__) { // console.warn('focus can only been set on element with dataIndex'); // } // } // else { i.focus=e,i.blurScope=n):i.focus&&(i.focus=null)}var Xi=["emphasis","blur","select"],ji={itemStyle:"getItemStyle",lineStyle:"getLineStyle",areaStyle:"getAreaStyle"}; /** * Set emphasis/blur/selected states of element. */ function qi(t,e,n, // default itemStyle i){n=n||"itemStyle";for(var o=0;o0){var h={duration:d.duration,delay:d.delay||0,easing:d.easing,done:a,force:!!a||!!s, // Set to final state in update/init animation. // So the post processing based on the path shape can be done correctly. setToFinal:!c,scope:t,during:s};u?e.animateFrom(n,h):e.animateTo(n,h)}else e.stopAnimation(), // If `isFrom`, the props is the "from" props. !u&&e.attr(n), // Call during at least once. s&&s(1),a&&a()} /** * Update graphic element properties with or without animation according to the * configuration in series. * * Caution: this method will stop previous animation. * So do not use this method to one element twice before * animation starts, unless you know what you are doing. * @example * graphic.updateProps(el, { * position: [100, 100] * }, seriesModel, dataIndex, function () { console.log('Animation done!'); }); * // Or * graphic.updateProps(el, { * position: [100, 100] * }, seriesModel, function () { console.log('Animation done!'); }); */function io(t,e, // TODO: TYPE AnimatableModel n,i,o,r){no("update",t,e,n,i,o,r)} /** * Init graphic element properties with or without animation according to the * configuration in series. * * Caution: this method will stop previous animation. * So do not use this method to one element twice before * animation starts, unless you know what you are doing. */function oo(t,e,n,i,o,r){no("enter",t,e,n,i,o,r)} /** * If element is removed. * It can determine if element is having remove animation. */function ro(t){if(!t.__zr)return!0;for(var e=0;eMath.abs(r[1])?r[0]>0?"right":"left":r[1]>0?"bottom":"top"}function Ao(t){return!t.isGroup} /** * Apply group transition animation from g1 to g2. * If no animatableModel, no animation. */ function Lo(t,e,n){if(t&&e){var i,o=(i={},t.traverse((function(t){Ao(t)&&t.anid&&(i[t.anid]=t)})),i);e.traverse((function(t){if(Ao(t)&&t.anid){var e=o[t.anid];if(e){var i=r(t);t.attr(r(e)),io(t,i,n,ni(t).dataIndex)}}}))}function r(t){var e={x:t.x,y:t.y,rotation:t.rotation};return function(t){return null!=t.shape}(t)&&(e.shape=p({},t.shape)),e}}function ko(t,e){ // FIXME: This way might be incorrect when graphic clipped by a corner // and when element has a border. return n(t,(function(t){var n=t[0];n=co(n,e.x),n=ho(n,e.x+e.width);var i=t[1];return i=co(i,e.y),[n,i=ho(i,e.y+e.height)]}))} /** * Return a new clipped rect. If rect size are negative, return undefined. */function Po(t,e){var n=co(t.x,e.x),i=ho(t.x+t.width,e.x+e.width),o=co(t.y,e.y),r=ho(t.y+t.height,e.y+e.height); // If the total rect is cliped, nothing, including the border, // should be painted. So return undefined. if(i>=n&&r>=o)return{x:n,y:o,width:i-n,height:r-o}}function No(t, // Support 'image://' or 'path://' or direct svg path. e,n){var i=p({rectHover:!0},e),o=i.style={strokeNoScale:!0};if(n=n||{x:-1,y:-1,width:2,height:2},t)return 0===t.indexOf("image://")?(o.image=t.slice(8),I(o,n),new b(i)):xo(t.replace("path://",""),i,n,"center")} /** * Return `true` if the given line (line `a`) and the given polygon * are intersect. * Note that we do not count colinear as intersect here because no * requirement for that. We could do that if required in future. */function Oo(t,e,n,i,o){for(var r=0,a=o[o.length-1];r=-1e-6)return!1; // `vec_m` and `vec_n` are intersect iff // existing `p` and `q` in [0, 1] such that `vec_a1 + p * vec_m = vec_b1 + q * vec_n`, // such that `q = ((vec_a1 - vec_b1) X vec_m) / (vec_n X vec_m)` // and `p = ((vec_a1 - vec_b1) X vec_n) / (vec_n X vec_m)`. var f=t-o,g=e-r,y=Eo(f,g,u,c)/p;if(y<0||y>1)return!1;var m=Eo(f,g,d,h)/p;return!(m<0||m>1)} /** * Cross product of 2-dimension vector. */function Eo(t,e,n,i){return t*i-n*e}function Vo(e){var n=e.itemTooltipOption,i=e.componentModel,o=e.itemName,r=t(n)?{formatter:n}:n,s=i.mainType,l=i.componentIndex,u={componentType:s,name:o,$vars:["name"]};u[s+"Index"]=l;var c=e.formatterParamsExtra;c&&a(v(c),(function(t){N(u,t)||(u[t]=c[t],u.$vars.push(t))}));var d=ni(e.el);d.componentMainType=s,d.componentIndex=l,d.tooltipConfig={name:o,option:I({content:o,encodeHTMLContent:!0,formatterParams:u},r)}}function zo(t,e){var n; // TODO // Polyfill for fixing zrender group traverse don't visit it's root issue. t.isGroup&&(n=e(t)),n||t.traverse(e)}function Bo(t,e){if(t)if(i(t))for(var n=0;n` // getModel(path: string | string[], parentModel?: Model): Model; // TODO 'a.b.c' is deprecated t.prototype.getModel=function(e,n){var i=null!=e,o=i?this.parsePath(e):null;return new t(i?this._doGet(o):this.option,n=n||this.parentModel&&this.parentModel.getModel(this.resolveParentPath(o)),this.ecModel)}, /** * If model has option */ t.prototype.isEmpty=function(){return null==this.option},t.prototype.restoreData=function(){}, // Pending t.prototype.clone=function(){return new(0,this.constructor)(et(this.option))}, // setReadOnly(properties): void { // clazzUtil.setReadOnly(this, properties); // } // If path is null/undefined, return null/undefined. t.prototype.parsePath=function(t){return"string"==typeof t?t.split("."):t}, // Resolve path for parent. Perhaps useful when parent use a different property. // Default to be a identity resolver. // Can be modified to a different resolver. t.prototype.resolveParentPath=function(t){return t}, // FIXME:TS check whether put this method here t.prototype.isAnimationEnabled=function(){if(!d.node&&this.option){if(null!=this.option.animation)return!!this.option.animation;if(this.parentModel)return this.parentModel.isAnimationEnabled()}},t.prototype._doGet=function(t,e){var n=this.option;if(!t)return n;for(var i=0;i-1?_r:Sr;function Dr(t,e){t=t.toUpperCase(),Mr[t]=new yr(e),wr[t]=e} // export function getLocale(locale: string) { // return localeStorage[locale]; // } function Tr(t){return Mr[t]} // Default locale Dr(br,{time:{month:["January","February","March","April","May","June","July","August","September","October","November","December"],monthAbbr:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayOfWeekAbbr:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},legend:{selector:{all:"All",inverse:"Inv"}},toolbox:{brush:{title:{rect:"Box Select",polygon:"Lasso Select",lineX:"Horizontally Select",lineY:"Vertically Select",keep:"Keep Selections",clear:"Clear Selections"}},dataView:{title:"Data View",lang:["Data View","Close","Refresh"]},dataZoom:{title:{zoom:"Zoom",back:"Zoom Reset"}},magicType:{title:{line:"Switch to Line Chart",bar:"Switch to Bar Chart",stack:"Stack",tiled:"Tile"}},restore:{title:"Restore"},saveAsImage:{title:"Save as Image",lang:["Right Click to Save Image"]}},series:{typeNames:{pie:"Pie chart",bar:"Bar chart",line:"Line chart",scatter:"Scatter plot",effectScatter:"Ripple scatter plot",radar:"Radar chart",tree:"Tree",treemap:"Treemap",boxplot:"Boxplot",candlestick:"Candlestick",k:"K line chart",heatmap:"Heat map",map:"Map",parallel:"Parallel coordinate map",lines:"Line graph",graph:"Relationship graph",sankey:"Sankey diagram",funnel:"Funnel chart",gauge:"Gauge",pictorialBar:"Pictorial bar",themeRiver:"Theme River Map",sunburst:"Sunburst",custom:"Custom chart",chart:"Chart"}},aria:{general:{withTitle:'This is a chart about "{title}"',withoutTitle:"This is a chart"},series:{single:{prefix:"",withName:" with type {seriesType} named {seriesName}.",withoutName:" with type {seriesType}."},multiple:{prefix:". It consists of {seriesCount} series count.",withName:" The {seriesId} series is a {seriesType} representing {seriesName}.",withoutName:" The {seriesId} series is a {seriesType}.",separator:{middle:"",end:""}}},data:{allData:"The data is as follows: ",partialData:"The first {displayCnt} items are: ",withName:"the data for {name} is {value}",withoutName:"{value}",separator:{middle:", ",end:". "}}}}),Dr(_r,{time:{month:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],monthAbbr:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],dayOfWeekAbbr:["日","一","二","三","四","五","六"]},legend:{selector:{all:"全选",inverse:"反选"}},toolbox:{brush:{title:{rect:"矩形选择",polygon:"圈选",lineX:"横向选择",lineY:"纵向选择",keep:"保持选择",clear:"清除选择"}},dataView:{title:"数据视图",lang:["数据视图","关闭","刷新"]},dataZoom:{title:{zoom:"区域缩放",back:"区域缩放还原"}},magicType:{title:{line:"切换为折线图",bar:"切换为柱状图",stack:"切换为堆叠",tiled:"切换为平铺"}},restore:{title:"还原"},saveAsImage:{title:"保存为图片",lang:["右键另存为图片"]}},series:{typeNames:{pie:"饼图",bar:"柱状图",line:"折线图",scatter:"散点图",effectScatter:"涟漪散点图",radar:"雷达图",tree:"树图",treemap:"矩形树图",boxplot:"箱型图",candlestick:"K线图",k:"K线图",heatmap:"热力图",map:"地图",parallel:"平行坐标图",lines:"线图",graph:"关系图",sankey:"桑基图",funnel:"漏斗图",gauge:"仪表盘图",pictorialBar:"象形柱图",themeRiver:"主题河流图",sunburst:"旭日图",custom:"自定义图表",chart:"图表"}},aria:{general:{withTitle:"这是一个关于“{title}”的图表。",withoutTitle:"这是一个图表,"},series:{single:{prefix:"",withName:"图表类型是{seriesType},表示{seriesName}。",withoutName:"图表类型是{seriesType}。"},multiple:{prefix:"它由{seriesCount}个图表系列组成。",withName:"第{seriesId}个系列是一个表示{seriesName}的{seriesType},",withoutName:"第{seriesId}个系列是一个{seriesType},",separator:{middle:";",end:"。"}}},data:{allData:"其数据是——",partialData:"其中,前{displayCnt}项是——",withName:"{name}的数据是{value}",withoutName:"{value}",separator:{middle:",",end:""}}}});var Cr=1e3,Ar=6e4,Lr=36e5,kr=864e5,Pr=31536e6,Nr={year:"{yyyy}",month:"{MMM}",day:"{d}",hour:"{HH}:{mm}",minute:"{HH}:{mm}",second:"{HH}:{mm}:{ss}",millisecond:"{HH}:{mm}:{ss} {SSS}",none:"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss} {SSS}"},Or="{yyyy}-{MM}-{dd}",Rr={year:"{yyyy}",month:"{yyyy}-{MM}",day:Or,hour:Or+" "+Nr.hour,minute:Or+" "+Nr.minute,second:Or+" "+Nr.second,millisecond:Nr.none},Er=["year","month","day","hour","minute","second","millisecond"],Vr=["year","half-year","quarter","month","week","half-week","day","half-day","quarter-day","hour","minute","second","millisecond"];function zr(t,e){return"0000".substr(0,e-(t+="").length)+t}function Br(t){switch(t){case"half-year":case"quarter":return"month";case"week":case"half-week":return"day";case"half-day":case"quarter-day":return"hour";default: // year, minutes, second, milliseconds return t}}function Gr(t){return t===Br(t)}function Fr( // Note: The result based on `isUTC` are totally different, which can not be just simply // substituted by the result without `isUTC`. So we make the param `isUTC` mandatory. t,e,n,i){var o=sn(t),r=o[Yr(n)](),a=o[Ur(n)]()+1,s=Math.floor((a-1)/3)+1,l=o[Zr(n)](),u=o["get"+(n?"UTC":"")+"Day"](),c=o[Xr(n)](),d=(c-1)%12+1,h=o[jr(n)](),p=o[qr(n)](),f=o[Kr(n)](),g=c>=12?"pm":"am",y=g.toUpperCase(),m=(i instanceof yr?i:Tr(i||Ir)||Mr[Sr]).getModel("time"),v=m.get("month"),x=m.get("monthAbbr"),_=m.get("dayOfWeek"),b=m.get("dayOfWeekAbbr");return(e||"").replace(/{a}/g,g+"").replace(/{A}/g,y+"").replace(/{yyyy}/g,r+"").replace(/{yy}/g,zr(r%100+"",2)).replace(/{Q}/g,s+"").replace(/{MMMM}/g,v[a-1]).replace(/{MMM}/g,x[a-1]).replace(/{MM}/g,zr(a,2)).replace(/{M}/g,a+"").replace(/{dd}/g,zr(l,2)).replace(/{d}/g,l+"").replace(/{eeee}/g,_[u]).replace(/{ee}/g,b[u]).replace(/{e}/g,u+"").replace(/{HH}/g,zr(c,2)).replace(/{H}/g,c+"").replace(/{hh}/g,zr(d+"",2)).replace(/{h}/g,d+"").replace(/{mm}/g,zr(h,2)).replace(/{m}/g,h+"").replace(/{ss}/g,zr(p,2)).replace(/{s}/g,p+"").replace(/{SSS}/g,zr(f,3)).replace(/{S}/g,f+"")}function Wr(t,e){var n=sn(t),i=n[Ur(e)]()+1,o=n[Zr(e)](),r=n[Xr(e)](),a=n[jr(e)](),s=n[qr(e)](),l=0===n[Kr(e)](),u=l&&0===s,c=u&&0===a,d=c&&0===r,h=d&&1===o;return h&&1===i?"year":h?"month":d?"day":c?"hour":u?"minute":l?"second":"millisecond"}function Hr(t,e,n){var i=l(t)?sn(t):t;switch(e=e||Wr(t,n)){case"year":return i[Yr(n)]();case"half-year":return i[Ur(n)]()>=6?1:0;case"quarter":return Math.floor((i[Ur(n)]()+1)/4);case"month":return i[Ur(n)]();case"day":return i[Zr(n)]();case"half-day":return i[Xr(n)]()/24;case"hour":return i[Xr(n)]();case"minute":return i[jr(n)]();case"second":return i[qr(n)]();case"millisecond":return i[Kr(n)]()}}function Yr(t){return t?"getUTCFullYear":"getFullYear"}function Ur(t){return t?"getUTCMonth":"getMonth"}function Zr(t){return t?"getUTCDate":"getDate"}function Xr(t){return t?"getUTCHours":"getHours"}function jr(t){return t?"getUTCMinutes":"getMinutes"}function qr(t){return t?"getUTCSeconds":"getSeconds"}function Kr(t){return t?"getUTCMilliseconds":"getMilliseconds"}function Jr(t){return t?"setUTCFullYear":"setFullYear"}function $r(t){return t?"setUTCMonth":"setMonth"}function Qr(t){return t?"setUTCDate":"setDate"}function ta(t){return t?"setUTCHours":"setHours"}function ea(t){return t?"setUTCMinutes":"setMinutes"}function na(t){return t?"setUTCSeconds":"setSeconds"}function ia(t){return t?"setUTCMilliseconds":"setMilliseconds"} /** * Add a comma each three digit. */ function oa(e){if(!fn(e))return t(e)?e:"-";var n=(e+"").split(".");return n[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,"$1,")+(n.length>1?"."+n[1]:"")}function ra(t,e){return t=(t||"").toLowerCase().replace(/-(.)/g,(function(t,e){return e.toUpperCase()})),e&&t&&(t=t.charAt(0).toUpperCase()+t.slice(1)),t}var aa=it; /** * Make value user readable for tooltip and label. * "User readable": * Try to not print programmer-specific text like NaN, Infinity, null, undefined. * Avoid to display an empty string, which users can not recognize there is * a value and it might look like a bug. */function sa(t,e,n){function i(t){return t&&Q(t)?t:"-"}function o(t){return!(null==t||isNaN(t)||!isFinite(t))}var r="time"===e,a=t instanceof Date;if(r||a){var s=r?sn(t):t;if(!isNaN(+s))return Fr(s,"{yyyy}-{MM}-{dd} {HH}:{mm}:{ss}",n); // In other cases, continue to try to display the value in the following code. if(a)return"-"}if("ordinal"===e)return u(t)?i(t):l(t)&&o(t)?t+"":"-"; // By default. var c=pn(t);return o(c)?oa(c):u(t)?i(t):"boolean"==typeof t?t+"":"-"}var la=["a","b","c","d","e","f","g"],ua=function(t,e){return"{"+t+(null==e?"":e)+"}"}; /** * Template formatter * @param {Array.|Object} paramsList */ function ca(t,e,n){i(e)||(e=[e]);var o=e.length;if(!o)return"";for(var r=e[0].$vars||[],a=0;a':'':{renderMode:a,content:"{"+(i.markerId||"markerX")+"|} ",style:"subItem"===r?{width:4,height:4,borderRadius:2,backgroundColor:o}:{width:10,height:10,borderRadius:5,backgroundColor:o}}:""} /** * @deprecated Use `time/format` instead. * ISO Date format * @param {string} tpl * @param {number} value * @param {boolean} [isUTC=false] Default in local time. * see `module:echarts/scale/Time` * and `module:echarts/util/number#parseDate`. * @inner */ /** * @return Never be null/undefined. */ function ha(e,n){return n=n||"transparent",t(e)?e:o(e)&&e.colorStops&&(e.colorStops[0]||{}).color||n} /** * open new tab * @param link url * @param target blank or self */function pa(t,e){ /* global window */ if("_blank"===e||"blank"===e){var n=window.open();n.opener=null,n.location.href=t}else window.open(t,e)}var fa=a,ga=["left","right","top","bottom","width","height"],ya=[["width","left","right"],["height","top","bottom"]]; /** * @public */function ma(t,e,n,i,o){var r=0,a=0;null==i&&(i=Infinity),null==o&&(o=Infinity);var s=0;e.eachChild((function(l,u){var c,d,h=l.getBoundingRect(),p=e.childAt(u+1),f=p&&p.getBoundingRect();if("horizontal"===t){var g=h.width+(f?-f.x+h.x:0); // Wrap when width exceeds maxWidth or meet a `newline` group // FIXME compare before adding gap? (c=r+g)>i||l.newline?(r=0,c=g,a+=s+n,s=h.height): // FIXME: consider rect.y is not `0`? s=Math.max(s,h.height)}else{var y=h.height+(f?-f.y+h.y:0); // Wrap when width exceeds maxHeight or meet a `newline` group (d=a+y)>o||l.newline?(r+=s+n,a=0,d=y,s=h.width):s=Math.max(s,h.width)}l.newline||(l.x=r,l.y=a,l.markRedraw(),"horizontal"===t?r=c+n:a=d+n)}))} /** * VBox or HBox layouting * @param {string} orient * @param {module:zrender/graphic/Group} group * @param {number} gap * @param {number} [width=Infinity] * @param {number} [height=Infinity] */var va=ma; /** * VBox layouting * @param {module:zrender/graphic/Group} group * @param {number} gap * @param {number} [width=Infinity] * @param {number} [height=Infinity] */ /** * Parse position info. */ function xa(t,e,n){n=aa(n||0);var i=e.width,o=e.height,r=je(t.left,i),a=je(t.top,o),s=je(t.right,i),l=je(t.bottom,o),u=je(t.width,i),c=je(t.height,o),d=n[2]+n[0],h=n[1]+n[3],p=t.aspect; // Align left and top switch( // If width is not specified, calculate width from left and right isNaN(u)&&(u=i-s-h-r),isNaN(c)&&(c=o-l-d-a),null!=p&&( // If width and height are not given // 1. Graph should not exceeds the container // 2. Aspect must be keeped // 3. Graph should take the space as more as possible // FIXME // Margin is not considered, because there is no case that both // using margin and aspect so far. isNaN(u)&&isNaN(c)&&(p>i/o?u=.8*i:c=.8*o), // Calculate width or height with given aspect isNaN(u)&&(u=p*c),isNaN(c)&&(c=u/p)), // If left is not specified, calculate left from right and width isNaN(r)&&(r=i-s-u-h),isNaN(a)&&(a=o-l-c-d),t.left||t.right){case"center":r=i/2-u/2-n[3];break;case"right":r=i-u-h}switch(t.top||t.bottom){case"middle":case"center":a=o/2-c/2-n[0];break;case"bottom":a=o-c-d} // If something is wrong and left, top, width, height are calculated as NaN r=r||0,a=a||0,isNaN(u)&&( // Width may be NaN if only one value is given except width u=i-h-r-(s||0)),isNaN(c)&&( // Height may be NaN if only one value is given except height c=o-d-a-(l||0));var f=new Y(r+n[3],a+n[0],u,c);return f.margin=n,f} /** * Position a zr element in viewport * Group position is specified by either * {left, top}, {right, bottom} * If all properties exists, right and bottom will be igonred. * * Logic: * 1. Scale (against origin point in parent coord) * 2. Rotate (against origin point in parent coord) * 3. Translate (with el.position by this method) * So this method only fixes the last step 'Translate', which does not affect * scaling and rotating. * * If be called repeatedly with the same input el, the same result will be gotten. * * Return true if the layout happened. * * @param el Should have `getBoundingRect` method. * @param positionInfo * @param positionInfo.left * @param positionInfo.top * @param positionInfo.right * @param positionInfo.bottom * @param positionInfo.width Only for opt.boundingModel: 'raw' * @param positionInfo.height Only for opt.boundingModel: 'raw' * @param containerRect * @param margin * @param opt * @param opt.hv Only horizontal or only vertical. Default to be [1, 1] * @param opt.boundingMode * Specify how to calculate boundingRect when locating. * 'all': Position the boundingRect that is transformed and uioned * both itself and its descendants. * This mode simplies confine the elements in the bounding * of their container (e.g., using 'right: 0'). * 'raw': Position the boundingRect that is not transformed and only itself. * This mode is useful when you want a element can overflow its * container. (Consider a rotated circle needs to be located in a corner.) * In this mode positionInfo.width/height can only be number. */function _a(t,e,n,i,o,r){var a,s=!o||!o.hv||o.hv[0],l=!o||!o.hv||o.hv[1],u=o&&o.boundingMode||"all";if((r=r||t).x=t.x,r.y=t.y,!s&&!l)return!1;if("raw"===u)a="group"===t.type?new Y(0,0,+e.width||0,+e.height||0):t.getBoundingRect();else if(a=t.getBoundingRect(),t.needLocalTransform()){var c=t.getLocalTransform(); // Notice: raw rect may be inner object of el, // which should not be modified. (a=a.clone()).applyTransform(c)} // The real width and height can not be specified but calculated by the given el. var d=xa(I({width:a.width,height:a.height},e),n,i),h=s?d.x-a.x:0,p=l?d.y-a.y:0; // Because 'tranlate' is the last step in transform // (see zrender/core/Transformable#getLocalTransform), // we can just only modify el.position to get final result. return"raw"===u?(r.x=h,r.y=p):(r.x+=h,r.y+=p),r===t&&t.markRedraw(),!0} /** * @param option Contains some of the properties in HV_NAMES. * @param hvIdx 0: horizontal; 1: vertical. */function ba(t){var e=t.layoutMode||t.constructor.layoutMode;return o(e)?e:e?{type:e}:null} /** * Consider Case: * When default option has {left: 0, width: 100}, and we set {right: 0} * through setOption or media query, using normal zrUtil.merge will cause * {right: 0} does not take effect. * * @example * ComponentModel.extend({ * init: function () { * ... * let inputPositionParams = layout.getLayoutParams(option); * this.mergeOption(inputPositionParams); * }, * mergeOption: function (newOption) { * newOption && zrUtil.merge(thisOption, newOption, true); * layout.mergeLayoutParam(thisOption, newOption); * } * }); * * @param targetOption * @param newOption * @param opt */function Sa(t,e,n){var o=n&&n.ignoreSize;!i(o)&&(o=[o,o]);var r=s(ya[0],0),a=s(ya[1],1);function s(n,i){var r={},a=0,s={},c=0;if(fa(n,(function(e){s[e]=t[e]})),fa(n,(function(t){ // Consider case: newOption.width is null, which is // set by user for removing width setting. l(e,t)&&(r[t]=s[t]=e[t]),u(r,t)&&a++,u(s,t)&&c++})),o[i]) // Only one of left/right is premitted to exist. return u(e,n[1])?s[n[2]]=null:u(e,n[2])&&(s[n[1]]=null),s; // Case: newOption: {width: ..., right: ...}, // or targetOption: {right: ...} and newOption: {width: ...}, // There is no conflict when merged only has params count // little than enoughParamNumber. if(2!==c&&a){if(a>=2)return r; // Chose another param from targetOption by priority. for(var d=0;d=0;a--)r=tt(r,n[a],!0);e.defaultOption=r}return e.defaultOption}, /** * Notice: always force to input param `useDefault` in case that forget to consider it. * The same behavior as `modelUtil.parseFinder`. * * @param useDefault In many cases like series refer axis and axis refer grid, * If axis index / axis id not specified, use the first target as default. * In other cases like dataZoom refer axis, if not specified, measn no refer. */ e.prototype.getReferringComponents=function(t,e){var n=t+"Index",i=t+"Id";return Gn(this.ecModel,t,{index:this.get(n,!0),id:this.get(i,!0)},e)},e.prototype.getBoxLayoutParams=function(){ // Consider itself having box layout configs. var t=this;return{left:t.get("left"),top:t.get("top"),right:t.get("right"),bottom:t.get("bottom"),width:t.get("width"),height:t.get("height")}}, /** * Get key for zlevel. * If developers don't configure zlevel. We will assign zlevel to series based on the key. * For example, lines with trail effect and progressive series will in an individual zlevel. */ e.prototype.getZLevelKey=function(){return""},e.prototype.setZLevel=function(t){this.option.zlevel=t},e.protoInitialize=function(){var t=e.prototype;t.type="component",t.id="",t.name="",t.mainType="",t.subType="",t.componentIndex=0}(),e}(yr);jn(Da,yr),$n(Da),function(t){var e={};t.registerSubTypeDefaulter=function(t,n){var i=Zn(t);e[i.main]=n},t.determineSubType=function(n,i){var o=i.type;if(!o){var r=Zn(n).main;t.hasSubTypes(n)&&e[r]&&(o=e[r](i))}return o}} /** * Implements `TopologicalTravelable` for `entity`. * * Topological travel on Activity Network (Activity On Vertices). * Dependencies is defined in Model.prototype.dependencies, like ['xAxis', 'yAxis']. * If 'xAxis' or 'yAxis' is absent in componentTypeList, just ignore it in topology. * If there is circular dependencey, Error will be thrown. */(Da),function(t,e){function n(t,e){return t[e]||(t[e]={predecessor:[],successor:[]}),t[e]} /** * @param targetNameList Target Component type list. * Can be ['aa', 'bb', 'aa.xx'] * @param fullNameList By which we can build dependency graph. * @param callback Params: componentType, dependencies. * @param context Scope of callback. */ t.topologicalTravel=function(t,i,o,r){if(t.length){var s=function(t){var i={},o=[];return a(t,(function(r){var s=n(i,r),l=function(t,e){var n=[];return a(t,(function(t){c(e,t)>=0&&n.push(t)})),n}(s.originalDeps=e(r),t);s.entryCount=l.length,0===s.entryCount&&o.push(r),a(l,(function(t){c(s.predecessor,t)<0&&s.predecessor.push(t);var e=n(i,t);c(e.successor,t)<0&&e.successor.push(r)}))})),{graph:i,noEntryList:o}}(i),l=s.graph,u=s.noEntryList,d={};for(a(t,(function(t){d[t]=!0}));u.length;){var h=u.pop(),p=l[h],f=!!d[h];f&&(o.call(r,h,p.originalDeps.slice()),delete d[h]),a(p.successor,f?y:g)}a(d,(function(){throw new Error("")}))}function g(t){l[t].entryCount--,0===l[t].entryCount&&u.push(t)} // Consider this case: legend depends on series, and we call // chart.setOption({series: [...]}), where only series is in option. // If we do not have 'removeEdgeAndAdd', legendModel.mergeOption will // not be called, but only sereis.mergeOption is called. Thus legend // have no chance to update its local record about series (like which // name of series is available in legend). function y(t){d[t]=!0,g(t)}}}(Da,(function(t){var e=[]; // Hack dataset for convenience. a(Da.getClassesByMainType(t),(function(t){e=e.concat(t.dependencies||t.prototype.dependencies||[])})), // Ensure main type. e=n(e,(function(t){return Zn(t).main})),"dataset"!==t&&c(e,"dataset")<=0&&e.unshift("dataset");return e}));const Ta=Da; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /** * AUTO-GENERATED FILE. DO NOT MODIFY. */ /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */var Ca=""; // Navigator not exists in node "undefined"!=typeof navigator&&( /* global navigator */ Ca=navigator.platform||"");var Aa="rgba(0, 0, 0, 0.2)";const La={darkMode:"auto", // backgroundColor: 'rgba(0,0,0,0)', colorBy:"series",color:["#5470c6","#91cc75","#fac858","#ee6666","#73c0de","#3ba272","#fc8452","#9a60b4","#ea7ccc"],gradientColor:["#f6efa6","#d88273","#bf444c"],aria:{decal:{decals:[{color:Aa,dashArrayX:[1,0],dashArrayY:[2,5],symbolSize:1,rotation:Math.PI/6},{color:Aa,symbol:"circle",dashArrayX:[[8,8],[0,8,8,0]],dashArrayY:[6,0],symbolSize:.8},{color:Aa,dashArrayX:[1,0],dashArrayY:[4,3],rotation:-Math.PI/4},{color:Aa,dashArrayX:[[6,6],[0,6,6,0]],dashArrayY:[6,0]},{color:Aa,dashArrayX:[[1,0],[1,6]],dashArrayY:[1,0,6,0],rotation:Math.PI/4},{color:Aa,symbol:"triangle",dashArrayX:[[9,9],[0,9,9,0]],dashArrayY:[7,2],symbolSize:.75}]}}, // If xAxis and yAxis declared, grid is created by default. // grid: {}, textStyle:{ // color: '#000', // decoration: 'none', // PENDING fontFamily:Ca.match(/^Win/)?"Microsoft YaHei":"sans-serif", // fontFamily: 'Arial, Verdana, sans-serif', fontSize:12,fontStyle:"normal",fontWeight:"normal"}, // http://blogs.adobe.com/webplatform/2014/02/24/using-blend-modes-in-html-canvas/ // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation // Default is source-over blendMode:null,stateAnimation:{duration:300,easing:"cubicOut"},animation:"auto",animationDuration:1e3,animationDurationUpdate:500,animationEasing:"cubicInOut",animationEasingUpdate:"cubicInOut",animationThreshold:2e3, // Configuration for progressive/incremental rendering progressiveThreshold:3e3,progressive:400, // Threshold of if use single hover layer to optimize. // It is recommended that `hoverLayerThreshold` is equivalent to or less than // `progressiveThreshold`, otherwise hover will cause restart of progressive, // which is unexpected. // see example . hoverLayerThreshold:3e3, // See: module:echarts/scale/Time useUTC:!1};var ka=r(["tooltip","label","itemName","itemId","itemGroupId","itemChildGroupId","seriesName"]),Pa="original",Na="arrayRows",Oa="objectRows",Ra="keyedColumns",Ea="typedArray",Va="unknown",za="column",Ba="row",Ga=1,Fa=2,Wa=3,Ha=On(); /** * [The strategy of the arrengment of data dimensions for dataset]: * "value way": all axes are non-category axes. So series one by one take * several (the number is coordSysDims.length) dimensions from dataset. * The result of data arrengment of data dimensions like: * | ser0_x | ser0_y | ser1_x | ser1_y | ser2_x | ser2_y | * "category way": at least one axis is category axis. So the the first data * dimension is always mapped to the first category axis and shared by * all of the series. The other data dimensions are taken by series like * "value way" does. * The result of data arrengment of data dimensions like: * | ser_shared_x | ser0_y | ser1_y | ser2_y | * * @return encode Never be `null/undefined`. */ function Ya(t,e,n){var i={},r=Za(e); // Currently only make default when using dataset, util more reqirements occur. if(!r||!t)return i;var s,l,u=[],c=[],d=e.ecModel,h=Ha(d).datasetMap,p=r.uid+"_"+n.seriesLayoutBy;t=t.slice(),a(t,(function(e,n){var r=o(e)?e:t[n]={name:e};"ordinal"===r.type&&null==s&&(s=n,l=y(r)),i[r.name]=[]}));var f=h.get(p)||h.set(p,{categoryWayDim:l,valueWayDim:0}); // TODO // Auto detect first time axis and do arrangement. function g(t,e,n){for(var i=0;i "other dim" > "the value dim itself". if(d&&null==t.v&&a!==r&&(t.v=a),(null==t.n||t.n===t.v||!d&&o[t.n]===Wa)&&(t.n=a),h(t)&&o[t.n]!==Wa)return t; // [Strategy of idxRes1]: if idxRes0 not satisfied (that is, no BE_ORDINAL.Not), // find the first BE_ORDINAL.Might as the value dim, // and then find a name dim with the priority: // "other dim" > "the value dim itself". // That is for backward compat: number-like (e.g., `'3'`, `'55'`) can be // treated as number. d||(c===Fa&&null==i.v&&a!==r&&(i.v=a),null!=i.n&&i.n!==i.v||(i.n=a))}function h(t){return null!=t.v&&null!=t.n}return h(t)?t:h(i)?i:null}();if(u){i.value=[u.v]; // `potentialNameDimIndex` has highest priority. var c=null!=r?r:u.n; // By default, label uses itemName in charts. // So we don't set encodeLabel here. i.itemName=[c],i.seriesName=[c]}return i} /** * @return If return null/undefined, indicate that should not use datasetModel. */function Za(t){if(!t.get("data",!0))return Gn(t.ecModel,"dataset",{index:t.get("datasetIndex",!0),id:t.get("datasetId",!0)},zn).models[0]} /** * @return Always return an array event empty. */ /** * The rule should not be complex, otherwise user might not * be able to known where the data is wrong. * The code is ugly, but how to make it neat? */ function Xa(t,e){return ja(t.data,t.sourceFormat,t.seriesLayoutBy,t.dimensionsDefine,t.startIndex,e)} // dimIndex may be overflow source data. // return {BE_ORDINAL} function ja(e,n,r,a,s,l){var u,c,d; // Experience value. if(at(e))return Wa; // When sourceType is 'objectRows' or 'keyedColumns', dimensionsDefine // always exists in source. if(a){var h=a[l];o(h)?(c=h.name,d=h.type):t(h)&&(c=h)}if(null!=d)return"ordinal"===d?Ga:Wa;if(n===Na){var p=e;if(r===Ba){for(var f=p[l],g=0;g<(f||[]).length&&g<5;g++)if(null!=(u=b(f[s+g])))return u}else for(g=0;ge)return t[i];return t[n-1]}(i,a):n; // In case can't find in layered color palette. if((c=c||n)&&c.length){var d=c[l];return o&&(u[o]=d),s.paletteIdx=(l+1)%c.length,d}}var os="\0_ec_inner",rs=/** @class */function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return Ue(n,e),n.prototype.init=function(t,e,n,i,o,r){i=i||{},this.option=null,// Mark as not initialized. this._theme=new yr(i),this._locale=new yr(o),this._optionManager=r},n.prototype.setOption=function(t,e,n){var i=ls(e);this._optionManager.setOption(t,n,i),this._resetOption(null,i)}, /** * @param type null/undefined: reset all. * 'recreate': force recreate all. * 'timeline': only reset timeline option * 'media': only reset media query option * @return Whether option changed. */ n.prototype.resetOption=function(t,e){return this._resetOption(t,ls(e))},n.prototype._resetOption=function(t,e){var n=!1,i=this._optionManager;if(!t||"recreate"===t){var o=i.mountOption("recreate"===t);this.option&&"recreate"!==t?(this.restoreData(),this._mergeOption(o,e)):$a(this,o),n=!0} // By design, if `setOption(option2)` at the second time, and `option2` is a `ECUnitOption`, // it should better not have the same props with `MediaUnit['option']`. // Because either `option2` or `MediaUnit['option']` will be always merged to "current option" // rather than original "baseOption". If they both override a prop, the result might be // unexpected when media state changed after `setOption` called. // If we really need to modify a props in each `MediaUnit['option']`, use the full version // (`{baseOption, media}`) in `setOption`. // For `timeline`, the case is the same. if("timeline"!==t&&"media"!==t||this.restoreData(),!t||"recreate"===t||"timeline"===t){var r=i.getTimelineOption(this);r&&(n=!0,this._mergeOption(r,e))}if(!t||"recreate"===t||"media"===t){var s=i.getMediaOption(this);s.length&&a(s,(function(t){n=!0,this._mergeOption(t,e)}),this)}return n},n.prototype.mergeOption=function(t){this._mergeOption(t,null)},n.prototype._mergeOption=function(t,e){var n=this.option,i=this._componentsMap,s=this._componentsCount,l=[],u=r(),c=e&&e.replaceMergeMainTypeMap; // `datasetMap` is used to make default encode. Ha(this).datasetMap=r(), // If no component class, merge directly. // For example: color, animaiton options, etc. a(t,(function(t,e){null!=t&&(Ta.hasClass(e)?e&&(l.push(e),u.set(e,!0)): // globalSettingTask.dirty(); n[e]=null==n[e]?et(t):tt(n[e],t,!0))})),c&& // If there is a mainType `xxx` in `replaceMerge` but not declared in option, // we trade it as it is declared in option as `{xxx: []}`. Because: // (1) for normal merge, `{xxx: null/undefined}` are the same meaning as `{xxx: []}`. // (2) some preprocessor may convert some of `{xxx: null/undefined}` to `{xxx: []}`. c.each((function(t,e){Ta.hasClass(e)&&!u.get(e)&&(l.push(e),u.set(e,!0))})),Ta.topologicalTravel(l,Ta.getAllClassMainTypes(),(function(e){var r=function(t,e,n){var i=qa.get(e);if(!i)return n;var o=i(t);return o?n.concat(o):n}(this,e,Sn(t[e])),l=i.get(e),u= // `!oldCmptList` means init. See the comment in `mappingToExists` l?c&&c.get(e)?"replaceMerge":"normalMerge":"replaceAll",d=Tn(l,r,u); // Set mainType and complete subType. (function(t,e,n){ // Set mainType and complete subType. a(t,(function(t){var i=t.newOption;o(i)&&(t.keyInfo.mainType=e,t.keyInfo.subType=function(t,e,n,i){ // tooltip, markline, markpoint may always has no subType return e.type?e.type:n?n.subType:i.determineSubType(t,e)} /** * A helper for removing duplicate items between batchA and batchB, * and in themselves, and categorize by series. * * @param batchA Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...] * @param batchB Like: [{seriesId: 2, dataIndex: [32, 4, 5]}, ...] * @return result: [resultBatchA, resultBatchB] */(e,i,t.existing,n))}))})(d,e,Ta), // Empty it before the travel, in order to prevent `this._componentsMap` // from being used in the `init`/`mergeOption`/`optionUpdated` of some // components, which is probably incorrect logic. n[e]=null,i.set(e,null),s.set(e,0);var h,f=[],g=[],y=0; // Backup series for filtering. a(d,(function(t,n){var i=t.existing,o=t.newOption;if(o){var r="series"===e,a=Ta.getClass(e,t.keyInfo.subType,!r);if(!a)return; // TODO Before multiple tooltips get supported, we do this check to avoid unexpected exception. if("tooltip"===e){if(h)return;h=!0}if(i&&i.constructor===a)i.name=t.keyInfo.name, // componentModel.settingTask && componentModel.settingTask.dirty(); i.mergeOption(o,this),i.optionUpdated(o,!1);else{ // PENDING Global as parent ? var s=p({componentIndex:n},t.keyInfo);i=new a(o,this,this,s), // Assign `keyInfo` p(i,s),t.brandNew&&(i.__requireNewView=!0),i.init(o,this,this), // Call optionUpdated after init. // newCmptOption has been used as componentModel.option // and may be merged with theme and default, so pass null // to avoid confusion. i.optionUpdated(null,!0)}}else i&&( // Consider where is no new option and should be merged using {}, // see removeEdgeAndAdd in topologicalTravel and // ComponentModel.getAllClassMainTypes. i.mergeOption({},this),i.optionUpdated({},!1)); // If no both `resultItem.exist` and `resultItem.option`, // either it is in `replaceMerge` and not matched by any id, // or it has been removed in previous `replaceMerge` and left a "hole" in this component index. i?(f.push(i.option),g.push(i),y++):( // Always do assign to avoid elided item in array. f.push(void 0),g.push(void 0))}),this),n[e]=f,i.set(e,g),s.set(e,y),"series"===e&&Ka(this)} // If no series declared, ensure `_seriesIndices` initialized. ),this),this._seriesIndices||Ka(this)}, /** * Get option for output (cloned option and inner info removed) */ n.prototype.getOption=function(){var t=et(this.option);return a(t,(function(e,n){if(Ta.hasClass(n)){for(var i=Sn(e),o=i.length,r=!1,a=o-1 // Inner cmpts need to be removed. // Inner cmpts might not be at last since ec5.0, but still // compatible for users: if inner cmpt at last, splice the returned array. ;a>=0;a--) // Remove options with inner id. i[a]&&!Pn(i[a])?r=!0:(i[a]=null,!r&&o--);i.length=o,t[n]=i}})),delete t[os],t},n.prototype.getTheme=function(){return this._theme},n.prototype.getLocaleModel=function(){return this._locale},n.prototype.setUpdatePayload=function(t){this._payload=t},n.prototype.getUpdatePayload=function(){return this._payload}, /** * @param idx If not specified, return the first one. */ n.prototype.getComponent=function(t,e){var n=this._componentsMap.get(t);if(n){var i=n[e||0];if(i)return i;if(null==e)for(var o=0;o * Support: width, height, aspectRatio * Can use max or min as prefix. */(t,e,!o);this._newBaseOption=r.baseOption, // For setOption at second time (using merge mode); o?( // FIXME // the restore merge solution is essentially incorrect. // the mapping can not be 100% consistent with ecModel, which probably brings // potential bug! // The first merge is delayed, because in most cases, users do not call `setOption` twice. // let fakeCmptsMap = this._fakeCmptsMap; // if (!fakeCmptsMap) { // fakeCmptsMap = this._fakeCmptsMap = createHashMap(); // mergeToBackupOption(fakeCmptsMap, null, optionBackup.baseOption, null); // } // mergeToBackupOption( // fakeCmptsMap, optionBackup.baseOption, newParsedOption.baseOption, opt // ); // For simplicity, timeline options and media options do not support merge, // that is, if you `setOption` twice and both has timeline options, the latter // timeline options will not be merged to the former, but just substitute them. r.timelineOptions.length&&(o.timelineOptions=r.timelineOptions),r.mediaList.length&&(o.mediaList=r.mediaList),r.mediaDefault&&(o.mediaDefault=r.mediaDefault)):this._optionBackup=r},t.prototype.mountOption=function(t){var e=this._optionBackup;return this._timelineOptions=e.timelineOptions,this._mediaList=e.mediaList,this._mediaDefault=e.mediaDefault,this._currentMediaIndices=[],et(t?e.baseOption:this._newBaseOption)},t.prototype.getTimelineOption=function(t){var e,n=this._timelineOptions;if(n.length){ // getTimelineOption can only be called after ecModel inited, // so we can get currentIndex from timelineModel. var i=t.getComponent("timeline");i&&(e=et( // FIXME:TS as TimelineModel or quivlant interface n[i.getCurrentIndex()]))}return e},t.prototype.getMediaOption=function(t){var e,i,o=this._api.getWidth(),r=this._api.getHeight(),a=this._mediaList,s=this._mediaDefault,l=[],u=[]; // No media defined. if(!a.length&&!s)return u; // Multi media may be applied, the latter defined media has higher priority. for(var c=0,d=a.length;c; /** * TERM EXPLANATIONS: * See `ECOption` and `ECUnitOption` in `src/util/types.ts`. */function ms(t,e,n){var i={width:e,height:n,aspectratio:e/n},o=!0;return a(t,(function(t,e){var n=e.match(gs);if(n&&n[1]&&n[2]){var r=n[1],a=n[2].toLowerCase();(function(t,e,n){return"min"===n?t>=e:"max"===n?t<=e:t===e})(i[a],t,r)||(o=!1)}})),o} /** * Consider case: * `chart.setOption(opt1);` * Then user do some interaction like dataZoom, dataView changing. * `chart.setOption(opt2);` * Then user press 'reset button' in toolbox. * * After doing that all of the interaction effects should be reset, the * chart should be the same as the result of invoke * `chart.setOption(opt1); chart.setOption(opt2);`. * * Although it is not able ensure that * `chart.setOption(opt1); chart.setOption(opt2);` is equivalents to * `chart.setOption(merge(opt1, opt2));` exactly, * this might be the only simple way to implement that feature. * * MEMO: We've considered some other approaches: * 1. Each model handles its self restoration but not uniform treatment. * (Too complex in logic and error-prone) * 2. Use a shadow ecModel. (Performance expensive) * * FIXME: A possible solution: * Add a extra level of model for each component model. The inheritance chain would be: * ecModel <- componentModel <- componentActionModel <- dataItemModel * And all of the actions can only modify the `componentActionModel` rather than * `componentModel`. `setOption` will only modify the `ecModel` and `componentModel`. * When "resotre" action triggered, model from `componentActionModel` will be discarded * instead of recreating the "ecModel" from the "_optionBackup". */ // function mergeToBackupOption( // fakeCmptsMap: FakeComponentsMap, // // `tarOption` Can be null/undefined, means init // tarOption: ECUnitOption, // newOption: ECUnitOption, // // Can be null/undefined // opt: InnerSetOptionOpts // ): void { // newOption = newOption || {} as ECUnitOption; // const notInit = !!tarOption; // each(newOption, function (newOptsInMainType, mainType) { // if (newOptsInMainType == null) { // return; // } // if (!ComponentModel.hasClass(mainType)) { // if (tarOption) { // tarOption[mainType] = merge(tarOption[mainType], newOptsInMainType, true); // } // } // else { // const oldTarOptsInMainType = notInit ? normalizeToArray(tarOption[mainType]) : null; // const oldFakeCmptsInMainType = fakeCmptsMap.get(mainType) || []; // const resultTarOptsInMainType = notInit ? (tarOption[mainType] = [] as ComponentOption[]) : null; // const resultFakeCmptsInMainType = fakeCmptsMap.set(mainType, []); // const mappingResult = mappingToExists( // oldFakeCmptsInMainType, // normalizeToArray(newOptsInMainType), // (opt && opt.replaceMergeMainTypeMap.get(mainType)) ? 'replaceMerge' : 'normalMerge' // ); // setComponentTypeToKeyInfo(mappingResult, mainType, ComponentModel as ComponentModelConstructor); // each(mappingResult, function (resultItem, index) { // // The same logic as `Global.ts#_mergeOption`. // let fakeCmpt = resultItem.existing; // const newOption = resultItem.newOption; // const keyInfo = resultItem.keyInfo; // let fakeCmptOpt; // if (!newOption) { // fakeCmptOpt = oldTarOptsInMainType[index]; // } // else { // if (fakeCmpt && fakeCmpt.subType === keyInfo.subType) { // fakeCmpt.name = keyInfo.name; // if (notInit) { // fakeCmptOpt = merge(oldTarOptsInMainType[index], newOption, true); // } // } // else { // fakeCmpt = extend({}, keyInfo); // if (notInit) { // fakeCmptOpt = clone(newOption); // } // } // } // if (fakeCmpt) { // notInit && resultTarOptsInMainType.push(fakeCmptOpt); // resultFakeCmptsInMainType.push(fakeCmpt); // } // else { // notInit && resultTarOptsInMainType.push(void 0); // resultFakeCmptsInMainType.push(void 0); // } // }); // } // }); // } const vs=ys;var xs=a,_s=o,bs=["areaStyle","lineStyle","nodeStyle","linkStyle","chordStyle","label","labelLine"];function Ss(t){var e=t&&t.itemStyle;if(e)for(var n=0,i=bs.length;n // (2) Only register once when import repeatedly. // Should be executed after series is filtered and before stack calculation. function Bs(t){a(t,(function(e,n){var i=[],o=[NaN,NaN],r=[e.stackResultDimension,e.stackedOverDimension],a=e.data,s=e.isStackedByIndex,l=e.seriesModel.get("stackStrategy")||"samesign"; // Should not write on raw data, because stack series model list changes // depending on legend selection. a.modify(r,(function(r,u,c){var d,h,p=a.get(e.stackedDimension,c); // Consider `connectNulls` of line area, if value is NaN, stackedOver // should also be NaN, to draw a appropriate belt area. if(isNaN(p))return o;s?h=a.getRawIndex(c):d=a.get(e.stackedByDimension,c); // If stackOver is NaN, chart view will render point on value start. for(var f=NaN,g=n-1;g>=0;g--){var y=t[g]; // Has been optimized by inverted indices on `stackedByDimension`. if(s||(h=y.data.rawIndexOf(y.stackedByDimension,d)),h>=0){var m=y.data.getByRawIndex(y.stackResultDimension,h); // Considering positive stack, negative stack and empty data if("all"===l||"positive"===l&&m>0||"negative"===l&&m<0||"samesign"===l&&p>=0&&m>0||"samesign"===l&&p<=0&&m<0){ // The sum has to be very small to be affected by the // floating arithmetic problem. An incorrect result will probably // cause axis min/max to be filtered incorrectly. p=en(p,m),f=m;break}}}return i[0]=p,i[1]=f,i}))}))} // @inner var Gs,Fs,Ws,Hs,Ys,Us=function(t){this.data=t.data||(t.sourceFormat===Ra?{}:[]),this.sourceFormat=t.sourceFormat||Va, // Visit config this.seriesLayoutBy=t.seriesLayoutBy||za,this.startIndex=t.startIndex||0,this.dimensionsDetectedCount=t.dimensionsDetectedCount,this.metaRawOption=t.metaRawOption;var e=this.dimensionsDefine=t.dimensionsDefine;if(e)for(var n=0;nu&&(u=p)}s[0]=l,s[1]=u}},i=function(){return this._data?this._data.length/this._dimSize:0};function o(t){for(var e=0;e=0&&(a=s.interpolatedValue[u])}return null!=a?a+"":""})):void 0}, /** * Get raw value in option */ e.prototype.getRawValue=function(t,e){return cl(this.getData(e),t)}, /** * Should be implemented. * @param {number} dataIndex * @param {boolean} [multipleSeries=false] * @param {string} [dataType] */ e.prototype.formatTooltip=function(t,e,n){},e}(); // PENDING: previously we accept this type when calling `formatTooltip`, // but guess little chance has been used outside. Do we need to backward // compat it? // type TooltipFormatResultLegacyObject = { // // `html` means the markup language text, either in 'html' or 'richText'. // // The name `html` is not appropriate because in 'richText' it is not a HTML // // string. But still support it for backward compatibility. // html: string; // markers: Dictionary; // }; /** * For backward compat, normalize the return from `formatTooltip`. */ function pl(t){var e,n; // let markers: Dictionary; return o(t)?t.type&&(n=t):e=t,{text:e, // markers: markers || markersExisting, frag:n}} /** * @param {Object} define * @return See the return of `createTask`. */function fl(t){return new gl(t)}var gl=/** @class */function(){function t(t){t=t||{},this._reset=t.reset,this._plan=t.plan,this._count=t.count,this._onDirty=t.onDirty,this._dirty=!0} /** * @param step Specified step. * @param skip Skip customer perform call. * @param modBy Sampling window size. * @param modDataCount Sampling count. * @return whether unfinished. */return t.prototype.perform=function(t){var e,n=this._upstream,o=t&&t.skip; // TODO some refactor. // Pull data. Must pull data each time, because context.data // may be updated by Series.setData. if(this._dirty&&n){var r=this.context;r.data=r.outputData=n.context.outputData}this.__pipeline&&(this.__pipeline.currentTask=this),this._plan&&!o&&(e=this._plan(this.context)); // Support sharding by mod, which changes the render sequence and makes the rendered graphic // elements uniformed distributed when progress, especially when moving or zooming. var a,s=d(this._modBy),l=this._modDataCount||0,u=d(t&&t.modBy),c=t&&t.modDataCount||0;function d(t){// jshint ignore:line return!(t>=1)&&(t=1),t}s===u&&l===c||(e="reset"),(this._dirty||"reset"===e)&&(this._dirty=!1,a=this._doReset(o)),this._modBy=u,this._modDataCount=c;var h=t&&t.step; // Note: Stubs, that its host overall task let it has progress, has progress. // If no progress, pass index from upstream to downstream each time plan called. if(this._dueEnd=n?n._outputDueEnd:this._count?this._count(this.context):Infinity,this._progress){var p=this._dueIndex,f=Math.min(null!=h?this._dueIndex+h:Infinity,this._dueEnd);if(!o&&(a||p1&&i>0?s:a}};return r;function a(){return e=t?null:r stubCount++); // props.push({text: 'idx', value: `overall (stubs: ${stubCount})`}); // } // props.push({text: 'uid', value: task.uidDebug}); // if (task.__pipeline) { // props.push({text: 'pipelineId', value: task.__pipeline.id}); // task.agent && props.push( // {text: 'stubFor', value: task.agent.uidDebug} // ); // } // props.push( // {text: 'dirty', value: task._dirty}, // {text: 'dueIndex', value: task._dueIndex}, // {text: 'dueEnd', value: task._dueEnd}, // {text: 'outputDueEnd', value: task._outputDueEnd} // ); // if (extra) { // Object.keys(extra).forEach(key => { // props.push({text: key, value: extra[key]}); // }); // } // let args = ['color: blue']; // let msg = `%c[${prefix || 'T'}] %c` + props.map(item => ( // args.push('color: green', 'color: red'), // `${item.text}: %c${item.value}` // )).join('%c, '); // console.log.apply(console, [msg].concat(args)); // // console.log(this); // }; // window.printPipeline = function (task: any, prefix: string) { // const pipeline = task.__pipeline; // let currTask = pipeline.head; // while (currTask) { // window.printTask(currTask, prefix); // currTask = currTask._downstream; // } // }; // window.showChain = function (chainHeadTask) { // var chain = []; // var task = chainHeadTask; // while (task) { // chain.push({ // task: task, // up: task._upstream, // down: task._downstream, // idxInPipeline: task.__idxInPipeline // }); // task = task._downstream; // } // return chain; // }; // window.findTaskInChain = function (task, chainHeadTask) { // let chain = window.showChain(chainHeadTask); // let result = []; // for (let i = 0; i < chain.length; i++) { // let chainItem = chain[i]; // if (chainItem.task === task) { // result.push(i); // } // } // return result; // }; // window.printChainAEachInChainB = function (chainHeadTaskA, chainHeadTaskB) { // let chainA = window.showChain(chainHeadTaskA); // for (let i = 0; i < chainA.length; i++) { // console.log('chainAIdx:', i, 'inChainB:', window.findTaskInChain(chainA[i].task, chainHeadTaskB)); // } // }; /** * Convert raw the value in to inner value in List. * * [Performance sensitive] * * [Caution]: this is the key logic of user value parser. * For backward compatibility, do not modify it until you have to! */ function ml(t, // For high performance, do not omit the second param. e){ // Performance sensitive. var n=e&&e.type;return"ordinal"===n?t:("time"!==n||l(t)||null==t||"-"===t||(t=+sn(t)),null==t||""===t?NaN:Number(t))}var vl=r({number:function(t){ // Do not use `numericToNumber` here. We have `numericToNumber` by default. // Here the number parser can have loose rule: // enable to cut suffix: "120px" => 120, "14%" => 14. return parseFloat(t)},time:function(t){ // return timestamp. return+sn(t)},trim:function(e){return t(e)?Q(e):e}});function xl(t){return vl.get(t)}var _l={lt:function(t,e){return te},gte:function(t,e){return t>=e}},bl=/** @class */function(){function t(t,e){if(!l(e)){vn("")}this._opFn=_l[t],this._rvalFloat=pn(e)} // Performance sensitive. return t.prototype.evaluate=function(t){ // Most cases is 'number', and typeof maybe 10 times faseter than parseFloat. return l(t)?this._opFn(t,this._rvalFloat):this._opFn(pn(t),this._rvalFloat)},t}(),Sl=/** @class */function(){ /** * @param order by default: 'asc' * @param incomparable by default: Always on the tail. * That is, if 'asc' => 'max', if 'desc' => 'min' * See the definition of "incomparable" in [SORT_COMPARISON_RULE]. */ function e(t,e){var n="desc"===t;this._resultLT=n?1:-1,null==e&&(e=n?"min":"max"),this._incomparable="min"===e?-Infinity:Infinity} // See [SORT_COMPARISON_RULE]. // Performance sensitive. return e.prototype.evaluate=function(e,n){ // Most cases is 'number', and typeof maybe 10 times faseter than parseFloat. var i=l(e)?e:pn(e),o=l(n)?n:pn(n),r=isNaN(i),a=isNaN(o);if(r&&(i=this._incomparable),a&&(o=this._incomparable),r&&a){var s=t(e),u=t(n);s&&(i=u?e:0),u&&(o=s?n:0)}return io?-this._resultLT:0},e}(),wl=/** @class */function(){function t(t,e){this._rval=e,this._isEQ=t,this._rvalTypeof=typeof e,this._rvalFloat=pn(e)} // Performance sensitive. return t.prototype.evaluate=function(t){var e=t===this._rval;if(!e){var n=typeof t;n===this._rvalTypeof||"number"!==n&&"number"!==this._rvalTypeof||(e=pn(t)===this._rvalFloat)}return this._isEQ?e:!e},t}(); /** * [FILTER_COMPARISON_RULE] * `lt`|`lte`|`gt`|`gte`: * + rval must be a number. And lval will be converted to number (`numericToNumber`) to compare. * `eq`: * + If same type, compare with `===`. * + If there is one number, convert to number (`numericToNumber`) to compare. * + Else return `false`. * `ne`: * + Not `eq`. * * * [SORT_COMPARISON_RULE] * All the values are grouped into three categories: * + "numeric" (number and numeric string) * + "non-numeric-string" (string that excluding numeric string) * + "others" * "numeric" vs "numeric": values are ordered by number order. * "non-numeric-string" vs "non-numeric-string": values are ordered by ES spec (#sec-abstract-relational-comparison). * "others" vs "others": do not change order (always return 0). * "numeric" vs "non-numeric-string": "non-numeric-string" is treated as "incomparable". * "number" vs "others": "others" is treated as "incomparable". * "non-numeric-string" vs "others": "others" is treated as "incomparable". * "incomparable" will be seen as -Infinity or Infinity (depends on the settings). * MEMO: * Non-numeric string sort makes sense when we need to put the items with the same tag together. * But if we support string sort, we still need to avoid the misleading like `'2' > '12'`, * So we treat "numeric-string" sorted by number order rather than string comparison. * * * [CHECK_LIST_OF_THE_RULE_DESIGN] * + Do not support string comparison until required. And also need to * avoid the misleading of "2" > "12". * + Should avoid the misleading case: * `" 22 " gte "22"` is `true` but `" 22 " eq "22"` is `false`. * + JS bad case should be avoided: null <= 0, [] <= 0, ' ' <= 0, ... * + Only "numeric" can be converted to comparable number, otherwise converted to NaN. * See `util/number.ts#numericToNumber`. * * @return If `op` is not `RelationalOperator`, return null; */ function Ml(t,e){return"eq"===t||"ne"===t?new wl("eq"===t,e):N(_l,t)?new bl(t,e):null} /** * TODO: disable writable. * This structure will be exposed to users. */var Il=/** @class */function(){function t(){}return t.prototype.getRawData=function(){ // Only built-in transform available. throw new Error("not supported")},t.prototype.getRawDataItem=function(t){ // Only built-in transform available. throw new Error("not supported")},t.prototype.cloneRawData=function(){}, /** * @return If dimension not found, return null/undefined. */ t.prototype.getDimensionInfo=function(t){}, /** * dimensions defined if and only if either: * (a) dataset.dimensions are declared. * (b) dataset data include dimensions definitions in data (detected or via specified `sourceHeader`). * If dimensions are defined, `dimensionInfoAll` is corresponding to * the defined dimensions. * Otherwise, `dimensionInfoAll` is determined by data columns. * @return Always return an array (even empty array). */ t.prototype.cloneAllDimensionInfo=function(){},t.prototype.count=function(){}, /** * Only support by dimension index. * No need to support by dimension name in transform function, * because transform function is not case-specific, no need to use name literally. */ t.prototype.retrieveValue=function(t,e){},t.prototype.retrieveValueFromItem=function(t,e){},t.prototype.convertValue=function(t,e){return ml(t,e)},t}();function Dl(t){if(!Pl(t.sourceFormat)){vn("")}return t.data}function Tl(t){var e=t.sourceFormat,n=t.data;if(!Pl(e)){vn("")}if(e===Na){for(var i=[],o=0,r=n.length;o65535?Rl:El}function Fl(t,e,n,i,o){var r=Bl[n||"float"];if(o){var a=t[e],s=a&&a.length;if(s!==i){ // The cost of the copy is probably inconsiderable // within the initial chunkSize. for(var l=new r(i),u=0;ug[1]&&(g[1]=f)}return this._rawCount=this._count=s,{start:a,end:s}},t.prototype._initDataFromProvider=function(t,e,i){for(var o=this._provider,r=this._chunks,a=this._dimensions,s=a.length,l=this._rawExtent,u=n(a,(function(t){return t.property})),c=0;cm[1]&&(m[1]=y)}}!o.persistent&&o.clean&& // Clean unused data if data source is typed array. o.clean(),this._rawCount=this._count=e, // Reset data extent this._extent=[]},t.prototype.count=function(){return this._count}, /** * Get value. Return NaN if idx is out of range. */ t.prototype.get=function(t,e){if(!(e>=0&&e=0&&e=this._rawCount||t<0)return-1;if(!this._indices)return t; // Indices are ascending var e=this._indices,n=e[t]; // If rawIndex === dataIndex if(null!=n&&nt))return r;o=r-1}}return-1}, /** * Retrieve the index of nearest value. * @param dim * @param value * @param [maxDistance=Infinity] * @return If and only if multiple indices have * the same value, they are put to the result. */ t.prototype.indicesOfNearest=function(t,e,n){var i=this._chunks[t],o=[];if(!i)return o;null==n&&(n=Infinity); // Check the test case of `test/ut/spec/data/SeriesData.js`. for(var r=Infinity,a=-1,s=0,l=0,u=this.count();l= 0` in this case. // But if `this.get(dim, i)` and `this.get(dim, j)` get the same value, both of them // should be push to `nearestIndices`. (d=0&&a<0)&&(r=d,a=c,s=0),c===a&&(o[s++]=l))}return o.length=s,o},t.prototype.getIndices=function(){var t,e=this._indices;if(e){var n=e.constructor,i=this._count; // `new Array(a, b, c)` is different from `new Uint32Array(a, b, c)`. if(n===Array){t=new n(i);for(var o=0;o=u&&_<=c||isNaN(_))&&(a[s++]=p),p++}h=!0}else if(2===o){f=d[i[0]];var y=d[i[1]],m=t[i[1]][0],x=t[i[1]][1];for(g=0;g=u&&_<=c||isNaN(_))&&(b>=m&&b<=x||isNaN(b))&&(a[s++]=p),p++}h=!0}}if(!h)if(1===o)for(g=0;g=u&&_<=c||isNaN(_))&&(a[s++]=S)}else for(g=0;gt[I][1])&&(w=!1)}w&&(a[s++]=e.getRawIndex(g))} // Set indices after filtered. return sy[1]&&(y[1]=g)}}}}, /** * Large data down sampling using largest-triangle-three-buckets * @param {string} valueDimension * @param {number} targetCount */ t.prototype.lttbDownSample=function(t,e){var n,i,o,r=this.clone([t],!0),a=r._chunks[t],s=this.count(),l=0,u=Math.floor(1/e),c=this.getRawIndex(0),d=new(Gl(this._rawCount))(Math.min(2*(Math.ceil(s/u)+2),s)); // First frame use the first data. d[l++]=c;for(var h=1;hn&&(n=i,o=I)}M>0&&M<_-x&&( // Append first NaN point in every bucket. // It is necessary to ensure the correct order of indices. d[l++]=Math.min(w,o),o=Math.max(w,o)),d[l++]=o,c=o} // First frame use the last data. return d[l++]=this.getRawIndex(s-1),r._count=l,r._indices=d,r.getRawIndex=this._getRawIdx,r}, /** * Large data down sampling using min-max * @param {string} valueDimension * @param {number} rate */ t.prototype.minmaxDownSample=function(t,e){for(var n=this.clone([t],!0),i=n._chunks,o=Math.floor(1/e),r=i[t],a=this.count(),s=new(Gl(this._rawCount))(2*Math.ceil(a/o)),l=0,u=0;ua&&(f=a-u); // Determine min and max within the current frame for(var g=0;gp&&(p=y,h=u+g)}var m=this.getRawIndex(c),v=this.getRawIndex(h); // Set the order of the min and max values, based on their ordering in the frame cu-p&&(s=u-p,a.length=s);for(var f=0;fc[1]&&(c[1]=y),d[h++]=m}return o._count=h,o._indices=d,o._updateGetRawIdx(),o}, /** * Data iteration * @param ctx default this * @example * list.each('x', function (x, idx) {}); * list.each(['x', 'y'], function (x, y, idx) {}); * list.each(function (idx) {}) */ t.prototype.each=function(t,e){if(this._count)for(var n=t.length,i=this._chunks,o=0,r=this.count();oa&&(a=l)}return i=[r,a],this._extent[t]=i,i}, /** * Get raw data item */ t.prototype.getRawDataItem=function(t){var e=this.getRawIndex(t);if(this._provider.persistent)return this._provider.getItem(e);for(var n=[],i=this._chunks,o=0;o=0?this._indices[t]:-1},t.prototype._updateGetRawIdx=function(){this.getRawIndex=this._indices?this._getRawIdx:this._getRawIdxIdentity},t.internalField=function(){function t(t,e,n,i){return ml(t[i],this._dimensions[i])}Nl={arrayRows:t,objectRows:function(t,e,n,i){return ml(t[e],this._dimensions[i])},keyedColumns:t,original:function(t,e,n,i){ // Performance sensitive, do not use modelUtil.getDataItemValue. // If dataItem is an plain object with no value field, the let `value` // will be assigned with the object, but it will be tread correctly // in the `convertValue`. var o=t&&(null==t.value?t:t.value);return ml(o instanceof Array?o[i]:o,this._dimensions[i])},typedArray:function(t,e,n,i){return t[i]}}}(),t}();const Hl=Wl; /** * [REQUIREMENT_MEMO]: * (0) `metaRawOption` means `dimensions`/`sourceHeader`/`seriesLayoutBy` in raw option. * (1) Keep support the feature: `metaRawOption` can be specified both on `series` and * `root-dataset`. Them on `series` has higher priority. * (2) Do not support to set `metaRawOption` on a `non-root-dataset`, because it might * confuse users: whether those props indicate how to visit the upstream source or visit * the transform result source, and some transforms has nothing to do with these props, * and some transforms might have multiple upstream. * (3) Transforms should specify `metaRawOption` in each output, just like they can be * declared in `root-dataset`. * (4) At present only support visit source in `SERIES_LAYOUT_BY_COLUMN` in transforms. * That is for reducing complexity in transforms. * PENDING: Whether to provide transposition transform? * * [IMPLEMENTAION_MEMO]: * "sourceVisitConfig" are calculated from `metaRawOption` and `data`. * They will not be calculated until `source` is about to be visited (to prevent from * duplicate calcuation). `source` is visited only in series and input to transforms. * * [DIMENSION_INHERIT_RULE]: * By default the dimensions are inherited from ancestors, unless a transform return * a new dimensions definition. * Consider the case: * ```js * dataset: [{ * source: [ ['Product', 'Sales', 'Prise'], ['Cookies', 321, 44.21], ...] * }, { * transform: { type: 'filter', ... } * }] * dataset: [{ * dimension: ['Product', 'Sales', 'Prise'], * source: [ ['Cookies', 321, 44.21], ...] * }, { * transform: { type: 'filter', ... } * }] * ``` * The two types of option should have the same behavior after transform. * * * [SCENARIO]: * (1) Provide source data directly: * ```js * series: { * encode: {...}, * dimensions: [...] * seriesLayoutBy: 'row', * data: [[...]] * } * ``` * (2) Series refer to dataset. * ```js * series: [{ * encode: {...} * // Ignore datasetIndex means `datasetIndex: 0` * // and the dimensions defination in dataset is used * }, { * encode: {...}, * seriesLayoutBy: 'column', * datasetIndex: 1 * }] * ``` * (3) dataset transform * ```js * dataset: [{ * source: [...] * }, { * source: [...] * }, { * // By default from 0. * transform: { type: 'filter', config: {...} } * }, { * // Piped. * transform: [ * { type: 'filter', config: {...} }, * { type: 'sort', config: {...} } * ] * }, { * id: 'regressionData', * fromDatasetIndex: 1, * // Third-party transform * transform: { type: 'ecStat:regression', config: {...} } * }, { * // retrieve the extra result. * id: 'regressionFormula', * fromDatasetId: 'regressionData', * fromTransformResult: 1 * }] * ``` */var Yl=/** @class */function(){function t(t){ // Cached source. Do not repeat calculating if not dirty. this._sourceList=[],this._storeList=[], // version sign of each upstream source manager. this._upstreamSignList=[],this._versionSignBase=0,this._dirty=!0,this._sourceHost=t} /** * Mark dirty. */return t.prototype.dirty=function(){this._setLocalSource([],[]),this._storeList=[],this._dirty=!0},t.prototype._setLocalSource=function(t,e){this._sourceList=t,this._upstreamSignList=e,this._versionSignBase++,this._versionSignBase>9e10&&(this._versionSignBase=0)}, /** * For detecting whether the upstream source is dirty, so that * the local cached source (in `_sourceList`) should be discarded. */ t.prototype._getVersionSign=function(){return this._sourceHost.uid+"_"+this._versionSignBase}, /** * Always return a source instance. Otherwise throw error. */ t.prototype.prepareSource=function(){ // For the case that call `setOption` multiple time but no data changed, // cache the result source to prevent from repeating transform. this._isDirty()&&(this._createSource(),this._dirty=!1)},t.prototype._createSource=function(){this._setLocalSource([],[]);var t,e,n=this._sourceHost,i=this._getUpstreamSourceManagers(),o=!!i.length;if(Zl(n)){var r=n,a=void 0,s=void 0,l=void 0; // Has upstream dataset if(o){var u=i[0];u.prepareSource(),a=(l=u.getSource()).data,s=l.sourceFormat,e=[u._getVersionSign()]} // Series data is from own. else a=r.get("data",!0),s=at(a)?Ea:Pa,e=[]; // See [REQUIREMENT_MEMO], merge settings on series and parent dataset if it is root. var c=this._getSourceMetaRawOption()||{},d=l&&l.metaRawOption||{},h=x(c.seriesLayoutBy,d.seriesLayoutBy)||null,p=x(c.sourceHeader,d.sourceHeader),f=x(c.dimensions,d.dimensions);t=h!==d.seriesLayoutBy||!!p!=!!d.sourceHeader||f?[Xs(a,{seriesLayoutBy:h,sourceHeader:p,dimensions:f},s)]:[]}else{var g=n; // Has upstream dataset. if(o){var y=this._applyTransform(i);t=y.sourceList,e=y.upstreamSignList} // Is root dataset. else{t=[Xs(g.get("source",!0),this._getSourceMetaRawOption(),null)],e=[]}}this._setLocalSource(t,e)},t.prototype._applyTransform=function(t){var e,n=this._sourceHost,i=n.get("transform",!0),o=n.get("fromTransformResult",!0);if(null!=o){1!==t.length&&Xl("")}var r,s=[],l=[];return a(t,(function(t){t.prepareSource();var e=t.getSource(o||0);null==o||e||Xl(""),s.push(e),l.push(t._getVersionSign())})),i?e=function(t,e){var n=Sn(t),i=n.length;i||vn("");for(var o=0,r=i;o1||n>0&&!t.noHeader;return a(t.blocks,(function(t){var n=eu(t); // If the some of the sub-blocks have some gaps (like 10px) inside, this block // should use a larger gap (like 20px) to distinguish those sub-blocks. n>=e&&(e=n+ +(i&&( // 0 always can not be readable gap level. !n||Ql(t)&&!t.noHeader)))})),e}return 0}function nu(t,e,n,o){var r,l=e.noHeader,u=(r=eu(e),{html:Kl[r],richText:Jl[r]}),c=[],d=e.blocks||[];s(!d||i(d)),d=d||[];var h=t.orderMode;if(e.sortBlocks&&h){d=d.slice();var f={valueAsc:"asc",valueDesc:"desc"};if(N(f,h)){var g=new Sl(f[h],null);d.sort((function(t,e){return g.evaluate(t.sortParam,e.sortParam)}))} // FIXME 'seriesDesc' necessary? else"seriesDesc"===h&&d.reverse()}a(d,(function(n,i){var r=e.valueFormatter,a=tu(n)( // Inherit valueFormatter r?p(p({},t),{valueFormatter:r}):t,n,i>0?u.html:0,o);null!=a&&c.push(a)}));var y="richText"===t.renderMode?c.join(u.richText):ru(o,c.join(""),l?n:u.html);if(l)return y;var m=sa(e.header,"ordinal",t.useUTC),v=ql(o,t.renderMode).nameStyle,x=jl(o);return"richText"===t.renderMode?au(t,m,v)+u.richText+y:ru(o,'
'+ot(m)+"
"+y,n)}function iu(t,e,o,r){var a=t.renderMode,s=e.noName,l=e.noValue,u=!e.markerType,c=e.name,d=t.useUTC,h=e.valueFormatter||t.valueFormatter||function(t){return t=i(t)?t:[t],n(t,(function(t,e){return sa(t,i(g)?g[e]:g,d)}))};if(!s||!l){var p=u?"":t.markupStyleCreator.makeTooltipMarker(e.markerType,e.markerColor||"#333",a),f=s?"":sa(c,"ordinal",d),g=e.valueType,y=l?[]:h(e.value,e.dataIndex),m=!u||!s,v=!u&&s,x=ql(r,a),_=x.nameStyle,b=x.valueStyle;return"richText"===a?(u?"":p)+(s?"":au(t,f,_))+(l?"":function(t,e,n,o,r){var a=[r],s=o?10:20; // Value has commas inside, so use ' ' as delimiter for multiple values. return n&&a.push({padding:[0,0,0,s],align:"right"}),t.markupStyleCreator.wrapRichTextStyle(i(e)?e.join(" "):e,a)}(t,y,m,v,b)):ru(r,(u?"":p)+(s?"":function(t,e,n){return''+ot(t)+""}(f,!u,_))+(l?"":function(t,e,o,r){ // Do not too close to marker, considering there are multiple values separated by spaces. var a=o?"10px":"20px",s=e?"float:right;margin-left:"+a:"";return t=i(t)?t:[t],''+n(t,(function(t){return ot(t)})).join("  ")+""}(y,m,v,b)),o)}} /** * @return markupText. null/undefined means no content. */function ou(t,e,n,i,o,r){if(t)return tu(t)({useUTC:o,renderMode:n,orderMode:i,markupStyleCreator:e,valueFormatter:t.valueFormatter},t,0,r)}function ru(t,e,n){return'
'+e+'
'}function au(t,e,n){return t.markupStyleCreator.wrapRichTextStyle(e,n)}function su(t,e){return ha(t.getData().getItemVisual(e,"style")[t.visualDrawType])}function lu(t,e){var n=t.get("padding");return null!=n?n:"richText"===e?[8,10]:10} /** * The major feature is generate styles for `renderMode: 'richText'`. * But it also serves `renderMode: 'html'` to provide * "renderMode-independent" API. */var uu=/** @class */function(){function e(){this.richTextStyles={}, // Notice that "generate a style name" usually happens repeatedly when mouse is moving and // a tooltip is displayed. So we put the `_nextStyleNameId` as a member of each creator // rather than static shared by all creators (which will cause it increase to fast). this._nextStyleNameId=gn()}return e.prototype._generateStyleName=function(){return"__EC_aUTo_"+this._nextStyleNameId++},e.prototype.makeTooltipMarker=function(e,n,i){var o="richText"===i?this._generateStyleName():null,r=da({color:n,type:e,renderMode:i,markerId:o});return t(r)?r:(this.richTextStyles[o]=r.style,r.content)}, /** * @usage * ```ts * const styledText = markupStyleCreator.wrapRichTextStyle([ * // The styles will be auto merged. * { * fontSize: 12, * color: 'blue' * }, * { * padding: 20 * } * ]); * ``` */ e.prototype.wrapRichTextStyle=function(t,e){var n={};i(e)?a(e,(function(t){return p(n,t)})):p(n,e);var o=this._generateStyleName();return this.richTextStyles[o]=n,"{"+o+"|"+t+"}"},e}();function cu(t){var n,o,r,s,l=t.series,u=t.dataIndex,c=t.multipleSeries,d=l.getData(),h=d.mapDimensionsAll("defaultedTooltip"),p=h.length,f=l.getRawValue(u),g=i(f),y=su(l,u);if(p>1||g&&!p){var m=function(t,n,i,o,r){ // check: category-no-encode-has-axis-data in dataset.html var s=n.getData(),l=e(t,(function(t,e,n){var i=s.getDimensionInfo(n);return t||i&&!1!==i.tooltip&&null!=i.displayName}),!1),u=[],c=[],d=[];function h(t,e){var n=s.getDimensionInfo(e); // If `dimInfo.tooltip` is not set, show tooltip. n&&!1!==n.otherDims.tooltip&&(l?d.push($l("nameValue",{markerType:"subItem",markerColor:r,name:n.displayName,value:t,valueType:n.type})):(u.push(t),c.push(n.type)))}return o.length?a(o,(function(t){h(cl(s,i,t),t)})):a(t,h),{inlineValues:u,inlineValueTypes:c,blocks:d}}(f,l,u,h,y);n=m.inlineValues,o=m.inlineValueTypes,r=m.blocks, // Only support tooltip sort by the first inline value. It's enough in most cases. s=m.inlineValues[0]}else if(p){var v=d.getDimensionInfo(h[0]);s=n=cl(d,u,h[0]),o=v.type}else s=n=g?f[0]:f; // Do not show generated series name. It might not be readable. var x=kn(l),_=x&&l.name||"",b=d.getName(u),S=c?_:b;return $l("section",{header:_, // When series name is not specified, do not show a header line with only '-'. // This case always happens in tooltip.trigger: 'item'. noHeader:c||!x,sortParam:s,blocks:[$l("nameValue",{markerType:"item",markerColor:y, // Do not mix display seriesName and itemName in one tooltip, // which might confuses users. name:S, // name dimension might be auto assigned, where the name might // be not readable. So we check trim here. noName:!Q(S),value:n,valueType:o,dataIndex:u})].concat(r||[])})}var du=On();function hu(t,e){return t.getName(e)||t.getId(e)}var pu="__universalTransitionEnabled",fu=/** @class */function(t){function e(){ // [Caution]: Because this class or desecendants can be used as `XXX.extend(subProto)`, // the class members must not be initialized in constructor or declaration place. // Otherwise there is bad case: // class A {xxx = 1;} // enableClassExtend(A); // class B extends A {} // var C = B.extend({xxx: 5}); // var c = new C(); // console.log(c.xxx); // expect 5 but always 1. var e=null!==t&&t.apply(this,arguments)||this; // --------------------------------------- // Props about data selection // --------------------------------------- return e._selectedDataIndicesMap={},e}return Ue(e,t),e.prototype.init=function(t,e,n){this.seriesIndex=this.componentIndex,this.dataTask=fl({count:yu,reset:mu}),this.dataTask.context={model:this},this.mergeDefaultAndTheme(t,n),(du(this).sourceManager=new Yl(this)).prepareSource();var i=this.getInitialData(t,n);xu(i,this),this.dataTask.context.data=i,du(this).dataBeforeProcessed=i, // If we reverse the order (make data firstly, and then make // dataBeforeProcessed by cloneShallow), cloneShallow will // cause data.graph.data !== data when using // module:echarts/data/Graph or module:echarts/data/Tree. // See module:echarts/data/helper/linkSeriesData // Theoretically, it is unreasonable to call `seriesModel.getData()` in the model // init or merge stage, because the data can be restored. So we do not `restoreData` // and `setData` here, which forbids calling `seriesModel.getData()` in this stage. // Call `seriesModel.getRawData()` instead. // this.restoreData(); gu(this),this._initSelectedMapFromData(i)}, /** * Util for merge default and theme to option */ e.prototype.mergeDefaultAndTheme=function(t,e){var n=ba(this),i=n?wa(t):{},o=this.subType;Ta.hasClass(o)&&(o+="Series"),tt(t,e.getTheme().get(this.subType)),tt(t,this.getDefaultOption()), // Default label emphasis `show` wn(t,"label",["show"]),this.fillDataTextStyle(t.data),n&&Sa(t,i,n)},e.prototype.mergeOption=function(t,e){ // this.settingTask.dirty(); t=tt(this.option,t,!0),this.fillDataTextStyle(t.data);var n=ba(this);n&&Sa(this.option,t,n);var i=du(this).sourceManager;i.dirty(),i.prepareSource();var o=this.getInitialData(t,e);xu(o,this),this.dataTask.dirty(),this.dataTask.context.data=o,du(this).dataBeforeProcessed=o,gu(this),this._initSelectedMapFromData(o)},e.prototype.fillDataTextStyle=function(t){ // Default data label emphasis `show` // FIXME Tree structure data ? // FIXME Performance ? if(t&&!at(t))for(var e=["show"],n=0;nthis.getShallow("animationThreshold")&&(e=!1),!!e},e.prototype.restoreData=function(){this.dataTask.dirty()},e.prototype.getColorFromPalette=function(t,e,n){var i=this.ecModel,o=es.prototype.getColorFromPalette.call(this,t,e,n); // PENDING return o||(o=i.getColorFromPalette(t,e,n)),o}, /** * Use `data.mapDimensionsAll(coordDim)` instead. * @deprecated */ e.prototype.coordDimToDataDim=function(t){return this.getRawData().mapDimensionsAll(t)}, /** * Get progressive rendering count each step */ e.prototype.getProgressive=function(){return this.get("progressive")}, /** * Get progressive rendering count each step */ e.prototype.getProgressiveThreshold=function(){return this.get("progressiveThreshold")}, // PENGING If selectedMode is null ? e.prototype.select=function(t,e){this._innerSelect(this.getData(e),t)},e.prototype.unselect=function(t,e){var n=this.option.selectedMap;if(n){var i=this.option.selectedMode,o=this.getData(e);if("series"===i||"all"===n)return this.option.selectedMap={},void(this._selectedDataIndicesMap={});for(var r=0;r=0&&n.push(o)}return n},e.prototype.isSelected=function(t,e){var n=this.option.selectedMap;if(!n)return!1;var i=this.getData(e);return("all"===n||n[hu(i,t)])&&!i.getItemModel(t).get(["select","disabled"])},e.prototype.isUniversalTransitionEnabled=function(){if(this[pu])return!0;var t=this.option.universalTransition; // Quick reject return!!t&&(!0===t||t&&t.enabled)},e.prototype._innerSelect=function(t,e){var n,i,r=this.option,a=r.selectedMode,s=e.length;if(a&&s)if("series"===a)r.selectedMap="all";else if("multiple"===a){o(r.selectedMap)||(r.selectedMap={});for(var l=r.selectedMap,u=0;u0&&this._innerSelect(t,e)}}, // /** // * @see {module:echarts/stream/Scheduler} // */ // abstract pipeTask: null e.registerClass=function(t){return Ta.registerClass(t)},e.protoInitialize=function(){var t=e.prototype;t.type="series.__base__",t.seriesIndex=0,t.ignoreStyleOnData=!1,t.hasSymbolVisual=!1,t.defaultSymbol="circle", // Make sure the values can be accessed! t.visualStyleAccessPath="itemStyle",t.visualDrawType="fill"}(),e}(Ta); /** * MUST be called after `prepareSource` called * Here we need to make auto series, especially for auto legend. But we * do not modify series.name in option to avoid side effects. */ function gu(t){ // User specified name has higher priority, otherwise it may cause // series can not be queried unexpectedly. var e=t.name;kn(t)||(t.name=function(t){var e=t.getRawData(),n=e.mapDimensionsAll("seriesName"),i=[];return a(n,(function(t){var n=e.getDimensionInfo(t);n.displayName&&i.push(n.displayName)})),i.join(" ")}(t)||e)}function yu(t){return t.model.getRawData().count()}function mu(t){var e=t.model;return e.setData(e.getRawData().cloneShallow()),vu}function vu(t,e){ // Avoid repeat cloneShallow when data just created in reset. e.outputData&&t.end>e.outputData.count()&&e.model.getRawData().cloneShallow(e.outputData)} // TODO refactor function xu(t,e){a(ct(t.CHANGABLE_METHODS,t.DOWNSAMPLE_METHODS),(function(n){t.wrapMethod(n,rt(_u,e))}))}function _u(t,e){var n=bu(t);return n&& // Consider case: filter, selectRange n.setOutputEnd((e||this).count()),e}function bu(t){var e=(t.ecModel||{}).scheduler,n=e&&e.getPipeline(t.uid);if(n){ // When pipline finished, the currrentTask keep the last // task (renderTask). var i=n.currentTask;if(i){var o=i.agentStubMap;o&&(i=o.get(t.uid))}return i}}nt(fu,hl),nt(fu,es),jn(fu,Ta);const Su=fu;var wu=/** @class */function(){function t(){this.group=new Z,this.uid=vr("viewComponent")}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,n,i){},t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,n,i){ // Do nothing; },t.prototype.updateLayout=function(t,e,n,i){ // Do nothing; },t.prototype.updateVisual=function(t,e,n,i){ // Do nothing; }, /** * Hook for toggle blur target series. * Can be used in marker for blur or leave blur the markers */ t.prototype.toggleBlurSeries=function(t,e,n){ // Do nothing; }, /** * Traverse the new rendered elements. * * It will traverse the new added element in progressive rendering. * And traverse all in normal rendering. */ t.prototype.eachRendered=function(t){var e=this.group;e&&e.traverse(t)},t}();Xn(wu),$n(wu);const Mu=wu; /** * @return {string} If large mode changed, return string 'reset'; */function Iu(){var t=On();return function(e){var n=t(e),i=e.pipelineContext,o=!!n.large,r=!!n.progressiveRender,a=n.large=!(!i||!i.large),s=n.progressiveRender=!(!i||!i.progressiveRender);return!(o===a&&r===s)&&"reset"}}var Du=On(),Tu=Iu(),Cu=/** @class */function(){function t(){this.group=new Z,this.uid=vr("viewChart"),this.renderTask=fl({plan:ku,reset:Pu}),this.renderTask.context={view:this}}return t.prototype.init=function(t,e){},t.prototype.render=function(t,e,n,i){}, /** * Highlight series or specified data item. */ t.prototype.highlight=function(t,e,n,i){var o=t.getData(i&&i.dataType);o&&Lu(o,i,"emphasis")}, /** * Downplay series or specified data item. */ t.prototype.downplay=function(t,e,n,i){var o=t.getData(i&&i.dataType);o&&Lu(o,i,"normal")}, /** * Remove self. */ t.prototype.remove=function(t,e){this.group.removeAll()}, /** * Dispose self. */ t.prototype.dispose=function(t,e){},t.prototype.updateView=function(t,e,n,i){this.render(t,e,n,i)}, // FIXME never used? t.prototype.updateLayout=function(t,e,n,i){this.render(t,e,n,i)}, // FIXME never used? t.prototype.updateVisual=function(t,e,n,i){this.render(t,e,n,i)}, /** * Traverse the new rendered elements. * * It will traverse the new added element in progressive rendering. * And traverse all in normal rendering. */ t.prototype.eachRendered=function(t){Bo(this.group,t)},t.markUpdateMethod=function(t,e){Du(t).updateMethod=e},t.protoInitialize=void(t.prototype.type="chart"),t}(); /** * Set state of single element */ function Au(t,e,n){t&&Ji(t)&&("emphasis"===e?ki:Pi)(t,n)}function Lu(t,e,n){var i=Nn(t,e),o=e&&null!=e.highlightKey? /** * Support highlight/downplay record on each elements. * For the case: hover highlight/downplay (legend, visualMap, ...) and * user triggered highlight/downplay should not conflict. * Only all of the highlightDigit cleared, return to normal. * @param {string} highlightKey * @return {number} highlightDigit */ function(t){var e=ri[t];return null==e&&oi<=32&&(e=ri[t]=oi++),e}(e.highlightKey):null;null!=i?a(Sn(i),(function(e){Au(t.getItemGraphicEl(e),n,o)})):t.eachItemGraphicEl((function(t){Au(t,n,o)}))}function ku(t){return Tu(t.model)}function Pu(t){var e=t.model,n=t.ecModel,i=t.api,o=t.payload,r=e.pipelineContext.progressiveRender,a=t.view,s=o&&Du(o).updateMethod,l=r?"incrementalPrepareRender":s&&a[s]?s:"render";return"render"!==l&&a[l](e,n,i,o),Nu[l]}Xn(Cu),$n(Cu);var Nu={incrementalPrepareRender:{progress:function(t,e){e.view.incrementalRender(t,e.model,e.ecModel,e.api,e.payload)}},render:{ // Put view.render in `progress` to support appendData. But in this case // view.render should not be called in reset, otherwise it will be called // twise. Use `forceFirstProgress` to make sure that view.render is called // in any cases. forceFirstProgress:!0,progress:function(t,e){e.view.render(e.model,e.ecModel,e.api,e.payload)}}};const Ou=Cu; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /** * AUTO-GENERATED FILE. DO NOT MODIFY. */ /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */var Ru="\0__throttleOriginMethod",Eu="\0__throttleRate",Vu="\0__throttleType"; /** * @public * @param {(Function)} fn * @param {number} [delay=0] Unit: ms. * @param {boolean} [debounce=false] * true: If call interval less than `delay`, only the last call works. * false: If call interval less than `delay, call works on fixed rate. * @return {(Function)} throttled fn. */ function zu(t,e,n){var i,o,r,a,s,l=0,u=0,c=null;function d(){u=(new Date).getTime(),c=null,t.apply(r,a||[])}e=e||0;var h=function(){for(var t=[],h=0;h=0?d():c=setTimeout(d,-o),l=i}; /** * Clear throttle. * @public */return h.clear=function(){c&&(clearTimeout(c),c=null)}, /** * Enable debounce once. */ h.debounceNextCall=function(t){s=t},h} /** * Create throttle method or update throttle rate. * * @example * ComponentView.prototype.render = function () { * ... * throttle.createOrUpdate( * this, * '_dispatchAction', * this.model.get('throttle'), * 'fixRate' * ); * }; * ComponentView.prototype.remove = function () { * throttle.clear(this, '_dispatchAction'); * }; * ComponentView.prototype.dispose = function () { * throttle.clear(this, '_dispatchAction'); * }; * */function Bu(t,e,n,i){var o=t[e];if(o){var r=o[Ru]||o,a=o[Vu];if(o[Eu]!==n||a!==i){if(null==n||!i)return t[e]=r;(o=t[e]=zu(r,n,"debounce"===i))[Ru]=r,o[Vu]=i,o[Eu]=n}return o}} /** * Clear throttle. Example see throttle.createOrUpdate. */function Gu(t,e){var n=t[e];n&&n[Ru]&&( // Clear throttle n.clear&&n.clear(),t[e]=n[Ru])}var Fu=On(),Wu={itemStyle:Qn(hr,!0),lineStyle:Qn(ur,!0)},Hu={lineStyle:"stroke",itemStyle:"fill"};function Yu(t,e){var n=t.visualStyleMapper||Wu[e];return n||Wu.itemStyle}function Uu(t,e){ // return defaultColorKey[stylePath] || var n=t.visualDrawType||Hu[e];return n||"fill"}var Zu={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",o=t.getModel(i),r=Yu(t,i)(o),a=o.getShallow("decal");a&&(n.setVisual("decal",a),a.dirty=!0); // TODO var s=Uu(t,i),l=r[s],u=f(l)?l:null,c="auto"===r.fill||"auto"===r.stroke; // Get from color palette by default. if(!r[s]||u||c){ // Note: If some series has color specified (e.g., by itemStyle.color), we DO NOT // make it effect palette. Because some scenarios users need to make some series // transparent or as background, which should better not effect the palette. var d=t.getColorFromPalette( // TODO series count changed. t.name,null,e.getSeriesCount());r[s]||(r[s]=d,n.setVisual("colorFromPalette",!0)),r.fill="auto"===r.fill||f(r.fill)?d:r.fill,r.stroke="auto"===r.stroke||f(r.stroke)?d:r.stroke} // Only visible series has each data be visual encoded if(n.setVisual("style",r),n.setVisual("drawType",s),!e.isSeriesFiltered(t)&&u)return n.setVisual("colorFromPalette",!1),{dataEach:function(e,n){var i=t.getDataParams(n),o=p({},r);o[s]=u(i),e.setItemVisual(n,"style",o)}}}},Xu=new yr,ju={createOnAllSeries:!0,performRawSeries:!0,reset:function(t,e){if(!t.ignoreStyleOnData&&!e.isSeriesFiltered(t)){var n=t.getData(),i=t.visualStyleAccessPath||"itemStyle",o=Yu(t,i),r=n.getVisual("drawType");return{dataEach:n.hasItemOption?function(t,e){ // Not use getItemModel for performance considuration var n=t.getRawDataItem(e);if(n&&n[i]){Xu.option=n[i];var a=o(Xu),s=t.ensureUniqueItemVisual(e,"style");p(s,a),Xu.option.decal&&(t.setItemVisual(e,"decal",Xu.option.decal),Xu.option.decal.dirty=!0),r in a&&t.setItemVisual(e,"colorFromPalette",!1)}}:null}}}},qu={performRawSeries:!0,overallReset:function(t){ // Each type of series uses one scope. // Pie and funnel are using different scopes. var e=r();t.eachSeries((function(t){var n=t.getColorBy();if(!t.isColorBySeries()){var i=t.type+"-"+n,o=e.get(i);o||(o={},e.set(i,o)),Fu(t).scope=o}})),t.eachSeries((function(e){if(!e.isColorBySeries()&&!t.isSeriesFiltered(e)){var n=e.getRawData(),i={},o=e.getData(),r=Fu(e).scope,a=e.visualStyleAccessPath||"itemStyle",s=Uu(e,a);o.each((function(t){var e=o.getRawIndex(t);i[e]=t})), // Iterate on data before filtered. To make sure color from palette can be // Consistent when toggling legend. n.each((function(t){var a=i[t]; // Get color from palette for each data only when the color is inherited from series color, which is // also picked from color palette. So following situation is not in the case: // 1. series.itemStyle.color is set // 2. color is encoded by visualMap if(o.getItemVisual(a,"colorFromPalette")){var l=o.ensureUniqueItemVisual(a,"style"),u=n.getName(t)||t+"",c=n.count();l[s]=e.getColorFromPalette(u,r,c)}}))}}))}},Ku=Math.PI;var Ju=/** @class */function(){function t(t,e,n,i){ // key: handlerUID this._stageTaskMap=r(),this.ecInstance=t,this.api=e, // Fix current processors in case that in some rear cases that // processors might be registered after echarts instance created. // Register processors incrementally for a echarts instance is // not supported by this stream architecture. n=this._dataProcessorHandlers=n.slice(),i=this._visualHandlers=i.slice(),this._allHandlers=n.concat(i)}return t.prototype.restoreData=function(t,e){ // TODO: Only restore needed series and components, but not all components. // Currently `restoreData` of all of the series and component will be called. // But some independent components like `title`, `legend`, `graphic`, `toolbox`, // `tooltip`, `axisPointer`, etc, do not need series refresh when `setOption`, // and some components like coordinate system, axes, dataZoom, visualMap only // need their target series refresh. // (1) If we are implementing this feature some day, we should consider these cases: // if a data processor depends on a component (e.g., dataZoomProcessor depends // on the settings of `dataZoom`), it should be re-performed if the component // is modified by `setOption`. // (2) If a processor depends on sevral series, speicified by its `getTargetSeries`, // it should be re-performed when the result array of `getTargetSeries` changed. // We use `dependencies` to cover these issues. // (3) How to update target series when coordinate system related components modified. // TODO: simply the dirty mechanism? Check whether only the case here can set tasks dirty, // and this case all of the tasks will be set as dirty. t.restoreData(e), // Theoretically an overall task not only depends on each of its target series, but also // depends on all of the series. // The overall task is not in pipeline, and `ecModel.restoreData` only set pipeline tasks // dirty. If `getTargetSeries` of an overall task returns nothing, we should also ensure // that the overall task is set as dirty and to be performed, otherwise it probably cause // state chaos. So we have to set dirty of all of the overall tasks manually, otherwise it // probably cause state chaos (consider `dataZoomProcessor`). this._stageTaskMap.each((function(t){var e=t.overallTask;e&&e.dirty()}))}, // If seriesModel provided, incremental threshold is check by series data. t.prototype.getPerformArgs=function(t,e){ // For overall task if(t.__pipeline){var n=this._pipelineMap.get(t.__pipeline.id),i=n.context,o=!e&&n.progressiveEnabled&&(!i||i.progressiveRender)&&t.__idxInPipeline>n.blockIndex?n.step:null,r=i&&i.modDataCount;return{step:o,modBy:null!=r?Math.ceil(r/o):null,modDataCount:r}}},t.prototype.getPipeline=function(t){return this._pipelineMap.get(t)}, /** * Current, progressive rendering starts from visual and layout. * Always detect render mode in the same stage, avoiding that incorrect * detection caused by data filtering. * Caution: * `updateStreamModes` use `seriesModel.getData()`. */ t.prototype.updateStreamModes=function(t,e){var n=this._pipelineMap.get(t.uid),i=t.getData().count(),o=n.progressiveEnabled&&e.incrementalPrepareRender&&i>=n.threshold,r=t.get("large")&&i>=t.get("largeThreshold"),a="mod"===t.get("progressiveChunkMode")?i:null;t.pipelineContext=n.context={progressiveRender:o,modDataCount:a,large:r}},t.prototype.restorePipelines=function(t){var e=this,n=e._pipelineMap=r();t.eachSeries((function(t){var i=t.getProgressive(),o=t.uid;n.set(o,{id:o,head:null,tail:null,threshold:t.getProgressiveThreshold(),progressiveEnabled:i&&!(t.preventIncremental&&t.preventIncremental()),blockIndex:-1,step:Math.round(i||700),count:0}),e._pipe(t,t.dataTask)}))},t.prototype.prepareStageTasks=function(){var t=this._stageTaskMap,e=this.api.getModel(),n=this.api;a(this._allHandlers,(function(i){var o=t.get(i.uid)||t.set(i.uid,{});s(!(i.reset&&i.overallReset),""),i.reset&&this._createSeriesStageTask(i,o,e,n),i.overallReset&&this._createOverallStageTask(i,o,e,n)}),this)},t.prototype.prepareView=function(t,e,n,i){var o=t.renderTask,r=o.context;r.model=e,r.ecModel=n,r.api=i,o.__block=!t.incrementalPrepareRender,this._pipe(e,o)},t.prototype.performDataProcessorTasks=function(t,e){ // If we do not use `block` here, it should be considered when to update modes. this._performStageTasks(this._dataProcessorHandlers,t,e,{block:!0})},t.prototype.performVisualTasks=function(t,e,n){this._performStageTasks(this._visualHandlers,t,e,n)},t.prototype._performStageTasks=function(t,e,n,i){i=i||{};var o=!1,r=this;function s(t,e){return t.setDirty&&(!t.dirtyMap||t.dirtyMap.get(e.__pipeline.id))}a(t,(function(t,a){if(!i.visualType||i.visualType===t.visualType){var l=r._stageTaskMap.get(t.uid),u=l.seriesTaskMap,c=l.overallTask;if(c){var d,h=c.agentStubMap;h.each((function(t){s(i,t)&&(t.dirty(),d=!0)})),d&&c.dirty(),r.updatePayload(c,n);var p=r.getPerformArgs(c,i.block); // Execute stubs firstly, which may set the overall task dirty, // then execute the overall task. And stub will call seriesModel.setData, // which ensures that in the overallTask seriesModel.getData() will not // return incorrect data. h.each((function(t){t.perform(p)})),c.perform(p)&&(o=!0)}else u&&u.each((function(a,l){s(i,a)&&a.dirty();var u=r.getPerformArgs(a,i.block); // FIXME // if intending to declare `performRawSeries` in handlers, only // stream-independent (specifically, data item independent) operations can be // performed. Because if a series is filtered, most of the tasks will not // be performed. A stream-dependent operation probably cause wrong biz logic. // Perhaps we should not provide a separate callback for this case instead // of providing the config `performRawSeries`. The stream-dependent operations // and stream-independent operations should better not be mixed. u.skip=!t.performRawSeries&&e.isSeriesFiltered(a.context.model),r.updatePayload(a,n),a.perform(u)&&(o=!0)}))}})),this.unfinished=o||this.unfinished},t.prototype.performSeriesTasks=function(t){var e;t.eachSeries((function(t){ // Progress to the end for dataInit and dataRestore. e=t.dataTask.perform()||e})),this.unfinished=e||this.unfinished},t.prototype.plan=function(){ // Travel pipelines, check block. this._pipelineMap.each((function(t){var e=t.tail;do{if(e.__block){t.blockIndex=e.__idxInPipeline;break}e=e.getUpstream()}while(e)}))},t.prototype.updatePayload=function(t,e){"remain"!==e&&(t.context.payload=e)},t.prototype._createSeriesStageTask=function(t,e,n,i){var o=this,a=e.seriesTaskMap,s=e.seriesTaskMap=r(),l=t.seriesType,u=t.getTargetSeries;function c(e){var r=e.uid,l=s.set(r,a&&a.get(r)||fl({plan:nc,reset:ic,count:ac})); // Init tasks for each seriesModel only once. // Reuse original task instance. l.context={model:e,ecModel:n,api:i, // PENDING: `useClearVisual` not used? useClearVisual:t.isVisual&&!t.isLayout,plan:t.plan,reset:t.reset,scheduler:o},o._pipe(e,l)} // If a stageHandler should cover all series, `createOnAllSeries` should be declared mandatorily, // to avoid some typo or abuse. Otherwise if an extension do not specify a `seriesType`, // it works but it may cause other irrelevant charts blocked. t.createOnAllSeries?n.eachRawSeries(c):l?n.eachRawSeriesByType(l,c):u&&u(n,i).each(c)},t.prototype._createOverallStageTask=function(t,e,n,i){var o=this,l=e.overallTask=e.overallTask||fl({reset:$u});l.context={ecModel:n,api:i,overallReset:t.overallReset,scheduler:o};var u=l.agentStubMap,c=l.agentStubMap=r(),d=t.seriesType,h=t.getTargetSeries,p=!0,f=!1; // The count of stages are totally about only several dozen, so // do not need to reuse the map. function g(t){var e=t.uid,n=c.set(e,u&&u.get(e)||( // When the result of `getTargetSeries` changed, the overallTask // should be set as dirty and re-performed. f=!0,fl({reset:Qu,onDirty:ec})));n.context={model:t,overallProgress:p},n.agent=l,n.__block=p,o._pipe(t,n)}s(!t.createOnAllSeries,""),d?n.eachRawSeriesByType(d,g):h?h(n,i).each(g):(p=!1,a(n.getSeries(),g)),f&&l.dirty()},t.prototype._pipe=function(t,e){var n=t.uid,i=this._pipelineMap.get(n);!i.head&&(i.head=e),i.tail&&i.tail.pipe(e),i.tail=e,e.__idxInPipeline=i.count++,e.__pipeline=i},t.wrapStageHandler=function(t,e){return f(t)&&(t={overallReset:t,seriesType:sc(t)}),t.uid=vr("stageHandler"),e&&(t.visualType=e),t},t}();function $u(t){t.overallReset(t.ecModel,t.api,t.payload)}function Qu(t){return t.overallProgress&&tc}function tc(){this.agent.dirty(),this.getDownstream().dirty()}function ec(){this.agent&&this.agent.dirty()}function nc(t){return t.plan?t.plan(t.model,t.ecModel,t.api,t.payload):null}function ic(t){t.useClearVisual&&t.data.clearAllVisual();var e=t.resetDefines=Sn(t.reset(t.model,t.ecModel,t.api,t.payload));return e.length>1?n(e,(function(t,e){return rc(e)})):oc}var oc=rc(0);function rc(t){return function(e,n){var i=n.data,o=n.resetDefines[t];if(o&&o.dataEach)for(var r=e.start;r0&&c===e.length-u.length){var d=e.slice(0,c); // Consider `dataIndex`. "data"!==d&&(n.mainType=d,n[u.toLowerCase()]=t,r=!0)}}l.hasOwnProperty(e)&&(i[e]=t,r=!0),r||(o[e]=t)}))}return{cptQuery:n,dataQuery:i,otherQuery:o}},e.prototype.filter=function(t,e){ // They should be assigned before each trigger call. var n=this.eventInfo;if(!n)return!0;var i=n.targetEl,o=n.packedEvent,r=n.model,a=n.view; // For event like 'globalout'. if(!r||!a)return!0;var s=e.cptQuery,l=e.dataQuery;return u(s,r,"mainType")&&u(s,r,"subType")&&u(s,r,"index","componentIndex")&&u(s,r,"name")&&u(s,r,"id")&&u(l,o,"name")&&u(l,o,"dataIndex")&&u(l,o,"dataType")&&(!a.filterForExposedEvent||a.filterForExposedEvent(t,e.otherQuery,i,o));function u(t,e,n,i){return null==t[n]||e[i||n]===t[n]}},e.prototype.afterTrigger=function(){ // Make sure the eventInfo won't be used in next trigger. this.eventInfo=null},e}(),Sc=["symbol","symbolSize","symbolRotate","symbolOffset"],wc=Sc.concat(["symbolKeepAspect"]),Mc={createOnAllSeries:!0, // For legend. performRawSeries:!0,reset:function(t,e){var n=t.getData();if(t.legendIcon&&n.setVisual("legendIcon",t.legendIcon),t.hasSymbolVisual){for(var i={},o={},r=!1,a=0;a0&&t.unfinished); // Call flush explicitly for trigger finished event. t.unfinished||this._zr.flush(); // Else, zr flushing be ensue within the same frame, // because zr flushing is after onframe event. }}},s.prototype.getDom=function(){return this._dom},s.prototype.getId=function(){return this.id},s.prototype.getZr=function(){return this._zr},s.prototype.isSSR=function(){return this._ssr}, /* eslint-disable-next-line */ s.prototype.setOption=function(t,e,n){if(!this[nd])if(this._disposed)this.id;else{var i,r,a;if(o(e)&&(n=e.lazyUpdate,i=e.silent,r=e.replaceMerge,a=e.transition,e=e.notMerge),this[nd]=!0,!this._model||e){var s=new vs(this._api),l=this._theme,u=this._model=new us;u.scheduler=this._scheduler,u.ssr=this._ssr,u.init(null,null,null,l,this._locale,s)}this._model.setOption(t,{replaceMerge:r},Ed);var c={seriesTransition:a,optionChanged:!0};if(n)this[id]={silent:i,updateParams:c},this[nd]=!1, // `setOption(option, {lazyMode: true})` may be called when zrender has been slept. // It should wake it up to make sure zrender start to render at the next frame. this.getZr().wakeUp();else{try{cd(this),pd.update.call(this,null,c)}catch(d){throw this[id]=null,this[nd]=!1,d} // Ensure zr refresh sychronously, and then pixel in canvas can be // fetched after `setOption`. this._ssr|| // not use flush when using ssr mode. this._zr.flush(),this[id]=null,this[nd]=!1,md.call(this,i),vd.call(this,i)}}}, /** * @deprecated */ s.prototype.setTheme=function(){}, // We don't want developers to use getModel directly. s.prototype.getModel=function(){return this._model},s.prototype.getOption=function(){return this._model&&this._model.getOption()},s.prototype.getWidth=function(){return this._zr.getWidth()},s.prototype.getHeight=function(){return this._zr.getHeight()},s.prototype.getDevicePixelRatio=function(){return this._zr.painter.dpr /* eslint-disable-next-line */||d.hasGlobalWindow&&window.devicePixelRatio||1}, /** * Get canvas which has all thing rendered * @deprecated Use renderToCanvas instead. */ s.prototype.getRenderedCanvas=function(t){return this.renderToCanvas(t)},s.prototype.renderToCanvas=function(t){return t=t||{},this._zr.painter.getRenderedCanvas({backgroundColor:t.backgroundColor||this._model.get("backgroundColor"),pixelRatio:t.pixelRatio||this.getDevicePixelRatio()})},s.prototype.renderToSVGString=function(t){return t=t||{},this._zr.painter.renderToString({useViewBox:t.useViewBox})}, /** * Get svg data url */ s.prototype.getSvgDataURL=function(){if(d.svgSupported){var t=this._zr,e=t.storage.getDisplayList(); // Stop animations return a(e,(function(t){t.stopAnimation(null,!0)})),t.painter.toDataURL()}},s.prototype.getDataURL=function(t){if(!this._disposed){var e=(t=t||{}).excludeComponents,n=this._model,i=[],o=this;a(e,(function(t){n.eachComponent({mainType:t},(function(t){var e=o._componentsMap[t.__viewId];e.group.ignore||(i.push(e),e.group.ignore=!0)}))}));var r="svg"===this._zr.painter.getType()?this.getSvgDataURL():this.renderToCanvas(t).toDataURL("image/"+(t&&t.type||"png"));return a(i,(function(t){t.group.ignore=!1})),r}this.id},s.prototype.getConnectedDataURL=function(t){if(!this._disposed){var e="svg"===t.type,n=this.group,i=Math.min,o=Math.max,r=Infinity;if(Fd[n]){var s=r,l=r,u=-Infinity,c=-Infinity,d=[],h=t&&t.pixelRatio||this.getDevicePixelRatio();a(Gd,(function(r,a){if(r.group===n){var h=e?r.getZr().painter.getSvgDom().innerHTML:r.renderToCanvas(et(t)),p=r.getDom().getBoundingClientRect();s=i(p.left,s),l=i(p.top,l),u=o(p.right,u),c=o(p.bottom,c),d.push({dom:h,left:p.left,top:p.top})}}));var p=(u*=h)-(s*=h),f=(c*=h)-(l*=h),g=gt.createCanvas(),y=vt(g,{renderer:e?"svg":"canvas"});if(y.resize({width:p,height:f}),e){var m="";return a(d,(function(t){var e=t.left-s,n=t.top-l;m+=''+t.dom+""})),y.painter.getSvgRoot().innerHTML=m,t.connectedBackgroundColor&&y.painter.setBackgroundColor(t.connectedBackgroundColor),y.refreshImmediately(),y.painter.toDataURL()} // Background between the charts return t.connectedBackgroundColor&&y.add(new G({shape:{x:0,y:0,width:p,height:f},style:{fill:t.connectedBackgroundColor}})),a(d,(function(t){var e=new b({style:{x:t.left*h-s,y:t.top*h-l,image:t.dom}});y.add(e)})),y.refreshImmediately(),g.toDataURL("image/"+(t&&t.type||"png"))}return this.getDataURL(t)}this.id},s.prototype.convertToPixel=function(t,e){return fd(this,"convertToPixel",t,e)},s.prototype.convertFromPixel=function(t,e){return fd(this,"convertFromPixel",t,e)}, /** * Is the specified coordinate systems or components contain the given pixel point. * @param {Array|number} value * @return {boolean} result */ s.prototype.containPixel=function(t,e){if(!this._disposed){var n,i=En(this._model,t);return a(i,(function(t,i){i.indexOf("Models")>=0&&a(t,(function(t){var o=t.coordinateSystem;if(o&&o.containPoint)n=n||!!o.containPoint(e);else if("seriesModels"===i){var r=this._chartsMap[t.__viewId];r&&r.containPoint&&(n=n||r.containPoint(e,t))}}),this)}),this),!!n}this.id}, /** * Get visual from series or data. * @param finder * If string, e.g., 'series', means {seriesIndex: 0}. * If Object, could contain some of these properties below: * { * seriesIndex / seriesId / seriesName, * dataIndex / dataIndexInside * } * If dataIndex is not specified, series visual will be fetched, * but not data item visual. * If all of seriesIndex, seriesId, seriesName are not specified, * visual will be fetched from first series. * @param visualType 'color', 'symbol', 'symbolSize' */ s.prototype.getVisual=function(t,e){var n=En(this._model,t,{defaultMainType:"series"}),i=n.seriesModel.getData(),o=n.hasOwnProperty("dataIndexInside")?n.dataIndexInside:n.hasOwnProperty("dataIndex")?i.indexOfRawIndex(n.dataIndex):null;return null!=o?Dc(i,o,e):Tc(i,e)}, /** * Get view of corresponding component model */ s.prototype.getViewOfComponentModel=function(t){return this._componentsMap[t.__viewId]}, /** * Get view of corresponding series model */ s.prototype.getViewOfSeriesModel=function(t){return this._chartsMap[t.__viewId]},s.prototype._initEvents=function(){var t,e,n,i=this;a(Pd,(function(t){var e=function(e){var n,o=i.getModel(),r=e.target; // Contract: if params prepared in mouse event, // these properties must be specified: // { // componentType: string (component main type) // componentIndex: number // } // Otherwise event query can not work. if( // no e.target when 'globalout'. "globalout"===t?n={}:r&&kc(r,(function(t){var e=ni(t);if(e&&null!=e.dataIndex){var i=e.dataModel||o.getSeriesByIndex(e.seriesIndex);return n=i&&i.getDataParams(e.dataIndex,e.dataType,r)||{},!0} // If element has custom eventData of components if(e.eventData)return n=p({},e.eventData),!0}),!0),n){var a=n.componentType,s=n.componentIndex; // Special handling for historic reason: when trigger by // markLine/markPoint/markArea, the componentType is // 'markLine'/'markPoint'/'markArea', but we should better // enable them to be queried by seriesIndex, since their // option is set in each series. "markLine"!==a&&"markPoint"!==a&&"markArea"!==a||(a="series",s=n.seriesIndex);var l=a&&null!=s&&o.getComponent(a,s),u=l&&i["series"===l.mainType?"_chartsMap":"_componentsMap"][l.__viewId];n.event=e,n.type=t,i._$eventProcessor.eventInfo={targetEl:r,packedEvent:n,model:l,view:u},i.trigger(t,n)}}; // Consider that some component (like tooltip, brush, ...) // register zr event handler, but user event handler might // do anything, such as call `setOption` or `dispatchAction`, // which probably update any of the content and probably // cause problem if it is called previous other inner handlers. e.zrEventfulCallAtLast=!0,i._zr.on(t,e,i)})),a(Od,(function(t,e){i._messageCenter.on(e,(function(t){this.trigger(e,t)}),i)})), // Extra events // TODO register? a(["selectchanged"],(function(t){i._messageCenter.on(t,(function(e){this.trigger(t,e)}),i)})),t=this._messageCenter,e=this,n=this._api,t.on("selectchanged",(function(t){var i=n.getModel();t.isFromClick?(Lc("map","selectchanged",e,i,t),Lc("pie","selectchanged",e,i,t)):"select"===t.fromAction?(Lc("map","selected",e,i,t),Lc("pie","selected",e,i,t)):"unselect"===t.fromAction&&(Lc("map","unselected",e,i,t),Lc("pie","unselected",e,i,t))}))},s.prototype.isDisposed=function(){return this._disposed},s.prototype.clear=function(){this._disposed?this.id:this.setOption({series:[]},!0)},s.prototype.dispose=function(){if(this._disposed)this.id;else{this._disposed=!0,this.getDom()&&Fn(this.getDom(),Yd,"");var t=this,e=t._api,n=t._model;a(t._componentsViews,(function(t){t.dispose(n,e)})),a(t._chartsViews,(function(t){t.dispose(n,e)})), // Dispose after all views disposed t._zr.dispose(), // Set properties to null. // To reduce the memory cost in case the top code still holds this instance unexpectedly. t._dom=t._model=t._chartsMap=t._componentsMap=t._chartsViews=t._componentsViews=t._scheduler=t._api=t._zr=t._throttledZrFlush=t._theme=t._coordSysMgr=t._messageCenter=null,delete Gd[t.id]}}, /** * Resize the chart */ s.prototype.resize=function(t){if(!this[nd])if(this._disposed)this.id;else{this._zr.resize(t);var e=this._model; // Resize loading effect if(this._loadingFX&&this._loadingFX.resize(),e){var n=e.resetOption("media"),i=t&&t.silent; // There is some real cases that: // chart.setOption(option, { lazyUpdate: true }); // chart.resize(); this[id]&&(null==i&&(i=this[id].silent),n=!0,this[id]=null),this[nd]=!0;try{n&&cd(this),pd.update.call(this,{type:"resize",animation:p({ // Disable animation duration:0},t&&t.animation)})}catch(o){throw this[nd]=!1,o}this[nd]=!1,md.call(this,i),vd.call(this,i)}}},s.prototype.showLoading=function(t,e){if(this._disposed)this.id;else if(o(t)&&(e=t,t=""),t=t||"default",this.hideLoading(),Bd[t]){var n=Bd[t](this._api,e),i=this._zr;this._loadingFX=n,i.add(n)}}, /** * Hide loading effect */ s.prototype.hideLoading=function(){this._disposed?this.id:(this._loadingFX&&this._zr.remove(this._loadingFX),this._loadingFX=null)},s.prototype.makeActionFromEvent=function(t){var e=p({},t);return e.type=Od[t.type],e}, /** * @param opt If pass boolean, means opt.silent * @param opt.silent Default `false`. Whether trigger events. * @param opt.flush Default `undefined`. * true: Flush immediately, and then pixel in canvas can be fetched * immediately. Caution: it might affect performance. * false: Not flush. * undefined: Auto decide whether perform flush. */ s.prototype.dispatchAction=function(t,e){if(this._disposed)this.id;else if(o(e)||(e={silent:!!e}),Nd[t.type]&&this._model) // May dispatchAction in rendering procedure if(this[nd])this._pendingActions.push(t);else{var n=e.silent;yd.call(this,t,n);var i=e.flush;i?this._zr.flush():!1!==i&&d.browser.weChat&& // In WeChat embedded browser, `requestAnimationFrame` and `setInterval` // hang when sliding page (on touch event), which cause that zr does not // refresh until user interaction finished, which is not expected. // But `dispatchAction` may be called too frequently when pan on touch // screen, which impacts performance if do not throttle them. this._throttledZrFlush(),md.call(this,n),vd.call(this,n)} // Avoid dispatch action before setOption. Especially in `connect`. },s.prototype.updateLabelLayout=function(){Kc.trigger("series:layoutlabels",this._model,this._api,{ // Not adding series labels. // TODO updatedSeries:[]})},s.prototype.appendData=function(t){if(this._disposed)this.id;else{var e=t.seriesIndex;this.getModel().getSeriesByIndex(e).appendData(t), // Note: `appendData` does not support that update extent of coordinate // system, util some scenario require that. In the expected usage of // `appendData`, the initial extent of coordinate system should better // be fixed by axis `min`/`max` setting or initial data, otherwise if // the extent changed while `appendData`, the location of the painted // graphic elements have to be changed, which make the usage of // `appendData` meaningless. this._scheduler.unfinished=!0,this.getZr().wakeUp()}}, // A work around for no `internal` modifier in ts yet but // need to strictly hide private methods to JS users. s.internalField=function(){function t(t){t.clearColorPalette(),t.eachSeries((function(t){t.clearColorPalette()}))} // Allocate zlevels for series and components function e(t){ // Keep other states. for(var e=[],n=t.currentStates,i=0;i0?{duration:r,delay:i.get("delay"),easing:i.get("easing")}:null;n.eachRendered((function(t){if(t.states&&t.states.emphasis){ // Not applied on removed elements, it may still in fading. if(ro(t))return; // Only updated on changed element. In case element is incremental and don't want to rerender. // TODO, a more proper way? if(t instanceof g&&function(t){var e=ai(t);e.normalFill=t.style.fill,e.normalStroke=t.style.stroke;var n=t.states.select||{};e.selectFill=n.style&&n.style.fill||null,e.selectStroke=n.style&&n.style.stroke||null}(t),t.__dirty){var n=t.prevStates; // Restore states without animation n&&t.useStates(n)} // Update state transition and enable animation again. if(o){t.stateTransition=a;var i=t.getTextContent(),r=t.getTextGuideLine(); // TODO Is it necessary to animate label? i&&(i.stateTransition=a),r&&(r.stateTransition=a)} // Use highlighted and selected flag to toggle states. t.__dirty&&e(t)}}))}cd=function(t){var e=t._scheduler;e.restorePipelines(t._model),e.prepareStageTasks(),dd(t,!0),dd(t,!1),e.plan()}, /** * Prepare view instances of charts and components */ dd=function(t,e){for(var n=t._model,i=t._scheduler,o=e?t._componentsViews:t._chartsViews,r=e?t._componentsMap:t._chartsMap,a=t._zr,s=t._api,l=0;le.get("hoverLayerThreshold")&&!d.node&&!d.worker&&e.eachSeries((function(e){if(!e.preventUsingHoverLayer){var n=t._chartsMap[e.__viewId];n.__alive&&n.eachRendered((function(t){t.states.emphasis&&(t.states.emphasis.hoverLayer=!0)}))}}))}(t,e),Kc.trigger("series:afterupdate",e,n,r)},Dd=function(t){t[od]=!0, // Wake up zrender if it's sleep. Let it update states in the next frame. t.getZr().wakeUp()},Td=function(t){t[od]&&(t.getZr().storage.traverse((function(t){ // Not applied on removed elements, it may still in fading. ro(t)||e(t)})),t[od]=!1)},Md=function(t){return new(/** @class */function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return Ue(n,e),n.prototype.getCoordinateSystems=function(){return t._coordSysMgr.getCoordinateSystems()},n.prototype.getComponentByElement=function(e){for(;e;){var n=e.__ecComponentInfo;if(null!=n)return t._model.getComponent(n.mainType,n.index);e=e.parent}},n.prototype.enterEmphasis=function(e,n){ki(e,n),Dd(t)},n.prototype.leaveEmphasis=function(e,n){Pi(e,n),Dd(t)},n.prototype.enterBlur=function(e){Ni(e),Dd(t)},n.prototype.leaveBlur=function(e){Oi(e),Dd(t)},n.prototype.enterSelect=function(e){Ri(e),Dd(t)},n.prototype.leaveSelect=function(e){Ei(e),Dd(t)},n.prototype.getModel=function(){return t.getModel()},n.prototype.getViewOfComponentModel=function(e){return t.getViewOfComponentModel(e)},n.prototype.getViewOfSeriesModel=function(e){return t.getViewOfSeriesModel(e)},n}(ds))(t)},Id=function(t){function e(t,e){for(var n=0;n} */function ih(t,e){ah(Vd,t,e,1e3,"layout")}function oh(t,e){ah(Vd,t,e,3e3,"visual")}var rh=[];function ah(t,e,n,i,r){ // Already registered if((f(e)||o(e))&&(n=e,e=i),!(c(rh,n)>=0)){rh.push(n);var a=hc.wrapStageHandler(n,r);a.__prio=e,a.__raw=n,t.push(a)}}function sh(t,e){Bd[t]=e} /** * ZRender need a canvas context to do measureText. * But in node environment canvas may be created by node-canvas. * So we need to specify how to create a canvas instead of using document.createElement('canvas') * * * @deprecated use setPlatformAPI({ createCanvas }) instead. * * @example * let Canvas = require('canvas'); * let echarts = require('echarts'); * echarts.setCanvasCreator(function () { * // Small size is enough. * return new Canvas(32, 32); * }); */ /** * The parameters and usage: see `geoSourceManager.registerMap`. * Compatible with previous `echarts.registerMap`. */ function lh(t,e,n){var i=$c("registerMap");i&&i(t,e,n)}var uh=function(t){var e=(t=et(t)).type;e||vn("");var n=e.split(":");2!==n.length&&vn(""); // Namespace 'echarts:xxx' is official namespace, where the transforms should // be called directly via 'xxx' rather than 'echarts:xxx'. var i=!1;"echarts"===n[0]&&(e=n[1],i=!0),t.__isBuiltIn=i,Ll.set(e,t)}; /** * Globa dispatchAction to a specified chart instance. */ // export function dispatchAction(payload: { chartId: string } & Payload, opt?: Parameters[1]) { // if (!payload || !payload.chartId) { // // Must have chartId to find chart // return; // } // const chart = instances[payload.chartId]; // if (chart) { // chart.dispatchAction(payload, opt); // } // } // Builtin global visual oh(Qc,Zu),oh(td,ju),oh(td,qu),oh(Qc,Mc),oh(td,Ic),oh(7e3,(function(t,e){t.eachRawSeries((function(n){if(!t.isSeriesFiltered(n)){var i=n.getData();i.hasItemVisual()&&i.each((function(t){var n=i.getItemVisual(t,"decal");n&&(i.ensureUniqueItemVisual(t,"style").decal=Zc(n,e))}));var o=i.getVisual("decal");if(o)i.getVisual("style").decal=Zc(o,e)}}))})),Kd(zs),Jd(900,(function(t){var e=r();t.eachSeries((function(t){var n=t.get("stack"); // Compatible: when `stack` is set as '', do not stack. if(n){var i=e.get(n)||e.set(n,[]),o=t.getData(),r={ // Used for calculate axis extent automatically. // TODO: Type getCalculationInfo return more specific type? stackResultDimension:o.getCalculationInfo("stackResultDimension"),stackedOverDimension:o.getCalculationInfo("stackedOverDimension"),stackedDimension:o.getCalculationInfo("stackedDimension"),stackedByDimension:o.getCalculationInfo("stackedByDimension"),isStackedByIndex:o.getCalculationInfo("isStackedByIndex"),data:o,seriesModel:t}; // If stacked on axis that do not support data stack. if(!r.stackedDimension||!r.isStackedByIndex&&!r.stackedByDimension)return;i.length&&o.setCalculationInfo("stackedOnSeries",i[i.length-1].seriesModel),i.push(r)}})),e.each(Bs)})),sh("default",( /** * @param {module:echarts/ExtensionAPI} api * @param {Object} [opts] * @param {string} [opts.text] * @param {string} [opts.color] * @param {string} [opts.textColor] * @return {module:zrender/Element} */ function(t,e){I(e=e||{},{text:"loading",textColor:"#000",fontSize:12,fontWeight:"normal",fontStyle:"normal",fontFamily:"sans-serif",maskColor:"rgba(255, 255, 255, 0.8)",showSpinner:!0,color:"#5470c6",spinnerRadius:10,lineWidth:5,zlevel:0});var n=new Z,i=new G({style:{fill:e.maskColor},zlevel:e.zlevel,z:1e4});n.add(i);var o,r=new $({style:{text:e.text,fill:e.textColor,fontSize:e.fontSize,fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:e.fontFamily},zlevel:e.zlevel,z:10001}),a=new G({style:{fill:"none"},textContent:r,textConfig:{position:"right",distance:10},zlevel:e.zlevel,z:10001});return n.add(a),e.showSpinner&&((o=new H({shape:{startAngle:-Ku/2,endAngle:-Ku/2+.1,r:e.spinnerRadius},style:{stroke:e.color,lineCap:"round",lineWidth:e.lineWidth},zlevel:e.zlevel,z:10001})).animateShape(!0).when(1e3,{endAngle:3*Ku/2}).start("circularInOut"),o.animateShape(!0).when(1e3,{startAngle:3*Ku/2}).delay(300).start("circularInOut"),n.add(o)), // Inject resize n.resize=function(){var n=r.getBoundingRect().width,s=e.showSpinner?e.spinnerRadius:0,l=(t.getWidth()-2*s-(e.showSpinner&&n?10:0)-n)/2-(e.showSpinner&&n?0:5+n/2)+(e.showSpinner?0:n/2)+(n?0:s),u=t.getHeight()/2;e.showSpinner&&o.setShape({cx:l,cy:u}),a.setShape({x:l-s,y:u-s,width:2*s,height:2*s}),i.setShape({x:0,y:0,width:t.getWidth(),height:t.getHeight()})},n.resize(),n})), // Default actions eh({type:di,event:di,update:di},dt),eh({type:hi,event:hi,update:hi},dt),eh({type:pi,event:pi,update:pi},dt),eh({type:fi,event:fi,update:fi},dt),eh({type:gi,event:gi,update:gi},dt), // Default theme qd("light",fc),qd("dark",_c); // For backward compatibility, where the namespace `dataTool` will // be mounted on `echarts` is the extension `dataTool` is imported. var ch=[],dh={registerPreprocessor:Kd,registerProcessor:Jd,registerPostInit:$d,registerPostUpdate:Qd,registerUpdateLifecycle:th,registerAction:eh,registerCoordinateSystem:nh,registerLayout:ih,registerVisual:oh,registerTransform:uh,registerLoading:sh,registerMap:lh,registerImpl:function(t,e){Jc[t]=e},PRIORITY:ed,ComponentModel:Ta,ComponentView:Mu,SeriesModel:Su,ChartView:Ou, // TODO Use ComponentModel and SeriesModel instead of Constructor registerComponentModel:function(t){Ta.registerClass(t)},registerComponentView:function(t){Mu.registerClass(t)},registerSeriesModel:function(t){Su.registerClass(t)},registerChartView:function(t){Ou.registerClass(t)},registerSubTypeDefaulter:function(t,e){Ta.registerSubTypeDefaulter(t,e)},registerPainter:function(t,e){St(t,e)}};function hh(t){i(t)? // use([ChartLine, ChartBar]); a(t,(function(t){hh(t)})):c(ch,t)>=0||(ch.push(t),f(t)&&(t={install:t}),t.install(dh))} /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /** * AUTO-GENERATED FILE. DO NOT MODIFY. */ /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */function ph(t){return null==t?0:t.length||1}function fh(t){return t}var gh=/** @class */function(){ /** * @param context Can be visited by this.context in callback. */ function t(t,e,n,i,o, // By default: 'oneToOne'. r){this._old=t,this._new=e,this._oldKeyGetter=n||fh,this._newKeyGetter=i||fh, // Visible in callback via `this.context`; this.context=o,this._diffModeMultiple="multiple"===r} /** * Callback function when add a data */return t.prototype.add=function(t){return this._add=t,this}, /** * Callback function when update a data */ t.prototype.update=function(t){return this._update=t,this}, /** * Callback function when update a data and only work in `cbMode: 'byKey'`. */ t.prototype.updateManyToOne=function(t){return this._updateManyToOne=t,this}, /** * Callback function when update a data and only work in `cbMode: 'byKey'`. */ t.prototype.updateOneToMany=function(t){return this._updateOneToMany=t,this}, /** * Callback function when update a data and only work in `cbMode: 'byKey'`. */ t.prototype.updateManyToMany=function(t){return this._updateManyToMany=t,this}, /** * Callback function when remove a data */ t.prototype.remove=function(t){return this._remove=t,this},t.prototype.execute=function(){this[this._diffModeMultiple?"_executeMultiple":"_executeOneToOne"]()},t.prototype._executeOneToOne=function(){var t=this._old,e=this._new,n={},i=new Array(t.length),o=new Array(e.length);this._initIndexMap(t,null,i,"_oldKeyGetter"),this._initIndexMap(e,n,o,"_newKeyGetter");for(var r=0;r1){ // Consider there is duplicate key (for example, use dataItem.name as key). // We should make sure every item in newArr and oldArr can be visited. var u=s.shift();1===s.length&&(n[a]=s[0]),this._update&&this._update(u,r)}else 1===l?(n[a]=null,this._update&&this._update(s,r)):this._remove&&this._remove(r)}this._performRestAdd(o,n)}, /** * For example, consider the case: * oldData: [o0, o1, o2, o3, o4, o5, o6, o7], * newData: [n0, n1, n2, n3, n4, n5, n6, n7, n8], * Where: * o0, o1, n0 has key 'a' (many to one) * o5, n4, n5, n6 has key 'b' (one to many) * o2, n1 has key 'c' (one to one) * n2, n3 has key 'd' (add) * o3, o4 has key 'e' (remove) * o6, o7, n7, n8 has key 'f' (many to many, treated as add and remove) * Then: * (The order of the following directives are not ensured.) * this._updateManyToOne(n0, [o0, o1]); * this._updateOneToMany([n4, n5, n6], o5); * this._update(n1, o2); * this._remove(o3); * this._remove(o4); * this._remove(o6); * this._remove(o7); * this._add(n2); * this._add(n3); * this._add(n7); * this._add(n8); */ t.prototype._executeMultiple=function(){var t=this._old,e=this._new,n={},i={},o=[],r=[];this._initIndexMap(t,n,o,"_oldKeyGetter"),this._initIndexMap(e,i,r,"_newKeyGetter");for(var a=0;a1&&1===d)this._updateManyToOne&&this._updateManyToOne(u,l),i[s]=null;else if(1===c&&d>1)this._updateOneToMany&&this._updateOneToMany(u,l),i[s]=null;else if(1===c&&1===d)this._update&&this._update(u,l),i[s]=null;else if(c>1&&d>1)this._updateManyToMany&&this._updateManyToMany(u,l),i[s]=null;else if(c>1)for(var h=0;h1)for(var a=0;a to determine whether data can be shared. // (Because in this case there might be no dimension name defined in dataset, but indices always exists). // (Indices are always 0, 1, 2, ..., so we can ignore them to shorten the hash). // Otherwise if retrieving data by property name (like `data: [{aa: 123, bb: 765}, ...]`), // use in hash. !e||null==s||c&&c.isCalculationCoord||(i+=n?s.replace(/\`/g,"`1").replace(/\$/g,"`2"):s),i+="$",i+=Sh[l]||"f",u&&(i+=u.uid),i+="$"} // Source from endpoint(usually series) will be read differently // when seriesLayoutBy or startIndex(which is affected by sourceHeader) are different. // So we use this three props as key. var h=this.source;return{dimensions:o,hash:[h.seriesLayoutBy,h.startIndex,i].join("$$")}},t.prototype.makeOutputDimensionNames=function(){for(var t=[],e=0,n=0;e30}var Ch,Ah,Lh,kh,Ph,Nh,Oh,Rh=o,Eh=n,Vh="undefined"==typeof Int32Array?Array:Int32Array,zh=["hasItemOption","_nameList","_idList","_invertedIndicesMap","_dimSummary","userOutput","_rawData","_dimValueGetter","_nameDimIdx","_idDimIdx","_nameRepeatCount"],Bh=["_approximateExtent"],Gh=/** @class */function(){ /** * @param dimensionsInput.dimensions * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...]. * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius */ function e(e,n){var i;this.type="list",this._dimOmitted=!1,this._nameList=[],this._idList=[], // Models of data option is stored sparse for optimizing memory cost // Never used yet (not used yet). // private _optionModels: Model[] = []; // Global visual properties after visual coding this._visual={}, // Global layout properties. this._layout={}, // Item visual properties after visual coding this._itemVisuals=[], // Item layout properties after layout this._itemLayouts=[], // Graphic elements this._graphicEls=[], // key: dim, value: extent this._approximateExtent={},this._calculationInfo={}, // Having detected that there is data item is non primitive type // (in type `OptionDataItemObject`). // Like `data: [ { value: xx, itemStyle: {...} }, ...]` // At present it only happen in `SOURCE_FORMAT_ORIGINAL`. this.hasItemOption=!1, // Methods that create a new list based on this list should be listed here. // Notice that those method should `RETURN` the new list. this.TRANSFERABLE_METHODS=["cloneShallow","downSample","minmaxDownSample","lttbDownSample","map"], // Methods that change indices of this list should be listed here. this.CHANGABLE_METHODS=["filterSelf","selectRange"],this.DOWNSAMPLE_METHODS=["downSample","minmaxDownSample","lttbDownSample"];var o=!1;Mh(e)?(i=e.dimensions,this._dimOmitted=e.isDimensionOmitted(),this._schema=e):(o=!0,i=e),i=i||["x","y"];for(var s={},l=[],u={},c=!1,d={},h=0;h=e)){var n=this._store.getProvider();this._updateOrdinalMeta();var i=this._nameList,o=this._idList; // Each data item is value // [1, 2] // 2 // Bar chart, line chart which uses category axis // only gives the 'y' value. 'x' value is the indices of category // Use a tempValue to normalize the value to be a (x, y) value // If dataItem is {name: ...} or {id: ...}, it has highest priority. // This kind of ids and names are always stored `_nameList` and `_idList`. if(n.getSource().sourceFormat===Pa&&!n.pure)for(var r=[],a=t;a0}, /** * Make sure itemVisual property is unique */ // TODO: use key to save visual to reduce memory. e.prototype.ensureUniqueItemVisual=function(t,e){var n=this._itemVisuals,o=n[t];o||(o=n[t]={});var r=o[e];return null==r&&(r=this.getVisual(e), // TODO Performance? i(r)?r=r.slice():Rh(r)&&(r=p({},r)),o[e]=r),r}, // eslint-disable-next-line e.prototype.setItemVisual=function(t,e,n){var i=this._itemVisuals[t]||{};this._itemVisuals[t]=i,Rh(e)?p(i,e):i[e]=n}, /** * Clear itemVisuals and list visual. */ e.prototype.clearAllVisual=function(){this._visual={},this._itemVisuals=[]},e.prototype.setLayout=function(t,e){Rh(t)?p(this._layout,t):this._layout[t]=e}, /** * Get layout property. */ e.prototype.getLayout=function(t){return this._layout[t]}, /** * Get layout of single data item */ e.prototype.getItemLayout=function(t){return this._itemLayouts[t]}, /** * Set layout of single data item */ e.prototype.setItemLayout=function(t,e,n){this._itemLayouts[t]=n?p(this._itemLayouts[t]||{},e):e}, /** * Clear all layout of single data item */ e.prototype.clearItemLayouts=function(){this._itemLayouts.length=0}, /** * Set graphic element relative to data. It can be set as null */ e.prototype.setItemGraphicEl=function(t,e){var n=this.hostModel&&this.hostModel.seriesIndex;ii(n,this.dataType,t,e),this._graphicEls[t]=e},e.prototype.getItemGraphicEl=function(t){return this._graphicEls[t]},e.prototype.eachItemGraphicEl=function(t,e){a(this._graphicEls,(function(n,i){n&&t&&t.call(e,n,i)}))}, /** * Shallow clone a new list except visual and layout properties, and graph elements. * New list only change the indices. */ e.prototype.cloneShallow=function(t){return t||(t=new e(this._schema?this._schema:Eh(this.dimensions,this._getDimInfo,this),this.hostModel)),Ph(t,this),t._store=this._store,t}, /** * Wrap some method to add more feature */ e.prototype.wrapMethod=function(t,e){var n=this[t];f(n)&&(this.__wrappedMethods=this.__wrappedMethods||[],this.__wrappedMethods.push(t),this[t]=function(){var t=n.apply(this,arguments);return e.apply(this,[t].concat(wt(arguments)))})}, // ---------------------------------------------------------- // A work around for internal method visiting private member. // ---------------------------------------------------------- e.internalField=(Ch=function(t){var e=t._invertedIndicesMap;a(e,(function(n,i){var o=t._dimInfos[i],r=o.ordinalMeta,a=t._store; // Currently, only dimensions that has ordinalMeta can create inverted indices. if(r){n=e[i]=new Vh(r.categories.length); // The default value of TypedArray is 0. To avoid miss // mapping to 0, we should set it as INDEX_NOT_FOUND. for(var s=0;s1&&(s+="__ec__"+u),i[e]=s}})),e}();const Fh=Gh; /** * For outside usage compat (like echarts-gl are using it). */function Wh(t,e){return Hh(t,e).dimensions} /** * This method builds the relationship between: * + "what the coord sys or series requires (see `coordDimensions`)", * + "what the user defines (in `encode` and `dimensions`, see `opt.dimensionsDefine` and `opt.encodeDefine`)" * + "what the data source provids (see `source`)". * * Some guess strategy will be adapted if user does not define something. * If no 'value' dimension specified, the first no-named dimension will be * named as 'value'. * * @return The results are always sorted by `storeDimIndex` asc. */function Hh( // TODO: TYPE completeDimensions type e,n){Zs(e)||(e=js(e));var i=(n=n||{}).coordDimensions||[],s=n.dimensionsDefine||e.dimensionsDefine||[],l=r(),u=[],c= // ??? TODO // Originally detect dimCount by data[0]. Should we // optimize it to only by sysDims and dimensions and encode. // So only necessary dims will be initialized. // But // (1) custom series should be considered. where other dims // may be visited. // (2) sometimes user need to calculate bubble size or use visualMap // on other dimensions besides coordSys needed. // So, dims that is not used by system, should be shared in data store? function(t,e,n,i){ // Note that the result dimCount should not small than columns count // of data, otherwise `dataDimNameMap` checking will be incorrect. var r=Math.max(t.dimensionsDetectedCount||1,e.length,n.length,i||0);return a(e,(function(t){var e;o(t)&&(e=t.dimsDef)&&(r=Math.max(r,e.length))})),r}(e,i,s,n.dimensionsCount),d=n.canOmitUnusedDimensions&&Th(c),h=s===e.dimensionsDefine,f=h?Dh(e):Ih(s),g=n.encodeDefine;!g&&n.encodeDefaulter&&(g=n.encodeDefaulter(e,c));for(var y=r(g),m=new Vl(c),v=0;v0&&( // Starts from 0. i.name=o+(a-1)),a++,e.set(o,a)}}(u),new wh({source:e,dimensions:u,fullDimensionCount:c,dimensionOmitted:d})}function Yh(t,e,n){if(n||e.hasKey(t)){for(var i=0;e.hasKey(t+i);)i++;t+=i}return e.set(t,!0),t} /** * @class * For example: * { * coordSysName: 'cartesian2d', * coordSysDims: ['x', 'y', ...], * axisMap: HashMap({ * x: xAxisModel, * y: yAxisModel * }), * categoryAxisMap: HashMap({ * x: xAxisModel, * y: undefined * }), * // The index of the first category axis in `coordSysDims`. * // `null/undefined` means no category axis exists. * firstCategoryDimIndex: 1, * // To replace user specified encode. * } */var Uh=function(t){this.coordSysDims=[],this.axisMap=r(),this.categoryAxisMap=r(),this.coordSysName=t};var Zh={cartesian2d:function(t,e,n,i){var o=t.getReferringComponents("xAxis",zn).models[0],r=t.getReferringComponents("yAxis",zn).models[0];e.coordSysDims=["x","y"],n.set("x",o),n.set("y",r),Xh(o)&&(i.set("x",o),e.firstCategoryDimIndex=0),Xh(r)&&(i.set("y",r),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},singleAxis:function(t,e,n,i){var o=t.getReferringComponents("singleAxis",zn).models[0];e.coordSysDims=["single"],n.set("single",o),Xh(o)&&(i.set("single",o),e.firstCategoryDimIndex=0)},polar:function(t,e,n,i){var o=t.getReferringComponents("polar",zn).models[0],r=o.findAxisModel("radiusAxis"),a=o.findAxisModel("angleAxis");e.coordSysDims=["radius","angle"],n.set("radius",r),n.set("angle",a),Xh(r)&&(i.set("radius",r),e.firstCategoryDimIndex=0),Xh(a)&&(i.set("angle",a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=1))},geo:function(t,e,n,i){e.coordSysDims=["lng","lat"]},parallel:function(t,e,n,i){var o=t.ecModel,r=o.getComponent("parallel",t.get("parallelIndex")),s=e.coordSysDims=r.dimensions.slice();a(r.parallelAxisIndex,(function(t,r){var a=o.getComponent("parallelAxis",t),l=s[r];n.set(l,a),Xh(a)&&(i.set(l,a),null==e.firstCategoryDimIndex&&(e.firstCategoryDimIndex=r))}))}};function Xh(t){return"category"===t.get("type")} /** * Note that it is too complicated to support 3d stack by value * (have to create two-dimension inverted index), so in 3d case * we just support that stacked by index. * * @param seriesModel * @param dimensionsInput The same as the input of . * The input will be modified. * @param opt * @param opt.stackedCoordDimension Specify a coord dimension if needed. * @param opt.byIndex=false * @return calculationInfo * { * stackedDimension: string * stackedByDimension: string * isStackedByIndex: boolean * stackedOverDimension: string * stackResultDimension: string * } */function jh(e,n,i){var o,r,s,l=(i=i||{}).byIndex,u=i.stackedCoordDimension;!function(t){return!Mh(t.schema)}(n)?(r=n.schema,o=r.dimensions,s=n.store):o=n; // Compatibal: when `stack` is set as '', do not stack. var c,d,h,p,f=!(!e||!e.get("stack")); // Add stack dimension, they can be both calculated by coordinate system in `unionExtent`. // That put stack logic in List is for using conveniently in echarts extensions, but it // might not be a good way. if(a(o,(function(e,n){t(e)&&(o[n]=e={name:e}),f&&!e.isExtraCoord&&( // Find the first ordinal dimension as the stackedByDimInfo. l||c||!e.ordinalMeta||(c=e), // Find the first stackable dimension as the stackedDimInfo. d||"ordinal"===e.type||"time"===e.type||u&&u!==e.coordDim||(d=e))})),!d||l||c||( // Compatible with previous design, value axis (time axis) only stack by index. // It may make sense if the user provides elaborately constructed data. l=!0),d){ // Use a weird name that not duplicated with other names. // Also need to use seriesModel.id as postfix because different // series may share same data store. The stack dimension needs to be distinguished. h="__\0ecstackresult_"+e.id,p="__\0ecstackedover_"+e.id, // Create inverted index to fast query index by value. c&&(c.createInvertedIndices=!0);var g=d.coordDim,y=d.type,m=0;a(o,(function(t){t.coordDim===g&&m++}));var v={name:h,coordDim:g,coordDimIndex:m,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:o.length},x={name:p, // This dimension contains stack base (generally, 0), so do not set it as // `stackedDimCoordDim` to avoid extent calculation, consider log scale. coordDim:p,coordDimIndex:m+1,type:y,isExtraCoord:!0,isCalculationCoord:!0,storeDimIndex:o.length+1};r?(s&&(v.storeDimIndex=s.ensureCalculationDimension(p,y),x.storeDimIndex=s.ensureCalculationDimension(h,y)),r.appendCalculationDimension(v),r.appendCalculationDimension(x)):(o.push(v),o.push(x))}return{stackedDimension:d&&d.name,stackedByDimension:c&&c.name,isStackedByIndex:l,stackedOverDimension:p,stackResultDimension:h}}function qh(t,e){ // Each single series only maps to one pair of axis. So we do not need to // check stackByDim, whatever stacked by a dimension or stacked by index. return!!e&&e===t.getCalculationInfo("stackedDimension")}function Kh(t,e){return qh(t,e)?t.getCalculationInfo("stackResultDimension"):e} /** * Caution: there are side effects to `sourceManager` in this method. * Should better only be called in `Series['getInitialData']`. */ function Jh(t,e,o){o=o||{};var r,s=e.getSourceManager(),l=!1;t?(l=!0,r=js(t)): // Is series.data. not dataset. l=(r=s.getSource()).sourceFormat===Pa;var u=function(t){var e=t.get("coordinateSystem"),n=new Uh(e),i=Zh[e];if(i)return i(t,n,n.axisMap,n.categoryAxisMap),n}(e),c=function(t,e){var i,o=t.get("coordinateSystem"),r=fs.get(o);return e&&e.coordSysDims&&(i=n(e.coordSysDims,(function(t){var n={name:t},i=e.axisMap.get(t);if(i){var o=i.get("type");n.type=xh(o)}return n}))),i||( // Get dimensions from registered coordinate system i=r&&(r.getDimensionsInfo?r.getDimensionsInfo():r.dimensions.slice())||["x","y"]),i}(e,u),d=o.useEncodeDefaulter,h=f(d)?d:d?rt(Ya,c,e):null,p=Hh(r,{coordDimensions:c,generateCoord:o.generateCoord,encodeDefine:e.getEncode(),encodeDefaulter:h,canOmitUnusedDimensions:!l}),g=function(t,e,n){var i,o;return n&&a(t,(function(t,r){var a=t.coordDim,s=n.categoryAxisMap.get(a);s&&(null==i&&(i=r),t.ordinalMeta=s.getOrdinalMeta(),e&&(t.createInvertedIndices=!0)),null!=t.otherDims.itemName&&(o=!0)})),o||null==i||(t[i].otherDims.itemName=0),i}(p.dimensions,o.createInvertedIndices,u),y=l?null:s.getSharedDataStore(p),m=jh(e,{schema:p,store:y}),v=new Fh(p,e);v.setCalculationInfo(m);var x=null!=g&&function(t){if(t.sourceFormat===Pa){var e=function(t){var e=0;for(;ee[1]&&(e[1]=t[1])}, /** * Set extent from data */ t.prototype.unionExtentFromData=function(t,e){this.unionExtent(t.getApproximateExtent(e))}, /** * Get extent * * Extent is always in increase order. */ t.prototype.getExtent=function(){return this._extent.slice()}, /** * Set extent */ t.prototype.setExtent=function(t,e){var n=this._extent;isNaN(t)||(n[0]=t),isNaN(e)||(n[1]=e)}, /** * If value is in extent range */ t.prototype.isInExtentRange=function(t){return this._extent[0]<=t&&this._extent[1]>=t}, /** * When axis extent depends on data and no data exists, * axis ticks should not be drawn, which is named 'blank'. */ t.prototype.isBlank=function(){return this._isBlank}, /** * When axis extent depends on data and no data exists, * axis ticks should not be drawn, which is named 'blank'. */ t.prototype.setBlank=function(t){this._isBlank=t},t}();$n($h);const Qh=$h;var tp=0,ep=/** @class */function(){function e(t){this.categories=t.categories||[],this._needCollect=t.needCollect,this._deduplication=t.deduplication,this.uid=++tp}return e.createByAxisModel=function(t){var i=t.option,o=i.data,r=o&&n(o,np);return new e({categories:r,needCollect:!r, // deduplication is default in axis. deduplication:!1!==i.dedplication})},e.prototype.getOrdinal=function(t){ // @ts-ignore return this._getOrCreateMap().get(t)}, /** * @return The ordinal. If not found, return NaN. */ e.prototype.parseAndCollect=function(e){var n,i=this._needCollect; // The value of category dim can be the index of the given category set. // This feature is only supported when !needCollect, because we should // consider a common case: a value is 2017, which is a number but is // expected to be tread as a category. This case usually happen in dataset, // where it happent to be no need of the index feature. if(!t(e)&&!i)return e; // Optimize for the scenario: // category is ['2012-01-01', '2012-01-02', ...], where the input // data has been ensured not duplicate and is large data. // Notice, if a dataset dimension provide categroies, usually echarts // should remove duplication except user tell echarts dont do that // (set axis.deduplication = false), because echarts do not know whether // the values in the category dimension has duplication (consider the // parallel-aqi example) if(i&&!this._deduplication)return n=this.categories.length,this.categories[n]=e,n;var o=this._getOrCreateMap(); // @ts-ignore return null==(n=o.get(e))&&(i?(n=this.categories.length,this.categories[n]=e, // @ts-ignore o.set(e,n)):n=NaN),n}, // Consider big data, do not create map until needed. e.prototype._getOrCreateMap=function(){return this._map||(this._map=r(this.categories))},e}();function np(t){return o(t)&&null!=t.value?t.value:t+""}const ip=ep;function op(t){return"interval"===t.type||"log"===t.type} /** * @param extent Both extent[0] and extent[1] should be valid number. * Should be extent[0] < extent[1]. * @param splitNumber splitNumber should be >= 1. */function rp(t,e,n,i){var o={},r=t[1]-t[0],a=o.interval=cn(r/e,!0);null!=n&&ai&&(a=o.interval=i); // Tow more digital for tick. var s=o.intervalPrecision=sp(a); // Niced extent inside original extent // In some cases (e.g., splitNumber is 1), niceTickExtent may be out of extent. return function(t,e){!isFinite(t[0])&&(t[0]=e[0]),!isFinite(t[1])&&(t[1]=e[1]),lp(t,0,e),lp(t,1,e),t[0]>t[1]&&(t[0]=t[1])}(o.niceTickExtent=[qe(Math.ceil(t[0]/a)*a,s),qe(Math.floor(t[1]/a)*a,s)],t),o}function ap(t){var e=Math.pow(10,un(t)),n=t/e; // Increase interval return n?2===n?n=3:3===n?n=5: // f is 1 or 5 n*=2:n=1,qe(n*e)} /** * @return interval precision */function sp(t){ // Tow more digital for tick. return Je(t)+2}function lp(t,e,n){t[e]=Math.max(Math.min(t[e],n[1]),n[0])}function up(t,e){return t>=e[0]&&t<=e[1]}function cp(t,e){return e[1]===e[0]?.5:(t-e[0])/(e[1]-e[0])}function dp(t,e){return t*(e[1]-e[0])+e[0]}var hp=/** @class */function(e){function r(t){var r=e.call(this,t)||this;r.type="ordinal";var a=r.getSetting("ordinalMeta"); // Caution: Should not use instanceof, consider ec-extensions using // import approach to get OrdinalMeta class. return a||(a=new ip({})),i(a)&&(a=new ip({categories:n(a,(function(t){return o(t)?t.value:t}))})),r._ordinalMeta=a,r._extent=r.getSetting("extent")||[0,a.categories.length-1],r}return Ue(r,e),r.prototype.parse=function(e){ // Caution: Math.round(null) will return `0` rather than `NaN` return null==e?NaN:t(e)?this._ordinalMeta.getOrdinal(e):Math.round(e)},r.prototype.contain=function(t){return up(t=this.parse(t),this._extent)&&null!=this._ordinalMeta.categories[t]}, /** * Normalize given rank or name to linear [0, 1] * @param val raw ordinal number. * @return normalized value in [0, 1]. */ r.prototype.normalize=function(t){return cp(t=this._getTickNumber(this.parse(t)),this._extent)}, /** * @param val normalized value in [0, 1]. * @return raw ordinal number. */ r.prototype.scale=function(t){return t=Math.round(dp(t,this._extent)),this.getRawOrdinalNumber(t)},r.prototype.getTicks=function(){for(var t=[],e=this._extent,n=e[0];n<=e[1];)t.push({value:n}),n++;return t},r.prototype.getMinorTicks=function(t){}, /** * @see `Ordinal['_ordinalNumbersByTick']` */ r.prototype.setSortInfo=function(t){if(null!=t){for(var e=t.ordinalNumbers,n=this._ordinalNumbersByTick=[],i=this._ticksByOrdinalNumber=[],o=0,r=this._ordinalMeta.categories.length,a=Math.min(r,e.length);o=0&&t=0&&t=t},r.prototype.getOrdinalMeta=function(){return this._ordinalMeta},r.prototype.calcNiceTicks=function(){},r.prototype.calcNiceExtent=function(){},r.type="ordinal",r}(Qh);Qh.registerClass(hp);const pp=hp;var fp=qe,gp=/** @class */function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="interval", // Step is calculated in adjustExtent. e._interval=0,e._intervalPrecision=2,e}return Ue(e,t),e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return up(t,this._extent)},e.prototype.normalize=function(t){return cp(t,this._extent)},e.prototype.scale=function(t){return dp(t,this._extent)},e.prototype.setExtent=function(t,e){var n=this._extent; // start,end may be a Number like '25',so... isNaN(t)||(n[0]=parseFloat(t)),isNaN(e)||(n[1]=parseFloat(e))},e.prototype.unionExtent=function(t){var e=this._extent;t[0]e[1]&&(e[1]=t[1]), // unionExtent may called by it's sub classes this.setExtent(e[0],e[1])},e.prototype.getInterval=function(){return this._interval},e.prototype.setInterval=function(t){this._interval=t, // Dropped auto calculated niceExtent and use user-set extent. // We assume user wants to set both interval, min, max to get a better result. this._niceExtent=this._extent.slice(),this._intervalPrecision=sp(t)}, /** * @param expandToNicedExtent Whether expand the ticks to niced extent. */ e.prototype.getTicks=function(t){var e=this._interval,n=this._extent,i=this._niceExtent,o=this._intervalPrecision,r=[]; // If interval is 0, return []; if(!e)return r; // Consider this case: using dataZoom toolbox, zoom and zoom. n[0]1e4)return[]; // Consider this case: the last item of ticks is smaller // than niceTickExtent[1] and niceTickExtent[1] === extent[1]. var s=r.length?r[r.length-1].value:i[1];return n[1]>s&&(t?r.push({value:fp(s+e,o)}):r.push({value:n[1]})),r},e.prototype.getMinorTicks=function(t){for(var e=this.getTicks(!0),n=[],i=this.getExtent(),o=1;oi[0]&&c0&&( // Ignore 0 delta because they are of the same axis value r=null===r?l:Math.min(r,l))} // Set to null if only have one data n[i]=r}}return n}(t),n=[];return a(t,(function(t){var i,o=t.coordinateSystem.getBaseAxis(),r=o.getExtent();if("category"===o.type)i=o.getBandWidth();else if("value"===o.type||"time"===o.type){var a=o.dim+"_"+o.index,s=e[a],l=Math.abs(r[1]-r[0]),u=o.scale.getExtent(),c=Math.abs(u[1]-u[0]);i=s?l/c*s:l}else{var d=t.getData();i=Math.abs(r[1]-r[0])/d.count()}var h=je(t.get("barWidth"),i),p=je(t.get("barMaxWidth"),i),f=je( // barMinWidth by default is 0.5 / 1 in cartesian. Because in value axis, // the auto-calculated bar width might be less than 0.5 / 1. t.get("barMinWidth")||(Ap(t)?.5:1),i),g=t.get("barGap"),y=t.get("barCategoryGap");n.push({bandWidth:i,barWidth:h,barMaxWidth:p,barMinWidth:f,barGap:g,barCategoryGap:y,axisKey:Sp(o),stackId:bp(t)})})),Ip(n)}function Ip(t){ // Columns info on each category axis. Key is cartesian name var e={};a(t,(function(t,n){var i=t.axisKey,o=t.bandWidth,r=e[i]||{bandWidth:o,remainedWidth:o,autoWidthCount:0,categoryGap:null,gap:"20%",stacks:{}},a=r.stacks;e[i]=r;var s=t.stackId;a[s]||r.autoWidthCount++,a[s]=a[s]||{width:0,maxWidth:0}; // Caution: In a single coordinate system, these barGrid attributes // will be shared by series. Consider that they have default values, // only the attributes set on the last series will work. // Do not change this fact unless there will be a break change. var l=t.barWidth;l&&!a[s].width&&( // See #6312, do not restrict width. a[s].width=l,l=Math.min(r.remainedWidth,l),r.remainedWidth-=l);var u=t.barMaxWidth;u&&(a[s].maxWidth=u);var c=t.barMinWidth;c&&(a[s].minWidth=c);var d=t.barGap;null!=d&&(r.gap=d);var h=t.barCategoryGap;null!=h&&(r.categoryGap=h)}));var n={};return a(e,(function(t,e){n[e]={};var i=t.stacks,o=t.bandWidth,r=t.categoryGap;if(null==r){var s=v(i).length; // More columns in one group // the spaces between group is smaller. Or the column will be too thin. r=Math.max(35-4*s,15)+"%"}var l=je(r,o),u=je(t.gap,1),c=t.remainedWidth,d=t.autoWidthCount,h=(c-l)/(d+(d-1)*u);h=Math.max(h,0), // Find if any auto calculated bar exceeded maxBarWidth a(i,(function(t){var e=t.maxWidth,n=t.minWidth;if(t.width){ // `barMinWidth/barMaxWidth` has higher priority than `barWidth`, as // CSS does. Because barWidth can be a percent value, where // `barMaxWidth` can be used to restrict the final width. i=t.width;e&&(i=Math.min(i,e)), // `minWidth` has higher priority, as described above n&&(i=Math.max(i,n)),t.width=i,c-=i+u*i,d--}else{var i=h;e&&ei&&(i=n),i!==h&&(t.width=i,c-=i+u*i,d--)}})), // Recalculate width again h=(c-l)/(d+(d-1)*u),h=Math.max(h,0);var p,f=0;a(i,(function(t,e){t.width||(t.width=h),p=t,f+=t.width*(1+u)})),p&&(f-=p.width*u);var g=-f/2;a(i,(function(t,i){n[e][i]=n[e][i]||{bandWidth:o,offset:g,width:t.width},g+=t.width*(1+u)}))})),n}function Dp(t,e){var n=wp(t,e),i=Mp(n);a(n,(function(t){var e=t.getData(),n=t.coordinateSystem.getBaseAxis(),o=bp(t),r=i[Sp(n)][o],a=r.offset,s=r.width;e.setLayout({bandWidth:r.bandWidth,offset:a,size:s})}))} // TODO: Do not support stack in large mode yet. function Tp(t){return{seriesType:t,plan:Iu(),reset:function(t){if(Cp(t)){var e=t.getData(),n=t.coordinateSystem,i=n.getBaseAxis(),o=n.getOtherAxis(i),r=e.getDimensionIndex(e.mapDimension(o.dim)),a=e.getDimensionIndex(e.mapDimension(i.dim)),s=t.get("showBackground",!0),l=e.mapDimension(o.dim),u=e.getCalculationInfo("stackResultDimension"),c=qh(e,l)&&!!e.getCalculationInfo("stackedOnSeries"),d=o.isHorizontal(),h= // See cases in `test/bar-start.html` and `#7412`, `#8747`. function(t,e){var n=e.model.get("startValue");n||(n=0);return e.toGlobalCoord(e.dataToCoord("log"===e.type?n>0?n:1:n))} // FIXME 公用? (0,o),p=Ap(t),f=t.get("barMinHeight")||0,g=u&&e.getDimensionIndex(u),y=e.getLayout("size"),m=e.getLayout("offset");return{progress:function(t,e){for(var i,o=t.count,l=p&&xp(3*o),u=p&&s&&xp(3*o),v=p&&xp(o),x=n.master.getRect(),_=d?x.width:x.height,b=e.getStore(),S=0;null!=(i=t.next());){var w=b.get(c?g:r,i),M=b.get(a,i),I=h,D=void 0; // Because of the barMinHeight, we can not use the value in // stackResultDimension directly. c&&(D=+w-b.get(r,i));var T=void 0,C=void 0,A=void 0,L=void 0;if(d){var k=n.dataToPoint([w,M]);if(c)I=n.dataToPoint([D,M])[0];T=I,C=k[1]+m,A=k[0]-I,L=y,Math.abs(A)0)for(var u=0;u=0;--u)if(c[d]){s=c[d];break}s=s||l.none}if(i(s)){var h=null==e.level?0:e.level>=0?e.level:s.length+e.level;s=s[h=Math.min(h,s.length-1)]}}return Fr(new Date(e.value),s,a,r)}(e,n,o,this.getSetting("locale"),r)}, /** * @override */ o.prototype.getTicks=function(){var t=this._interval,e=this._extent,i=[]; // If interval is 0, return []; if(!t)return i;i.push({value:e[0],level:0});var o=this.getSetting("useUTC"),r=function(t,e,i,o){var r=1e4,a=Vr,s=0;function l(t,e,n,i,r,a,s){ // if (isDate) { // d -= 1; // Starts with 0; PENDING // } for(var l=new Date(e),u=e,c=l[i]();u1&&0===u&& // Add nearest years to the left extent. r.unshift({value:r[0].value-h})}}for(u=0;u=o[0]&&v<=o[1]&&h++)}var x=(o[1]-o[0])/e; // Added too much in this level and not too less in last level if(h>1.5*x&&p>x/1.5)break; // Only treat primary time unit as one level. if(c.push(y),h>x||t===a[f])break} // Reset if next unitName is primary d=[]}}var _=st(n(c,(function(t){return st(t,(function(t){return t.value>=o[0]&&t.value<=o[1]&&!t.notAdd}))})),(function(t){return t.length>0})),b=[],S=_.length-1;for(f=0;f<_.length;++f)for(var w=_[f],M=0;Mn&&(this._approxInterval=n);var r=kp.length,a=Math.min(function(t,e,n,i){for(;n>>1;t[o][1]16?16:t>7.5?7:t>3.5?4:t>1.5?2:1}function Np(t){return(t/=2592e6)>6?6:t>3?3:t>2?2:1}function Op(t){return(t/=Lr)>12?12:t>6?6:t>3.5?4:t>2?2:1}function Rp(t,e){return(t/=e?Ar:Cr)>30?30:t>20?20:t>15?15:t>10?10:t>5?5:t>2?2:1}function Ep(t){return cn(t,!0)}function Vp(t,e,n){var i=new Date(t);switch(Br(e)){case"year":case"month":i[$r(n)](0);case"day":i[Qr(n)](1);case"hour":i[ta(n)](0);case"minute":i[ea(n)](0);case"second":i[na(n)](0),i[ia(n)](0)}return i.getTime()}Qh.registerClass(Lp);const zp=Lp;var Bp=Qh.prototype,Gp=yp.prototype,Fp=qe,Wp=Math.floor,Hp=Math.ceil,Yp=Math.pow,Up=Math.log,Zp=/** @class */function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.type="log",e.base=10,e._originalScale=new yp, // FIXME:TS actually used by `IntervalScale` e._interval=0,e} /** * @param Whether expand the ticks to niced extent. */return Ue(e,t),e.prototype.getTicks=function(t){var e=this._originalScale,i=this._extent,o=e.getExtent(),r=Gp.getTicks.call(this,t);return n(r,(function(t){var e=t.value,n=qe(Yp(this.base,e)); // Fix #4158 return n=e===i[0]&&this._fixMin?jp(n,o[0]):n,{value:n=e===i[1]&&this._fixMax?jp(n,o[1]):n}}),this)},e.prototype.setExtent=function(t,e){var n=Up(this.base); // log(-Infinity) is NaN, so safe guard here t=Up(Math.max(0,t))/n,e=Up(Math.max(0,e))/n,Gp.setExtent.call(this,t,e)}, /** * @return {number} end */ e.prototype.getExtent=function(){var t=this.base,e=Bp.getExtent.call(this);e[0]=Yp(t,e[0]),e[1]=Yp(t,e[1]); // Fix #4158 var n=this._originalScale.getExtent();return this._fixMin&&(e[0]=jp(e[0],n[0])),this._fixMax&&(e[1]=jp(e[1],n[1])),e},e.prototype.unionExtent=function(t){this._originalScale.unionExtent(t);var e=this.base;t[0]=Up(t[0])/Up(e),t[1]=Up(t[1])/Up(e),Bp.unionExtent.call(this,t)},e.prototype.unionExtentFromData=function(t,e){ // TODO // filter value that <= 0 this.unionExtent(t.getApproximateExtent(e))}, /** * Update interval and extent of intervals for nice ticks * @param approxTickNum default 10 Given approx tick number */ e.prototype.calcNiceTicks=function(t){t=t||10;var e=this._extent,n=e[1]-e[0];if(!(Infinity===n||n<=0)){var i=ln(n); // Interval should be integer for( // Filter ticks to get closer to the desired count. t/n*i<=.5&&(i*=10);!isNaN(i)&&Math.abs(i)<1&&Math.abs(i)>0;)i*=10;var o=[qe(Hp(e[0]/i)*i),qe(Wp(e[1]/i)*i)];this._interval=i,this._niceExtent=o}},e.prototype.calcNiceExtent=function(t){Gp.calcNiceExtent.call(this,t),this._fixMin=t.fixMin,this._fixMax=t.fixMax},e.prototype.parse=function(t){return t},e.prototype.contain=function(t){return up(t=Up(t)/Up(this.base),this._extent)},e.prototype.normalize=function(t){return cp(t=Up(t)/Up(this.base),this._extent)},e.prototype.scale=function(t){return t=dp(t,this._extent),Yp(this.base,t)},e.type="log",e}(Qh),Xp=Zp.prototype; // FIXME:TS refactor: not good to call it directly with `this`? function jp(t,e){return Fp(t,Je(e))}Xp.getMinorTicks=Gp.getMinorTicks,Xp.getLabel=Gp.getLabel,Qh.registerClass(Zp);const qp=Zp;var Kp=/** @class */function(){function t(t,e, // Usually: data extent from all series on this axis. n){this._prepareParams(t,e,n)} /** * Parameters depending on outside (like model, user callback) * are prepared and fixed here. */return t.prototype._prepareParams=function(t,e, // Usually: data extent from all series on this axis. n){n[1]0&&s>0&&!l&&(a=0), // Axis is under zero and max is not set a<0&&s<0&&!u&&(s=0));var d=this._determinedMin,h=this._determinedMax; // Ensure min/max be finite number or NaN here. (not to be null/undefined) // `NaN` means min/max axis is blank. return null!=d&&(a=d,l=!0),null!=h&&(s=h,u=!0),{min:a,max:s,minFixed:l,maxFixed:u,isBlank:c}},t.prototype.modifyDataMinMax=function(t,e){this[$p[t]]=e},t.prototype.setDeterminedMinMax=function(t,e){this[Jp[t]]=e},t.prototype.freeze=function(){ // @ts-ignore this.frozen=!0},t}(),Jp={min:"_determinedMin",max:"_determinedMax"},$p={min:"_dataMin",max:"_dataMax"}; /** * Get scale min max and related info only depends on model settings. * This method can be called after coordinate system created. * For example, in data processing stage. * * Scale extent info probably be required multiple times during a workflow. * For example: * (1) `dataZoom` depends it to get the axis extent in "100%" state. * (2) `processor/extentCalculator` depends it to make sure whether axis extent is specified. * (3) `coordSys.update` use it to finally decide the scale extent. * But the callback of `min`/`max` should not be called multiple times. * The code below should not be implemented repeatedly either. * So we cache the result in the scale instance, which will be recreated at the beginning * of the workflow (because `scale` instance will be recreated each round of the workflow). */ function Qp(t,e, // Usually: data extent from all series on this axis. n){ // Do not permit to recreate. var i=t.rawExtentInfo;return i||(i=new Kp(t,e,n), // @ts-ignore t.rawExtentInfo=i,i)}function tf(t,e){return null==e?null:It(e)?NaN:t.parse(e)} /** * Get axis scale extent before niced. * Item of returned array can only be number (including Infinity and NaN). * * Caution: * Precondition of calling this method: * The scale extent has been initialized using series data extent via * `scale.setExtent` or `scale.unionExtentFromData`; */function ef(t,e){var n=t.type,i=Qp(t,e,t.getExtent()).calculate();t.setBlank(i.isBlank);var o=i.min,r=i.max,s=e.ecModel;if(s&&"time"/* || scaleType === 'interval' */===n){var l=wp("bar",s),u=!1;if(a(l,(function(t){u=u||t.getBaseAxis()===e.axis})),u){ // Calculate placement of bars on axis. TODO should be decoupled // with barLayout var c=Mp(l),d=function(t,e,n, // Only support cartesian coord yet. i){ // Get Axis Length var o=n.axis.getExtent(),r=Math.abs(o[1]-o[0]),s=function(t,e,n){if(t&&e){var i=t[Sp(e)];return null!=i&&null!=n?i[bp(n)]:i}}(i,n.axis);if(void 0===s)return{min:t,max:e};var l=Infinity;a(s,(function(t){l=Math.min(t.offset,l)}));var u=-Infinity;a(s,(function(t){u=Math.max(t.offset+t.width,u)})),l=Math.abs(l),u=Math.abs(u);var c=l+u,d=e-t,h=d/(1-(l+u)/r)-d; // Calculate required buffer based on old range and overflow return e+=h*(u/c),t-=h*(l/c),{min:t,max:e}} // Precondition of calling this method: // The scale extent has been initialized using series data extent via // `scale.setExtent` or `scale.unionExtentFromData`; (o,r,e,c); // Adjust axis min and max to account for overflow o=d.min,r=d.max}}return{extent:[o,r], // "fix" means "fixed", the value should not be // changed in the subsequent steps. fixMin:i.minFixed,fixMax:i.maxFixed}}function nf(t,e){var n=e,i=ef(t,n),o=i.extent,r=n.get("splitNumber");t instanceof qp&&(t.base=n.get("logBase"));var a=t.type,s=n.get("interval"),l="interval"===a||"time"===a;t.setExtent(o[0],o[1]),t.calcNiceExtent({splitNumber:r,fixMin:i.fixMin,fixMax:i.fixMax,minInterval:l?n.get("minInterval"):null,maxInterval:l?n.get("maxInterval"):null}), // If some one specified the min, max. And the default calculated interval // is not good enough. He can specify the interval. It is often appeared // in angle axis with angle 0 - 360. Interval calculated in interval scale is hard // to be 60. // FIXME null!=s&&t.setInterval&&t.setInterval(s)} /** * @param axisType Default retrieve from model.type */function of(t,e){if(e=e||t.get("type"))switch(e){ // Buildin scale case"category":return new pp({ordinalMeta:t.getOrdinalMeta?t.getOrdinalMeta():t.getCategories(),extent:[Infinity,-Infinity]});case"time":return new zp({locale:t.ecModel.getLocaleModel(),useUTC:t.ecModel.get("useUTC")});default: // case 'value'/'interval', 'log', or others. return new(Qh.getClass(e)||yp)}} /** * Check if the axis cross 0 */ /** * @param axis * @return Label formatter function. * param: {number} tickValue, * param: {number} idx, the index in all ticks. * If category axis, this param is not required. * return: {string} label string. */ function rf(e){var n,i,o=e.getLabelModel().get("formatter"),r="category"===e.type?e.scale.getExtent()[0]:null;return"time"===e.scale.type?(i=o,function(t,n){return e.scale.getFormattedLabel(t,n,i)}):t(o)?function(t){return function(n){ // For category axis, get raw value; for numeric axis, // get formatted label like '1,333,444'. var i=e.scale.getLabel(n);return t.replace("{value}",null!=i?i:"")}}(o):f(o)?(n=o,function(t,i){ // The original intention of `idx` is "the index of the tick in all ticks". // But the previous implementation of category axis do not consider the // `axisLabel.interval`, which cause that, for example, the `interval` is // `1`, then the ticks "name5", "name7", "name9" are displayed, where the // corresponding `idx` are `0`, `2`, `4`, but not `0`, `1`, `2`. So we keep // the definition here for back compatibility. return null!=r&&(i=t.value-r),n(af(e,t),i,null!=t.level?{level:t.level}:null)}):function(t){return e.scale.getLabel(t)}}function af(t,e){ // In category axis with data zoom, tick is not the original // index of axis.data. So tick should not be exposed to user // in category axis. return"category"===t.type?t.scale.getLabel(e):e.value} /** * @param axis * @return Be null/undefined if no labels. */function sf(t,e){var n=e*Math.PI/180,i=t.width,o=t.height,r=i*Math.abs(Math.cos(n))+Math.abs(o*Math.sin(n)),a=i*Math.abs(Math.sin(n))+Math.abs(o*Math.cos(n));return new Y(t.x,t.y,r,a)} /** * @param model axisLabelModel or axisTickModel * @return {number|String} Can be null|'auto'|number|function */function lf(t){var e=t.get("interval");return null==e?"auto":e} /** * Set `categoryInterval` as 0 implicitly indicates that * show all labels regardless of overlap. * @param {Object} axis axisModel.axis */function uf(t){return"category"===t.type&&0===lf(t.getLabelModel())}function cf(t,e){ // Remove duplicated dat dimensions caused by `getStackedDimension`. var n={}; // Currently `mapDimensionsAll` will contain stack result dimension ('__\0ecstackresult'). // PENDING: is it reasonable? Do we need to remove the original dim from "coord dim" since // there has been stacked result dim? return a(t.mapDimensionsAll(e),(function(e){ // For example, the extent of the original dimension // is [0.1, 0.5], the extent of the `stackResultDimension` // is [7, 9], the final extent should NOT include [0.1, 0.5], // because there is no graphic corresponding to [0.1, 0.5]. // See the case in `test/area-stack.html` `main1`, where area line // stack needs `yAxis` not start from 0. n[Kh(t,e)]=!0})),v(n)} /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ /** * AUTO-GENERATED FILE. DO NOT MODIFY. */ /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ // eslint-disable-next-line @typescript-eslint/no-unused-vars var df=/** @class */function(){function t(){}return t.prototype.getNeedCrossZero=function(){return!this.option.scale}, /** * Should be implemented by each axis model if necessary. * @return coordinate system model */ t.prototype.getCoordSysModel=function(){},t}(); /** * Create a multi dimension List structure from seriesModel. */var hf={isDimensionStacked:qh,enableDataStack:jh,getStackedDimension:Kh}; /** * Create scale * @param {Array.} dataExtent * @param {Object|module:echarts/Model} option If `optoin.type` * is secified, it can only be `'value'` currently. */function pf(t,e){return Zo(t,null,null,"normal"!==(e=e||{}).state)}const ff=Object.freeze(Object.defineProperty({__proto__:null,createDimensions:Wh,createList:function(t){return Jh(null,t)},createScale:function(t,e){var n=e;e instanceof yr||(n=new yr(e));var i=of(n);return i.setExtent(t[0],t[1]),nf(i,n),i} /** * Mixin common methods to axis model, * * Include methods * `getFormattedLabels() => Array.` * `getCategories() => Array.` * `getMin(origin: boolean) => number` * `getMax(origin: boolean) => number` * `getNeedCrossZero() => boolean` */,createSymbol:Gc,createTextStyle:pf,dataStack:hf,enableHoverEmphasis:Yi,getECData:ni,getLayoutRect:xa,mixinAxisModelCommonMethods:function(t){nt(t,df)}},Symbol.toStringTag,{value:"Module"}));var gf=[];function yf(t,e){for(var n=0;nn&&(t=o,n=a)}if(t)return function(t){ // Polygon should been closed. for(var e=0,n=0,i=0,o=t.length,r=t[o-1][0],a=t[o-1][1],s=0;s>1^-(1&s),l=l>>1^-(1&l),o= // Delta deocding s+=o,r=l+=r, // Dequantize i.push([s/n,l/n])}return i}function If(t,e){return t=function(t){if(!t.UTF8Encoding)return t;var e=t,n=e.UTF8Scale;null==n&&(n=1024);var i=e.features;return a(i,(function(t){var e=t.geometry,i=e.encodeOffsets,o=e.coordinates; // Geometry may be appeded manually in the script after json loaded. // In this case this geometry is usually not encoded. if(i)switch(e.type){case"LineString":e.coordinates=Mf(o,i,n);break;case"Polygon":case"MultiLineString":wf(o,i,n);break;case"MultiPolygon":a(o,(function(t,e){return wf(t,i[e],n)}))}})), // Has been decoded e.UTF8Encoding=!1,e}(t),n(st(t.features,(function(t){ // Output of mapshaper may have geometry null return t.geometry&&t.properties&&t.geometry.coordinates.length>0})),(function(t){var n=t.properties,i=t.geometry,o=[];switch(i.type){case"Polygon":var r=i.coordinates; // According to the GeoJSON specification. // First must be exterior, and the rest are all interior(holes). o.push(new xf(r[0],r.slice(1)));break;case"MultiPolygon":a(i.coordinates,(function(t){t[0]&&o.push(new xf(t[0],t.slice(1)))}));break;case"LineString":o.push(new _f([i.coordinates]));break;case"MultiLineString":o.push(new _f(i.coordinates))}var s=new bf(n[e||"name"],o,n.cp);return s.properties=n,s}))}const Df=Object.freeze(Object.defineProperty({__proto__:null,MAX_SAFE_INTEGER:nn,asc:Ke,getPercentWithPrecision:function(t,e,n){return t[e]&&tn(t,n)[e]||0},getPixelPrecision:Qe,getPrecision:Je,getPrecisionSafe:$e,isNumeric:fn,isRadianAroundZero:rn,linearMap:Xe,nice:cn,numericToNumber:pn,parseDate:sn,quantile:dn,quantity:ln,quantityExponent:un,reformIntervals:hn,remRadian:on,round:qe},Symbol.toStringTag,{value:"Module"})),Tf=Object.freeze(Object.defineProperty({__proto__:null,format:Fr,parse:sn},Symbol.toStringTag,{value:"Module"})),Cf=Object.freeze(Object.defineProperty({__proto__:null,Arc:H,BezierCurve:W,BoundingRect:Y,Circle:O,CompoundPath:U,Ellipse:R,Group:Z,Image:b,IncrementalDisplayable:X,Line:F,LinearGradient:j,Polygon:z,Polyline:B,RadialGradient:J,Rect:G,Ring:V,Sector:E,Text:$,clipPointsByRect:ko,clipRectByRect:Po,createIcon:No,extendPath:yo,extendShape:fo,getShapeClass:vo,getTransform:Do,initProps:oo,makeImage:_o,makePath:xo,mergePath:So,registerShape:mo,resizePath:wo,updateProps:io},Symbol.toStringTag,{value:"Module"})),Af=Object.freeze(Object.defineProperty({__proto__:null,addCommas:oa,capitalFirst: /** * Capital first * @param {string} str * @return {string} */ function(t){return t?t.charAt(0).toUpperCase()+t.substr(1):t},encodeHTML:ot,formatTime:function(t,e,n){"week"!==t&&"month"!==t&&"quarter"!==t&&"half-year"!==t&&"year"!==t||(t="MM-dd\nyyyy");var i=sn(e),o=n?"getUTC":"get",r=i[o+"FullYear"](),a=i[o+"Month"]()+1,s=i[o+"Date"](),l=i[o+"Hours"](),u=i[o+"Minutes"](),c=i[o+"Seconds"](),d=i[o+"Milliseconds"]();return t=t.replace("MM",zr(a,2)).replace("M",a).replace("yyyy",r).replace("yy",zr(r%100+"",2)).replace("dd",zr(s,2)).replace("d",s).replace("hh",zr(l,2)).replace("h",l).replace("mm",zr(u,2)).replace("m",u).replace("ss",zr(c,2)).replace("s",c).replace("SSS",zr(d,3))},formatTpl:ca,getTextRect:function(t,e,n,i,o,r,a,s){return new $({style:{text:t,font:e,align:n,verticalAlign:i,padding:o,rich:r,overflow:a?"truncate":null,lineHeight:s}}).getBoundingRect()},getTooltipMarker:da,normalizeCssArray:aa,toCamelCase:ra,truncateText:At},Symbol.toStringTag,{value:"Module"})),Lf=Object.freeze(Object.defineProperty({__proto__:null,bind:lt,clone:et,curry:rt,defaults:I,each:a,extend:p,filter:st,indexOf:c,inherits:h,isArray:i,isFunction:f,isObject:o,isString:t,map:n,merge:tt,reduce:e},Symbol.toStringTag,{value:"Module"}));var kf=On();function Pf(t,e){var i=n(e,(function(e){return t.scale.parse(e)}));return"time"===t.type&&i.length>0&&( // Time axis needs duplicate first/last tick (see TimeScale.getTicks()) // The first and last tick/label don't get drawn i.sort(),i.unshift(i[0]),i.push(i[i.length-1])),i}function Nf(t){var e=t.getLabelModel().get("customValues");if(e){var i=rf(t),o=t.scale.getExtent(),r=Pf(t,e),a=st(r,(function(t){return t>=o[0]&&t<=o[1]}));return{labels:n(a,(function(e){var n={value:e};return{formattedLabel:i(n),rawLabel:t.scale.getLabel(n),tickValue:e}}))}} // Only ordinal scale support tick interval return"category"===t.type?function(t){var e=t.getLabelModel(),n=Rf(t,e);return!e.get("show")||t.scale.isBlank()?{labels:[],labelCategoryInterval:n.labelCategoryInterval}:n}(t):function(t){var e=t.scale.getTicks(),i=rf(t);return{labels:n(e,(function(e,n){return{level:e.level,formattedLabel:i(e,n),rawLabel:t.scale.getLabel(e),tickValue:e.value}}))}}(t)} /** * @param {module:echats/coord/Axis} axis * @param {module:echarts/model/Model} tickModel For example, can be axisTick, splitLine, splitArea. * @return {Object} { * ticks: Array. * tickCategoryInterval: number * } */function Of(t,e){var i=t.getTickModel().get("customValues");if(i){var o=t.scale.getExtent(),r=Pf(t,i);return{ticks:st(r,(function(t){return t>=o[0]&&t<=o[1]}))}} // Only ordinal scale support tick interval return"category"===t.type?function(t,e){var i,o,r=Ef(t,"ticks"),a=lf(e),s=Vf(r,a);if(s)return s; // Optimize for the case that large category data and no label displayed, // we should not return all ticks. e.get("show")&&!t.scale.isBlank()||(i=[]);if(f(a))i=Gf(t,a,!0);else if("auto"===a){var l=Rf(t,t.getLabelModel());o=l.labelCategoryInterval,i=n(l.labels,(function(t){return t.tickValue}))}else i=Bf(t,o=a,!0); // Cache to avoid calling interval function repeatedly. return zf(r,a,{ticks:i,tickCategoryInterval:o})}(t,e):{ticks:n(t.scale.getTicks(),(function(t){return t.value}))}}function Rf(t,e){var n,i,o=Ef(t,"labels"),r=lf(e),a=Vf(o,r);return a||(f(r)?n=Gf(t,r):(i="auto"===r?function(t){var e=kf(t).autoInterval;return null!=e?e:kf(t).autoInterval=t.calculateCategoryInterval()} /** * Calculate interval for category axis ticks and labels. * To get precise result, at least one of `getRotate` and `isHorizontal` * should be implemented in axis. */(t):r,n=Bf(t,i)),zf(o,r,{labels:n,labelCategoryInterval:i}))}function Ef(t,e){ // Because key can be a function, and cache size always is small, we use array cache. return kf(t)[e]||(kf(t)[e]=[])}function Vf(t,e){for(var n=0;n 0. Otherwise the selection // of displayable ticks and symbols probably keep changing. // 3 is empirical value. 0!==u&&l>1&&c/l>2&&(u=Math.round(Math.ceil(u/l)*l)); // (1) Only add min max label here but leave overlap checking // to render stage, which also ensure the returned list // suitable for splitLine and splitArea rendering. // (2) Scales except category always contain min max label so // do not need to perform this process. var d=uf(t),h=a.get("showMinLabel")||d,p=a.get("showMaxLabel")||d;h&&u!==r[0]&&g(r[0]); // Optimize: avoid generating large array by `ordinalScale.getTicks()`. for(var f=u;f<=r[1];f+=l)g(f);function g(t){var e={value:t};s.push(n?t:{formattedLabel:i(e),rawLabel:o.getLabel(e),tickValue:t})}return p&&f-l!==r[1]&&g(r[1]),s}function Gf(t,e,n){var i=t.scale,o=rf(t),r=[];return a(i.getTicks(),(function(t){var a=i.getLabel(t),s=t.value;e(t.value,a)&&r.push(n?s:{formattedLabel:o(t),rawLabel:a,tickValue:s})})),r}var Ff=[0,1],Wf=/** @class */function(){function t(t,e,n){this.onBand=!1,this.inverse=!1,this.dim=t,this.scale=e,this._extent=n||[0,0]} /** * If axis extent contain given coord */return t.prototype.contain=function(t){var e=this._extent,n=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return t>=n&&t<=i}, /** * If axis extent contain given data */ t.prototype.containData=function(t){return this.scale.contain(t)}, /** * Get coord extent. */ t.prototype.getExtent=function(){return this._extent.slice()}, /** * Get precision used for formatting */ t.prototype.getPixelPrecision=function(t){return Qe(t||this.scale.getExtent(),this._extent)}, /** * Set coord extent */ t.prototype.setExtent=function(t,e){var n=this._extent;n[0]=t,n[1]=e}, /** * Convert data to coord. Data is the rank if it has an ordinal scale */ t.prototype.dataToCoord=function(t,e){var n=this._extent,i=this.scale;return t=i.normalize(t),this.onBand&&"ordinal"===i.type&&Hf(n=n.slice(),i.count()),Xe(t,Ff,n,e)}, /** * Convert coord to data. Data is the rank if it has an ordinal scale */ t.prototype.coordToData=function(t,e){var n=this._extent,i=this.scale;this.onBand&&"ordinal"===i.type&&Hf(n=n.slice(),i.count());var o=Xe(t,n,Ff,e);return this.scale.scale(o)}, /** * Convert pixel point to data in axis */ t.prototype.pointToData=function(t,e){}, /** * Different from `zrUtil.map(axis.getTicks(), axis.dataToCoord, axis)`, * `axis.getTicksCoords` considers `onBand`, which is used by * `boundaryGap:true` of category axis and splitLine and splitArea. * @param opt.tickModel default: axis.model.getModel('axisTick') * @param opt.clamp If `true`, the first and the last * tick must be at the axis end points. Otherwise, clip ticks * that outside the axis extent. */ t.prototype.getTicksCoords=function(t){var e=(t=t||{}).tickModel||this.getTickModel(),i=Of(this,e).ticks,o=n(i,(function(t){return{coord:this.dataToCoord("ordinal"===this.scale.type?this.scale.getRawOrdinalNumber(t):t),tickValue:t}}),this); // If axis has labels [1, 2, 3, 4]. Bands on the axis are // |---1---|---2---|---3---|---4---|. // So the displayed ticks and splitLine/splitArea should between // each data item, otherwise cause misleading (e.g., split tow bars // of a single data item when there are two bar series). // Also consider if tickCategoryInterval > 0 and onBand, ticks and // splitLine/spliteArea should layout appropriately corresponding // to displayed labels. (So we should not use `getBandWidth` in this // case). return function(t,e,n,i){var o=e.length;if(!t.onBand||n||!o)return;var r,s,l=t.getExtent();if(1===o)e[0].coord=l[0],r=e[1]={coord:l[1],tickValue:e[0].tickValue};else{var u=e[o-1].tickValue-e[0].tickValue,c=(e[o-1].coord-e[0].coord)/u;a(e,(function(t){t.coord-=c/2}));var d=t.scale.getExtent();s=1+d[1]-e[o-1].tickValue,r={coord:e[o-1].coord+c*s,tickValue:d[1]+1},e.push(r)}var h=l[0]>l[1]; // Handling clamp. p(e[0].coord,l[0])&&(i?e[0].coord=l[0]:e.shift());i&&p(l[0],e[0].coord)&&e.unshift({coord:l[0]});p(l[1],r.coord)&&(i?r.coord=l[1]:e.pop());i&&p(r.coord,l[1])&&e.push({coord:l[1]});function p(t,e){ // Avoid rounding error cause calculated tick coord different with extent. // It may cause an extra unnecessary tick added. return t=qe(t),e=qe(e),h?t>e:t0&&t<100||(t=5);var e=this.scale.getMinorTicks(t);return n(e,(function(t){return n(t,(function(t){return{coord:this.dataToCoord(t),tickValue:t}}),this)}),this)},t.prototype.getViewLabels=function(){return Nf(this).labels},t.prototype.getLabelModel=function(){return this.model.getModel("axisLabel")}, /** * Notice here we only get the default tick model. For splitLine * or splitArea, we should pass the splitLineModel or splitAreaModel * manually when calling `getTicksCoords`. * In GL, this method may be overridden to: * `axisModel.getModel('axisTick', grid3DModel.getModel('axisTick'));` */ t.prototype.getTickModel=function(){return this.model.getModel("axisTick")}, /** * Get width of band */ t.prototype.getBandWidth=function(){var t=this._extent,e=this.scale.getExtent(),n=e[1]-e[0]+(this.onBand?1:0); // Fix #2728, avoid NaN when only one data. 0===n&&(n=1);var i=Math.abs(t[1]-t[0]);return Math.abs(i)/n}, /** * Only be called in category axis. * Can be overridden, consider other axes like in 3D. * @return Auto interval for cateogry axis tick and label */ t.prototype.calculateCategoryInterval=function(){return function(t){var e=function(t){var e=t.getLabelModel();return{axisRotate:t.getRotate?t.getRotate():t.isHorizontal&&!t.isHorizontal()?90:0,labelRotate:e.get("rotate")||0,font:e.getFont()}}(t),n=rf(t),i=(e.axisRotate-e.labelRotate)/180*Math.PI,o=t.scale,r=o.getExtent(),a=o.count();if(r[1]-r[0]<1)return 0;var s=1; // Simple optimization. Empirical value: tick count should less than 40. a>40&&(s=Math.max(1,Math.floor(a/40))); // Caution: Performance sensitive for large category data. // Consider dataZoom, we should make appropriate step to avoid O(n) loop. for(var l=r[0],u=t.dataToCoord(l+1)-t.dataToCoord(l),c=Math.abs(u*Math.cos(i)),d=Math.abs(u*Math.sin(i)),h=0,p=0;l<=r[1];l+=s){var f,g,y=Lt(n({value:l}),e.font,"center","top"); // Magic number f=1.3*y.width,g=1.3*y.height, // Min size, void long loop. h=Math.max(h,f,7),p=Math.max(p,g,7)}var m=h/c,v=p/d; // 0/0 is NaN, 1/0 is Infinity. isNaN(m)&&(m=Infinity),isNaN(v)&&(v=Infinity);var x=Math.max(0,Math.floor(Math.min(m,v))),_=kf(t.model),b=t.getExtent(),S=_.lastAutoInterval,w=_.lastTickCount; // Use cache to keep interval stable while moving zoom window, // otherwise the calculated interval might jitter when the zoom // window size is close to the interval-changing size. // For example, if all of the axis labels are `a, b, c, d, e, f, g`. // The jitter will cause that sometimes the displayed labels are // `a, d, g` (interval: 2) sometimes `a, c, e`(interval: 1). return null!=S&&null!=w&&Math.abs(S-x)<=1&&Math.abs(w-a)<=1&&S>x&&_.axisExtent0===b[0]&&_.axisExtent1===b[1]?x=S:(_.lastTickCount=a,_.lastAutoInterval=x,_.axisExtent0=b[0],_.axisExtent1=b[1]),x}(this)},t}(); /** * Base class of Axis. */function Hf(t,e){var n=(t[1]-t[0])/e/2;t[0]+=n,t[1]-=n}const Yf=Wf; // --------------------- Deprecated Extension Methods --------------------- // Should use `ComponentModel.extend` or `class XXXX extend ComponentModel` to create class. // Then use `registerComponentModel` in `install` parameter when `use` this extension. For example: // class Bar3DModel extends ComponentModel {} // export function install(registers) { registers.registerComponentModel(Bar3DModel); } // echarts.use(install); function Uf(t){var e=Su.extend(t);return Su.registerClass(e),e}function Zf(t){var e=Ou.extend(t);return Ou.registerClass(e),e}var Xf=2*Math.PI,jf=kt.CMD,qf=["top","right","bottom","left"];function Kf(t,e,n,i,o){var r=n.width,a=n.height;switch(t){case"top":i.set(n.x+r/2,n.y-e),o.set(0,-1);break;case"bottom":i.set(n.x+r/2,n.y+a+e),o.set(0,1);break;case"left":i.set(n.x-e,n.y+a/2),o.set(-1,0);break;case"right":i.set(n.x+r+e,n.y+a/2),o.set(1,0)}}function Jf(t,e,n,i,o,r,a,s,l){a-=t,s-=e;var u=Math.sqrt(a*a+s*s),c=(a/=u)*n+t,d=(s/=u)*n+e;if(Math.abs(i-o)%Xf<1e-4) // Is a circle return l[0]=c,l[1]=d,u-n;if(r){var h=i;i=Et(o),o=Et(h)}else i=Et(i),o=Et(o);i>o&&(o+=Xf);var p=Math.atan2(s,a);if(p<0&&(p+=Xf),p>=i&&p<=o||p+Xf>=i&&p+Xf<=o) // Project point is on the arc. return l[0]=c,l[1]=d,u-n;var f=n*Math.cos(i)+t,g=n*Math.sin(i)+e,y=n*Math.cos(o)+t,m=n*Math.sin(o)+e,v=(f-a)*(f-a)+(g-s)*(g-s),x=(y-a)*(y-a)+(m-s)*(m-s);return v0){e=e/180*Math.PI, // The line points can be // /pt1----pt2 (label) // / // pt0/ ig.fromArray(t[0]),og.fromArray(t[1]),rg.fromArray(t[2]),K.sub(ag,ig,og),K.sub(sg,rg,og);var n=ag.len(),i=sg.len();if(!(n<.001||i<.001)){ag.scale(1/n),sg.scale(1/i);var o=ag.dot(sg);if(Math.cos(e)1&&K.copy(cg,rg),cg.toArray(t[1])}}}} /** * Limit the angle of line and the surface * @param maxSurfaceAngle Radian of minimum turn angle. 0 - 180. 0 is same direction to normal. 180 is opposite */function hg(t,e,n){if(n<=180&&n>0){n=n/180*Math.PI,ig.fromArray(t[0]),og.fromArray(t[1]),rg.fromArray(t[2]),K.sub(ag,og,ig),K.sub(sg,rg,og);var i=ag.len(),o=sg.len();if(!(i<.001||o<.001))if(ag.scale(1/i),sg.scale(1/o),ag.dot(e)=a) // parallel K.copy(cg,rg);else{ // Calculate new projected length with limited minTurnAngle and get the new connect point cg.scaleAndAdd(sg,r/Math.tan(Math.PI/2-s)); // Limit the new calculated connect point between pt1 and pt2. var l=rg.x!==og.x?(cg.x-og.x)/(rg.x-og.x):(cg.y-og.y)/(rg.y-og.y);if(isNaN(l))return;l<0?K.copy(cg,og):l>1&&K.copy(cg,rg)}cg.toArray(t[1])}}}function pg(t,e,n,i){var o="normal"===n,r=o?t:t.ensureState(n); // Make sure display. r.ignore=e; // Set smooth var a=i.get("smooth");a&&!0===a&&(a=.3),r.shape=r.shape||{},a>0&&(r.shape.smooth=a);var s=i.getModel("lineStyle").getLineStyle();o?t.useStyle(s):r.style=s}function fg(t,e){var n=e.smooth,i=e.points;if(i)if(t.moveTo(i[0][0],i[0][1]),n>0&&i.length>=3){var o=Pt(i[0],i[1]),r=Pt(i[1],i[2]);if(!o||!r)return t.lineTo(i[1][0],i[1][1]),void t.lineTo(i[2][0],i[2][1]);var a=Math.min(o,r)*n,s=Nt([],i[1],i[0],a/o),l=Nt([],i[1],i[2],a/r),u=Nt([],s,l,.5);t.bezierCurveTo(s[0],s[1],s[0],s[1],u[0],u[1]),t.bezierCurveTo(l[0],l[1],l[0],l[1],i[2][0],i[2][1])}else for(var c=1;c0&&r&& // Shift back to make the distribution more equally. _(-c/a,0,a); // TODO bleedMargin? var f,g,y=t[0],m=t[a-1];return v(), // If ends exceed two bounds, squeeze at most 80%, then take the gap of two bounds. f<0&&b(-f,.8),g<0&&b(g,.8),v(),x(f,g,1),x(g,f,-1), // Handle bailout when there is not enough space. v(),f<0&&S(-f),g<0&&S(g),u}function v(){f=y.rect[e]-i,g=o-m.rect[e]-m.rect[n]}function x(t,e,n){if(t<0){ // Move from other gap if can. var i=Math.min(e,-t);if(i>0){_(i*n,0,a);var o=i+t;o<0&&b(-o*n,1)}else b(-t*n,1)}}function _(n,i,o){0!==n&&(u=!0);for(var r=i;r0)for(l=0;l0;l--){_(-(r[l-1]*d),l,a)}}} /** * Squeeze to allow overlap if there is no more space available. * Let other overlapping strategy like hideOverlap do the job instead of keep exceeding the bounds. */function S(t){var e=t<0?-1:1;t=Math.abs(t);for(var n=Math.ceil(t/(a-1)),i=0;i0? // Forward _(n,0,i+1): // Backward _(-n,a-i-1,a),(t-=n)<=0)return}} /** * Adjust labels on x direction to avoid overlap. */ /** * Adjust labels on y direction to avoid overlap. */ function xg(t,e,n, // If average the shifts on all labels and add them to 0 i){return vg(t,"y","height",e,n,i)}function _g(t){var e=[]; // TODO, render overflow visible first, put in the displayedLabels. t.sort((function(t,e){return e.priority-t.priority}));var n=new Y(0,0,0,0);function i(t){if(!t.ignore){ // Show on emphasis. var e=t.ensureState("emphasis");null==e.ignore&&(e.ignore=!1)}t.ignore=!0}for(var o=0;o