echarts 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/echarts-en.common.js +370 -150
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +508 -229
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +312 -123
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +344 -150
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +482 -229
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +286 -123
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/bmap.js +336 -2
- package/dist/extension/bmap.js.map +1 -1
- package/dist/extension/bmap.min.js +1 -1
- package/extension/bmap/BMapView.js +6 -2
- package/extension-src/bmap/BMapView.js +3 -2
- package/lib/chart/bar/BarView.js +20 -5
- package/lib/chart/heatmap/HeatmapView.js +2 -2
- package/lib/chart/helper/EffectSymbol.js +2 -1
- package/lib/chart/helper/LineDraw.js +5 -1
- package/lib/chart/helper/Symbol.js +1 -2
- package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
- package/lib/chart/line/LineView.js +33 -0
- package/lib/chart/map/MapSeries.js +3 -2
- package/lib/chart/pie/PieView.js +20 -13
- package/lib/chart/sankey/sankeyLayout.js +18 -0
- package/lib/chart/sunburst/SunburstPiece.js +1 -0
- package/lib/chart/sunburst/SunburstSeries.js +12 -7
- package/lib/chart/sunburst/SunburstView.js +5 -1
- package/lib/chart/tree/TreeSeries.js +4 -4
- package/lib/chart/treemap/TreemapSeries.js +15 -3
- package/lib/chart/treemap/TreemapView.js +23 -11
- package/lib/component/helper/MapDraw.js +32 -4
- package/lib/component/title.js +6 -2
- package/lib/component/toolbox/ToolboxView.js +1 -1
- package/lib/component/toolbox/feature/MagicType.js +2 -1
- package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
- package/lib/component/tooltip/TooltipView.js +1 -1
- package/lib/component/visualMap/PiecewiseModel.js +3 -6
- package/lib/coord/axisHelper.js +22 -16
- package/lib/coord/calendar/Calendar.js +8 -4
- package/lib/coord/geo/geoJSONLoader.js +3 -2
- package/lib/coord/geo/geoSourceManager.js +3 -2
- package/lib/coord/geo/parseGeoJson.js +3 -2
- package/lib/coord/radar/Radar.js +1 -1
- package/lib/data/Tree.js +8 -19
- package/lib/echarts.js +57 -34
- package/lib/langEN.js +26 -0
- package/lib/loading/default.js +43 -27
- package/lib/model/Series.js +1 -1
- package/lib/util/format.js +19 -2
- package/lib/util/graphic.js +11 -8
- package/lib/visual/symbol.js +12 -2
- package/map/js/province/gansu.js +2 -2
- package/package.json +2 -2
- package/src/chart/bar/BarView.js +16 -3
- package/src/chart/heatmap/HeatmapView.js +2 -2
- package/src/chart/helper/EffectSymbol.js +2 -1
- package/src/chart/helper/LineDraw.js +5 -1
- package/src/chart/helper/Symbol.js +2 -2
- package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
- package/src/chart/line/LineView.js +39 -0
- package/src/chart/map/MapSeries.js +3 -2
- package/src/chart/pie/PieView.js +18 -13
- package/src/chart/sankey/sankeyLayout.js +21 -2
- package/src/chart/sunburst/SunburstPiece.js +2 -0
- package/src/chart/sunburst/SunburstSeries.js +12 -7
- package/src/chart/sunburst/SunburstView.js +2 -1
- package/src/chart/tree/TreeSeries.js +3 -6
- package/src/chart/treemap/TreemapSeries.js +15 -5
- package/src/chart/treemap/TreemapView.js +20 -14
- package/src/component/helper/MapDraw.js +26 -3
- package/src/component/title.js +3 -2
- package/src/component/toolbox/ToolboxView.js +1 -1
- package/src/component/toolbox/feature/MagicType.js +2 -1
- package/src/component/toolbox/feature/SaveAsImage.js +2 -1
- package/src/component/tooltip/TooltipView.js +1 -1
- package/src/component/visualMap/PiecewiseModel.js +5 -9
- package/src/coord/axisHelper.js +26 -19
- package/src/coord/calendar/Calendar.js +12 -5
- package/src/coord/geo/geoJSONLoader.js +3 -2
- package/src/coord/geo/geoSourceManager.js +3 -2
- package/src/coord/geo/parseGeoJson.js +3 -2
- package/src/coord/radar/Radar.js +1 -1
- package/src/data/Tree.js +11 -18
- package/src/echarts.js +60 -36
- package/src/langEN.js +26 -0
- package/src/layout/barGrid.js +4 -2
- package/src/loading/default.js +46 -34
- package/src/model/Series.js +1 -1
- package/src/util/format.js +17 -1
- package/src/util/graphic.js +10 -7
- package/src/visual/symbol.js +11 -2
package/dist/extension/bmap.js
CHANGED
|
@@ -270,6 +270,340 @@ echarts.extendComponentModel({
|
|
|
270
270
|
}
|
|
271
271
|
});
|
|
272
272
|
|
|
273
|
+
/**
|
|
274
|
+
* @module zrender/core/util
|
|
275
|
+
*/
|
|
276
|
+
|
|
277
|
+
// 用于处理merge时无法遍历Date等对象的问题
|
|
278
|
+
var BUILTIN_OBJECT = {
|
|
279
|
+
'[object Function]': 1,
|
|
280
|
+
'[object RegExp]': 1,
|
|
281
|
+
'[object Date]': 1,
|
|
282
|
+
'[object Error]': 1,
|
|
283
|
+
'[object CanvasGradient]': 1,
|
|
284
|
+
'[object CanvasPattern]': 1,
|
|
285
|
+
// For node-canvas
|
|
286
|
+
'[object Image]': 1,
|
|
287
|
+
'[object Canvas]': 1
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
var TYPED_ARRAY = {
|
|
291
|
+
'[object Int8Array]': 1,
|
|
292
|
+
'[object Uint8Array]': 1,
|
|
293
|
+
'[object Uint8ClampedArray]': 1,
|
|
294
|
+
'[object Int16Array]': 1,
|
|
295
|
+
'[object Uint16Array]': 1,
|
|
296
|
+
'[object Int32Array]': 1,
|
|
297
|
+
'[object Uint32Array]': 1,
|
|
298
|
+
'[object Float32Array]': 1,
|
|
299
|
+
'[object Float64Array]': 1
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
var objToString = Object.prototype.toString;
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Those data types can be cloned:
|
|
308
|
+
* Plain object, Array, TypedArray, number, string, null, undefined.
|
|
309
|
+
* Those data types will be assgined using the orginal data:
|
|
310
|
+
* BUILTIN_OBJECT
|
|
311
|
+
* Instance of user defined class will be cloned to a plain object, without
|
|
312
|
+
* properties in prototype.
|
|
313
|
+
* Other data types is not supported (not sure what will happen).
|
|
314
|
+
*
|
|
315
|
+
* Caution: do not support clone Date, for performance consideration.
|
|
316
|
+
* (There might be a large number of date in `series.data`).
|
|
317
|
+
* So date should not be modified in and out of echarts.
|
|
318
|
+
*
|
|
319
|
+
* @param {*} source
|
|
320
|
+
* @return {*} new
|
|
321
|
+
*/
|
|
322
|
+
function clone(source) {
|
|
323
|
+
if (source == null || typeof source !== 'object') {
|
|
324
|
+
return source;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
var result = source;
|
|
328
|
+
var typeStr = objToString.call(source);
|
|
329
|
+
|
|
330
|
+
if (typeStr === '[object Array]') {
|
|
331
|
+
if (!isPrimitive(source)) {
|
|
332
|
+
result = [];
|
|
333
|
+
for (var i = 0, len = source.length; i < len; i++) {
|
|
334
|
+
result[i] = clone(source[i]);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
else if (TYPED_ARRAY[typeStr]) {
|
|
339
|
+
if (!isPrimitive(source)) {
|
|
340
|
+
var Ctor = source.constructor;
|
|
341
|
+
if (source.constructor.from) {
|
|
342
|
+
result = Ctor.from(source);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
result = new Ctor(source.length);
|
|
346
|
+
for (var i = 0, len = source.length; i < len; i++) {
|
|
347
|
+
result[i] = clone(source[i]);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {
|
|
353
|
+
result = {};
|
|
354
|
+
for (var key in source) {
|
|
355
|
+
if (source.hasOwnProperty(key)) {
|
|
356
|
+
result[key] = clone(source[key]);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
return result;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @memberOf module:zrender/core/util
|
|
366
|
+
* @param {*} target
|
|
367
|
+
* @param {*} source
|
|
368
|
+
* @param {boolean} [overwrite=false]
|
|
369
|
+
*/
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* @param {Array} targetAndSources The first item is target, and the rests are source.
|
|
374
|
+
* @param {boolean} [overwrite=false]
|
|
375
|
+
* @return {*} target
|
|
376
|
+
*/
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @param {*} target
|
|
381
|
+
* @param {*} source
|
|
382
|
+
* @memberOf module:zrender/core/util
|
|
383
|
+
*/
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* @param {*} target
|
|
388
|
+
* @param {*} source
|
|
389
|
+
* @param {boolean} [overlay=false]
|
|
390
|
+
* @memberOf module:zrender/core/util
|
|
391
|
+
*/
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* 查询数组中元素的index
|
|
400
|
+
* @memberOf module:zrender/core/util
|
|
401
|
+
*/
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* 构造类继承关系
|
|
406
|
+
*
|
|
407
|
+
* @memberOf module:zrender/core/util
|
|
408
|
+
* @param {Function} clazz 源类
|
|
409
|
+
* @param {Function} baseClazz 基类
|
|
410
|
+
*/
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* @memberOf module:zrender/core/util
|
|
415
|
+
* @param {Object|Function} target
|
|
416
|
+
* @param {Object|Function} sorce
|
|
417
|
+
* @param {boolean} overlay
|
|
418
|
+
*/
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Consider typed array.
|
|
423
|
+
* @param {Array|TypedArray} data
|
|
424
|
+
*/
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* 数组或对象遍历
|
|
429
|
+
* @memberOf module:zrender/core/util
|
|
430
|
+
* @param {Object|Array} obj
|
|
431
|
+
* @param {Function} cb
|
|
432
|
+
* @param {*} [context]
|
|
433
|
+
*/
|
|
434
|
+
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* 数组映射
|
|
438
|
+
* @memberOf module:zrender/core/util
|
|
439
|
+
* @param {Array} obj
|
|
440
|
+
* @param {Function} cb
|
|
441
|
+
* @param {*} [context]
|
|
442
|
+
* @return {Array}
|
|
443
|
+
*/
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* @memberOf module:zrender/core/util
|
|
448
|
+
* @param {Array} obj
|
|
449
|
+
* @param {Function} cb
|
|
450
|
+
* @param {Object} [memo]
|
|
451
|
+
* @param {*} [context]
|
|
452
|
+
* @return {Array}
|
|
453
|
+
*/
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* 数组过滤
|
|
458
|
+
* @memberOf module:zrender/core/util
|
|
459
|
+
* @param {Array} obj
|
|
460
|
+
* @param {Function} cb
|
|
461
|
+
* @param {*} [context]
|
|
462
|
+
* @return {Array}
|
|
463
|
+
*/
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* 数组项查找
|
|
468
|
+
* @memberOf module:zrender/core/util
|
|
469
|
+
* @param {Array} obj
|
|
470
|
+
* @param {Function} cb
|
|
471
|
+
* @param {*} [context]
|
|
472
|
+
* @return {*}
|
|
473
|
+
*/
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* @memberOf module:zrender/core/util
|
|
478
|
+
* @param {Function} func
|
|
479
|
+
* @param {*} context
|
|
480
|
+
* @return {Function}
|
|
481
|
+
*/
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* @memberOf module:zrender/core/util
|
|
486
|
+
* @param {Function} func
|
|
487
|
+
* @return {Function}
|
|
488
|
+
*/
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* @memberOf module:zrender/core/util
|
|
493
|
+
* @param {*} value
|
|
494
|
+
* @return {boolean}
|
|
495
|
+
*/
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* @memberOf module:zrender/core/util
|
|
500
|
+
* @param {*} value
|
|
501
|
+
* @return {boolean}
|
|
502
|
+
*/
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* @memberOf module:zrender/core/util
|
|
507
|
+
* @param {*} value
|
|
508
|
+
* @return {boolean}
|
|
509
|
+
*/
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* @memberOf module:zrender/core/util
|
|
514
|
+
* @param {*} value
|
|
515
|
+
* @return {boolean}
|
|
516
|
+
*/
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* @memberOf module:zrender/core/util
|
|
521
|
+
* @param {*} value
|
|
522
|
+
* @return {boolean}
|
|
523
|
+
*/
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* @memberOf module:zrender/core/util
|
|
528
|
+
* @param {*} value
|
|
529
|
+
* @return {boolean}
|
|
530
|
+
*/
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* @memberOf module:zrender/core/util
|
|
535
|
+
* @param {*} value
|
|
536
|
+
* @return {boolean}
|
|
537
|
+
*/
|
|
538
|
+
function isDom(value) {
|
|
539
|
+
return typeof value === 'object'
|
|
540
|
+
&& typeof value.nodeType === 'number'
|
|
541
|
+
&& typeof value.ownerDocument === 'object';
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Whether is exactly NaN. Notice isNaN('a') returns true.
|
|
546
|
+
* @param {*} value
|
|
547
|
+
* @return {boolean}
|
|
548
|
+
*/
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* If value1 is not null, then return value1, otherwise judget rest of values.
|
|
553
|
+
* Low performance.
|
|
554
|
+
* @memberOf module:zrender/core/util
|
|
555
|
+
* @return {*} Final value
|
|
556
|
+
*/
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* @memberOf module:zrender/core/util
|
|
565
|
+
* @param {Array} arr
|
|
566
|
+
* @param {number} startIndex
|
|
567
|
+
* @param {number} endIndex
|
|
568
|
+
* @return {Array}
|
|
569
|
+
*/
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Normalize css liked array configuration
|
|
574
|
+
* e.g.
|
|
575
|
+
* 3 => [3, 3, 3, 3]
|
|
576
|
+
* [4, 2] => [4, 2, 4, 2]
|
|
577
|
+
* [4, 3, 2] => [4, 3, 2, 3]
|
|
578
|
+
* @param {number|Array.<number>} val
|
|
579
|
+
* @return {Array.<number>}
|
|
580
|
+
*/
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* @memberOf module:zrender/core/util
|
|
585
|
+
* @param {boolean} condition
|
|
586
|
+
* @param {string} message
|
|
587
|
+
*/
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* @memberOf module:zrender/core/util
|
|
592
|
+
* @param {string} str string to be trimed
|
|
593
|
+
* @return {string} trimed string
|
|
594
|
+
*/
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
var primitiveKey = '__ec_primitive__';
|
|
598
|
+
/**
|
|
599
|
+
* Set an object as primitive to be ignored traversing children in clone or merge
|
|
600
|
+
*/
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
function isPrimitive(obj) {
|
|
604
|
+
return obj[primitiveKey];
|
|
605
|
+
}
|
|
606
|
+
|
|
273
607
|
/*
|
|
274
608
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
275
609
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -366,7 +700,7 @@ echarts.extendComponentView({
|
|
|
366
700
|
if (JSON.stringify(originalStyle) !== mapStyleStr) {
|
|
367
701
|
// FIXME May have blank tile when dragging if setMapStyle
|
|
368
702
|
if (Object.keys(newMapStyle).length) {
|
|
369
|
-
bmap.setMapStyle(newMapStyle);
|
|
703
|
+
bmap.setMapStyle(clone(newMapStyle));
|
|
370
704
|
}
|
|
371
705
|
bMapModel.__mapStyle = JSON.parse(mapStyleStr);
|
|
372
706
|
}
|
|
@@ -380,7 +714,7 @@ echarts.extendComponentView({
|
|
|
380
714
|
if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
|
|
381
715
|
// FIXME May have blank tile when dragging if setMapStyle
|
|
382
716
|
if (Object.keys(newMapStyle2).length) {
|
|
383
|
-
bmap.setMapStyleV2(newMapStyle2);
|
|
717
|
+
bmap.setMapStyleV2(clone(newMapStyle2));
|
|
384
718
|
}
|
|
385
719
|
bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
|
|
386
720
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bmap.js","sources":["../../extension-src/bmap/BMapCoordSys.js","../../extension-src/bmap/BMapModel.js","../../extension-src/bmap/BMapView.js","../../extension-src/bmap/bmap.js"],"sourcesContent":["/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/* global BMap */\n\nimport {\n util as zrUtil,\n graphic,\n matrix\n} from 'echarts';\n\nfunction BMapCoordSys(bmap, api) {\n this._bmap = bmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n\n this._api = api;\n\n this._projection = new BMap.MercatorProjection();\n}\n\nBMapCoordSys.prototype.dimensions = ['lng', 'lat'];\n\nBMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\n\nBMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));\n};\n\nBMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\n\nBMapCoordSys.prototype.getBMap = function () {\n return this._bmap;\n};\n\nBMapCoordSys.prototype.dataToPoint = function (data) {\n var point = new BMap.Point(data[0], data[1]);\n // TODO mercator projection is toooooooo slow\n // var mercatorPoint = this._projection.lngLatToPoint(point);\n\n // var width = this._api.getZr().getWidth();\n // var height = this._api.getZr().getHeight();\n // var divider = Math.pow(2, 18 - 10);\n // return [\n // Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),\n // Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)\n // ];\n var px = this._bmap.pointToOverlayPixel(point);\n var mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\n\nBMapCoordSys.prototype.pointToData = function (pt) {\n var mapOffset = this._mapOffset;\n var pt = this._bmap.overlayPixelToPoint({\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1]\n });\n return [pt.lng, pt.lat];\n};\n\nBMapCoordSys.prototype.getViewRect = function () {\n var api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\n\nBMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\n\nBMapCoordSys.prototype.prepareCustoms = function (data) {\n var rect = this.getViewRect();\n return {\n coordSys: {\n // The name exposed to user is always 'cartesian2d' but not 'grid'.\n type: 'bmap',\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height\n },\n api: {\n coord: zrUtil.bind(this.dataToPoint, this),\n size: zrUtil.bind(dataToCoordSize, this)\n }\n };\n};\n\nfunction dataToCoordSize(dataSize, dataItem) {\n dataItem = dataItem || [0, 0];\n return zrUtil.map([0, 1], function (dimIdx) {\n var val = dataItem[dimIdx];\n var halfSize = dataSize[dimIdx] / 2;\n var p1 = [];\n var p2 = [];\n p1[dimIdx] = val - halfSize;\n p2[dimIdx] = val + halfSize;\n p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];\n return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);\n }, this);\n}\n\nvar Overlay;\n\n// For deciding which dimensions to use when creating list data\nBMapCoordSys.dimensions = BMapCoordSys.prototype.dimensions;\n\nfunction createOverlayCtor() {\n function Overlay(root) {\n this._root = root;\n }\n\n Overlay.prototype = new BMap.Overlay();\n /**\n * 初始化\n *\n * @param {BMap.Map} map\n * @override\n */\n Overlay.prototype.initialize = function (map) {\n map.getPanes().labelPane.appendChild(this._root);\n return this._root;\n };\n /**\n * @override\n */\n Overlay.prototype.draw = function () {};\n\n return Overlay;\n}\n\nBMapCoordSys.create = function (ecModel, api) {\n var bmapCoordSys;\n var root = api.getDom();\n\n // TODO Dispose\n ecModel.eachComponent('bmap', function (bmapModel) {\n var painter = api.getZr().painter;\n var viewportRoot = painter.getViewportRoot();\n if (typeof BMap === 'undefined') {\n throw new Error('BMap api is not loaded');\n }\n Overlay = Overlay || createOverlayCtor();\n if (bmapCoordSys) {\n throw new Error('Only one bmap component can exist');\n }\n if (!bmapModel.__bmap) {\n // Not support IE8\n var bmapRoot = root.querySelector('.ec-extension-bmap');\n if (bmapRoot) {\n // Reset viewport left and top, which will be changed\n // in moving handler in BMapView\n viewportRoot.style.left = '0px';\n viewportRoot.style.top = '0px';\n root.removeChild(bmapRoot);\n }\n bmapRoot = document.createElement('div');\n bmapRoot.style.cssText = 'width:100%;height:100%';\n // Not support IE8\n bmapRoot.classList.add('ec-extension-bmap');\n root.appendChild(bmapRoot);\n var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);\n\n var overlay = new Overlay(viewportRoot);\n bmap.addOverlay(overlay);\n\n // Override\n painter.getViewportRootOffset = function () {\n return {offsetLeft: 0, offsetTop: 0};\n };\n }\n var bmap = bmapModel.__bmap;\n\n // Set bmap options\n // centerAndZoom before layout and render\n var center = bmapModel.get('center');\n var zoom = bmapModel.get('zoom');\n if (center && zoom) {\n var pt = new BMap.Point(center[0], center[1]);\n bmap.centerAndZoom(pt, zoom);\n }\n\n bmapCoordSys = new BMapCoordSys(bmap, api);\n bmapCoordSys.setMapOffset(bmapModel.__mapOffset || [0, 0]);\n bmapCoordSys.setZoom(zoom);\n bmapCoordSys.setCenter(center);\n\n bmapModel.coordinateSystem = bmapCoordSys;\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === 'bmap') {\n seriesModel.coordinateSystem = bmapCoordSys;\n }\n });\n};\n\nexport default BMapCoordSys;","/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\nimport * as echarts from 'echarts';\n\nfunction v2Equal(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1];\n}\n\nexport default echarts.extendComponentModel({\n type: 'bmap',\n\n getBMap: function () {\n // __bmap is injected when creating BMapCoordSys\n return this.__bmap;\n },\n\n setCenterAndZoom: function (center, zoom) {\n this.option.center = center;\n this.option.zoom = zoom;\n },\n\n centerOrZoomChanged: function (center, zoom) {\n var option = this.option;\n return !(v2Equal(center, option.center) && zoom === option.zoom);\n },\n\n defaultOption: {\n\n center: [104.114129, 37.550339],\n\n zoom: 5,\n\n mapStyle: {},\n\n mapStyleV2: {},\n\n roam: false\n }\n});","/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\nimport * as echarts from 'echarts';\n\nexport default echarts.extendComponentView({\n type: 'bmap',\n\n render: function (bMapModel, ecModel, api) {\n var rendering = true;\n\n var bmap = bMapModel.getBMap();\n var viewportRoot = api.getZr().painter.getViewportRoot();\n var coordSys = bMapModel.coordinateSystem;\n var moveHandler = function (type, target) {\n if (rendering) {\n return;\n }\n var offsetEl = viewportRoot.parentNode.parentNode.parentNode;\n var mapOffset = [\n -parseInt(offsetEl.style.left, 10) || 0,\n -parseInt(offsetEl.style.top, 10) || 0\n ];\n viewportRoot.style.left = mapOffset[0] + 'px';\n viewportRoot.style.top = mapOffset[1] + 'px';\n\n coordSys.setMapOffset(mapOffset);\n bMapModel.__mapOffset = mapOffset;\n\n api.dispatchAction({\n type: 'bmapRoam'\n });\n };\n\n function zoomEndHandler() {\n if (rendering) {\n return;\n }\n api.dispatchAction({\n type: 'bmapRoam'\n });\n }\n\n bmap.removeEventListener('moving', this._oldMoveHandler);\n // FIXME\n // Moveend may be triggered by centerAndZoom method when creating coordSys next time\n // bmap.removeEventListener('moveend', this._oldMoveHandler);\n bmap.removeEventListener('zoomend', this._oldZoomEndHandler);\n bmap.addEventListener('moving', moveHandler);\n // bmap.addEventListener('moveend', moveHandler);\n bmap.addEventListener('zoomend', zoomEndHandler);\n\n this._oldMoveHandler = moveHandler;\n this._oldZoomEndHandler = zoomEndHandler;\n\n var roam = bMapModel.get('roam');\n if (roam && roam !== 'scale') {\n bmap.enableDragging();\n }\n else {\n bmap.disableDragging();\n }\n if (roam && roam !== 'move') {\n bmap.enableScrollWheelZoom();\n bmap.enableDoubleClickZoom();\n bmap.enablePinchToZoom();\n }\n else {\n bmap.disableScrollWheelZoom();\n bmap.disableDoubleClickZoom();\n bmap.disablePinchToZoom();\n }\n\n /* map 2.0 */\n var originalStyle = bMapModel.__mapStyle;\n\n var newMapStyle = bMapModel.get('mapStyle') || {};\n // FIXME, Not use JSON methods\n var mapStyleStr = JSON.stringify(newMapStyle);\n if (JSON.stringify(originalStyle) !== mapStyleStr) {\n // FIXME May have blank tile when dragging if setMapStyle\n if (Object.keys(newMapStyle).length) {\n bmap.setMapStyle(newMapStyle);\n }\n bMapModel.__mapStyle = JSON.parse(mapStyleStr);\n }\n\n /* map 3.0 */\n var originalStyle2 = bMapModel.__mapStyle2;\n\n var newMapStyle2 = bMapModel.get('mapStyleV2') || {};\n // FIXME, Not use JSON methods\n var mapStyleStr2 = JSON.stringify(newMapStyle2);\n if (JSON.stringify(originalStyle2) !== mapStyleStr2) {\n // FIXME May have blank tile when dragging if setMapStyle\n if (Object.keys(newMapStyle2).length) {\n bmap.setMapStyleV2(newMapStyle2);\n }\n bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);\n }\n\n rendering = false;\n }\n});","/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * BMap component extension\n */\n\nimport * as echarts from 'echarts';\nimport BMapCoordSys from './BMapCoordSys';\n\nimport './BMapModel';\nimport './BMapView';\n\necharts.registerCoordinateSystem('bmap', BMapCoordSys);\n\n// Action\necharts.registerAction({\n type: 'bmapRoam',\n event: 'bmapRoam',\n update: 'updateLayout'\n}, function (payload, ecModel) {\n ecModel.eachComponent('bmap', function (bMapModel) {\n var bmap = bMapModel.getBMap();\n var center = bmap.getCenter();\n bMapModel.setCenterAndZoom([center.lng, center.lat], bmap.getZoom());\n });\n});\n\nexport var version = '1.0.0';\n"],"names":["graphic","matrix","zrUtil","echarts.extendComponentModel","echarts.extendComponentView","echarts.registerCoordinateSystem","echarts.registerAction"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBA,AAMA,SAAS,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE;IAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;;IAEzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;;IAEhB,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;CACpD;;AAED,YAAY,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;;AAEnD,YAAY,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,IAAI,EAAE;IAC7C,IAAI,CAAC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CAAC,KAAK,YAAY,EAAE;;YAEjD,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,EAAE;gBAClC,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;aACpC;YACD,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;SACpD;;QAED,SAAS,GAAG,KAAK,CAAC;KACrB;CACJ,CAAC;;ACvHF;;;;;;;;;;;;;;;;;;;;;;;AAuBA,AAMAC,gCAAgC,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;;;AAGvDC,sBAAsB,CAAC;IACnB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,cAAc;CACzB,EAAE,UAAU,OAAO,EAAE,OAAO,EAAE;IAC3B,OAAO,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,SAAS,EAAE;QAC/C,IAAI,IAAI,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAC9B,SAAS,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;KACxE,CAAC,CAAC;CACN,CAAC,CAAC;;AAEH,AAAO,IAAI,OAAO,GAAG,OAAO;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"bmap.js","sources":["../../extension-src/bmap/BMapCoordSys.js","../../extension-src/bmap/BMapModel.js","../../../zrender/src/core/util.js","../../extension-src/bmap/BMapView.js","../../extension-src/bmap/bmap.js"],"sourcesContent":["/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/* global BMap */\n\nimport {\n util as zrUtil,\n graphic,\n matrix\n} from 'echarts';\n\nfunction BMapCoordSys(bmap, api) {\n this._bmap = bmap;\n this.dimensions = ['lng', 'lat'];\n this._mapOffset = [0, 0];\n\n this._api = api;\n\n this._projection = new BMap.MercatorProjection();\n}\n\nBMapCoordSys.prototype.dimensions = ['lng', 'lat'];\n\nBMapCoordSys.prototype.setZoom = function (zoom) {\n this._zoom = zoom;\n};\n\nBMapCoordSys.prototype.setCenter = function (center) {\n this._center = this._projection.lngLatToPoint(new BMap.Point(center[0], center[1]));\n};\n\nBMapCoordSys.prototype.setMapOffset = function (mapOffset) {\n this._mapOffset = mapOffset;\n};\n\nBMapCoordSys.prototype.getBMap = function () {\n return this._bmap;\n};\n\nBMapCoordSys.prototype.dataToPoint = function (data) {\n var point = new BMap.Point(data[0], data[1]);\n // TODO mercator projection is toooooooo slow\n // var mercatorPoint = this._projection.lngLatToPoint(point);\n\n // var width = this._api.getZr().getWidth();\n // var height = this._api.getZr().getHeight();\n // var divider = Math.pow(2, 18 - 10);\n // return [\n // Math.round((mercatorPoint.x - this._center.x) / divider + width / 2),\n // Math.round((this._center.y - mercatorPoint.y) / divider + height / 2)\n // ];\n var px = this._bmap.pointToOverlayPixel(point);\n var mapOffset = this._mapOffset;\n return [px.x - mapOffset[0], px.y - mapOffset[1]];\n};\n\nBMapCoordSys.prototype.pointToData = function (pt) {\n var mapOffset = this._mapOffset;\n var pt = this._bmap.overlayPixelToPoint({\n x: pt[0] + mapOffset[0],\n y: pt[1] + mapOffset[1]\n });\n return [pt.lng, pt.lat];\n};\n\nBMapCoordSys.prototype.getViewRect = function () {\n var api = this._api;\n return new graphic.BoundingRect(0, 0, api.getWidth(), api.getHeight());\n};\n\nBMapCoordSys.prototype.getRoamTransform = function () {\n return matrix.create();\n};\n\nBMapCoordSys.prototype.prepareCustoms = function (data) {\n var rect = this.getViewRect();\n return {\n coordSys: {\n // The name exposed to user is always 'cartesian2d' but not 'grid'.\n type: 'bmap',\n x: rect.x,\n y: rect.y,\n width: rect.width,\n height: rect.height\n },\n api: {\n coord: zrUtil.bind(this.dataToPoint, this),\n size: zrUtil.bind(dataToCoordSize, this)\n }\n };\n};\n\nfunction dataToCoordSize(dataSize, dataItem) {\n dataItem = dataItem || [0, 0];\n return zrUtil.map([0, 1], function (dimIdx) {\n var val = dataItem[dimIdx];\n var halfSize = dataSize[dimIdx] / 2;\n var p1 = [];\n var p2 = [];\n p1[dimIdx] = val - halfSize;\n p2[dimIdx] = val + halfSize;\n p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];\n return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);\n }, this);\n}\n\nvar Overlay;\n\n// For deciding which dimensions to use when creating list data\nBMapCoordSys.dimensions = BMapCoordSys.prototype.dimensions;\n\nfunction createOverlayCtor() {\n function Overlay(root) {\n this._root = root;\n }\n\n Overlay.prototype = new BMap.Overlay();\n /**\n * 初始化\n *\n * @param {BMap.Map} map\n * @override\n */\n Overlay.prototype.initialize = function (map) {\n map.getPanes().labelPane.appendChild(this._root);\n return this._root;\n };\n /**\n * @override\n */\n Overlay.prototype.draw = function () {};\n\n return Overlay;\n}\n\nBMapCoordSys.create = function (ecModel, api) {\n var bmapCoordSys;\n var root = api.getDom();\n\n // TODO Dispose\n ecModel.eachComponent('bmap', function (bmapModel) {\n var painter = api.getZr().painter;\n var viewportRoot = painter.getViewportRoot();\n if (typeof BMap === 'undefined') {\n throw new Error('BMap api is not loaded');\n }\n Overlay = Overlay || createOverlayCtor();\n if (bmapCoordSys) {\n throw new Error('Only one bmap component can exist');\n }\n if (!bmapModel.__bmap) {\n // Not support IE8\n var bmapRoot = root.querySelector('.ec-extension-bmap');\n if (bmapRoot) {\n // Reset viewport left and top, which will be changed\n // in moving handler in BMapView\n viewportRoot.style.left = '0px';\n viewportRoot.style.top = '0px';\n root.removeChild(bmapRoot);\n }\n bmapRoot = document.createElement('div');\n bmapRoot.style.cssText = 'width:100%;height:100%';\n // Not support IE8\n bmapRoot.classList.add('ec-extension-bmap');\n root.appendChild(bmapRoot);\n var bmap = bmapModel.__bmap = new BMap.Map(bmapRoot);\n\n var overlay = new Overlay(viewportRoot);\n bmap.addOverlay(overlay);\n\n // Override\n painter.getViewportRootOffset = function () {\n return {offsetLeft: 0, offsetTop: 0};\n };\n }\n var bmap = bmapModel.__bmap;\n\n // Set bmap options\n // centerAndZoom before layout and render\n var center = bmapModel.get('center');\n var zoom = bmapModel.get('zoom');\n if (center && zoom) {\n var pt = new BMap.Point(center[0], center[1]);\n bmap.centerAndZoom(pt, zoom);\n }\n\n bmapCoordSys = new BMapCoordSys(bmap, api);\n bmapCoordSys.setMapOffset(bmapModel.__mapOffset || [0, 0]);\n bmapCoordSys.setZoom(zoom);\n bmapCoordSys.setCenter(center);\n\n bmapModel.coordinateSystem = bmapCoordSys;\n });\n\n ecModel.eachSeries(function (seriesModel) {\n if (seriesModel.get('coordinateSystem') === 'bmap') {\n seriesModel.coordinateSystem = bmapCoordSys;\n }\n });\n};\n\nexport default BMapCoordSys;","/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\nimport * as echarts from 'echarts';\n\nfunction v2Equal(a, b) {\n return a && b && a[0] === b[0] && a[1] === b[1];\n}\n\nexport default echarts.extendComponentModel({\n type: 'bmap',\n\n getBMap: function () {\n // __bmap is injected when creating BMapCoordSys\n return this.__bmap;\n },\n\n setCenterAndZoom: function (center, zoom) {\n this.option.center = center;\n this.option.zoom = zoom;\n },\n\n centerOrZoomChanged: function (center, zoom) {\n var option = this.option;\n return !(v2Equal(center, option.center) && zoom === option.zoom);\n },\n\n defaultOption: {\n\n center: [104.114129, 37.550339],\n\n zoom: 5,\n\n mapStyle: {},\n\n mapStyleV2: {},\n\n roam: false\n }\n});","/**\n * @module zrender/core/util\n */\n\n// 用于处理merge时无法遍历Date等对象的问题\nvar BUILTIN_OBJECT = {\n '[object Function]': 1,\n '[object RegExp]': 1,\n '[object Date]': 1,\n '[object Error]': 1,\n '[object CanvasGradient]': 1,\n '[object CanvasPattern]': 1,\n // For node-canvas\n '[object Image]': 1,\n '[object Canvas]': 1\n};\n\nvar TYPED_ARRAY = {\n '[object Int8Array]': 1,\n '[object Uint8Array]': 1,\n '[object Uint8ClampedArray]': 1,\n '[object Int16Array]': 1,\n '[object Uint16Array]': 1,\n '[object Int32Array]': 1,\n '[object Uint32Array]': 1,\n '[object Float32Array]': 1,\n '[object Float64Array]': 1\n};\n\nvar objToString = Object.prototype.toString;\n\nvar arrayProto = Array.prototype;\nvar nativeForEach = arrayProto.forEach;\nvar nativeFilter = arrayProto.filter;\nvar nativeSlice = arrayProto.slice;\nvar nativeMap = arrayProto.map;\nvar nativeReduce = arrayProto.reduce;\n\n// Avoid assign to an exported variable, for transforming to cjs.\nvar methods = {};\n\nexport function $override(name, fn) {\n // Clear ctx instance for different environment\n if (name === 'createCanvas') {\n _ctx = null;\n }\n\n methods[name] = fn;\n}\n\n/**\n * Those data types can be cloned:\n * Plain object, Array, TypedArray, number, string, null, undefined.\n * Those data types will be assgined using the orginal data:\n * BUILTIN_OBJECT\n * Instance of user defined class will be cloned to a plain object, without\n * properties in prototype.\n * Other data types is not supported (not sure what will happen).\n *\n * Caution: do not support clone Date, for performance consideration.\n * (There might be a large number of date in `series.data`).\n * So date should not be modified in and out of echarts.\n *\n * @param {*} source\n * @return {*} new\n */\nexport function clone(source) {\n if (source == null || typeof source !== 'object') {\n return source;\n }\n\n var result = source;\n var typeStr = objToString.call(source);\n\n if (typeStr === '[object Array]') {\n if (!isPrimitive(source)) {\n result = [];\n for (var i = 0, len = source.length; i < len; i++) {\n result[i] = clone(source[i]);\n }\n }\n }\n else if (TYPED_ARRAY[typeStr]) {\n if (!isPrimitive(source)) {\n var Ctor = source.constructor;\n if (source.constructor.from) {\n result = Ctor.from(source);\n }\n else {\n result = new Ctor(source.length);\n for (var i = 0, len = source.length; i < len; i++) {\n result[i] = clone(source[i]);\n }\n }\n }\n }\n else if (!BUILTIN_OBJECT[typeStr] && !isPrimitive(source) && !isDom(source)) {\n result = {};\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n result[key] = clone(source[key]);\n }\n }\n }\n\n return result;\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {*} target\n * @param {*} source\n * @param {boolean} [overwrite=false]\n */\nexport function merge(target, source, overwrite) {\n // We should escapse that source is string\n // and enter for ... in ...\n if (!isObject(source) || !isObject(target)) {\n return overwrite ? clone(source) : target;\n }\n\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n var targetProp = target[key];\n var sourceProp = source[key];\n\n if (isObject(sourceProp)\n && isObject(targetProp)\n && !isArray(sourceProp)\n && !isArray(targetProp)\n && !isDom(sourceProp)\n && !isDom(targetProp)\n && !isBuiltInObject(sourceProp)\n && !isBuiltInObject(targetProp)\n && !isPrimitive(sourceProp)\n && !isPrimitive(targetProp)\n ) {\n // 如果需要递归覆盖,就递归调用merge\n merge(targetProp, sourceProp, overwrite);\n }\n else if (overwrite || !(key in target)) {\n // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况\n // NOTE,在 target[key] 不存在的时候也是直接覆盖\n target[key] = clone(source[key], true);\n }\n }\n }\n\n return target;\n}\n\n/**\n * @param {Array} targetAndSources The first item is target, and the rests are source.\n * @param {boolean} [overwrite=false]\n * @return {*} target\n */\nexport function mergeAll(targetAndSources, overwrite) {\n var result = targetAndSources[0];\n for (var i = 1, len = targetAndSources.length; i < len; i++) {\n result = merge(result, targetAndSources[i], overwrite);\n }\n return result;\n}\n\n/**\n * @param {*} target\n * @param {*} source\n * @memberOf module:zrender/core/util\n */\nexport function extend(target, source) {\n for (var key in source) {\n if (source.hasOwnProperty(key)) {\n target[key] = source[key];\n }\n }\n return target;\n}\n\n/**\n * @param {*} target\n * @param {*} source\n * @param {boolean} [overlay=false]\n * @memberOf module:zrender/core/util\n */\nexport function defaults(target, source, overlay) {\n for (var key in source) {\n if (source.hasOwnProperty(key)\n && (overlay ? source[key] != null : target[key] == null)\n ) {\n target[key] = source[key];\n }\n }\n return target;\n}\n\nexport var createCanvas = function () {\n return methods.createCanvas();\n};\n\nmethods.createCanvas = function () {\n return document.createElement('canvas');\n};\n\n// FIXME\nvar _ctx;\n\nexport function getContext() {\n if (!_ctx) {\n // Use util.createCanvas instead of createCanvas\n // because createCanvas may be overwritten in different environment\n _ctx = createCanvas().getContext('2d');\n }\n return _ctx;\n}\n\n/**\n * 查询数组中元素的index\n * @memberOf module:zrender/core/util\n */\nexport function indexOf(array, value) {\n if (array) {\n if (array.indexOf) {\n return array.indexOf(value);\n }\n for (var i = 0, len = array.length; i < len; i++) {\n if (array[i] === value) {\n return i;\n }\n }\n }\n return -1;\n}\n\n/**\n * 构造类继承关系\n *\n * @memberOf module:zrender/core/util\n * @param {Function} clazz 源类\n * @param {Function} baseClazz 基类\n */\nexport function inherits(clazz, baseClazz) {\n var clazzPrototype = clazz.prototype;\n function F() {}\n F.prototype = baseClazz.prototype;\n clazz.prototype = new F();\n\n for (var prop in clazzPrototype) {\n if (clazzPrototype.hasOwnProperty(prop)) {\n clazz.prototype[prop] = clazzPrototype[prop];\n }\n }\n clazz.prototype.constructor = clazz;\n clazz.superClass = baseClazz;\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {Object|Function} target\n * @param {Object|Function} sorce\n * @param {boolean} overlay\n */\nexport function mixin(target, source, overlay) {\n target = 'prototype' in target ? target.prototype : target;\n source = 'prototype' in source ? source.prototype : source;\n\n defaults(target, source, overlay);\n}\n\n/**\n * Consider typed array.\n * @param {Array|TypedArray} data\n */\nexport function isArrayLike(data) {\n if (!data) {\n return;\n }\n if (typeof data === 'string') {\n return false;\n }\n return typeof data.length === 'number';\n}\n\n/**\n * 数组或对象遍历\n * @memberOf module:zrender/core/util\n * @param {Object|Array} obj\n * @param {Function} cb\n * @param {*} [context]\n */\nexport function each(obj, cb, context) {\n if (!(obj && cb)) {\n return;\n }\n if (obj.forEach && obj.forEach === nativeForEach) {\n obj.forEach(cb, context);\n }\n else if (obj.length === +obj.length) {\n for (var i = 0, len = obj.length; i < len; i++) {\n cb.call(context, obj[i], i, obj);\n }\n }\n else {\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n cb.call(context, obj[key], key, obj);\n }\n }\n }\n}\n\n/**\n * 数组映射\n * @memberOf module:zrender/core/util\n * @param {Array} obj\n * @param {Function} cb\n * @param {*} [context]\n * @return {Array}\n */\nexport function map(obj, cb, context) {\n if (!(obj && cb)) {\n return;\n }\n if (obj.map && obj.map === nativeMap) {\n return obj.map(cb, context);\n }\n else {\n var result = [];\n for (var i = 0, len = obj.length; i < len; i++) {\n result.push(cb.call(context, obj[i], i, obj));\n }\n return result;\n }\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {Array} obj\n * @param {Function} cb\n * @param {Object} [memo]\n * @param {*} [context]\n * @return {Array}\n */\nexport function reduce(obj, cb, memo, context) {\n if (!(obj && cb)) {\n return;\n }\n if (obj.reduce && obj.reduce === nativeReduce) {\n return obj.reduce(cb, memo, context);\n }\n else {\n for (var i = 0, len = obj.length; i < len; i++) {\n memo = cb.call(context, memo, obj[i], i, obj);\n }\n return memo;\n }\n}\n\n/**\n * 数组过滤\n * @memberOf module:zrender/core/util\n * @param {Array} obj\n * @param {Function} cb\n * @param {*} [context]\n * @return {Array}\n */\nexport function filter(obj, cb, context) {\n if (!(obj && cb)) {\n return;\n }\n if (obj.filter && obj.filter === nativeFilter) {\n return obj.filter(cb, context);\n }\n else {\n var result = [];\n for (var i = 0, len = obj.length; i < len; i++) {\n if (cb.call(context, obj[i], i, obj)) {\n result.push(obj[i]);\n }\n }\n return result;\n }\n}\n\n/**\n * 数组项查找\n * @memberOf module:zrender/core/util\n * @param {Array} obj\n * @param {Function} cb\n * @param {*} [context]\n * @return {*}\n */\nexport function find(obj, cb, context) {\n if (!(obj && cb)) {\n return;\n }\n for (var i = 0, len = obj.length; i < len; i++) {\n if (cb.call(context, obj[i], i, obj)) {\n return obj[i];\n }\n }\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {Function} func\n * @param {*} context\n * @return {Function}\n */\nexport function bind(func, context) {\n var args = nativeSlice.call(arguments, 2);\n return function () {\n return func.apply(context, args.concat(nativeSlice.call(arguments)));\n };\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {Function} func\n * @return {Function}\n */\nexport function curry(func) {\n var args = nativeSlice.call(arguments, 1);\n return function () {\n return func.apply(this, args.concat(nativeSlice.call(arguments)));\n };\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {*} value\n * @return {boolean}\n */\nexport function isArray(value) {\n return objToString.call(value) === '[object Array]';\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {*} value\n * @return {boolean}\n */\nexport function isFunction(value) {\n return typeof value === 'function';\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {*} value\n * @return {boolean}\n */\nexport function isString(value) {\n return objToString.call(value) === '[object String]';\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {*} value\n * @return {boolean}\n */\nexport function isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return type === 'function' || (!!value && type === 'object');\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {*} value\n * @return {boolean}\n */\nexport function isBuiltInObject(value) {\n return !!BUILTIN_OBJECT[objToString.call(value)];\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {*} value\n * @return {boolean}\n */\nexport function isTypedArray(value) {\n return !!TYPED_ARRAY[objToString.call(value)];\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {*} value\n * @return {boolean}\n */\nexport function isDom(value) {\n return typeof value === 'object'\n && typeof value.nodeType === 'number'\n && typeof value.ownerDocument === 'object';\n}\n\n/**\n * Whether is exactly NaN. Notice isNaN('a') returns true.\n * @param {*} value\n * @return {boolean}\n */\nexport function eqNaN(value) {\n /* eslint-disable-next-line no-self-compare */\n return value !== value;\n}\n\n/**\n * If value1 is not null, then return value1, otherwise judget rest of values.\n * Low performance.\n * @memberOf module:zrender/core/util\n * @return {*} Final value\n */\nexport function retrieve(values) {\n for (var i = 0, len = arguments.length; i < len; i++) {\n if (arguments[i] != null) {\n return arguments[i];\n }\n }\n}\n\nexport function retrieve2(value0, value1) {\n return value0 != null\n ? value0\n : value1;\n}\n\nexport function retrieve3(value0, value1, value2) {\n return value0 != null\n ? value0\n : value1 != null\n ? value1\n : value2;\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {Array} arr\n * @param {number} startIndex\n * @param {number} endIndex\n * @return {Array}\n */\nexport function slice() {\n return Function.call.apply(nativeSlice, arguments);\n}\n\n/**\n * Normalize css liked array configuration\n * e.g.\n * 3 => [3, 3, 3, 3]\n * [4, 2] => [4, 2, 4, 2]\n * [4, 3, 2] => [4, 3, 2, 3]\n * @param {number|Array.<number>} val\n * @return {Array.<number>}\n */\nexport function normalizeCssArray(val) {\n if (typeof (val) === 'number') {\n return [val, val, val, val];\n }\n var len = val.length;\n if (len === 2) {\n // vertical | horizontal\n return [val[0], val[1], val[0], val[1]];\n }\n else if (len === 3) {\n // top | horizontal | bottom\n return [val[0], val[1], val[2], val[1]];\n }\n return val;\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {boolean} condition\n * @param {string} message\n */\nexport function assert(condition, message) {\n if (!condition) {\n throw new Error(message);\n }\n}\n\n/**\n * @memberOf module:zrender/core/util\n * @param {string} str string to be trimed\n * @return {string} trimed string\n */\nexport function trim(str) {\n if (str == null) {\n return null;\n }\n else if (typeof str.trim === 'function') {\n return str.trim();\n }\n else {\n return str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n }\n}\n\nvar primitiveKey = '__ec_primitive__';\n/**\n * Set an object as primitive to be ignored traversing children in clone or merge\n */\nexport function setAsPrimitive(obj) {\n obj[primitiveKey] = true;\n}\n\nexport function isPrimitive(obj) {\n return obj[primitiveKey];\n}\n\n/**\n * @constructor\n * @param {Object} obj Only apply `ownProperty`.\n */\nfunction HashMap(obj) {\n var isArr = isArray(obj);\n // Key should not be set on this, otherwise\n // methods get/set/... may be overrided.\n this.data = {};\n var thisMap = this;\n\n (obj instanceof HashMap)\n ? obj.each(visit)\n : (obj && each(obj, visit));\n\n function visit(value, key) {\n isArr ? thisMap.set(value, key) : thisMap.set(key, value);\n }\n}\n\nHashMap.prototype = {\n constructor: HashMap,\n // Do not provide `has` method to avoid defining what is `has`.\n // (We usually treat `null` and `undefined` as the same, different\n // from ES6 Map).\n get: function (key) {\n return this.data.hasOwnProperty(key) ? this.data[key] : null;\n },\n set: function (key, value) {\n // Comparing with invocation chaining, `return value` is more commonly\n // used in this case: `var someVal = map.set('a', genVal());`\n return (this.data[key] = value);\n },\n // Although util.each can be performed on this hashMap directly, user\n // should not use the exposed keys, who are prefixed.\n each: function (cb, context) {\n context !== void 0 && (cb = bind(cb, context));\n /* eslint-disable guard-for-in */\n for (var key in this.data) {\n this.data.hasOwnProperty(key) && cb(this.data[key], key);\n }\n /* eslint-enable guard-for-in */\n },\n // Do not use this method if performance sensitive.\n removeKey: function (key) {\n delete this.data[key];\n }\n};\n\nexport function createHashMap(obj) {\n return new HashMap(obj);\n}\n\nexport function concatArray(a, b) {\n var newArray = new a.constructor(a.length + b.length);\n for (var i = 0; i < a.length; i++) {\n newArray[i] = a[i];\n }\n var offset = a.length;\n for (i = 0; i < b.length; i++) {\n newArray[i + offset] = b[i];\n }\n return newArray;\n}\n\n\nexport function noop() {}\n","/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\nimport * as echarts from 'echarts';\nimport { clone } from 'zrender/src/core/util';\n\nexport default echarts.extendComponentView({\n type: 'bmap',\n\n render: function (bMapModel, ecModel, api) {\n var rendering = true;\n\n var bmap = bMapModel.getBMap();\n var viewportRoot = api.getZr().painter.getViewportRoot();\n var coordSys = bMapModel.coordinateSystem;\n var moveHandler = function (type, target) {\n if (rendering) {\n return;\n }\n var offsetEl = viewportRoot.parentNode.parentNode.parentNode;\n var mapOffset = [\n -parseInt(offsetEl.style.left, 10) || 0,\n -parseInt(offsetEl.style.top, 10) || 0\n ];\n viewportRoot.style.left = mapOffset[0] + 'px';\n viewportRoot.style.top = mapOffset[1] + 'px';\n\n coordSys.setMapOffset(mapOffset);\n bMapModel.__mapOffset = mapOffset;\n\n api.dispatchAction({\n type: 'bmapRoam'\n });\n };\n\n function zoomEndHandler() {\n if (rendering) {\n return;\n }\n api.dispatchAction({\n type: 'bmapRoam'\n });\n }\n\n bmap.removeEventListener('moving', this._oldMoveHandler);\n // FIXME\n // Moveend may be triggered by centerAndZoom method when creating coordSys next time\n // bmap.removeEventListener('moveend', this._oldMoveHandler);\n bmap.removeEventListener('zoomend', this._oldZoomEndHandler);\n bmap.addEventListener('moving', moveHandler);\n // bmap.addEventListener('moveend', moveHandler);\n bmap.addEventListener('zoomend', zoomEndHandler);\n\n this._oldMoveHandler = moveHandler;\n this._oldZoomEndHandler = zoomEndHandler;\n\n var roam = bMapModel.get('roam');\n if (roam && roam !== 'scale') {\n bmap.enableDragging();\n }\n else {\n bmap.disableDragging();\n }\n if (roam && roam !== 'move') {\n bmap.enableScrollWheelZoom();\n bmap.enableDoubleClickZoom();\n bmap.enablePinchToZoom();\n }\n else {\n bmap.disableScrollWheelZoom();\n bmap.disableDoubleClickZoom();\n bmap.disablePinchToZoom();\n }\n\n /* map 2.0 */\n var originalStyle = bMapModel.__mapStyle;\n\n var newMapStyle = bMapModel.get('mapStyle') || {};\n // FIXME, Not use JSON methods\n var mapStyleStr = JSON.stringify(newMapStyle);\n if (JSON.stringify(originalStyle) !== mapStyleStr) {\n // FIXME May have blank tile when dragging if setMapStyle\n if (Object.keys(newMapStyle).length) {\n bmap.setMapStyle(clone(newMapStyle));\n }\n bMapModel.__mapStyle = JSON.parse(mapStyleStr);\n }\n\n /* map 3.0 */\n var originalStyle2 = bMapModel.__mapStyle2;\n\n var newMapStyle2 = bMapModel.get('mapStyleV2') || {};\n // FIXME, Not use JSON methods\n var mapStyleStr2 = JSON.stringify(newMapStyle2);\n if (JSON.stringify(originalStyle2) !== mapStyleStr2) {\n // FIXME May have blank tile when dragging if setMapStyle\n if (Object.keys(newMapStyle2).length) {\n bmap.setMapStyleV2(clone(newMapStyle2));\n }\n bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);\n }\n\n rendering = false;\n }\n});","/*\n* Licensed to the Apache Software Foundation (ASF) under one\n* or more contributor license agreements. See the NOTICE file\n* distributed with this work for additional information\n* regarding copyright ownership. The ASF licenses this file\n* to you under the Apache License, Version 2.0 (the\n* \"License\"); you may not use this file except in compliance\n* with the License. You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing,\n* software distributed under the License is distributed on an\n* \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n* KIND, either express or implied. See the License for the\n* specific language governing permissions and limitations\n* under the License.\n*/\n\n/**\n * BMap component extension\n */\n\nimport * as echarts from 'echarts';\nimport BMapCoordSys from './BMapCoordSys';\n\nimport './BMapModel';\nimport './BMapView';\n\necharts.registerCoordinateSystem('bmap', BMapCoordSys);\n\n// Action\necharts.registerAction({\n type: 'bmapRoam',\n event: 'bmapRoam',\n update: 'updateLayout'\n}, function (payload, ecModel) {\n ecModel.eachComponent('bmap', function (bMapModel) {\n var bmap = bMapModel.getBMap();\n var center = bmap.getCenter();\n bMapModel.setCenterAndZoom([center.lng, center.lat], bmap.getZoom());\n });\n});\n\nexport var version = '1.0.0';\n"],"names":["graphic","matrix","zrUtil","echarts.extendComponentModel","echarts.extendComponentView","echarts.registerCoordinateSystem","echarts.registerAction"],"mappings":";;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;AAqBA,AAMA,SAAS,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE;IAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAClB,IAAI,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;;IAEzB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;;IAEhB,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;CACpD;;AAED,YAAY,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;;AAEnD,YAAY,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,IAAI,EAAE;IAC7C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;CACrB,CAAC;;AAE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,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;QAC9B,SAAS,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;KACxE,CAAC,CAAC;CACN,CAAC,CAAC;;AAEH,AAAO,IAAI,OAAO,GAAG,OAAO;;;;;;;;"}
|
|
@@ -19,4 +19,4 @@
|
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(t.bmap={},t.echarts)}(this,function(t,o){"use strict";function l(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(a
|
|
22
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("echarts")):"function"==typeof define&&define.amd?define(["exports","echarts"],e):e(t.bmap={},t.echarts)}(this,function(t,o){"use strict";function l(t,e){this._bmap=t,this.dimensions=["lng","lat"],this._mapOffset=[0,0],this._api=e,this._projection=new BMap.MercatorProjection}function n(i,a){return a=a||[0,0],o.util.map([0,1],function(t){var e=a[t],o=i[t]/2,n=[],r=[];return n[t]=e-o,r[t]=e+o,n[1-t]=r[1-t]=a[1-t],Math.abs(this.dataToPoint(n)[t]-this.dataToPoint(r)[t])},this)}var d;l.prototype.dimensions=["lng","lat"],l.prototype.setZoom=function(t){this._zoom=t},l.prototype.setCenter=function(t){this._center=this._projection.lngLatToPoint(new BMap.Point(t[0],t[1]))},l.prototype.setMapOffset=function(t){this._mapOffset=t},l.prototype.getBMap=function(){return this._bmap},l.prototype.dataToPoint=function(t){var e=new BMap.Point(t[0],t[1]),o=this._bmap.pointToOverlayPixel(e),n=this._mapOffset;return[o.x-n[0],o.y-n[1]]},l.prototype.pointToData=function(t){var e=this._mapOffset;return[(t=this._bmap.overlayPixelToPoint({x:t[0]+e[0],y:t[1]+e[1]})).lng,t.lat]},l.prototype.getViewRect=function(){var t=this._api;return new o.graphic.BoundingRect(0,0,t.getWidth(),t.getHeight())},l.prototype.getRoamTransform=function(){return o.matrix.create()},l.prototype.prepareCustoms=function(t){var e=this.getViewRect();return{coordSys:{type:"bmap",x:e.x,y:e.y,width:e.width,height:e.height},api:{coord:o.util.bind(this.dataToPoint,this),size:o.util.bind(n,this)}}},l.dimensions=l.prototype.dimensions,l.create=function(t,c){var m,f=c.getDom();t.eachComponent("bmap",function(t){var e=c.getZr().painter,o=e.getViewportRoot();if("undefined"==typeof BMap)throw new Error("BMap api is not loaded");if(d=d||function(){function t(t){this._root=t}return(t.prototype=new BMap.Overlay).initialize=function(t){return t.getPanes().labelPane.appendChild(this._root),this._root},t.prototype.draw=function(){},t}(),m)throw new Error("Only one bmap component can exist");if(!t.__bmap){var n=f.querySelector(".ec-extension-bmap");n&&(o.style.left="0px",o.style.top="0px",f.removeChild(n)),(n=document.createElement("div")).style.cssText="width:100%;height:100%",n.classList.add("ec-extension-bmap"),f.appendChild(n);var r=t.__bmap=new BMap.Map(n),i=new d(o);r.addOverlay(i),e.getViewportRootOffset=function(){return{offsetLeft:0,offsetTop:0}}}r=t.__bmap;var a=t.get("center"),p=t.get("zoom");if(a&&p){var s=new BMap.Point(a[0],a[1]);r.centerAndZoom(s,p)}(m=new l(r,c)).setMapOffset(t.__mapOffset||[0,0]),m.setZoom(p),m.setCenter(a),t.coordinateSystem=m}),t.eachSeries(function(t){"bmap"===t.get("coordinateSystem")&&(t.coordinateSystem=m)})},o.extendComponentModel({type:"bmap",getBMap:function(){return this.__bmap},setCenterAndZoom:function(t,e){this.option.center=t,this.option.zoom=e},centerOrZoomChanged:function(t,e){var o=this.option;return!(function(t,e){return t&&e&&t[0]===e[0]&&t[1]===e[1]}(t,o.center)&&e===o.zoom)},defaultOption:{center:[104.114129,37.550339],zoom:5,mapStyle:{},mapStyleV2:{},roam:!1}});var p={"[object Function]":1,"[object RegExp]":1,"[object Date]":1,"[object Error]":1,"[object CanvasGradient]":1,"[object CanvasPattern]":1,"[object Image]":1,"[object Canvas]":1},s={"[object Int8Array]":1,"[object Uint8Array]":1,"[object Uint8ClampedArray]":1,"[object Int16Array]":1,"[object Uint16Array]":1,"[object Int32Array]":1,"[object Uint32Array]":1,"[object Float32Array]":1,"[object Float64Array]":1},c=Object.prototype.toString;function h(t){if(null==t||"object"!=typeof t)return t;var e=t,o=c.call(t);if("[object Array]"===o){if(!m(t)){e=[];for(var n=0,r=t.length;n<r;n++)e[n]=h(t[n])}}else if(s[o]){if(!m(t)){var i=t.constructor;if(t.constructor.from)e=i.from(t);else{e=new i(t.length);for(n=0,r=t.length;n<r;n++)e[n]=h(t[n])}}}else if(!p[o]&&!m(t)&&!function(t){return"object"==typeof t&&"number"==typeof t.nodeType&&"object"==typeof t.ownerDocument}(t))for(var a in e={},t)t.hasOwnProperty(a)&&(e[a]=h(t[a]));return e}var e="__ec_primitive__";function m(t){return t[e]}o.extendComponentView({type:"bmap",render:function(r,t,i){function e(t,e){if(!a){var o=p.parentNode.parentNode.parentNode,n=[-parseInt(o.style.left,10)||0,-parseInt(o.style.top,10)||0];p.style.left=n[0]+"px",p.style.top=n[1]+"px",s.setMapOffset(n),r.__mapOffset=n,i.dispatchAction({type:"bmapRoam"})}}var a=!0,o=r.getBMap(),p=i.getZr().painter.getViewportRoot(),s=r.coordinateSystem;function n(){a||i.dispatchAction({type:"bmapRoam"})}o.removeEventListener("moving",this._oldMoveHandler),o.removeEventListener("zoomend",this._oldZoomEndHandler),o.addEventListener("moving",e),o.addEventListener("zoomend",n),this._oldMoveHandler=e,this._oldZoomEndHandler=n;var c=r.get("roam");c&&"scale"!==c?o.enableDragging():o.disableDragging(),c&&"move"!==c?(o.enableScrollWheelZoom(),o.enableDoubleClickZoom(),o.enablePinchToZoom()):(o.disableScrollWheelZoom(),o.disableDoubleClickZoom(),o.disablePinchToZoom());var m=r.__mapStyle,f=r.get("mapStyle")||{},l=JSON.stringify(f);JSON.stringify(m)!==l&&(Object.keys(f).length&&o.setMapStyle(h(f)),r.__mapStyle=JSON.parse(l));var d=r.__mapStyle2,y=r.get("mapStyleV2")||{},u=JSON.stringify(y);JSON.stringify(d)!==u&&(Object.keys(y).length&&o.setMapStyleV2(h(y)),r.__mapStyle2=JSON.parse(u)),a=!1}}),o.registerCoordinateSystem("bmap",l),o.registerAction({type:"bmapRoam",event:"bmapRoam",update:"updateLayout"},function(t,e){e.eachComponent("bmap",function(t){var e=t.getBMap(),o=e.getCenter();t.setCenterAndZoom([o.lng,o.lat],e.getZoom())})});t.version="1.0.0"});
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
var echarts = require("echarts");
|
|
22
22
|
|
|
23
|
+
var _util = require("zrender/lib/core/util");
|
|
24
|
+
|
|
25
|
+
var clone = _util.clone;
|
|
26
|
+
|
|
23
27
|
/*
|
|
24
28
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
25
29
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -110,7 +114,7 @@ var _default = echarts.extendComponentView({
|
|
|
110
114
|
if (JSON.stringify(originalStyle) !== mapStyleStr) {
|
|
111
115
|
// FIXME May have blank tile when dragging if setMapStyle
|
|
112
116
|
if (Object.keys(newMapStyle).length) {
|
|
113
|
-
bmap.setMapStyle(newMapStyle);
|
|
117
|
+
bmap.setMapStyle(clone(newMapStyle));
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
bMapModel.__mapStyle = JSON.parse(mapStyleStr);
|
|
@@ -126,7 +130,7 @@ var _default = echarts.extendComponentView({
|
|
|
126
130
|
if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
|
|
127
131
|
// FIXME May have blank tile when dragging if setMapStyle
|
|
128
132
|
if (Object.keys(newMapStyle2).length) {
|
|
129
|
-
bmap.setMapStyleV2(newMapStyle2);
|
|
133
|
+
bmap.setMapStyleV2(clone(newMapStyle2));
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import * as echarts from 'echarts';
|
|
21
|
+
import { clone } from 'zrender/src/core/util';
|
|
21
22
|
|
|
22
23
|
export default echarts.extendComponentView({
|
|
23
24
|
type: 'bmap',
|
|
@@ -96,7 +97,7 @@ export default echarts.extendComponentView({
|
|
|
96
97
|
if (JSON.stringify(originalStyle) !== mapStyleStr) {
|
|
97
98
|
// FIXME May have blank tile when dragging if setMapStyle
|
|
98
99
|
if (Object.keys(newMapStyle).length) {
|
|
99
|
-
bmap.setMapStyle(newMapStyle);
|
|
100
|
+
bmap.setMapStyle(clone(newMapStyle));
|
|
100
101
|
}
|
|
101
102
|
bMapModel.__mapStyle = JSON.parse(mapStyleStr);
|
|
102
103
|
}
|
|
@@ -110,7 +111,7 @@ export default echarts.extendComponentView({
|
|
|
110
111
|
if (JSON.stringify(originalStyle2) !== mapStyleStr2) {
|
|
111
112
|
// FIXME May have blank tile when dragging if setMapStyle
|
|
112
113
|
if (Object.keys(newMapStyle2).length) {
|
|
113
|
-
bmap.setMapStyleV2(newMapStyle2);
|
|
114
|
+
bmap.setMapStyleV2(clone(newMapStyle2));
|
|
114
115
|
}
|
|
115
116
|
bMapModel.__mapStyle2 = JSON.parse(mapStyleStr2);
|
|
116
117
|
}
|
package/lib/chart/bar/BarView.js
CHANGED
|
@@ -153,6 +153,7 @@ var _default = echarts.extendChartView({
|
|
|
153
153
|
var roundCap = seriesModel.get('roundCap', true);
|
|
154
154
|
var drawBackground = seriesModel.get('showBackground', true);
|
|
155
155
|
var backgroundModel = seriesModel.getModel('backgroundStyle');
|
|
156
|
+
var barBorderRadius = backgroundModel.get('barBorderRadius') || 0;
|
|
156
157
|
var bgEls = [];
|
|
157
158
|
var oldBgEls = this._backgroundEls || [];
|
|
158
159
|
data.diff(oldData).add(function (dataIndex) {
|
|
@@ -160,8 +161,14 @@ var _default = echarts.extendChartView({
|
|
|
160
161
|
var layout = getLayout[coord.type](data, dataIndex, itemModel);
|
|
161
162
|
|
|
162
163
|
if (drawBackground) {
|
|
163
|
-
var
|
|
164
|
-
bgEl
|
|
164
|
+
var bgLayout = getLayout[coord.type](data, dataIndex);
|
|
165
|
+
var bgEl = createBackgroundEl(coord, isHorizontalOrRadial, bgLayout);
|
|
166
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle()); // Only cartesian2d support borderRadius.
|
|
167
|
+
|
|
168
|
+
if (coord.type === 'cartesian2d') {
|
|
169
|
+
bgEl.setShape('r', barBorderRadius);
|
|
170
|
+
}
|
|
171
|
+
|
|
165
172
|
bgEls[dataIndex] = bgEl;
|
|
166
173
|
} // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
|
|
167
174
|
|
|
@@ -191,9 +198,15 @@ var _default = echarts.extendChartView({
|
|
|
191
198
|
|
|
192
199
|
if (drawBackground) {
|
|
193
200
|
var bgEl = oldBgEls[oldIndex];
|
|
194
|
-
bgEl.useStyle(backgroundModel.getBarItemStyle());
|
|
201
|
+
bgEl.useStyle(backgroundModel.getBarItemStyle()); // Only cartesian2d support borderRadius.
|
|
202
|
+
|
|
203
|
+
if (coord.type === 'cartesian2d') {
|
|
204
|
+
bgEl.setShape('r', barBorderRadius);
|
|
205
|
+
}
|
|
206
|
+
|
|
195
207
|
bgEls[newIndex] = bgEl;
|
|
196
|
-
var
|
|
208
|
+
var bgLayout = getLayout[coord.type](data, newIndex);
|
|
209
|
+
var shape = createBackgroundShape(isHorizontalOrRadial, bgLayout, coord);
|
|
197
210
|
graphic.updateProps(bgEl, {
|
|
198
211
|
shape: shape
|
|
199
212
|
}, animationModel, newIndex);
|
|
@@ -415,9 +428,11 @@ function removeSector(dataIndex, animationModel, el) {
|
|
|
415
428
|
}
|
|
416
429
|
|
|
417
430
|
var getLayout = {
|
|
431
|
+
// itemModel is only used to get borderWidth, which is not needed
|
|
432
|
+
// when calculating bar background layout.
|
|
418
433
|
cartesian2d: function (data, dataIndex, itemModel) {
|
|
419
434
|
var layout = data.getItemLayout(dataIndex);
|
|
420
|
-
var fixedLineWidth = getLineWidth(itemModel, layout); // fix layout with lineWidth
|
|
435
|
+
var fixedLineWidth = itemModel ? getLineWidth(itemModel, layout) : 0; // fix layout with lineWidth
|
|
421
436
|
|
|
422
437
|
var signX = layout.width > 0 ? 1 : -1;
|
|
423
438
|
var signY = layout.height > 0 ? 1 : -1;
|