星火管控前端
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

echarts-liquidfill.js 48KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("echarts"));
  4. else if(typeof define === 'function' && define.amd)
  5. define(["echarts"], factory);
  6. else if(typeof exports === 'object')
  7. exports["echarts-liquidfill"] = factory(require("echarts"));
  8. else
  9. root["echarts-liquidfill"] = factory(root["echarts"]);
  10. })(self, function(__WEBPACK_EXTERNAL_MODULE_echarts_lib_echarts__) {
  11. return /******/ (() => { // webpackBootstrap
  12. /******/ "use strict";
  13. /******/ var __webpack_modules__ = ({
  14. /***/ "./index.js":
  15. /*!******************************!*\
  16. !*** ./index.js + 6 modules ***!
  17. \******************************/
  18. /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
  19. // ESM COMPAT FLAG
  20. __webpack_require__.r(__webpack_exports__);
  21. // EXTERNAL MODULE: external "echarts"
  22. var external_echarts_ = __webpack_require__("echarts/lib/echarts");
  23. ;// CONCATENATED MODULE: ./src/liquidFillSeries.js
  24. external_echarts_.extendSeriesModel({
  25. type: 'series.liquidFill',
  26. optionUpdated: function () {
  27. var option = this.option;
  28. option.gridSize = Math.max(Math.floor(option.gridSize), 4);
  29. },
  30. getInitialData: function (option, ecModel) {
  31. var dimensions = external_echarts_.helper.createDimensions(option.data, {
  32. coordDimensions: ['value']
  33. });
  34. var list = new external_echarts_.List(dimensions, this);
  35. list.initData(option.data);
  36. return list;
  37. },
  38. defaultOption: {
  39. color: ['#294D99', '#156ACF', '#1598ED', '#45BDFF'],
  40. center: ['50%', '50%'],
  41. radius: '50%',
  42. amplitude: '8%',
  43. waveLength: '80%',
  44. phase: 'auto',
  45. period: 'auto',
  46. direction: 'right',
  47. shape: 'circle',
  48. waveAnimation: true,
  49. animationEasing: 'linear',
  50. animationEasingUpdate: 'linear',
  51. animationDuration: 2000,
  52. animationDurationUpdate: 1000,
  53. outline: {
  54. show: true,
  55. borderDistance: 8,
  56. itemStyle: {
  57. color: 'none',
  58. borderColor: '#294D99',
  59. borderWidth: 8,
  60. shadowBlur: 20,
  61. shadowColor: 'rgba(0, 0, 0, 0.25)'
  62. }
  63. },
  64. backgroundStyle: {
  65. color: '#E3F7FF'
  66. },
  67. itemStyle: {
  68. opacity: 0.95,
  69. shadowBlur: 50,
  70. shadowColor: 'rgba(0, 0, 0, 0.4)'
  71. },
  72. label: {
  73. show: true,
  74. color: '#294D99',
  75. insideColor: '#fff',
  76. fontSize: 50,
  77. fontWeight: 'bold',
  78. align: 'center',
  79. baseline: 'middle',
  80. position: 'inside'
  81. },
  82. emphasis: {
  83. itemStyle: {
  84. opacity: 0.8
  85. }
  86. }
  87. }
  88. });
  89. ;// CONCATENATED MODULE: ./node_modules/zrender/lib/core/util.js
  90. var BUILTIN_OBJECT = {
  91. '[object Function]': true,
  92. '[object RegExp]': true,
  93. '[object Date]': true,
  94. '[object Error]': true,
  95. '[object CanvasGradient]': true,
  96. '[object CanvasPattern]': true,
  97. '[object Image]': true,
  98. '[object Canvas]': true
  99. };
  100. var TYPED_ARRAY = {
  101. '[object Int8Array]': true,
  102. '[object Uint8Array]': true,
  103. '[object Uint8ClampedArray]': true,
  104. '[object Int16Array]': true,
  105. '[object Uint16Array]': true,
  106. '[object Int32Array]': true,
  107. '[object Uint32Array]': true,
  108. '[object Float32Array]': true,
  109. '[object Float64Array]': true
  110. };
  111. var objToString = Object.prototype.toString;
  112. var arrayProto = Array.prototype;
  113. var nativeForEach = arrayProto.forEach;
  114. var nativeFilter = arrayProto.filter;
  115. var nativeSlice = arrayProto.slice;
  116. var nativeMap = arrayProto.map;
  117. var ctorFunction = function () { }.constructor;
  118. var protoFunction = ctorFunction ? ctorFunction.prototype : null;
  119. var methods = {};
  120. function $override(name, fn) {
  121. methods[name] = fn;
  122. }
  123. var idStart = 0x0907;
  124. function guid() {
  125. return idStart++;
  126. }
  127. function logError() {
  128. var args = [];
  129. for (var _i = 0; _i < arguments.length; _i++) {
  130. args[_i] = arguments[_i];
  131. }
  132. if (typeof console !== 'undefined') {
  133. console.error.apply(console, args);
  134. }
  135. }
  136. function clone(source) {
  137. if (source == null || typeof source !== 'object') {
  138. return source;
  139. }
  140. var result = source;
  141. var typeStr = objToString.call(source);
  142. if (typeStr === '[object Array]') {
  143. if (!isPrimitive(source)) {
  144. result = [];
  145. for (var i = 0, len = source.length; i < len; i++) {
  146. result[i] = clone(source[i]);
  147. }
  148. }
  149. }
  150. else if (TYPED_ARRAY[typeStr]) {
  151. if (!isPrimitive(source)) {
  152. var Ctor = source.constructor;
  153. if (Ctor.from) {
  154. result = Ctor.from(source);
  155. }
  156. else {
  157. result = new Ctor(source.length);
  158. for (var i = 0, len = source.length; i < len; i++) {
  159. result[i] = clone(source[i]);
  160. }
  161. }
  162. }
  163. }
  164. else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
  165. result = {};
  166. for (var key in source) {
  167. if (source.hasOwnProperty(key)) {
  168. result[key] = clone(source[key]);
  169. }
  170. }
  171. }
  172. return result;
  173. }
  174. function merge(target, source, overwrite) {
  175. if (!isObject(source) || !isObject(target)) {
  176. return overwrite ? clone(source) : target;
  177. }
  178. for (var key in source) {
  179. if (source.hasOwnProperty(key)) {
  180. var targetProp = target[key];
  181. var sourceProp = source[key];
  182. if (isObject(sourceProp)
  183. && isObject(targetProp)
  184. && !isArray(sourceProp)
  185. && !isArray(targetProp)
  186. && !isDom(sourceProp)
  187. && !isDom(targetProp)
  188. && !isBuiltInObject(sourceProp)
  189. && !isBuiltInObject(targetProp)
  190. && !isPrimitive(sourceProp)
  191. && !isPrimitive(targetProp)) {
  192. merge(targetProp, sourceProp, overwrite);
  193. }
  194. else if (overwrite || !(key in target)) {
  195. target[key] = clone(source[key]);
  196. }
  197. }
  198. }
  199. return target;
  200. }
  201. function mergeAll(targetAndSources, overwrite) {
  202. var result = targetAndSources[0];
  203. for (var i = 1, len = targetAndSources.length; i < len; i++) {
  204. result = merge(result, targetAndSources[i], overwrite);
  205. }
  206. return result;
  207. }
  208. function extend(target, source) {
  209. if (Object.assign) {
  210. Object.assign(target, source);
  211. }
  212. else {
  213. for (var key in source) {
  214. if (source.hasOwnProperty(key)) {
  215. target[key] = source[key];
  216. }
  217. }
  218. }
  219. return target;
  220. }
  221. function defaults(target, source, overlay) {
  222. var keysArr = keys(source);
  223. for (var i = 0; i < keysArr.length; i++) {
  224. var key = keysArr[i];
  225. if ((overlay ? source[key] != null : target[key] == null)) {
  226. target[key] = source[key];
  227. }
  228. }
  229. return target;
  230. }
  231. var createCanvas = function () {
  232. return methods.createCanvas();
  233. };
  234. methods.createCanvas = function () {
  235. return document.createElement('canvas');
  236. };
  237. function indexOf(array, value) {
  238. if (array) {
  239. if (array.indexOf) {
  240. return array.indexOf(value);
  241. }
  242. for (var i = 0, len = array.length; i < len; i++) {
  243. if (array[i] === value) {
  244. return i;
  245. }
  246. }
  247. }
  248. return -1;
  249. }
  250. function inherits(clazz, baseClazz) {
  251. var clazzPrototype = clazz.prototype;
  252. function F() { }
  253. F.prototype = baseClazz.prototype;
  254. clazz.prototype = new F();
  255. for (var prop in clazzPrototype) {
  256. if (clazzPrototype.hasOwnProperty(prop)) {
  257. clazz.prototype[prop] = clazzPrototype[prop];
  258. }
  259. }
  260. clazz.prototype.constructor = clazz;
  261. clazz.superClass = baseClazz;
  262. }
  263. function mixin(target, source, override) {
  264. target = 'prototype' in target ? target.prototype : target;
  265. source = 'prototype' in source ? source.prototype : source;
  266. if (Object.getOwnPropertyNames) {
  267. var keyList = Object.getOwnPropertyNames(source);
  268. for (var i = 0; i < keyList.length; i++) {
  269. var key = keyList[i];
  270. if (key !== 'constructor') {
  271. if ((override ? source[key] != null : target[key] == null)) {
  272. target[key] = source[key];
  273. }
  274. }
  275. }
  276. }
  277. else {
  278. defaults(target, source, override);
  279. }
  280. }
  281. function isArrayLike(data) {
  282. if (!data) {
  283. return false;
  284. }
  285. if (typeof data === 'string') {
  286. return false;
  287. }
  288. return typeof data.length === 'number';
  289. }
  290. function each(arr, cb, context) {
  291. if (!(arr && cb)) {
  292. return;
  293. }
  294. if (arr.forEach && arr.forEach === nativeForEach) {
  295. arr.forEach(cb, context);
  296. }
  297. else if (arr.length === +arr.length) {
  298. for (var i = 0, len = arr.length; i < len; i++) {
  299. cb.call(context, arr[i], i, arr);
  300. }
  301. }
  302. else {
  303. for (var key in arr) {
  304. if (arr.hasOwnProperty(key)) {
  305. cb.call(context, arr[key], key, arr);
  306. }
  307. }
  308. }
  309. }
  310. function map(arr, cb, context) {
  311. if (!arr) {
  312. return [];
  313. }
  314. if (!cb) {
  315. return slice(arr);
  316. }
  317. if (arr.map && arr.map === nativeMap) {
  318. return arr.map(cb, context);
  319. }
  320. else {
  321. var result = [];
  322. for (var i = 0, len = arr.length; i < len; i++) {
  323. result.push(cb.call(context, arr[i], i, arr));
  324. }
  325. return result;
  326. }
  327. }
  328. function reduce(arr, cb, memo, context) {
  329. if (!(arr && cb)) {
  330. return;
  331. }
  332. for (var i = 0, len = arr.length; i < len; i++) {
  333. memo = cb.call(context, memo, arr[i], i, arr);
  334. }
  335. return memo;
  336. }
  337. function filter(arr, cb, context) {
  338. if (!arr) {
  339. return [];
  340. }
  341. if (!cb) {
  342. return slice(arr);
  343. }
  344. if (arr.filter && arr.filter === nativeFilter) {
  345. return arr.filter(cb, context);
  346. }
  347. else {
  348. var result = [];
  349. for (var i = 0, len = arr.length; i < len; i++) {
  350. if (cb.call(context, arr[i], i, arr)) {
  351. result.push(arr[i]);
  352. }
  353. }
  354. return result;
  355. }
  356. }
  357. function find(arr, cb, context) {
  358. if (!(arr && cb)) {
  359. return;
  360. }
  361. for (var i = 0, len = arr.length; i < len; i++) {
  362. if (cb.call(context, arr[i], i, arr)) {
  363. return arr[i];
  364. }
  365. }
  366. }
  367. function keys(obj) {
  368. if (!obj) {
  369. return [];
  370. }
  371. if (Object.keys) {
  372. return Object.keys(obj);
  373. }
  374. var keyList = [];
  375. for (var key in obj) {
  376. if (obj.hasOwnProperty(key)) {
  377. keyList.push(key);
  378. }
  379. }
  380. return keyList;
  381. }
  382. function bindPolyfill(func, context) {
  383. var args = [];
  384. for (var _i = 2; _i < arguments.length; _i++) {
  385. args[_i - 2] = arguments[_i];
  386. }
  387. return function () {
  388. return func.apply(context, args.concat(nativeSlice.call(arguments)));
  389. };
  390. }
  391. var bind = (protoFunction && isFunction(protoFunction.bind))
  392. ? protoFunction.call.bind(protoFunction.bind)
  393. : bindPolyfill;
  394. function curry(func) {
  395. var args = [];
  396. for (var _i = 1; _i < arguments.length; _i++) {
  397. args[_i - 1] = arguments[_i];
  398. }
  399. return function () {
  400. return func.apply(this, args.concat(nativeSlice.call(arguments)));
  401. };
  402. }
  403. function isArray(value) {
  404. if (Array.isArray) {
  405. return Array.isArray(value);
  406. }
  407. return objToString.call(value) === '[object Array]';
  408. }
  409. function isFunction(value) {
  410. return typeof value === 'function';
  411. }
  412. function isString(value) {
  413. return typeof value === 'string';
  414. }
  415. function isStringSafe(value) {
  416. return objToString.call(value) === '[object String]';
  417. }
  418. function isNumber(value) {
  419. return typeof value === 'number';
  420. }
  421. function isObject(value) {
  422. var type = typeof value;
  423. return type === 'function' || (!!value && type === 'object');
  424. }
  425. function isBuiltInObject(value) {
  426. return !!BUILTIN_OBJECT[objToString.call(value)];
  427. }
  428. function isTypedArray(value) {
  429. return !!TYPED_ARRAY[objToString.call(value)];
  430. }
  431. function isDom(value) {
  432. return typeof value === 'object'
  433. && typeof value.nodeType === 'number'
  434. && typeof value.ownerDocument === 'object';
  435. }
  436. function isGradientObject(value) {
  437. return value.colorStops != null;
  438. }
  439. function isPatternObject(value) {
  440. return value.image != null;
  441. }
  442. function isRegExp(value) {
  443. return objToString.call(value) === '[object RegExp]';
  444. }
  445. function eqNaN(value) {
  446. return value !== value;
  447. }
  448. function retrieve() {
  449. var args = [];
  450. for (var _i = 0; _i < arguments.length; _i++) {
  451. args[_i] = arguments[_i];
  452. }
  453. for (var i = 0, len = args.length; i < len; i++) {
  454. if (args[i] != null) {
  455. return args[i];
  456. }
  457. }
  458. }
  459. function retrieve2(value0, value1) {
  460. return value0 != null
  461. ? value0
  462. : value1;
  463. }
  464. function retrieve3(value0, value1, value2) {
  465. return value0 != null
  466. ? value0
  467. : value1 != null
  468. ? value1
  469. : value2;
  470. }
  471. function slice(arr) {
  472. var args = [];
  473. for (var _i = 1; _i < arguments.length; _i++) {
  474. args[_i - 1] = arguments[_i];
  475. }
  476. return nativeSlice.apply(arr, args);
  477. }
  478. function normalizeCssArray(val) {
  479. if (typeof (val) === 'number') {
  480. return [val, val, val, val];
  481. }
  482. var len = val.length;
  483. if (len === 2) {
  484. return [val[0], val[1], val[0], val[1]];
  485. }
  486. else if (len === 3) {
  487. return [val[0], val[1], val[2], val[1]];
  488. }
  489. return val;
  490. }
  491. function assert(condition, message) {
  492. if (!condition) {
  493. throw new Error(message);
  494. }
  495. }
  496. function trim(str) {
  497. if (str == null) {
  498. return null;
  499. }
  500. else if (typeof str.trim === 'function') {
  501. return str.trim();
  502. }
  503. else {
  504. return str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
  505. }
  506. }
  507. var primitiveKey = '__ec_primitive__';
  508. function setAsPrimitive(obj) {
  509. obj[primitiveKey] = true;
  510. }
  511. function isPrimitive(obj) {
  512. return obj[primitiveKey];
  513. }
  514. var HashMap = (function () {
  515. function HashMap(obj) {
  516. this.data = {};
  517. var isArr = isArray(obj);
  518. this.data = {};
  519. var thisMap = this;
  520. (obj instanceof HashMap)
  521. ? obj.each(visit)
  522. : (obj && each(obj, visit));
  523. function visit(value, key) {
  524. isArr ? thisMap.set(value, key) : thisMap.set(key, value);
  525. }
  526. }
  527. HashMap.prototype.get = function (key) {
  528. return this.data.hasOwnProperty(key) ? this.data[key] : null;
  529. };
  530. HashMap.prototype.set = function (key, value) {
  531. return (this.data[key] = value);
  532. };
  533. HashMap.prototype.each = function (cb, context) {
  534. for (var key in this.data) {
  535. if (this.data.hasOwnProperty(key)) {
  536. cb.call(context, this.data[key], key);
  537. }
  538. }
  539. };
  540. HashMap.prototype.keys = function () {
  541. return keys(this.data);
  542. };
  543. HashMap.prototype.removeKey = function (key) {
  544. delete this.data[key];
  545. };
  546. return HashMap;
  547. }());
  548. function createHashMap(obj) {
  549. return new HashMap(obj);
  550. }
  551. function concatArray(a, b) {
  552. var newArray = new a.constructor(a.length + b.length);
  553. for (var i = 0; i < a.length; i++) {
  554. newArray[i] = a[i];
  555. }
  556. var offset = a.length;
  557. for (var i = 0; i < b.length; i++) {
  558. newArray[i + offset] = b[i];
  559. }
  560. return newArray;
  561. }
  562. function createObject(proto, properties) {
  563. var obj;
  564. if (Object.create) {
  565. obj = Object.create(proto);
  566. }
  567. else {
  568. var StyleCtor = function () { };
  569. StyleCtor.prototype = proto;
  570. obj = new StyleCtor();
  571. }
  572. if (properties) {
  573. extend(obj, properties);
  574. }
  575. return obj;
  576. }
  577. function hasOwn(own, prop) {
  578. return own.hasOwnProperty(prop);
  579. }
  580. function noop() { }
  581. ;// CONCATENATED MODULE: ./node_modules/echarts/lib/util/number.js
  582. /*
  583. * Licensed to the Apache Software Foundation (ASF) under one
  584. * or more contributor license agreements. See the NOTICE file
  585. * distributed with this work for additional information
  586. * regarding copyright ownership. The ASF licenses this file
  587. * to you under the Apache License, Version 2.0 (the
  588. * "License"); you may not use this file except in compliance
  589. * with the License. You may obtain a copy of the License at
  590. *
  591. * http://www.apache.org/licenses/LICENSE-2.0
  592. *
  593. * Unless required by applicable law or agreed to in writing,
  594. * software distributed under the License is distributed on an
  595. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  596. * KIND, either express or implied. See the License for the
  597. * specific language governing permissions and limitations
  598. * under the License.
  599. */
  600. /**
  601. * AUTO-GENERATED FILE. DO NOT MODIFY.
  602. */
  603. var RADIAN_EPSILON = 1e-4;
  604. function _trim(str) {
  605. return str.replace(/^\s+|\s+$/g, '');
  606. }
  607. function linearMap(val, domain, range, clamp) {
  608. var subDomain = domain[1] - domain[0];
  609. var subRange = range[1] - range[0];
  610. if (subDomain === 0) {
  611. return subRange === 0 ? range[0] : (range[0] + range[1]) / 2;
  612. }
  613. if (clamp) {
  614. if (subDomain > 0) {
  615. if (val <= domain[0]) {
  616. return range[0];
  617. } else if (val >= domain[1]) {
  618. return range[1];
  619. }
  620. } else {
  621. if (val >= domain[0]) {
  622. return range[0];
  623. } else if (val <= domain[1]) {
  624. return range[1];
  625. }
  626. }
  627. } else {
  628. if (val === domain[0]) {
  629. return range[0];
  630. }
  631. if (val === domain[1]) {
  632. return range[1];
  633. }
  634. }
  635. return (val - domain[0]) / subDomain * subRange + range[0];
  636. }
  637. function parsePercent(percent, all) {
  638. switch (percent) {
  639. case 'center':
  640. case 'middle':
  641. percent = '50%';
  642. break;
  643. case 'left':
  644. case 'top':
  645. percent = '0%';
  646. break;
  647. case 'right':
  648. case 'bottom':
  649. percent = '100%';
  650. break;
  651. }
  652. if (typeof percent === 'string') {
  653. if (_trim(percent).match(/%$/)) {
  654. return parseFloat(percent) / 100 * all;
  655. }
  656. return parseFloat(percent);
  657. }
  658. return percent == null ? NaN : +percent;
  659. }
  660. function round(x, precision, returnStr) {
  661. if (precision == null) {
  662. precision = 10;
  663. }
  664. precision = Math.min(Math.max(0, precision), 20);
  665. x = (+x).toFixed(precision);
  666. return returnStr ? x : +x;
  667. }
  668. function asc(arr) {
  669. arr.sort(function (a, b) {
  670. return a - b;
  671. });
  672. return arr;
  673. }
  674. function getPrecision(val) {
  675. val = +val;
  676. if (isNaN(val)) {
  677. return 0;
  678. }
  679. var e = 1;
  680. var count = 0;
  681. while (Math.round(val * e) / e !== val) {
  682. e *= 10;
  683. count++;
  684. }
  685. return count;
  686. }
  687. function getPrecisionSafe(val) {
  688. var str = val.toString();
  689. var eIndex = str.indexOf('e');
  690. if (eIndex > 0) {
  691. var precision = +str.slice(eIndex + 1);
  692. return precision < 0 ? -precision : 0;
  693. } else {
  694. var dotIndex = str.indexOf('.');
  695. return dotIndex < 0 ? 0 : str.length - 1 - dotIndex;
  696. }
  697. }
  698. function getPixelPrecision(dataExtent, pixelExtent) {
  699. var log = Math.log;
  700. var LN10 = Math.LN10;
  701. var dataQuantity = Math.floor(log(dataExtent[1] - dataExtent[0]) / LN10);
  702. var sizeQuantity = Math.round(log(Math.abs(pixelExtent[1] - pixelExtent[0])) / LN10);
  703. var precision = Math.min(Math.max(-dataQuantity + sizeQuantity, 0), 20);
  704. return !isFinite(precision) ? 20 : precision;
  705. }
  706. function getPercentWithPrecision(valueList, idx, precision) {
  707. if (!valueList[idx]) {
  708. return 0;
  709. }
  710. var sum = reduce(valueList, function (acc, val) {
  711. return acc + (isNaN(val) ? 0 : val);
  712. }, 0);
  713. if (sum === 0) {
  714. return 0;
  715. }
  716. var digits = Math.pow(10, precision);
  717. var votesPerQuota = map(valueList, function (val) {
  718. return (isNaN(val) ? 0 : val) / sum * digits * 100;
  719. });
  720. var targetSeats = digits * 100;
  721. var seats = map(votesPerQuota, function (votes) {
  722. return Math.floor(votes);
  723. });
  724. var currentSum = reduce(seats, function (acc, val) {
  725. return acc + val;
  726. }, 0);
  727. var remainder = map(votesPerQuota, function (votes, idx) {
  728. return votes - seats[idx];
  729. });
  730. while (currentSum < targetSeats) {
  731. var max = Number.NEGATIVE_INFINITY;
  732. var maxId = null;
  733. for (var i = 0, len = remainder.length; i < len; ++i) {
  734. if (remainder[i] > max) {
  735. max = remainder[i];
  736. maxId = i;
  737. }
  738. }
  739. ++seats[maxId];
  740. remainder[maxId] = 0;
  741. ++currentSum;
  742. }
  743. return seats[idx] / digits;
  744. }
  745. var MAX_SAFE_INTEGER = 9007199254740991;
  746. function remRadian(radian) {
  747. var pi2 = Math.PI * 2;
  748. return (radian % pi2 + pi2) % pi2;
  749. }
  750. function isRadianAroundZero(val) {
  751. return val > -RADIAN_EPSILON && val < RADIAN_EPSILON;
  752. }
  753. var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d{1,2})(?::(\d{1,2})(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/;
  754. function parseDate(value) {
  755. if (value instanceof Date) {
  756. return value;
  757. } else if (typeof value === 'string') {
  758. var match = TIME_REG.exec(value);
  759. if (!match) {
  760. return new Date(NaN);
  761. }
  762. if (!match[8]) {
  763. return new Date(+match[1], +(match[2] || 1) - 1, +match[3] || 1, +match[4] || 0, +(match[5] || 0), +match[6] || 0, +match[7] || 0);
  764. } else {
  765. var hour = +match[4] || 0;
  766. if (match[8].toUpperCase() !== 'Z') {
  767. hour -= +match[8].slice(0, 3);
  768. }
  769. return new Date(Date.UTC(+match[1], +(match[2] || 1) - 1, +match[3] || 1, hour, +(match[5] || 0), +match[6] || 0, +match[7] || 0));
  770. }
  771. } else if (value == null) {
  772. return new Date(NaN);
  773. }
  774. return new Date(Math.round(value));
  775. }
  776. function quantity(val) {
  777. return Math.pow(10, quantityExponent(val));
  778. }
  779. function quantityExponent(val) {
  780. if (val === 0) {
  781. return 0;
  782. }
  783. var exp = Math.floor(Math.log(val) / Math.LN10);
  784. if (val / Math.pow(10, exp) >= 10) {
  785. exp++;
  786. }
  787. return exp;
  788. }
  789. function nice(val, round) {
  790. var exponent = quantityExponent(val);
  791. var exp10 = Math.pow(10, exponent);
  792. var f = val / exp10;
  793. var nf;
  794. if (round) {
  795. if (f < 1.5) {
  796. nf = 1;
  797. } else if (f < 2.5) {
  798. nf = 2;
  799. } else if (f < 4) {
  800. nf = 3;
  801. } else if (f < 7) {
  802. nf = 5;
  803. } else {
  804. nf = 10;
  805. }
  806. } else {
  807. if (f < 1) {
  808. nf = 1;
  809. } else if (f < 2) {
  810. nf = 2;
  811. } else if (f < 3) {
  812. nf = 3;
  813. } else if (f < 5) {
  814. nf = 5;
  815. } else {
  816. nf = 10;
  817. }
  818. }
  819. val = nf * exp10;
  820. return exponent >= -20 ? +val.toFixed(exponent < 0 ? -exponent : 0) : val;
  821. }
  822. function quantile(ascArr, p) {
  823. var H = (ascArr.length - 1) * p + 1;
  824. var h = Math.floor(H);
  825. var v = +ascArr[h - 1];
  826. var e = H - h;
  827. return e ? v + e * (ascArr[h] - v) : v;
  828. }
  829. function reformIntervals(list) {
  830. list.sort(function (a, b) {
  831. return littleThan(a, b, 0) ? -1 : 1;
  832. });
  833. var curr = -Infinity;
  834. var currClose = 1;
  835. for (var i = 0; i < list.length;) {
  836. var interval = list[i].interval;
  837. var close_1 = list[i].close;
  838. for (var lg = 0; lg < 2; lg++) {
  839. if (interval[lg] <= curr) {
  840. interval[lg] = curr;
  841. close_1[lg] = !lg ? 1 - currClose : 1;
  842. }
  843. curr = interval[lg];
  844. currClose = close_1[lg];
  845. }
  846. if (interval[0] === interval[1] && close_1[0] * close_1[1] !== 1) {
  847. list.splice(i, 1);
  848. } else {
  849. i++;
  850. }
  851. }
  852. return list;
  853. function littleThan(a, b, lg) {
  854. return a.interval[lg] < b.interval[lg] || a.interval[lg] === b.interval[lg] && (a.close[lg] - b.close[lg] === (!lg ? 1 : -1) || !lg && littleThan(a, b, 1));
  855. }
  856. }
  857. function numericToNumber(val) {
  858. var valFloat = parseFloat(val);
  859. return valFloat == val && (valFloat !== 0 || typeof val !== 'string' || val.indexOf('x') <= 0) ? valFloat : NaN;
  860. }
  861. function isNumeric(val) {
  862. return !isNaN(numericToNumber(val));
  863. }
  864. function getRandomIdBase() {
  865. return Math.round(Math.random() * 9);
  866. }
  867. function getGreatestCommonDividor(a, b) {
  868. if (b === 0) {
  869. return a;
  870. }
  871. return getGreatestCommonDividor(b, a % b);
  872. }
  873. function getLeastCommonMultiple(a, b) {
  874. if (a == null) {
  875. return b;
  876. }
  877. if (b == null) {
  878. return a;
  879. }
  880. return a * b / getGreatestCommonDividor(a, b);
  881. }
  882. ;// CONCATENATED MODULE: ./src/liquidFillShape.js
  883. /* harmony default export */ const liquidFillShape = (external_echarts_.graphic.extendShape({
  884. type: 'ec-liquid-fill',
  885. shape: {
  886. waveLength: 0,
  887. radius: 0,
  888. radiusY: 0,
  889. cx: 0,
  890. cy: 0,
  891. waterLevel: 0,
  892. amplitude: 0,
  893. phase: 0,
  894. inverse: false
  895. },
  896. buildPath: function (ctx, shape) {
  897. if (shape.radiusY == null) {
  898. shape.radiusY = shape.radius;
  899. }
  900. /**
  901. * We define a sine wave having 4 waves, and make sure at least 8 curves
  902. * is drawn. Otherwise, it may cause blank area for some waves when
  903. * wave length is large enough.
  904. */
  905. var curves = Math.max(
  906. Math.ceil(2 * shape.radius / shape.waveLength * 4) * 2,
  907. 8
  908. );
  909. // map phase to [-Math.PI * 2, 0]
  910. while (shape.phase < -Math.PI * 2) {
  911. shape.phase += Math.PI * 2;
  912. }
  913. while (shape.phase > 0) {
  914. shape.phase -= Math.PI * 2;
  915. }
  916. var phase = shape.phase / Math.PI / 2 * shape.waveLength;
  917. var left = shape.cx - shape.radius + phase - shape.radius * 2;
  918. /**
  919. * top-left corner as start point
  920. *
  921. * draws this point
  922. * |
  923. * \|/
  924. * ~~~~~~~~
  925. * | |
  926. * +------+
  927. */
  928. ctx.moveTo(left, shape.waterLevel);
  929. /**
  930. * top wave
  931. *
  932. * ~~~~~~~~ <- draws this sine wave
  933. * | |
  934. * +------+
  935. */
  936. var waveRight = 0;
  937. for (var c = 0; c < curves; ++c) {
  938. var stage = c % 4;
  939. var pos = getWaterPositions(c * shape.waveLength / 4, stage,
  940. shape.waveLength, shape.amplitude);
  941. ctx.bezierCurveTo(pos[0][0] + left, -pos[0][1] + shape.waterLevel,
  942. pos[1][0] + left, -pos[1][1] + shape.waterLevel,
  943. pos[2][0] + left, -pos[2][1] + shape.waterLevel);
  944. if (c === curves - 1) {
  945. waveRight = pos[2][0];
  946. }
  947. }
  948. if (shape.inverse) {
  949. /**
  950. * top-right corner
  951. * 2. draws this line
  952. * |
  953. * +------+
  954. * 3. draws this line -> | | <- 1. draws this line
  955. * ~~~~~~~~
  956. */
  957. ctx.lineTo(waveRight + left, shape.cy - shape.radiusY);
  958. ctx.lineTo(left, shape.cy - shape.radiusY);
  959. ctx.lineTo(left, shape.waterLevel);
  960. }
  961. else {
  962. /**
  963. * top-right corner
  964. *
  965. * ~~~~~~~~
  966. * 3. draws this line -> | | <- 1. draws this line
  967. * +------+
  968. * ^
  969. * |
  970. * 2. draws this line
  971. */
  972. ctx.lineTo(waveRight + left, shape.cy + shape.radiusY);
  973. ctx.lineTo(left, shape.cy + shape.radiusY);
  974. ctx.lineTo(left, shape.waterLevel);
  975. }
  976. ctx.closePath();
  977. }
  978. }));
  979. /**
  980. * Using Bezier curves to fit sine wave.
  981. * There is 4 control points for each curve of wave,
  982. * which is at 1/4 wave length of the sine wave.
  983. *
  984. * The control points for a wave from (a) to (d) are a-b-c-d:
  985. * c *----* d
  986. * b *
  987. * |
  988. * ... a * ..................
  989. *
  990. * whose positions are a: (0, 0), b: (0.5, 0.5), c: (1, 1), d: (PI / 2, 1)
  991. *
  992. * @param {number} x x position of the left-most point (a)
  993. * @param {number} stage 0-3, stating which part of the wave it is
  994. * @param {number} waveLength wave length of the sine wave
  995. * @param {number} amplitude wave amplitude
  996. */
  997. function getWaterPositions(x, stage, waveLength, amplitude) {
  998. if (stage === 0) {
  999. return [
  1000. [x + 1 / 2 * waveLength / Math.PI / 2, amplitude / 2],
  1001. [x + 1 / 2 * waveLength / Math.PI, amplitude],
  1002. [x + waveLength / 4, amplitude]
  1003. ];
  1004. }
  1005. else if (stage === 1) {
  1006. return [
  1007. [x + 1 / 2 * waveLength / Math.PI / 2 * (Math.PI - 2),
  1008. amplitude],
  1009. [x + 1 / 2 * waveLength / Math.PI / 2 * (Math.PI - 1),
  1010. amplitude / 2],
  1011. [x + waveLength / 4, 0]
  1012. ]
  1013. }
  1014. else if (stage === 2) {
  1015. return [
  1016. [x + 1 / 2 * waveLength / Math.PI / 2, -amplitude / 2],
  1017. [x + 1 / 2 * waveLength / Math.PI, -amplitude],
  1018. [x + waveLength / 4, -amplitude]
  1019. ]
  1020. }
  1021. else {
  1022. return [
  1023. [x + 1 / 2 * waveLength / Math.PI / 2 * (Math.PI - 2),
  1024. -amplitude],
  1025. [x + 1 / 2 * waveLength / Math.PI / 2 * (Math.PI - 1),
  1026. -amplitude / 2],
  1027. [x + waveLength / 4, 0]
  1028. ]
  1029. }
  1030. }
  1031. ;// CONCATENATED MODULE: ./src/liquidFillView.js
  1032. var liquidFillView_parsePercent = parsePercent;
  1033. function isPathSymbol(symbol) {
  1034. return symbol && symbol.indexOf('path://') === 0
  1035. }
  1036. external_echarts_.extendChartView({
  1037. type: 'liquidFill',
  1038. render: function (seriesModel, ecModel, api) {
  1039. var self = this;
  1040. var group = this.group;
  1041. group.removeAll();
  1042. var data = seriesModel.getData();
  1043. var itemModel = data.getItemModel(0);
  1044. var center = itemModel.get('center');
  1045. var radius = itemModel.get('radius');
  1046. var width = api.getWidth();
  1047. var height = api.getHeight();
  1048. var size = Math.min(width, height);
  1049. // itemStyle
  1050. var outlineDistance = 0;
  1051. var outlineBorderWidth = 0;
  1052. var showOutline = seriesModel.get('outline.show');
  1053. if (showOutline) {
  1054. outlineDistance = seriesModel.get('outline.borderDistance');
  1055. outlineBorderWidth = liquidFillView_parsePercent(
  1056. seriesModel.get('outline.itemStyle.borderWidth'), size
  1057. );
  1058. }
  1059. var cx = liquidFillView_parsePercent(center[0], width);
  1060. var cy = liquidFillView_parsePercent(center[1], height);
  1061. var outterRadius;
  1062. var innerRadius;
  1063. var paddingRadius;
  1064. var isFillContainer = false;
  1065. var symbol = seriesModel.get('shape');
  1066. if (symbol === 'container') {
  1067. // a shape that fully fills the container
  1068. isFillContainer = true;
  1069. outterRadius = [
  1070. width / 2,
  1071. height / 2
  1072. ];
  1073. innerRadius = [
  1074. outterRadius[0] - outlineBorderWidth / 2,
  1075. outterRadius[1] - outlineBorderWidth / 2
  1076. ];
  1077. paddingRadius = [
  1078. liquidFillView_parsePercent(outlineDistance, width),
  1079. liquidFillView_parsePercent(outlineDistance, height)
  1080. ];
  1081. radius = [
  1082. Math.max(innerRadius[0] - paddingRadius[0], 0),
  1083. Math.max(innerRadius[1] - paddingRadius[1], 0)
  1084. ];
  1085. }
  1086. else {
  1087. outterRadius = liquidFillView_parsePercent(radius, size) / 2;
  1088. innerRadius = outterRadius - outlineBorderWidth / 2;
  1089. paddingRadius = liquidFillView_parsePercent(outlineDistance, size);
  1090. radius = Math.max(innerRadius - paddingRadius, 0);
  1091. }
  1092. if (showOutline) {
  1093. var outline = getOutline();
  1094. outline.style.lineWidth = outlineBorderWidth;
  1095. group.add(getOutline());
  1096. }
  1097. var left = isFillContainer ? 0 : cx - radius;
  1098. var top = isFillContainer ? 0 : cy - radius;
  1099. var wavePath = null;
  1100. group.add(getBackground());
  1101. // each data item for a wave
  1102. var oldData = this._data;
  1103. var waves = [];
  1104. data.diff(oldData)
  1105. .add(function (idx) {
  1106. var wave = getWave(idx, false);
  1107. var waterLevel = wave.shape.waterLevel;
  1108. wave.shape.waterLevel = isFillContainer ? height / 2 : radius;
  1109. external_echarts_.graphic.initProps(wave, {
  1110. shape: {
  1111. waterLevel: waterLevel
  1112. }
  1113. }, seriesModel);
  1114. wave.z2 = 2;
  1115. setWaveAnimation(idx, wave, null);
  1116. group.add(wave);
  1117. data.setItemGraphicEl(idx, wave);
  1118. waves.push(wave);
  1119. })
  1120. .update(function (newIdx, oldIdx) {
  1121. var waveElement = oldData.getItemGraphicEl(oldIdx);
  1122. // new wave is used to calculate position, but not added
  1123. var newWave = getWave(newIdx, false, waveElement);
  1124. // changes with animation
  1125. var shape = {};
  1126. var shapeAttrs = ['amplitude', 'cx', 'cy', 'phase', 'radius', 'radiusY', 'waterLevel', 'waveLength'];
  1127. for (var i = 0; i < shapeAttrs.length; ++i) {
  1128. var attr = shapeAttrs[i];
  1129. if (newWave.shape.hasOwnProperty(attr)) {
  1130. shape[attr] = newWave.shape[attr];
  1131. }
  1132. }
  1133. var style = {};
  1134. var styleAttrs = ['fill', 'opacity', 'shadowBlur', 'shadowColor'];
  1135. for (var i = 0; i < styleAttrs.length; ++i) {
  1136. var attr = styleAttrs[i];
  1137. if (newWave.style.hasOwnProperty(attr)) {
  1138. style[attr] = newWave.style[attr];
  1139. }
  1140. }
  1141. if (isFillContainer) {
  1142. shape.radiusY = height / 2;
  1143. }
  1144. // changes with animation
  1145. external_echarts_.graphic.updateProps(waveElement, {
  1146. shape: shape,
  1147. x: newWave.x,
  1148. y: newWave.y
  1149. }, seriesModel);
  1150. if (seriesModel.isUniversalTransitionEnabled && seriesModel.isUniversalTransitionEnabled()) {
  1151. external_echarts_.graphic.updateProps(waveElement, {
  1152. style: style
  1153. }, seriesModel);
  1154. }
  1155. else {
  1156. waveElement.useStyle(style);
  1157. }
  1158. // instant changes
  1159. var oldWaveClipPath = waveElement.getClipPath();
  1160. var newWaveClipPath = newWave.getClipPath();
  1161. waveElement.setClipPath(newWave.getClipPath());
  1162. waveElement.shape.inverse = newWave.inverse;
  1163. if (oldWaveClipPath && newWaveClipPath
  1164. && self._shape === symbol
  1165. // TODO use zrender morphing to apply complex symbol animation.
  1166. && !isPathSymbol(symbol)
  1167. ) {
  1168. // Can be animated.
  1169. external_echarts_.graphic.updateProps(newWaveClipPath, {
  1170. shape: oldWaveClipPath.shape
  1171. }, seriesModel, { isFrom: true });
  1172. }
  1173. setWaveAnimation(newIdx, waveElement, waveElement);
  1174. group.add(waveElement);
  1175. data.setItemGraphicEl(newIdx, waveElement);
  1176. waves.push(waveElement);
  1177. })
  1178. .remove(function (idx) {
  1179. var wave = oldData.getItemGraphicEl(idx);
  1180. group.remove(wave);
  1181. })
  1182. .execute();
  1183. if (itemModel.get('label.show')) {
  1184. group.add(getText(waves));
  1185. }
  1186. this._shape = symbol;
  1187. this._data = data;
  1188. /**
  1189. * Get path for outline, background and clipping
  1190. *
  1191. * @param {number} r outter radius of shape
  1192. * @param {boolean|undefined} isForClipping if the shape is used
  1193. * for clipping
  1194. */
  1195. function getPath(r, isForClipping) {
  1196. if (symbol) {
  1197. // customed symbol path
  1198. if (isPathSymbol(symbol)) {
  1199. var path = external_echarts_.graphic.makePath(symbol.slice(7), {});
  1200. var bouding = path.getBoundingRect();
  1201. var w = bouding.width;
  1202. var h = bouding.height;
  1203. if (w > h) {
  1204. h = r * 2 / w * h;
  1205. w = r * 2;
  1206. }
  1207. else {
  1208. w = r * 2 / h * w;
  1209. h = r * 2;
  1210. }
  1211. var left = isForClipping ? 0 : cx - w / 2;
  1212. var top = isForClipping ? 0 : cy - h / 2;
  1213. path = external_echarts_.graphic.makePath(
  1214. symbol.slice(7),
  1215. {},
  1216. new external_echarts_.graphic.BoundingRect(left, top, w, h)
  1217. );
  1218. if (isForClipping) {
  1219. path.x = -w / 2;
  1220. path.y = -h / 2;
  1221. }
  1222. return path;
  1223. }
  1224. else if (isFillContainer) {
  1225. // fully fill the container
  1226. var x = isForClipping ? -r[0] : cx - r[0];
  1227. var y = isForClipping ? -r[1] : cy - r[1];
  1228. return external_echarts_.helper.createSymbol(
  1229. 'rect', x, y, r[0] * 2, r[1] * 2
  1230. );
  1231. }
  1232. else {
  1233. var x = isForClipping ? -r : cx - r;
  1234. var y = isForClipping ? -r : cy - r;
  1235. if (symbol === 'pin') {
  1236. y += r;
  1237. }
  1238. else if (symbol === 'arrow') {
  1239. y -= r;
  1240. }
  1241. return external_echarts_.helper.createSymbol(symbol, x, y, r * 2, r * 2);
  1242. }
  1243. }
  1244. return new external_echarts_.graphic.Circle({
  1245. shape: {
  1246. cx: isForClipping ? 0 : cx,
  1247. cy: isForClipping ? 0 : cy,
  1248. r: r
  1249. }
  1250. });
  1251. }
  1252. /**
  1253. * Create outline
  1254. */
  1255. function getOutline() {
  1256. var outlinePath = getPath(outterRadius);
  1257. outlinePath.style.fill = null;
  1258. outlinePath.setStyle(seriesModel.getModel('outline.itemStyle')
  1259. .getItemStyle());
  1260. return outlinePath;
  1261. }
  1262. /**
  1263. * Create background
  1264. */
  1265. function getBackground() {
  1266. // Seperate stroke and fill, so we can use stroke to cover the alias of clipping.
  1267. var strokePath = getPath(radius);
  1268. strokePath.setStyle(seriesModel.getModel('backgroundStyle')
  1269. .getItemStyle());
  1270. strokePath.style.fill = null;
  1271. // Stroke is front of wave
  1272. strokePath.z2 = 5;
  1273. var fillPath = getPath(radius);
  1274. fillPath.setStyle(seriesModel.getModel('backgroundStyle')
  1275. .getItemStyle());
  1276. fillPath.style.stroke = null;
  1277. var group = new external_echarts_.graphic.Group();
  1278. group.add(strokePath);
  1279. group.add(fillPath);
  1280. return group;
  1281. }
  1282. /**
  1283. * wave shape
  1284. */
  1285. function getWave(idx, isInverse, oldWave) {
  1286. var radiusX = isFillContainer ? radius[0] : radius;
  1287. var radiusY = isFillContainer ? height / 2 : radius;
  1288. var itemModel = data.getItemModel(idx);
  1289. var itemStyleModel = itemModel.getModel('itemStyle');
  1290. var phase = itemModel.get('phase');
  1291. var amplitude = liquidFillView_parsePercent(itemModel.get('amplitude'),
  1292. radiusY * 2);
  1293. var waveLength = liquidFillView_parsePercent(itemModel.get('waveLength'),
  1294. radiusX * 2);
  1295. var value = data.get('value', idx);
  1296. var waterLevel = radiusY - value * radiusY * 2;
  1297. phase = oldWave ? oldWave.shape.phase
  1298. : (phase === 'auto' ? idx * Math.PI / 4 : phase);
  1299. var normalStyle = itemStyleModel.getItemStyle();
  1300. if (!normalStyle.fill) {
  1301. var seriesColor = seriesModel.get('color');
  1302. var id = idx % seriesColor.length;
  1303. normalStyle.fill = seriesColor[id];
  1304. }
  1305. var x = radiusX * 2;
  1306. var wave = new liquidFillShape({
  1307. shape: {
  1308. waveLength: waveLength,
  1309. radius: radiusX,
  1310. radiusY: radiusY,
  1311. cx: x,
  1312. cy: 0,
  1313. waterLevel: waterLevel,
  1314. amplitude: amplitude,
  1315. phase: phase,
  1316. inverse: isInverse
  1317. },
  1318. style: normalStyle,
  1319. x: cx,
  1320. y: cy,
  1321. });
  1322. wave.shape._waterLevel = waterLevel;
  1323. var hoverStyle = itemModel.getModel('emphasis.itemStyle')
  1324. .getItemStyle();
  1325. hoverStyle.lineWidth = 0;
  1326. wave.ensureState('emphasis').style = hoverStyle;
  1327. external_echarts_.helper.enableHoverEmphasis(wave);
  1328. // clip out the part outside the circle
  1329. var clip = getPath(radius, true);
  1330. // set fill for clipPath, otherwise it will not trigger hover event
  1331. clip.setStyle({
  1332. fill: 'white'
  1333. });
  1334. wave.setClipPath(clip);
  1335. return wave;
  1336. }
  1337. function setWaveAnimation(idx, wave, oldWave) {
  1338. var itemModel = data.getItemModel(idx);
  1339. var maxSpeed = itemModel.get('period');
  1340. var direction = itemModel.get('direction');
  1341. var value = data.get('value', idx);
  1342. var phase = itemModel.get('phase');
  1343. phase = oldWave ? oldWave.shape.phase
  1344. : (phase === 'auto' ? idx * Math.PI / 4 : phase);
  1345. var defaultSpeed = function (maxSpeed) {
  1346. var cnt = data.count();
  1347. return cnt === 0 ? maxSpeed : maxSpeed *
  1348. (0.2 + (cnt - idx) / cnt * 0.8);
  1349. };
  1350. var speed = 0;
  1351. if (maxSpeed === 'auto') {
  1352. speed = defaultSpeed(5000);
  1353. }
  1354. else {
  1355. speed = typeof maxSpeed === 'function'
  1356. ? maxSpeed(value, idx) : maxSpeed;
  1357. }
  1358. // phase for moving left/right
  1359. var phaseOffset = 0;
  1360. if (direction === 'right' || direction == null) {
  1361. phaseOffset = Math.PI;
  1362. }
  1363. else if (direction === 'left') {
  1364. phaseOffset = -Math.PI;
  1365. }
  1366. else if (direction === 'none') {
  1367. phaseOffset = 0;
  1368. }
  1369. else {
  1370. console.error('Illegal direction value for liquid fill.');
  1371. }
  1372. // wave animation of moving left/right
  1373. if (direction !== 'none' && itemModel.get('waveAnimation')) {
  1374. wave
  1375. .animate('shape', true)
  1376. .when(0, {
  1377. phase: phase
  1378. })
  1379. .when(speed / 2, {
  1380. phase: phaseOffset + phase
  1381. })
  1382. .when(speed, {
  1383. phase: phaseOffset * 2 + phase
  1384. })
  1385. .during(function () {
  1386. if (wavePath) {
  1387. wavePath.dirty(true);
  1388. }
  1389. })
  1390. .start();
  1391. }
  1392. }
  1393. /**
  1394. * text on wave
  1395. */
  1396. function getText(waves) {
  1397. var labelModel = itemModel.getModel('label');
  1398. function formatLabel() {
  1399. var formatted = seriesModel.getFormattedLabel(0, 'normal');
  1400. var defaultVal = (data.get('value', 0) * 100);
  1401. var defaultLabel = data.getName(0) || seriesModel.name;
  1402. if (!isNaN(defaultVal)) {
  1403. defaultLabel = defaultVal.toFixed(0) + '%';
  1404. }
  1405. return formatted == null ? defaultLabel : formatted;
  1406. }
  1407. var textRectOption = {
  1408. z2: 10,
  1409. shape: {
  1410. x: left,
  1411. y: top,
  1412. width: (isFillContainer ? radius[0] : radius) * 2,
  1413. height: (isFillContainer ? radius[1] : radius) * 2
  1414. },
  1415. style: {
  1416. fill: 'transparent'
  1417. },
  1418. textConfig: {
  1419. position: labelModel.get('position') || 'inside'
  1420. },
  1421. silent: true
  1422. };
  1423. var textOption = {
  1424. style: {
  1425. text: formatLabel(),
  1426. textAlign: labelModel.get('align'),
  1427. textVerticalAlign: labelModel.get('baseline')
  1428. }
  1429. };
  1430. Object.assign(textOption.style, external_echarts_.helper.createTextStyle(labelModel));
  1431. var outsideTextRect = new external_echarts_.graphic.Rect(textRectOption);
  1432. var insideTextRect = new external_echarts_.graphic.Rect(textRectOption);
  1433. insideTextRect.disableLabelAnimation = true;
  1434. outsideTextRect.disableLabelAnimation = true;
  1435. var outsideText = new external_echarts_.graphic.Text(textOption);
  1436. var insideText = new external_echarts_.graphic.Text(textOption);
  1437. outsideTextRect.setTextContent(outsideText);
  1438. insideTextRect.setTextContent(insideText);
  1439. var insColor = labelModel.get('insideColor');
  1440. insideText.style.fill = insColor;
  1441. var group = new external_echarts_.graphic.Group();
  1442. group.add(outsideTextRect);
  1443. group.add(insideTextRect);
  1444. // clip out waves for insideText
  1445. var boundingCircle = getPath(radius, true);
  1446. wavePath = new external_echarts_.graphic.CompoundPath({
  1447. shape: {
  1448. paths: waves
  1449. },
  1450. x: cx,
  1451. y: cy
  1452. });
  1453. wavePath.setClipPath(boundingCircle);
  1454. insideTextRect.setClipPath(wavePath);
  1455. return group;
  1456. }
  1457. },
  1458. dispose: function () {
  1459. // dispose nothing here
  1460. }
  1461. });
  1462. ;// CONCATENATED MODULE: ./src/liquidFill.js
  1463. ;// CONCATENATED MODULE: ./index.js
  1464. /***/ }),
  1465. /***/ "echarts/lib/echarts":
  1466. /*!**************************!*\
  1467. !*** external "echarts" ***!
  1468. \**************************/
  1469. /***/ ((module) => {
  1470. module.exports = __WEBPACK_EXTERNAL_MODULE_echarts_lib_echarts__;
  1471. /***/ })
  1472. /******/ });
  1473. /************************************************************************/
  1474. /******/ // The module cache
  1475. /******/ var __webpack_module_cache__ = {};
  1476. /******/
  1477. /******/ // The require function
  1478. /******/ function __webpack_require__(moduleId) {
  1479. /******/ // Check if module is in cache
  1480. /******/ if(__webpack_module_cache__[moduleId]) {
  1481. /******/ return __webpack_module_cache__[moduleId].exports;
  1482. /******/ }
  1483. /******/ // Create a new module (and put it into the cache)
  1484. /******/ var module = __webpack_module_cache__[moduleId] = {
  1485. /******/ // no module.id needed
  1486. /******/ // no module.loaded needed
  1487. /******/ exports: {}
  1488. /******/ };
  1489. /******/
  1490. /******/ // Execute the module function
  1491. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  1492. /******/
  1493. /******/ // Return the exports of the module
  1494. /******/ return module.exports;
  1495. /******/ }
  1496. /******/
  1497. /************************************************************************/
  1498. /******/ /* webpack/runtime/make namespace object */
  1499. /******/ (() => {
  1500. /******/ // define __esModule on exports
  1501. /******/ __webpack_require__.r = (exports) => {
  1502. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  1503. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  1504. /******/ }
  1505. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  1506. /******/ };
  1507. /******/ })();
  1508. /******/
  1509. /************************************************************************/
  1510. /******/ // module exports must be returned from runtime so entry inlining is disabled
  1511. /******/ // startup
  1512. /******/ // Load entry module and return exports
  1513. /******/ return __webpack_require__("./index.js");
  1514. /******/ })()
  1515. ;
  1516. });
  1517. //# sourceMappingURL=echarts-liquidfill.js.map