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