echarts-rails 0.1.3 → 0.1.4

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.
@@ -137,6 +137,9 @@ return /******/ (function(modules) { // webpackBootstrap
137
137
  var IN_MAIN_PROCESS = '__flag_in_main_process';
138
138
  var HAS_GRADIENT_OR_PATTERN_BG = '_hasGradientOrPatternBg';
139
139
 
140
+
141
+ var OPTION_UPDATED = '_optionUpdated';
142
+
140
143
  function createRegisterEventWithLowercaseName(method) {
141
144
  return function (eventName, handler, context) {
142
145
  // Event name is all lowercase
@@ -252,10 +255,25 @@ return /******/ (function(modules) { // webpackBootstrap
252
255
  }
253
256
  timsort(visualFuncs, prioritySortFunc);
254
257
  timsort(dataProcessorFuncs, prioritySortFunc);
258
+
259
+ this._zr.animation.on('frame', this._onframe, this);
255
260
  }
256
261
 
257
262
  var echartsProto = ECharts.prototype;
258
263
 
264
+ echartsProto._onframe = function () {
265
+ // Lazy update
266
+ if (this[OPTION_UPDATED]) {
267
+
268
+ this[IN_MAIN_PROCESS] = true;
269
+
270
+ updateMethods.prepareAndUpdate.call(this);
271
+
272
+ this[IN_MAIN_PROCESS] = false;
273
+
274
+ this[OPTION_UPDATED] = false;
275
+ }
276
+ };
259
277
  /**
260
278
  * @return {HTMLDomElement}
261
279
  */
@@ -273,9 +291,9 @@ return /******/ (function(modules) { // webpackBootstrap
273
291
  /**
274
292
  * @param {Object} option
275
293
  * @param {boolean} notMerge
276
- * @param {boolean} [notRefreshImmediately=false] Useful when setOption frequently.
294
+ * @param {boolean} [lazyUpdate=false] Useful when setOption frequently.
277
295
  */
278
- echartsProto.setOption = function (option, notMerge, notRefreshImmediately) {
296
+ echartsProto.setOption = function (option, notMerge, lazyUpdate) {
279
297
  if (true) {
280
298
  zrUtil.assert(!this[IN_MAIN_PROCESS], '`setOption` should not be called during main process.');
281
299
  }
@@ -291,13 +309,18 @@ return /******/ (function(modules) { // webpackBootstrap
291
309
 
292
310
  this._model.setOption(option, optionPreprocessorFuncs);
293
311
 
294
- updateMethods.prepareAndUpdate.call(this);
312
+ if (lazyUpdate) {
313
+ this[OPTION_UPDATED] = true;
314
+ }
315
+ else {
316
+ updateMethods.prepareAndUpdate.call(this);
317
+ this._zr.refreshImmediately();
318
+ this[OPTION_UPDATED] = false;
319
+ }
295
320
 
296
321
  this[IN_MAIN_PROCESS] = false;
297
322
 
298
323
  this._flushPendingActions();
299
-
300
- !notRefreshImmediately && this._zr.refreshImmediately();
301
324
  };
302
325
 
303
326
  /**
@@ -318,7 +341,7 @@ return /******/ (function(modules) { // webpackBootstrap
318
341
  * @return {Object}
319
342
  */
320
343
  echartsProto.getOption = function () {
321
- return this._model.getOption();
344
+ return this._model && this._model.getOption();
322
345
  };
323
346
 
324
347
  /**
@@ -688,7 +711,6 @@ return /******/ (function(modules) { // webpackBootstrap
688
711
  this._flushPendingActions();
689
712
  };
690
713
 
691
- var defaultLoadingEffect = __webpack_require__(93);
692
714
  /**
693
715
  * Show loading effect
694
716
  * @param {string} [name='default']
@@ -697,10 +719,18 @@ return /******/ (function(modules) { // webpackBootstrap
697
719
  echartsProto.showLoading = function (name, cfg) {
698
720
  if (zrUtil.isObject(name)) {
699
721
  cfg = name;
700
- name = 'default';
722
+ name = '';
701
723
  }
724
+ name = name || 'default';
725
+
702
726
  this.hideLoading();
703
- var el = defaultLoadingEffect(this._api, cfg);
727
+ if (!loadingEffects[name]) {
728
+ if (true) {
729
+ console.warn('Loading effects ' + name + ' not exists.');
730
+ }
731
+ return;
732
+ }
733
+ var el = loadingEffects[name](this._api, cfg);
704
734
  var zr = this._zr;
705
735
  this._loadingFX = el;
706
736
 
@@ -785,8 +815,17 @@ return /******/ (function(modules) { // webpackBootstrap
785
815
  isHighlightOrDownplay && updateMethods[updateMethod].call(this, batchItem);
786
816
  }
787
817
 
788
- (updateMethod !== 'none' && !isHighlightOrDownplay)
789
- && updateMethods[updateMethod].call(this, payload);
818
+ if (updateMethod !== 'none' && !isHighlightOrDownplay) {
819
+ // Still dirty
820
+ if (this[OPTION_UPDATED]) {
821
+ // FIXME Pass payload ?
822
+ updateMethods.prepareAndUpdate.call(this, payload);
823
+ this[OPTION_UPDATED] = false;
824
+ }
825
+ else {
826
+ updateMethods[updateMethod].call(this, payload);
827
+ }
828
+ }
790
829
 
791
830
  // Follow the rule of action batch
792
831
  if (batched) {
@@ -1024,7 +1063,7 @@ return /******/ (function(modules) { // webpackBootstrap
1024
1063
  }
1025
1064
 
1026
1065
  var MOUSE_EVENT_NAMES = [
1027
- 'click', 'dblclick', 'mouseover', 'mouseout', 'mousedown', 'mouseup', 'globalout'
1066
+ 'click', 'dblclick', 'mouseover', 'mouseout', 'mousemove', 'mousedown', 'mouseup', 'globalout'
1028
1067
  ];
1029
1068
  /**
1030
1069
  * @private
@@ -1066,7 +1105,7 @@ return /******/ (function(modules) { // webpackBootstrap
1066
1105
  * Clear
1067
1106
  */
1068
1107
  echartsProto.clear = function () {
1069
- this.setOption({}, true);
1108
+ this.setOption({ series: [] }, true);
1070
1109
  };
1071
1110
  /**
1072
1111
  * Dispose instance
@@ -1207,6 +1246,10 @@ return /******/ (function(modules) { // webpackBootstrap
1207
1246
  * @type {Object.<key, Object>}
1208
1247
  */
1209
1248
  var themeStorage = {};
1249
+ /**
1250
+ * Loading effects
1251
+ */
1252
+ var loadingEffects = {};
1210
1253
 
1211
1254
 
1212
1255
  var instances = {};
@@ -1222,9 +1265,9 @@ return /******/ (function(modules) { // webpackBootstrap
1222
1265
  /**
1223
1266
  * @type {number}
1224
1267
  */
1225
- version: '3.2.2',
1268
+ version: '3.2.3',
1226
1269
  dependencies: {
1227
- zrender: '3.1.2'
1270
+ zrender: '3.1.3'
1228
1271
  }
1229
1272
  };
1230
1273
 
@@ -1446,7 +1489,7 @@ return /******/ (function(modules) { // webpackBootstrap
1446
1489
  * Most visual encoding like color are common for different chart
1447
1490
  * But each chart has it's own layout algorithm
1448
1491
  *
1449
- * @param {string} [priority=1000]
1492
+ * @param {number} [priority=1000]
1450
1493
  * @param {Function} layoutFunc
1451
1494
  */
1452
1495
  echarts.registerLayout = function (priority, layoutFunc) {
@@ -1467,7 +1510,7 @@ return /******/ (function(modules) { // webpackBootstrap
1467
1510
  };
1468
1511
 
1469
1512
  /**
1470
- * @param {string} [priority=3000]
1513
+ * @param {number} [priority=3000]
1471
1514
  * @param {Function} visualFunc
1472
1515
  */
1473
1516
  echarts.registerVisual = function (priority, visualFunc) {
@@ -1486,6 +1529,14 @@ return /******/ (function(modules) { // webpackBootstrap
1486
1529
  });
1487
1530
  };
1488
1531
 
1532
+ /**
1533
+ * @param {string} name
1534
+ */
1535
+ echarts.registerLoading = function (name, loadingFx) {
1536
+ loadingEffects[name] = loadingFx;
1537
+ };
1538
+
1539
+
1489
1540
  var parseClassType = ComponentModel.parseClassType;
1490
1541
  /**
1491
1542
  * @param {Object} opts
@@ -1538,7 +1589,7 @@ return /******/ (function(modules) { // webpackBootstrap
1538
1589
  var classType = parseClassType(superClass);
1539
1590
  Clazz = ChartView.getClass(classType.main, true);
1540
1591
  }
1541
- return ChartView.extend(opts);
1592
+ return Clazz.extend(opts);
1542
1593
  };
1543
1594
 
1544
1595
  /**
@@ -1561,8 +1612,9 @@ return /******/ (function(modules) { // webpackBootstrap
1561
1612
  zrUtil.createCanvas = creator;
1562
1613
  };
1563
1614
 
1564
- echarts.registerVisual(PRIORITY_VISUAL_GLOBAL, __webpack_require__(94));
1565
- echarts.registerPreprocessor(__webpack_require__(95));
1615
+ echarts.registerVisual(PRIORITY_VISUAL_GLOBAL, __webpack_require__(93));
1616
+ echarts.registerPreprocessor(__webpack_require__(94));
1617
+ echarts.registerLoading('default', __webpack_require__(96));
1566
1618
 
1567
1619
  // Default action
1568
1620
  echarts.registerAction({
@@ -1884,6 +1936,8 @@ return /******/ (function(modules) { // webpackBootstrap
1884
1936
  newCptTypes, ComponentModel.getAllClassMainTypes(), visitComponent, this
1885
1937
  );
1886
1938
 
1939
+ this._seriesIndices = this._seriesIndices || [];
1940
+
1887
1941
  function visitComponent(mainType, dependencies) {
1888
1942
  var newCptOptionList = modelUtil.normalizeToArray(newOption[mainType]);
1889
1943
 
@@ -2053,6 +2107,10 @@ return /******/ (function(modules) { // webpackBootstrap
2053
2107
  || (!isNameArray && cpt.name === name);
2054
2108
  });
2055
2109
  }
2110
+ else {
2111
+ // Return all components with mainType
2112
+ result = cpts;
2113
+ }
2056
2114
 
2057
2115
  return filterBySubType(result, condition);
2058
2116
  },
@@ -3015,60 +3073,8 @@ return /******/ (function(modules) { // webpackBootstrap
3015
3073
  var Model = __webpack_require__(12);
3016
3074
  var zrUtil = __webpack_require__(4);
3017
3075
 
3018
- var AXIS_DIMS = ['x', 'y', 'z', 'radius', 'angle'];
3019
-
3020
3076
  var modelUtil = {};
3021
3077
 
3022
- /**
3023
- * Create "each" method to iterate names.
3024
- *
3025
- * @pubilc
3026
- * @param {Array.<string>} names
3027
- * @param {Array.<string>=} attrs
3028
- * @return {Function}
3029
- */
3030
- modelUtil.createNameEach = function (names, attrs) {
3031
- names = names.slice();
3032
- var capitalNames = zrUtil.map(names, modelUtil.capitalFirst);
3033
- attrs = (attrs || []).slice();
3034
- var capitalAttrs = zrUtil.map(attrs, modelUtil.capitalFirst);
3035
-
3036
- return function (callback, context) {
3037
- zrUtil.each(names, function (name, index) {
3038
- var nameObj = {name: name, capital: capitalNames[index]};
3039
-
3040
- for (var j = 0; j < attrs.length; j++) {
3041
- nameObj[attrs[j]] = name + capitalAttrs[j];
3042
- }
3043
-
3044
- callback.call(context, nameObj);
3045
- });
3046
- };
3047
- };
3048
-
3049
- /**
3050
- * @public
3051
- */
3052
- modelUtil.capitalFirst = function (str) {
3053
- return str ? str.charAt(0).toUpperCase() + str.substr(1) : str;
3054
- };
3055
-
3056
- /**
3057
- * Iterate each dimension name.
3058
- *
3059
- * @public
3060
- * @param {Function} callback The parameter is like:
3061
- * {
3062
- * name: 'angle',
3063
- * capital: 'Angle',
3064
- * axis: 'angleAxis',
3065
- * axisIndex: 'angleAixs',
3066
- * index: 'angleIndex'
3067
- * }
3068
- * @param {Object} context
3069
- */
3070
- modelUtil.eachAxisDim = modelUtil.createNameEach(AXIS_DIMS, ['axisIndex', 'axis', 'index']);
3071
-
3072
3078
  /**
3073
3079
  * If value is not array, then translate it to array.
3074
3080
  * @param {*} value
@@ -3082,76 +3088,6 @@ return /******/ (function(modules) { // webpackBootstrap
3082
3088
  : [value];
3083
3089
  };
3084
3090
 
3085
- /**
3086
- * If tow dataZoomModels has the same axis controlled, we say that they are 'linked'.
3087
- * dataZoomModels and 'links' make up one or more graphics.
3088
- * This function finds the graphic where the source dataZoomModel is in.
3089
- *
3090
- * @public
3091
- * @param {Function} forEachNode Node iterator.
3092
- * @param {Function} forEachEdgeType edgeType iterator
3093
- * @param {Function} edgeIdGetter Giving node and edgeType, return an array of edge id.
3094
- * @return {Function} Input: sourceNode, Output: Like {nodes: [], dims: {}}
3095
- */
3096
- modelUtil.createLinkedNodesFinder = function (forEachNode, forEachEdgeType, edgeIdGetter) {
3097
-
3098
- return function (sourceNode) {
3099
- var result = {
3100
- nodes: [],
3101
- records: {} // key: edgeType.name, value: Object (key: edge id, value: boolean).
3102
- };
3103
-
3104
- forEachEdgeType(function (edgeType) {
3105
- result.records[edgeType.name] = {};
3106
- });
3107
-
3108
- if (!sourceNode) {
3109
- return result;
3110
- }
3111
-
3112
- absorb(sourceNode, result);
3113
-
3114
- var existsLink;
3115
- do {
3116
- existsLink = false;
3117
- forEachNode(processSingleNode);
3118
- }
3119
- while (existsLink);
3120
-
3121
- function processSingleNode(node) {
3122
- if (!isNodeAbsorded(node, result) && isLinked(node, result)) {
3123
- absorb(node, result);
3124
- existsLink = true;
3125
- }
3126
- }
3127
-
3128
- return result;
3129
- };
3130
-
3131
- function isNodeAbsorded(node, result) {
3132
- return zrUtil.indexOf(result.nodes, node) >= 0;
3133
- }
3134
-
3135
- function isLinked(node, result) {
3136
- var hasLink = false;
3137
- forEachEdgeType(function (edgeType) {
3138
- zrUtil.each(edgeIdGetter(node, edgeType) || [], function (edgeId) {
3139
- result.records[edgeType.name][edgeId] && (hasLink = true);
3140
- });
3141
- });
3142
- return hasLink;
3143
- }
3144
-
3145
- function absorb(node, result) {
3146
- result.nodes.push(node);
3147
- forEachEdgeType(function (edgeType) {
3148
- zrUtil.each(edgeIdGetter(node, edgeType) || [], function (edgeId) {
3149
- result.records[edgeType.name][edgeId] = true;
3150
- });
3151
- });
3152
- }
3153
- };
3154
-
3155
3091
  /**
3156
3092
  * Sync default option between normal and emphasis like `position` and `show`
3157
3093
  * In case some one will write code like
@@ -3375,22 +3311,31 @@ return /******/ (function(modules) { // webpackBootstrap
3375
3311
  return;
3376
3312
  }
3377
3313
 
3314
+ // id has highest priority.
3315
+ for (var i = 0; i < result.length; i++) {
3316
+ if (!result[i].option // Consider name: two map to one.
3317
+ && cptOption.id != null
3318
+ && result[i].exist.id === cptOption.id + ''
3319
+ ) {
3320
+ result[i].option = cptOption;
3321
+ newCptOptions[index] = null;
3322
+ return;
3323
+ }
3324
+ }
3325
+
3378
3326
  for (var i = 0; i < result.length; i++) {
3379
3327
  var exist = result[i].exist;
3380
3328
  if (!result[i].option // Consider name: two map to one.
3381
- && (
3382
- // id has highest priority.
3383
- (cptOption.id != null && exist.id === cptOption.id + '')
3384
- || (cptOption.name != null
3385
- && !modelUtil.isIdInner(cptOption)
3386
- && !modelUtil.isIdInner(exist)
3387
- && exist.name === cptOption.name + ''
3388
- )
3389
- )
3329
+ // Can not match when both ids exist but different.
3330
+ && (exist.id == null || cptOption.id == null)
3331
+ && cptOption.name != null
3332
+ && !modelUtil.isIdInner(cptOption)
3333
+ && !modelUtil.isIdInner(exist)
3334
+ && exist.name === cptOption.name + ''
3390
3335
  ) {
3391
3336
  result[i].option = cptOption;
3392
3337
  newCptOptions[index] = null;
3393
- break;
3338
+ return;
3394
3339
  }
3395
3340
  }
3396
3341
  });
@@ -3503,28 +3448,29 @@ return /******/ (function(modules) { // webpackBootstrap
3503
3448
  var numberUtil = __webpack_require__(7);
3504
3449
  var textContain = __webpack_require__(8);
3505
3450
 
3451
+ var formatUtil = {};
3506
3452
  /**
3507
3453
  * 每三位默认加,格式化
3508
3454
  * @type {string|number} x
3509
3455
  */
3510
- function addCommas(x) {
3456
+ formatUtil.addCommas = function (x) {
3511
3457
  if (isNaN(x)) {
3512
3458
  return '-';
3513
3459
  }
3514
3460
  x = (x + '').split('.');
3515
3461
  return x[0].replace(/(\d{1,3})(?=(?:\d{3})+(?!\d))/g,'$1,')
3516
3462
  + (x.length > 1 ? ('.' + x[1]) : '');
3517
- }
3463
+ };
3518
3464
 
3519
3465
  /**
3520
3466
  * @param {string} str
3521
3467
  * @return {string} str
3522
3468
  */
3523
- function toCamelCase(str) {
3469
+ formatUtil.toCamelCase = function (str) {
3524
3470
  return str.toLowerCase().replace(/-(.)/g, function(match, group1) {
3525
3471
  return group1.toUpperCase();
3526
3472
  });
3527
- }
3473
+ };
3528
3474
 
3529
3475
  /**
3530
3476
  * Normalize css liked array configuration
@@ -3534,7 +3480,7 @@ return /******/ (function(modules) { // webpackBootstrap
3534
3480
  * [4, 3, 2] => [4, 3, 2, 3]
3535
3481
  * @param {number|Array.<number>} val
3536
3482
  */
3537
- function normalizeCssArray(val) {
3483
+ formatUtil.normalizeCssArray = function (val) {
3538
3484
  var len = val.length;
3539
3485
  if (typeof (val) === 'number') {
3540
3486
  return [val, val, val, val];
@@ -3548,29 +3494,30 @@ return /******/ (function(modules) { // webpackBootstrap
3548
3494
  return [val[0], val[1], val[2], val[1]];
3549
3495
  }
3550
3496
  return val;
3551
- }
3497
+ };
3552
3498
 
3553
- function encodeHTML(source) {
3499
+ formatUtil.encodeHTML = function (source) {
3554
3500
  return String(source)
3555
3501
  .replace(/&/g, '&amp;')
3556
3502
  .replace(/</g, '&lt;')
3557
3503
  .replace(/>/g, '&gt;')
3558
3504
  .replace(/"/g, '&quot;')
3559
3505
  .replace(/'/g, '&#39;');
3560
- }
3506
+ };
3561
3507
 
3562
3508
  var TPL_VAR_ALIAS = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
3563
3509
 
3564
- function wrapVar(varName, seriesIdx) {
3510
+ var wrapVar = function (varName, seriesIdx) {
3565
3511
  return '{' + varName + (seriesIdx == null ? '' : seriesIdx) + '}';
3566
- }
3512
+ };
3513
+
3567
3514
  /**
3568
3515
  * Template formatter
3569
3516
  * @param {string} tpl
3570
3517
  * @param {Array.<Object>|Object} paramsList
3571
3518
  * @return {string}
3572
3519
  */
3573
- function formatTpl(tpl, paramsList) {
3520
+ formatUtil.formatTpl = function (tpl, paramsList) {
3574
3521
  if (!zrUtil.isArray(paramsList)) {
3575
3522
  paramsList = [paramsList];
3576
3523
  }
@@ -3594,7 +3541,17 @@ return /******/ (function(modules) { // webpackBootstrap
3594
3541
  }
3595
3542
 
3596
3543
  return tpl;
3597
- }
3544
+ };
3545
+
3546
+
3547
+ /**
3548
+ * @param {string} str
3549
+ * @return {string}
3550
+ * @inner
3551
+ */
3552
+ var s2d = function (str) {
3553
+ return str < 10 ? ('0' + str) : str;
3554
+ };
3598
3555
 
3599
3556
  /**
3600
3557
  * ISO Date format
@@ -3602,7 +3559,7 @@ return /******/ (function(modules) { // webpackBootstrap
3602
3559
  * @param {number} value
3603
3560
  * @inner
3604
3561
  */
3605
- function formatTime(tpl, value) {
3562
+ formatUtil.formatTime = function (tpl, value) {
3606
3563
  if (tpl === 'week'
3607
3564
  || tpl === 'month'
3608
3565
  || tpl === 'quarter'
@@ -3634,33 +3591,20 @@ return /******/ (function(modules) { // webpackBootstrap
3634
3591
  .replace('s', s);
3635
3592
 
3636
3593
  return tpl;
3637
- }
3594
+ };
3638
3595
 
3639
3596
  /**
3597
+ * Capital first
3640
3598
  * @param {string} str
3641
3599
  * @return {string}
3642
- * @inner
3643
3600
  */
3644
- function s2d(str) {
3645
- return str < 10 ? ('0' + str) : str;
3646
- }
3647
-
3648
- module.exports = {
3649
-
3650
- normalizeCssArray: normalizeCssArray,
3651
-
3652
- addCommas: addCommas,
3653
-
3654
- toCamelCase: toCamelCase,
3655
-
3656
- encodeHTML: encodeHTML,
3657
-
3658
- formatTpl: formatTpl,
3601
+ formatUtil.capitalFirst = function (str) {
3602
+ return str ? str.charAt(0).toUpperCase() + str.substr(1) : str;
3603
+ };
3659
3604
 
3660
- formatTime: formatTime,
3605
+ formatUtil.truncateText = textContain.truncateText;
3661
3606
 
3662
- truncateText: textContain.truncateText
3663
- };
3607
+ module.exports = formatUtil;
3664
3608
 
3665
3609
 
3666
3610
  /***/ },
@@ -3775,9 +3719,12 @@ return /******/ (function(modules) { // webpackBootstrap
3775
3719
  * @param {number} x
3776
3720
  * @return {number}
3777
3721
  */
3778
- number.round = function (x) {
3722
+ number.round = function (x, precision) {
3723
+ if (precision == null) {
3724
+ precision = 10;
3725
+ }
3779
3726
  // PENDING
3780
- return +(+x).toFixed(10);
3727
+ return +(+x).toFixed(precision);
3781
3728
  };
3782
3729
 
3783
3730
  number.asc = function (arr) {
@@ -3809,6 +3756,15 @@ return /******/ (function(modules) { // webpackBootstrap
3809
3756
  return count;
3810
3757
  };
3811
3758
 
3759
+ number.getPrecisionSafe = function (val) {
3760
+ var str = val.toString();
3761
+ var dotIndex = str.indexOf('.');
3762
+ if (dotIndex < 0) {
3763
+ return 0;
3764
+ }
3765
+ return str.length - 1 - dotIndex;
3766
+ };
3767
+
3812
3768
  /**
3813
3769
  * @param {Array.<number>} dataExtent
3814
3770
  * @param {Array.<number>} pixelExtent
@@ -3848,17 +3804,23 @@ return /******/ (function(modules) { // webpackBootstrap
3848
3804
 
3849
3805
  /**
3850
3806
  * @param {string|Date|number} value
3851
- * @return {number} timestamp
3807
+ * @return {Date} date
3852
3808
  */
3853
3809
  number.parseDate = function (value) {
3854
- return value instanceof Date
3855
- ? value
3856
- : new Date(
3857
- typeof value === 'string'
3858
- // FIXME Date.parse('1970-01-01') is UTC, Date.parse('1970/01/01') is local
3859
- ? (new Date(value.replace(/-/g, '/')) - new Date('1970/01/01'))
3860
- : Math.round(value)
3861
- );
3810
+ if (value instanceof Date) {
3811
+ return value;
3812
+ }
3813
+ else if (typeof value === 'string') {
3814
+ // Treat as ISO format. See issue #3623
3815
+ var ret = new Date(value);
3816
+ if (isNaN(+ret)) {
3817
+ // FIXME new Date('1970-01-01') is UTC, new Date('1970/01/01') is local
3818
+ ret = new Date(new Date(value.replace(/-/g, '/')) - new Date('1970/01/01'));
3819
+ }
3820
+ return ret;
3821
+ }
3822
+
3823
+ return new Date(Math.round(value));
3862
3824
  };
3863
3825
 
3864
3826
  /**
@@ -4898,7 +4860,8 @@ return /******/ (function(modules) { // webpackBootstrap
4898
4860
  */
4899
4861
  getShallow: function (key, ignoreParent) {
4900
4862
  var option = this.option;
4901
- var val = option && option[key];
4863
+
4864
+ var val = option == null ? option : option[key];
4902
4865
  var parentModel = this.parentModel;
4903
4866
  if (val == null && parentModel && !ignoreParent) {
4904
4867
  val = parentModel.getShallow(key);
@@ -5197,7 +5160,7 @@ return /******/ (function(modules) { // webpackBootstrap
5197
5160
  getLineDash: function () {
5198
5161
  var lineType = this.get('type');
5199
5162
  return (lineType === 'solid' || lineType == null) ? null
5200
- : (lineType === 'dashed' ? [5, 5] : [1, 1]);
5163
+ : (lineType === 'dashed' ? [5, 5] : [2, 2]);
5201
5164
  }
5202
5165
  };
5203
5166
 
@@ -6167,7 +6130,7 @@ return /******/ (function(modules) { // webpackBootstrap
6167
6130
  color: ['#c23531','#2f4554', '#61a0a8', '#d48265', '#91c7ae','#749f83', '#ca8622', '#bda29a','#6e7074', '#546570', '#c4ccd3'],
6168
6131
 
6169
6132
  // 默认需要 Grid 配置项
6170
- grid: {},
6133
+ // grid: {},
6171
6134
  // 主题,主题
6172
6135
  textStyle: {
6173
6136
  // color: '#000',
@@ -8121,16 +8084,19 @@ return /******/ (function(modules) { // webpackBootstrap
8121
8084
  */
8122
8085
  transformableProto.setTransform = function (ctx) {
8123
8086
  var m = this.transform;
8087
+ var dpr = ctx.dpr || 1;
8124
8088
  if (m) {
8125
- ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
8089
+ ctx.setTransform(dpr * m[0], dpr * m[1], dpr * m[2], dpr * m[3], dpr * m[4], dpr * m[5]);
8090
+ }
8091
+ else {
8092
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
8126
8093
  }
8127
8094
  };
8128
8095
 
8129
8096
  transformableProto.restoreTransform = function (ctx) {
8130
- var m = this.invTransform;
8131
- if (m) {
8132
- ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
8133
- }
8097
+ var m = this.transform;
8098
+ var dpr = ctx.dpr || 1;
8099
+ ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
8134
8100
  }
8135
8101
 
8136
8102
  var tmpTransform = [];
@@ -8817,7 +8783,11 @@ return /******/ (function(modules) { // webpackBootstrap
8817
8783
  // kf1-----kf2---------current--------kf3
8818
8784
  // find kf2 and kf3 and do interpolation
8819
8785
  var frame;
8820
- if (percent < lastFramePercent) {
8786
+ // In the easing function like elasticOut, percent may less than 0
8787
+ if (percent < 0) {
8788
+ frame = 0;
8789
+ }
8790
+ else if (percent < lastFramePercent) {
8821
8791
  // Start from next key
8822
8792
  // PENDING start from lastFrame ?
8823
8793
  start = Math.min(lastFrame + 1, trackLen - 1);
@@ -9172,15 +9142,15 @@ return /******/ (function(modules) { // webpackBootstrap
9172
9142
 
9173
9143
  constructor: Clip,
9174
9144
 
9175
- step: function (time) {
9145
+ step: function (globalTime) {
9176
9146
  // Set startTime on first step, or _startTime may has milleseconds different between clips
9177
9147
  // PENDING
9178
9148
  if (!this._initialized) {
9179
- this._startTime = new Date().getTime() + this._delay;
9149
+ this._startTime = globalTime + this._delay;
9180
9150
  this._initialized = true;
9181
9151
  }
9182
9152
 
9183
- var percent = (time - this._startTime) / this._life;
9153
+ var percent = (globalTime - this._startTime) / this._life;
9184
9154
 
9185
9155
  // 还没开始
9186
9156
  if (percent < 0) {
@@ -9200,7 +9170,7 @@ return /******/ (function(modules) { // webpackBootstrap
9200
9170
  // 结束
9201
9171
  if (percent == 1) {
9202
9172
  if (this.loop) {
9203
- this.restart();
9173
+ this.restart (globalTime);
9204
9174
  // 重新开始周期
9205
9175
  // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
9206
9176
  return 'restart';
@@ -9215,10 +9185,9 @@ return /******/ (function(modules) { // webpackBootstrap
9215
9185
  return null;
9216
9186
  },
9217
9187
 
9218
- restart: function() {
9219
- var time = new Date().getTime();
9220
- var remainder = (time - this._startTime) % this._life;
9221
- this._startTime = new Date().getTime() - remainder + this.gap;
9188
+ restart: function (globalTime) {
9189
+ var remainder = (globalTime - this._startTime) % this._life;
9190
+ this._startTime = globalTime - remainder + this.gap;
9222
9191
 
9223
9192
  this._needsRemove = false;
9224
9193
  },
@@ -11194,6 +11163,7 @@ return /******/ (function(modules) { // webpackBootstrap
11194
11163
  transform = matrix.create();
11195
11164
  }
11196
11165
  matrix.mul(transform, m, transform);
11166
+ this.dirty(true);
11197
11167
  };
11198
11168
 
11199
11169
  return opts;
@@ -12043,25 +12013,42 @@ return /******/ (function(modules) { // webpackBootstrap
12043
12013
  textVerticalAlign: null,
12044
12014
 
12045
12015
  /**
12016
+ * Only useful in Path and Image element
12046
12017
  * @type {number}
12047
12018
  */
12048
12019
  textDistance: 5,
12049
12020
 
12050
12021
  /**
12022
+ * Only useful in Path and Image element
12051
12023
  * @type {number}
12052
12024
  */
12053
12025
  textShadowBlur: 0,
12054
12026
 
12055
12027
  /**
12028
+ * Only useful in Path and Image element
12056
12029
  * @type {number}
12057
12030
  */
12058
12031
  textShadowOffsetX: 0,
12059
12032
 
12060
12033
  /**
12034
+ * Only useful in Path and Image element
12061
12035
  * @type {number}
12062
12036
  */
12063
12037
  textShadowOffsetY: 0,
12064
12038
 
12039
+ /**
12040
+ * If transform text
12041
+ * Only useful in Path and Image element
12042
+ * @type {boolean}
12043
+ */
12044
+ textTransform: false,
12045
+
12046
+ /**
12047
+ * Text rotate around position of Path or Image
12048
+ * Only useful in Path and Image element and textTransform is false.
12049
+ */
12050
+ textRotation: 0,
12051
+
12065
12052
  /**
12066
12053
  * @type {string}
12067
12054
  * https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
@@ -12214,10 +12201,6 @@ return /******/ (function(modules) { // webpackBootstrap
12214
12201
  return value;
12215
12202
  }
12216
12203
 
12217
- function setTransform(ctx, m) {
12218
- ctx.transform(m[0], m[1], m[2], m[3], m[4], m[5]);
12219
- }
12220
-
12221
12204
  RectText.prototype = {
12222
12205
 
12223
12206
  constructor: RectText,
@@ -12253,10 +12236,15 @@ return /******/ (function(modules) { // webpackBootstrap
12253
12236
 
12254
12237
  // Transform rect to view space
12255
12238
  var transform = this.transform;
12256
- if (transform) {
12257
- tmpRect.copy(rect);
12258
- tmpRect.applyTransform(transform);
12259
- rect = tmpRect;
12239
+ if (!style.textTransform) {
12240
+ if (transform) {
12241
+ tmpRect.copy(rect);
12242
+ tmpRect.applyTransform(transform);
12243
+ rect = tmpRect;
12244
+ }
12245
+ }
12246
+ else {
12247
+ this.setTransform(ctx);
12260
12248
  }
12261
12249
 
12262
12250
  // Text position represented by coord
@@ -12302,7 +12290,9 @@ return /******/ (function(modules) { // webpackBootstrap
12302
12290
  var textStroke = style.textStroke;
12303
12291
  textFill && (ctx.fillStyle = textFill);
12304
12292
  textStroke && (ctx.strokeStyle = textStroke);
12305
- ctx.font = font;
12293
+
12294
+ // TODO Invalid font
12295
+ ctx.font = font || '12px sans-serif';
12306
12296
 
12307
12297
  // Text shadow
12308
12298
  // Always set shadowBlur and shadowOffset to avoid leak from displayable
@@ -12312,6 +12302,13 @@ return /******/ (function(modules) { // webpackBootstrap
12312
12302
  ctx.shadowOffsetY = style.textShadowOffsetY;
12313
12303
 
12314
12304
  var textLines = text.split('\n');
12305
+
12306
+ if (style.textRotation) {
12307
+ transform && ctx.translate(transform[4], transform[5]);
12308
+ ctx.rotate(style.textRotation);
12309
+ transform && ctx.translate(-transform[4], -transform[5]);
12310
+ }
12311
+
12315
12312
  for (var i = 0; i < textLines.length; i++) {
12316
12313
  textFill && ctx.fillText(textLines[i], x, y);
12317
12314
  textStroke && ctx.strokeText(textLines[i], x, y);
@@ -12431,10 +12428,13 @@ return /******/ (function(modules) { // webpackBootstrap
12431
12428
  * @return {module:zrender/core/PathProxy}
12432
12429
  */
12433
12430
  beginPath: function (ctx) {
12431
+
12434
12432
  this._ctx = ctx;
12435
12433
 
12436
12434
  ctx && ctx.beginPath();
12437
12435
 
12436
+ ctx && (this.dpr = ctx.dpr);
12437
+
12438
12438
  // Reset
12439
12439
  this._len = 0;
12440
12440
 
@@ -14731,7 +14731,6 @@ return /******/ (function(modules) { // webpackBootstrap
14731
14731
 
14732
14732
  // Must bind each time
14733
14733
  style.bind(ctx, this, prevEl);
14734
-
14735
14734
  // style.image is a url string
14736
14735
  if (typeof src === 'string') {
14737
14736
  image = this._image;
@@ -15104,7 +15103,8 @@ return /******/ (function(modules) { // webpackBootstrap
15104
15103
  textBaseline = style.textBaseline;
15105
15104
  }
15106
15105
 
15107
- ctx.font = font;
15106
+ // TODO Invalid font
15107
+ ctx.font = font || '12px sans-serif';
15108
15108
  ctx.textAlign = textAlign || 'left';
15109
15109
  // Use canvas default left textAlign. Giving invalid value will cause state not change
15110
15110
  if (ctx.textAlign !== textAlign) {
@@ -15204,7 +15204,6 @@ return /******/ (function(modules) { // webpackBootstrap
15204
15204
  * @module zrender/graphic/shape/Sector
15205
15205
  */
15206
15206
 
15207
- // FIXME clockwise seems wrong
15208
15207
 
15209
15208
 
15210
15209
  module.exports = __webpack_require__(45).extend({
@@ -16181,7 +16180,7 @@ return /******/ (function(modules) { // webpackBootstrap
16181
16180
  /**
16182
16181
  * @type {string}
16183
16182
  */
16184
- zrender.version = '3.1.2';
16183
+ zrender.version = '3.1.3';
16185
16184
 
16186
16185
  /**
16187
16186
  * Initializing a zrender instance
@@ -17165,7 +17164,7 @@ return /******/ (function(modules) { // webpackBootstrap
17165
17164
  if (el instanceof Group) {
17166
17165
  el.__storage = this;
17167
17166
  }
17168
- el.dirty();
17167
+ el.dirty(false);
17169
17168
 
17170
17169
  this._elements[el.id] = el;
17171
17170
 
@@ -17949,7 +17948,13 @@ return /******/ (function(modules) { // webpackBootstrap
17949
17948
 
17950
17949
  this._running = false;
17951
17950
 
17952
- this._time = 0;
17951
+ this._time;
17952
+
17953
+ this._pausedTime;
17954
+
17955
+ this._pauseStart;
17956
+
17957
+ this._paused = false;
17953
17958
 
17954
17959
  Dispatcher.call(this);
17955
17960
  };
@@ -18000,7 +18005,7 @@ return /******/ (function(modules) { // webpackBootstrap
18000
18005
 
18001
18006
  _update: function() {
18002
18007
 
18003
- var time = new Date().getTime();
18008
+ var time = new Date().getTime() - this._pausedTime;
18004
18009
  var delta = time - this._time;
18005
18010
  var clips = this._clips;
18006
18011
  var len = clips.length;
@@ -18045,10 +18050,8 @@ return /******/ (function(modules) { // webpackBootstrap
18045
18050
  this.stage.update();
18046
18051
  }
18047
18052
  },
18048
- /**
18049
- * 开始运行动画
18050
- */
18051
- start: function () {
18053
+
18054
+ _startLoop: function () {
18052
18055
  var self = this;
18053
18056
 
18054
18057
  this._running = true;
@@ -18058,19 +18061,50 @@ return /******/ (function(modules) { // webpackBootstrap
18058
18061
 
18059
18062
  requestAnimationFrame(step);
18060
18063
 
18061
- self._update();
18064
+ !self._paused && self._update();
18062
18065
  }
18063
18066
  }
18064
18067
 
18065
- this._time = new Date().getTime();
18066
18068
  requestAnimationFrame(step);
18067
18069
  },
18070
+
18071
+ /**
18072
+ * 开始运行动画
18073
+ */
18074
+ start: function () {
18075
+
18076
+ this._time = new Date().getTime();
18077
+ this._pausedTime = 0;
18078
+
18079
+ this._startLoop();
18080
+ },
18068
18081
  /**
18069
18082
  * 停止运行动画
18070
18083
  */
18071
18084
  stop: function () {
18072
18085
  this._running = false;
18073
18086
  },
18087
+
18088
+ /**
18089
+ * Pause
18090
+ */
18091
+ pause: function () {
18092
+ if (!this._paused) {
18093
+ this._pauseStart = new Date().getTime();
18094
+ this._paused = true;
18095
+ }
18096
+ },
18097
+
18098
+ /**
18099
+ * Resume
18100
+ */
18101
+ resume: function () {
18102
+ if (this._paused) {
18103
+ this._pausedTime += (new Date().getTime()) - this._pauseStart;
18104
+ this._paused = false;
18105
+ }
18106
+ },
18107
+
18074
18108
  /**
18075
18109
  * 清除所有动画片段
18076
18110
  */
@@ -18088,6 +18122,7 @@ return /******/ (function(modules) { // webpackBootstrap
18088
18122
  * 如果指定setter函数,会通过setter函数设置属性值
18089
18123
  * @return {module:zrender/animation/Animation~Animator}
18090
18124
  */
18125
+ // TODO Gap
18091
18126
  animate: function (target, options) {
18092
18127
  options = options || {};
18093
18128
  var animator = new Animator(
@@ -18723,28 +18758,14 @@ return /******/ (function(modules) { // webpackBootstrap
18723
18758
  function doClip(clipPaths, ctx) {
18724
18759
  for (var i = 0; i < clipPaths.length; i++) {
18725
18760
  var clipPath = clipPaths[i];
18726
- var m;
18727
- if (clipPath.transform) {
18728
- m = clipPath.transform;
18729
- ctx.transform(
18730
- m[0], m[1],
18731
- m[2], m[3],
18732
- m[4], m[5]
18733
- );
18734
- }
18735
18761
  var path = clipPath.path;
18762
+
18763
+ clipPath.setTransform(ctx);
18736
18764
  path.beginPath(ctx);
18737
18765
  clipPath.buildPath(path, clipPath.shape);
18738
18766
  ctx.clip();
18739
18767
  // Transform back
18740
- if (clipPath.transform) {
18741
- m = clipPath.invTransform;
18742
- ctx.transform(
18743
- m[0], m[1],
18744
- m[2], m[3],
18745
- m[4], m[5]
18746
- );
18747
- }
18768
+ clipPath.restoreTransform(ctx);
18748
18769
  }
18749
18770
  }
18750
18771
 
@@ -19063,15 +19084,15 @@ return /******/ (function(modules) { // webpackBootstrap
19063
19084
  var layerProgress;
19064
19085
  var frame = this._progress;
19065
19086
  function flushProgressiveLayer(layer) {
19087
+ var dpr = ctx.dpr || 1;
19066
19088
  ctx.save();
19067
19089
  ctx.globalAlpha = 1;
19068
19090
  ctx.shadowBlur = 0;
19069
19091
  // Avoid layer don't clear in next progressive frame
19070
19092
  currentLayer.__dirty = true;
19071
- ctx.drawImage(layer.dom, 0, 0, width, height);
19093
+ ctx.setTransform(1, 0, 0, 1, 0, 0);
19094
+ ctx.drawImage(layer.dom, 0, 0, width * dpr, height * dpr);
19072
19095
  ctx.restore();
19073
-
19074
- currentLayer.ctx.restore();
19075
19096
  }
19076
19097
 
19077
19098
  for (var i = 0, l = list.length; i < l; i++) {
@@ -19121,6 +19142,7 @@ return /******/ (function(modules) { // webpackBootstrap
19121
19142
  if (!(currentLayer.__dirty || paintAll)) {
19122
19143
  continue;
19123
19144
  }
19145
+
19124
19146
  if (elFrame >= 0) {
19125
19147
  // Progressive layer changed
19126
19148
  if (!currentProgressiveLayer) {
@@ -19184,7 +19206,7 @@ return /******/ (function(modules) { // webpackBootstrap
19184
19206
 
19185
19207
  _doPaintEl: function (el, currentLayer, forcePaint, scope) {
19186
19208
  var ctx = currentLayer.ctx;
19187
-
19209
+ var m = el.transform;
19188
19210
  if (
19189
19211
  (currentLayer.__dirty || forcePaint)
19190
19212
  // Ignore invisible element
@@ -19193,7 +19215,8 @@ return /******/ (function(modules) { // webpackBootstrap
19193
19215
  && el.style.opacity !== 0
19194
19216
  // Ignore scale 0 element, in some environment like node-canvas
19195
19217
  // Draw a scale 0 element can cause all following draw wrong
19196
- && el.scale[0] && el.scale[1]
19218
+ // And setTransform with scale 0 will cause set back transform failed.
19219
+ && !(m && !m[0] && !m[3])
19197
19220
  // Ignore culled element
19198
19221
  && !(el.culling && isDisplayableCulled(el, this._width, this._height))
19199
19222
  ) {
@@ -19820,10 +19843,7 @@ return /******/ (function(modules) { // webpackBootstrap
19820
19843
  initContext: function () {
19821
19844
  this.ctx = this.dom.getContext('2d');
19822
19845
 
19823
- var dpr = this.dpr;
19824
- if (dpr != 1) {
19825
- this.ctx.scale(dpr, dpr);
19826
- }
19846
+ this.ctx.dpr = this.dpr;
19827
19847
  },
19828
19848
 
19829
19849
  createBackBuffer: function () {
@@ -19854,10 +19874,6 @@ return /******/ (function(modules) { // webpackBootstrap
19854
19874
  dom.width = width * dpr;
19855
19875
  dom.height = height * dpr;
19856
19876
 
19857
- if (dpr != 1) {
19858
- this.ctx.scale(dpr, dpr);
19859
- }
19860
-
19861
19877
  if (domBack) {
19862
19878
  domBack.width = width * dpr;
19863
19879
  domBack.height = height * dpr;
@@ -19897,7 +19913,7 @@ return /******/ (function(modules) { // webpackBootstrap
19897
19913
  );
19898
19914
  }
19899
19915
 
19900
- ctx.clearRect(0, 0, width / dpr, height / dpr);
19916
+ ctx.clearRect(0, 0, width, height);
19901
19917
  if (clearColor) {
19902
19918
  var clearColorGradientOrPattern;
19903
19919
  // Gradient
@@ -19906,8 +19922,8 @@ return /******/ (function(modules) { // webpackBootstrap
19906
19922
  clearColorGradientOrPattern = clearColor.__canvasGradient || Style.getGradient(ctx, clearColor, {
19907
19923
  x: 0,
19908
19924
  y: 0,
19909
- width: width / dpr,
19910
- height: height / dpr
19925
+ width: width,
19926
+ height: height
19911
19927
  });
19912
19928
 
19913
19929
  clearColor.__canvasGradient = clearColorGradientOrPattern;
@@ -19918,7 +19934,7 @@ return /******/ (function(modules) { // webpackBootstrap
19918
19934
  }
19919
19935
  ctx.save();
19920
19936
  ctx.fillStyle = clearColorGradientOrPattern || clearColor;
19921
- ctx.fillRect(0, 0, width / dpr, height / dpr);
19937
+ ctx.fillRect(0, 0, width, height);
19922
19938
  ctx.restore();
19923
19939
  }
19924
19940
 
@@ -19926,7 +19942,7 @@ return /******/ (function(modules) { // webpackBootstrap
19926
19942
  var domBack = this.domBack;
19927
19943
  ctx.save();
19928
19944
  ctx.globalAlpha = lastFrameAlpha;
19929
- ctx.drawImage(domBack, 0, 0, width / dpr, height / dpr);
19945
+ ctx.drawImage(domBack, 0, 0, width, height);
19930
19946
  ctx.restore();
19931
19947
  }
19932
19948
  }
@@ -19940,109 +19956,6 @@ return /******/ (function(modules) { // webpackBootstrap
19940
19956
  /***/ function(module, exports, __webpack_require__) {
19941
19957
 
19942
19958
 
19943
-
19944
- var graphic = __webpack_require__(43);
19945
- var zrUtil = __webpack_require__(4);
19946
- var PI = Math.PI;
19947
- /**
19948
- * @param {module:echarts/ExtensionAPI} api
19949
- * @param {Object} [opts]
19950
- * @param {string} [opts.text]
19951
- * @param {string} [opts.color]
19952
- * @param {string} [opts.textColor]
19953
- * @return {module:zrender/Element}
19954
- */
19955
- module.exports = function (api, opts) {
19956
- opts = opts || {};
19957
- zrUtil.defaults(opts, {
19958
- text: 'loading',
19959
- color: '#c23531',
19960
- textColor: '#000',
19961
- maskColor: 'rgba(255, 255, 255, 0.8)',
19962
- zlevel: 0
19963
- });
19964
- var mask = new graphic.Rect({
19965
- style: {
19966
- fill: opts.maskColor
19967
- },
19968
- zlevel: opts.zlevel,
19969
- z: 10000
19970
- });
19971
- var arc = new graphic.Arc({
19972
- shape: {
19973
- startAngle: -PI / 2,
19974
- endAngle: -PI / 2 + 0.1,
19975
- r: 10
19976
- },
19977
- style: {
19978
- stroke: opts.color,
19979
- lineCap: 'round',
19980
- lineWidth: 5
19981
- },
19982
- zlevel: opts.zlevel,
19983
- z: 10001
19984
- });
19985
- var labelRect = new graphic.Rect({
19986
- style: {
19987
- fill: 'none',
19988
- text: opts.text,
19989
- textPosition: 'right',
19990
- textDistance: 10,
19991
- textFill: opts.textColor
19992
- },
19993
- zlevel: opts.zlevel,
19994
- z: 10001
19995
- });
19996
-
19997
- arc.animateShape(true)
19998
- .when(1000, {
19999
- endAngle: PI * 3 / 2
20000
- })
20001
- .start('circularInOut');
20002
- arc.animateShape(true)
20003
- .when(1000, {
20004
- startAngle: PI * 3 / 2
20005
- })
20006
- .delay(300)
20007
- .start('circularInOut');
20008
-
20009
- var group = new graphic.Group();
20010
- group.add(arc);
20011
- group.add(labelRect);
20012
- group.add(mask);
20013
- // Inject resize
20014
- group.resize = function () {
20015
- var cx = api.getWidth() / 2;
20016
- var cy = api.getHeight() / 2;
20017
- arc.setShape({
20018
- cx: cx,
20019
- cy: cy
20020
- });
20021
- var r = arc.shape.r;
20022
- labelRect.setShape({
20023
- x: cx - r,
20024
- y: cy - r,
20025
- width: r * 2,
20026
- height: r * 2
20027
- });
20028
-
20029
- mask.setShape({
20030
- x: 0,
20031
- y: 0,
20032
- width: api.getWidth(),
20033
- height: api.getHeight()
20034
- });
20035
- };
20036
- group.resize();
20037
- return group;
20038
- };
20039
-
20040
-
20041
- /***/ },
20042
- /* 94 */
20043
- /***/ function(module, exports, __webpack_require__) {
20044
-
20045
-
20046
19959
  var Gradient = __webpack_require__(61);
20047
19960
  module.exports = function (ecModel) {
20048
19961
  function encodeColor(seriesModel) {
@@ -20079,14 +19992,14 @@ return /******/ (function(modules) { // webpackBootstrap
20079
19992
 
20080
19993
 
20081
19994
  /***/ },
20082
- /* 95 */
19995
+ /* 94 */
20083
19996
  /***/ function(module, exports, __webpack_require__) {
20084
19997
 
20085
19998
  // Compatitable with 2.0
20086
19999
 
20087
20000
 
20088
20001
  var zrUtil = __webpack_require__(4);
20089
- var compatStyle = __webpack_require__(96);
20002
+ var compatStyle = __webpack_require__(95);
20090
20003
 
20091
20004
  function get(opt, path) {
20092
20005
  path = path.split(',');
@@ -20189,7 +20102,7 @@ return /******/ (function(modules) { // webpackBootstrap
20189
20102
 
20190
20103
 
20191
20104
  /***/ },
20192
- /* 96 */
20105
+ /* 95 */
20193
20106
  /***/ function(module, exports, __webpack_require__) {
20194
20107
 
20195
20108
 
@@ -20269,6 +20182,109 @@ return /******/ (function(modules) { // webpackBootstrap
20269
20182
  };
20270
20183
 
20271
20184
 
20185
+ /***/ },
20186
+ /* 96 */
20187
+ /***/ function(module, exports, __webpack_require__) {
20188
+
20189
+
20190
+
20191
+ var graphic = __webpack_require__(43);
20192
+ var zrUtil = __webpack_require__(4);
20193
+ var PI = Math.PI;
20194
+ /**
20195
+ * @param {module:echarts/ExtensionAPI} api
20196
+ * @param {Object} [opts]
20197
+ * @param {string} [opts.text]
20198
+ * @param {string} [opts.color]
20199
+ * @param {string} [opts.textColor]
20200
+ * @return {module:zrender/Element}
20201
+ */
20202
+ module.exports = function (api, opts) {
20203
+ opts = opts || {};
20204
+ zrUtil.defaults(opts, {
20205
+ text: 'loading',
20206
+ color: '#c23531',
20207
+ textColor: '#000',
20208
+ maskColor: 'rgba(255, 255, 255, 0.8)',
20209
+ zlevel: 0
20210
+ });
20211
+ var mask = new graphic.Rect({
20212
+ style: {
20213
+ fill: opts.maskColor
20214
+ },
20215
+ zlevel: opts.zlevel,
20216
+ z: 10000
20217
+ });
20218
+ var arc = new graphic.Arc({
20219
+ shape: {
20220
+ startAngle: -PI / 2,
20221
+ endAngle: -PI / 2 + 0.1,
20222
+ r: 10
20223
+ },
20224
+ style: {
20225
+ stroke: opts.color,
20226
+ lineCap: 'round',
20227
+ lineWidth: 5
20228
+ },
20229
+ zlevel: opts.zlevel,
20230
+ z: 10001
20231
+ });
20232
+ var labelRect = new graphic.Rect({
20233
+ style: {
20234
+ fill: 'none',
20235
+ text: opts.text,
20236
+ textPosition: 'right',
20237
+ textDistance: 10,
20238
+ textFill: opts.textColor
20239
+ },
20240
+ zlevel: opts.zlevel,
20241
+ z: 10001
20242
+ });
20243
+
20244
+ arc.animateShape(true)
20245
+ .when(1000, {
20246
+ endAngle: PI * 3 / 2
20247
+ })
20248
+ .start('circularInOut');
20249
+ arc.animateShape(true)
20250
+ .when(1000, {
20251
+ startAngle: PI * 3 / 2
20252
+ })
20253
+ .delay(300)
20254
+ .start('circularInOut');
20255
+
20256
+ var group = new graphic.Group();
20257
+ group.add(arc);
20258
+ group.add(labelRect);
20259
+ group.add(mask);
20260
+ // Inject resize
20261
+ group.resize = function () {
20262
+ var cx = api.getWidth() / 2;
20263
+ var cy = api.getHeight() / 2;
20264
+ arc.setShape({
20265
+ cx: cx,
20266
+ cy: cy
20267
+ });
20268
+ var r = arc.shape.r;
20269
+ labelRect.setShape({
20270
+ x: cx - r,
20271
+ y: cy - r,
20272
+ width: r * 2,
20273
+ height: r * 2
20274
+ });
20275
+
20276
+ mask.setShape({
20277
+ x: 0,
20278
+ y: 0,
20279
+ width: api.getWidth(),
20280
+ height: api.getHeight()
20281
+ });
20282
+ };
20283
+ group.resize();
20284
+ return group;
20285
+ };
20286
+
20287
+
20272
20288
  /***/ },
20273
20289
  /* 97 */
20274
20290
  /***/ function(module, exports, __webpack_require__) {
@@ -21592,10 +21608,10 @@ return /******/ (function(modules) { // webpackBootstrap
21592
21608
 
21593
21609
  hoverAnimation: true,
21594
21610
  // stack: null
21595
- xAxisIndex: 0,
21596
- yAxisIndex: 0,
21611
+ // xAxisIndex: 0,
21612
+ // yAxisIndex: 0,
21597
21613
 
21598
- polarIndex: 0,
21614
+ // polarIndex: 0,
21599
21615
 
21600
21616
  // If clip the overflow value
21601
21617
  clipOverflow: true,
@@ -21769,15 +21785,31 @@ return /******/ (function(modules) { // webpackBootstrap
21769
21785
  var creators = {
21770
21786
 
21771
21787
  cartesian2d: function (data, seriesModel, ecModel) {
21772
- var xAxisModel = ecModel.getComponent('xAxis', seriesModel.get('xAxisIndex'));
21773
- var yAxisModel = ecModel.getComponent('yAxis', seriesModel.get('yAxisIndex'));
21788
+
21789
+ var axesModels = zrUtil.map(['xAxis', 'yAxis'], function (name) {
21790
+ return ecModel.queryComponents({
21791
+ mainType: name,
21792
+ index: seriesModel.get(name + 'Index'),
21793
+ id: seriesModel.get(name + 'Id')
21794
+ })[0];
21795
+ });
21796
+ var xAxisModel = axesModels[0];
21797
+ var yAxisModel = axesModels[1];
21774
21798
 
21775
21799
  if (true) {
21776
21800
  if (!xAxisModel) {
21777
- throw new Error('xAxis "' + seriesModel.get('xAxisIndex') + '" not found');
21801
+ throw new Error('xAxis "' + zrUtil.retrieve(
21802
+ seriesModel.get('xAxisIndex'),
21803
+ seriesModel.get('xAxisId'),
21804
+ 0
21805
+ ) + '" not found');
21778
21806
  }
21779
21807
  if (!yAxisModel) {
21780
- throw new Error('yAxis "' + seriesModel.get('yAxisIndex') + '" not found');
21808
+ throw new Error('yAxis "' + zrUtil.retrieve(
21809
+ seriesModel.get('xAxisIndex'),
21810
+ seriesModel.get('yAxisId'),
21811
+ 0
21812
+ ) + '" not found');
21781
21813
  }
21782
21814
  }
21783
21815
 
@@ -21818,19 +21850,15 @@ return /******/ (function(modules) { // webpackBootstrap
21818
21850
  },
21819
21851
 
21820
21852
  polar: function (data, seriesModel, ecModel) {
21821
- var polarIndex = seriesModel.get('polarIndex') || 0;
21822
-
21823
- var axisFinder = function (axisModel) {
21824
- return axisModel.get('polarIndex') === polarIndex;
21825
- };
21826
-
21827
- var angleAxisModel = ecModel.findComponents({
21828
- mainType: 'angleAxis', filter: axisFinder
21829
- })[0];
21830
- var radiusAxisModel = ecModel.findComponents({
21831
- mainType: 'radiusAxis', filter: axisFinder
21853
+ var polarModel = ecModel.queryComponents({
21854
+ mainType: 'polar',
21855
+ index: seriesModel.get('polarIndex'),
21856
+ id: seriesModel.get('polarId')
21832
21857
  })[0];
21833
21858
 
21859
+ var angleAxisModel = polarModel.findAxisModel('angleAxis');
21860
+ var radiusAxisModel = polarModel.findAxisModel('radiusAxis');
21861
+
21834
21862
  if (true) {
21835
21863
  if (!angleAxisModel) {
21836
21864
  throw new Error('angleAxis option not found');
@@ -22422,6 +22450,13 @@ return /******/ (function(modules) { // webpackBootstrap
22422
22450
  );
22423
22451
  }
22424
22452
  else {
22453
+ // Not do it in update with animation
22454
+ if (step) {
22455
+ // TODO If stacked series is not step
22456
+ points = turnPointsIntoStep(points, coordSys, step);
22457
+ stackedOnPoints = turnPointsIntoStep(stackedOnPoints, coordSys, step);
22458
+ }
22459
+
22425
22460
  polyline.setShape({
22426
22461
  points: points
22427
22462
  });
@@ -22732,6 +22767,10 @@ return /******/ (function(modules) { // webpackBootstrap
22732
22767
 
22733
22768
  function symbolNeedsDraw(data, idx, isIgnore) {
22734
22769
  var point = data.getItemLayout(idx);
22770
+ // Is an object
22771
+ // if (point && point.hasOwnProperty('point')) {
22772
+ // point = point.point;
22773
+ // }
22735
22774
  return point && !isNaN(point[0]) && !isNaN(point[1]) && !(isIgnore && isIgnore(idx))
22736
22775
  && data.getItemVisual(idx, 'symbol') !== 'none';
22737
22776
  }
@@ -22911,6 +22950,13 @@ return /******/ (function(modules) { // webpackBootstrap
22911
22950
  this.childAt(0).stopAnimation(toLastFrame);
22912
22951
  };
22913
22952
 
22953
+ /**
22954
+ * Get symbol path element
22955
+ */
22956
+ symbolProto.getSymbolPath = function () {
22957
+ return this.childAt(0);
22958
+ };
22959
+
22914
22960
  /**
22915
22961
  * Get scale(aka, current symbol size).
22916
22962
  * Including the change caused by animation
@@ -23081,7 +23127,9 @@ return /******/ (function(modules) { // webpackBootstrap
23081
23127
  .off('emphasis')
23082
23128
  .off('normal');
23083
23129
 
23084
- graphic.setHoverStyle(symbolPath, hoverItemStyle);
23130
+ symbolPath.hoverStyle = hoverItemStyle;
23131
+
23132
+ graphic.setHoverStyle(symbolPath);
23085
23133
 
23086
23134
  if (hoverAnimation && seriesModel.ifEnableAnimation()) {
23087
23135
  var onEmphasis = function() {
@@ -24122,13 +24170,14 @@ return /******/ (function(modules) { // webpackBootstrap
24122
24170
 
24123
24171
  var graphic = __webpack_require__(43);
24124
24172
  var zrUtil = __webpack_require__(4);
24173
+ var echarts = __webpack_require__(1);
24125
24174
 
24126
24175
  __webpack_require__(113);
24127
24176
 
24128
24177
  __webpack_require__(130);
24129
24178
 
24130
24179
  // Grid view
24131
- __webpack_require__(1).extendComponentView({
24180
+ echarts.extendComponentView({
24132
24181
 
24133
24182
  type: 'grid',
24134
24183
 
@@ -24146,6 +24195,13 @@ return /******/ (function(modules) { // webpackBootstrap
24146
24195
  }
24147
24196
  });
24148
24197
 
24198
+ echarts.registerPreprocessor(function (option) {
24199
+ // Only create grid when need
24200
+ if (option.xAxis && option.yAxis && !option.grid) {
24201
+ option.grid = {};
24202
+ }
24203
+ });
24204
+
24149
24205
 
24150
24206
  /***/ },
24151
24207
  /* 113 */
@@ -24178,7 +24234,7 @@ return /******/ (function(modules) { // webpackBootstrap
24178
24234
  * @inner
24179
24235
  */
24180
24236
  function isAxisUsedInTheGrid(axisModel, gridModel, ecModel) {
24181
- return ecModel.getComponent('grid', axisModel.get('gridIndex')) === gridModel;
24237
+ return axisModel.findGridModel() === gridModel;
24182
24238
  }
24183
24239
 
24184
24240
  function getLabelUnionRect(axis) {
@@ -24491,12 +24547,10 @@ return /******/ (function(modules) { // webpackBootstrap
24491
24547
  axis.scale.setExtent(Infinity, -Infinity);
24492
24548
  });
24493
24549
  ecModel.eachSeries(function (seriesModel) {
24494
- if (seriesModel.get('coordinateSystem') === 'cartesian2d') {
24495
- var xAxisIndex = seriesModel.get('xAxisIndex');
24496
- var yAxisIndex = seriesModel.get('yAxisIndex');
24497
-
24498
- var xAxisModel = ecModel.getComponent('xAxis', xAxisIndex);
24499
- var yAxisModel = ecModel.getComponent('yAxis', yAxisIndex);
24550
+ if (isCartesian2D(seriesModel)) {
24551
+ var axesModels = findAxesModels(seriesModel, ecModel);
24552
+ var xAxisModel = axesModels[0];
24553
+ var yAxisModel = axesModels[1];
24500
24554
 
24501
24555
  if (!isAxisUsedInTheGrid(xAxisModel, gridModel, ecModel)
24502
24556
  || !isAxisUsedInTheGrid(yAxisModel, gridModel, ecModel)
@@ -24504,7 +24558,9 @@ return /******/ (function(modules) { // webpackBootstrap
24504
24558
  return;
24505
24559
  }
24506
24560
 
24507
- var cartesian = this.getCartesian(xAxisIndex, yAxisIndex);
24561
+ var cartesian = this.getCartesian(
24562
+ xAxisModel.componentIndex, yAxisModel.componentIndex
24563
+ );
24508
24564
  var data = seriesModel.getData();
24509
24565
  var xAxis = cartesian.getAxis('x');
24510
24566
  var yAxis = cartesian.getAxis('y');
@@ -24549,6 +24605,38 @@ return /******/ (function(modules) { // webpackBootstrap
24549
24605
  };
24550
24606
  }
24551
24607
 
24608
+ var axesTypes = ['xAxis', 'yAxis'];
24609
+ /**
24610
+ * @inner
24611
+ */
24612
+ function findAxesModels(seriesModel, ecModel) {
24613
+ return zrUtil.map(axesTypes, function (axisType) {
24614
+ var axisModel = ecModel.queryComponents({
24615
+ mainType: axisType,
24616
+ index: seriesModel.get(axisType + 'Index'),
24617
+ id: seriesModel.get(axisType + 'Id')
24618
+ })[0];
24619
+
24620
+ if (true) {
24621
+ if (!axisModel) {
24622
+ throw new Error(axisType + ' "' + zrUtil.retrieve(
24623
+ seriesModel.get(axisType + 'Index'),
24624
+ seriesModel.get(axisType + 'Id'),
24625
+ 0
24626
+ ) + '" not found');
24627
+ }
24628
+ }
24629
+ return axisModel;
24630
+ });
24631
+ }
24632
+
24633
+ /**
24634
+ * @inner
24635
+ */
24636
+ function isCartesian2D(seriesModel) {
24637
+ return seriesModel.get('coordinateSystem') === 'cartesian2d';
24638
+ }
24639
+
24552
24640
  Grid.create = function (ecModel, api) {
24553
24641
  var grids = [];
24554
24642
  ecModel.eachComponent('grid', function (gridModel, idx) {
@@ -24563,21 +24651,36 @@ return /******/ (function(modules) { // webpackBootstrap
24563
24651
 
24564
24652
  // Inject the coordinateSystems into seriesModel
24565
24653
  ecModel.eachSeries(function (seriesModel) {
24566
- if (seriesModel.get('coordinateSystem') !== 'cartesian2d') {
24654
+ if (!isCartesian2D(seriesModel)) {
24567
24655
  return;
24568
24656
  }
24569
- var xAxisIndex = seriesModel.get('xAxisIndex');
24570
- var yAxisIndex = seriesModel.get('yAxisIndex');
24571
- var xAxisModel = ecModel.getComponent('xAxis', xAxisIndex);
24657
+
24658
+ var axesModels = findAxesModels(seriesModel, ecModel);
24659
+ var xAxisModel = axesModels[0];
24660
+ var yAxisModel = axesModels[1];
24661
+
24662
+ var gridModel = xAxisModel.findGridModel();
24572
24663
 
24573
24664
  if (true) {
24574
- var yAxisModel = ecModel.getComponent('yAxis', yAxisIndex);
24575
- if (xAxisModel.get('gridIndex') !== yAxisModel.get('gridIndex')) {
24665
+ if (!gridModel) {
24666
+ throw new Error(
24667
+ 'Grid "' + zrUtil.retrieve(
24668
+ xAxisModel.get('gridIndex'),
24669
+ xAxisModel.get('gridId'),
24670
+ 0
24671
+ ) + '" not found'
24672
+ );
24673
+ }
24674
+ if (xAxisModel.findGridModel() !== yAxisModel.findGridModel()) {
24576
24675
  throw new Error('xAxis and yAxis must use the same grid');
24577
24676
  }
24578
24677
  }
24579
- var grid = grids[xAxisModel.get('gridIndex')];
24580
- seriesModel.coordinateSystem = grid.getCartesian(xAxisIndex, yAxisIndex);
24678
+
24679
+ var grid = gridModel.coordinateSystem;
24680
+
24681
+ seriesModel.coordinateSystem = grid.getCartesian(
24682
+ xAxisModel.componentIndex, yAxisModel.componentIndex
24683
+ );
24581
24684
  });
24582
24685
 
24583
24686
  return grids;
@@ -24671,6 +24774,11 @@ return /******/ (function(modules) { // webpackBootstrap
24671
24774
  var fixMin = (model.getMin ? model.getMin() : model.get('min')) != null;
24672
24775
  var fixMax = (model.getMax ? model.getMax() : model.get('max')) != null;
24673
24776
  var splitNumber = model.get('splitNumber');
24777
+
24778
+ if (scale.type === 'log') {
24779
+ scale.base = model.get('logBase');
24780
+ }
24781
+
24674
24782
  scale.setExtent(extent[0], extent[1]);
24675
24783
  scale.niceExtent(splitNumber, fixMin, fixMax);
24676
24784
 
@@ -25065,6 +25173,9 @@ return /******/ (function(modules) { // webpackBootstrap
25065
25173
 
25066
25174
  var mathFloor = Math.floor;
25067
25175
  var mathCeil = Math.ceil;
25176
+
25177
+ var getPrecisionSafe = numberUtil.getPrecisionSafe;
25178
+ var roundingErrorFix = numberUtil.round;
25068
25179
  /**
25069
25180
  * @alias module:echarts/coord/scale/Interval
25070
25181
  * @constructor
@@ -25130,6 +25241,8 @@ return /******/ (function(modules) { // webpackBootstrap
25130
25241
 
25131
25242
  if (interval) {
25132
25243
  var niceExtent = this._niceExtent;
25244
+ var precision = getPrecisionSafe(interval) + 2;
25245
+
25133
25246
  if (extent[0] < niceExtent[0]) {
25134
25247
  ticks.push(extent[0]);
25135
25248
  }
@@ -25137,7 +25250,7 @@ return /******/ (function(modules) { // webpackBootstrap
25137
25250
  while (tick <= niceExtent[1]) {
25138
25251
  ticks.push(tick);
25139
25252
  // Avoid rounding error
25140
- tick = numberUtil.round(tick + interval);
25253
+ tick = roundingErrorFix(tick + interval, precision);
25141
25254
  if (ticks.length > safeLimit) {
25142
25255
  return [];
25143
25256
  }
@@ -25191,12 +25304,21 @@ return /******/ (function(modules) { // webpackBootstrap
25191
25304
 
25192
25305
  // From "Nice Numbers for Graph Labels" of Graphic Gems
25193
25306
  // var niceSpan = numberUtil.nice(span, false);
25194
- var step = numberUtil.nice(span / splitNumber, true);
25307
+ var step = roundingErrorFix(
25308
+ numberUtil.nice(span / splitNumber, true),
25309
+ Math.max(
25310
+ getPrecisionSafe(extent[0]),
25311
+ getPrecisionSafe(extent[1])
25312
+ // extent may be [0, 1], and step should have 1 more digits.
25313
+ // To make it safe we add 2 more digits
25314
+ ) + 2
25315
+ );
25195
25316
 
25317
+ var precision = getPrecisionSafe(step) + 2;
25196
25318
  // Niced extent inside original extent
25197
25319
  var niceExtent = [
25198
- numberUtil.round(mathCeil(extent[0] / step) * step),
25199
- numberUtil.round(mathFloor(extent[1] / step) * step)
25320
+ roundingErrorFix(mathCeil(extent[0] / step) * step, precision),
25321
+ roundingErrorFix(mathFloor(extent[1] / step) * step, precision)
25200
25322
  ];
25201
25323
 
25202
25324
  this._interval = step;
@@ -25246,10 +25368,10 @@ return /******/ (function(modules) { // webpackBootstrap
25246
25368
  var interval = this._interval;
25247
25369
 
25248
25370
  if (!fixMin) {
25249
- extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval);
25371
+ extent[0] = roundingErrorFix(mathFloor(extent[0] / interval) * interval);
25250
25372
  }
25251
25373
  if (!fixMax) {
25252
- extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval);
25374
+ extent[1] = roundingErrorFix(mathCeil(extent[1] / interval) * interval);
25253
25375
  }
25254
25376
  }
25255
25377
  });
@@ -25455,20 +25577,21 @@ return /******/ (function(modules) { // webpackBootstrap
25455
25577
  var mathCeil = Math.ceil;
25456
25578
  var mathPow = Math.pow;
25457
25579
 
25458
- var LOG_BASE = 10;
25459
25580
  var mathLog = Math.log;
25460
25581
 
25461
25582
  var LogScale = Scale.extend({
25462
25583
 
25463
25584
  type: 'log',
25464
25585
 
25586
+ base: 10,
25587
+
25465
25588
  /**
25466
25589
  * @return {Array.<number>}
25467
25590
  */
25468
25591
  getTicks: function () {
25469
25592
  return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) {
25470
- return numberUtil.round(mathPow(LOG_BASE, val));
25471
- });
25593
+ return numberUtil.round(mathPow(this.base, val));
25594
+ }, this);
25472
25595
  },
25473
25596
 
25474
25597
  /**
@@ -25483,7 +25606,7 @@ return /******/ (function(modules) { // webpackBootstrap
25483
25606
  */
25484
25607
  scale: function (val) {
25485
25608
  val = scaleProto.scale.call(this, val);
25486
- return mathPow(LOG_BASE, val);
25609
+ return mathPow(this.base, val);
25487
25610
  },
25488
25611
 
25489
25612
  /**
@@ -25491,8 +25614,9 @@ return /******/ (function(modules) { // webpackBootstrap
25491
25614
  * @param {number} end
25492
25615
  */
25493
25616
  setExtent: function (start, end) {
25494
- start = mathLog(start) / mathLog(LOG_BASE);
25495
- end = mathLog(end) / mathLog(LOG_BASE);
25617
+ var base = this.base;
25618
+ start = mathLog(start) / mathLog(base);
25619
+ end = mathLog(end) / mathLog(base);
25496
25620
  intervalScaleProto.setExtent.call(this, start, end);
25497
25621
  },
25498
25622
 
@@ -25500,9 +25624,10 @@ return /******/ (function(modules) { // webpackBootstrap
25500
25624
  * @return {number} end
25501
25625
  */
25502
25626
  getExtent: function () {
25627
+ var base = this.base;
25503
25628
  var extent = scaleProto.getExtent.call(this);
25504
- extent[0] = mathPow(LOG_BASE, extent[0]);
25505
- extent[1] = mathPow(LOG_BASE, extent[1]);
25629
+ extent[0] = mathPow(base, extent[0]);
25630
+ extent[1] = mathPow(base, extent[1]);
25506
25631
  return extent;
25507
25632
  },
25508
25633
 
@@ -25510,8 +25635,9 @@ return /******/ (function(modules) { // webpackBootstrap
25510
25635
  * @param {Array.<number>} extent
25511
25636
  */
25512
25637
  unionExtent: function (extent) {
25513
- extent[0] = mathLog(extent[0]) / mathLog(LOG_BASE);
25514
- extent[1] = mathLog(extent[1]) / mathLog(LOG_BASE);
25638
+ var base = this.base;
25639
+ extent[0] = mathLog(extent[0]) / mathLog(base);
25640
+ extent[1] = mathLog(extent[1]) / mathLog(base);
25515
25641
  scaleProto.unionExtent.call(this, extent);
25516
25642
  },
25517
25643
 
@@ -25527,13 +25653,19 @@ return /******/ (function(modules) { // webpackBootstrap
25527
25653
  return;
25528
25654
  }
25529
25655
 
25530
- var interval = mathPow(10, mathFloor(mathLog(span / approxTickNum) / Math.LN10));
25656
+ var interval = numberUtil.quantity(span);
25531
25657
  var err = approxTickNum / span * interval;
25532
25658
 
25533
25659
  // Filter ticks to get closer to the desired count.
25534
25660
  if (err <= 0.5) {
25535
25661
  interval *= 10;
25536
25662
  }
25663
+
25664
+ // Interval should be integer
25665
+ while (!isNaN(interval) && Math.abs(interval) < 1 && Math.abs(interval) > 0) {
25666
+ interval *= 10;
25667
+ }
25668
+
25537
25669
  var niceExtent = [
25538
25670
  numberUtil.round(mathCeil(extent[0] / interval) * interval),
25539
25671
  numberUtil.round(mathFloor(extent[1] / interval) * interval)
@@ -25554,7 +25686,7 @@ return /******/ (function(modules) { // webpackBootstrap
25554
25686
 
25555
25687
  zrUtil.each(['contain', 'normalize'], function (methodName) {
25556
25688
  LogScale.prototype[methodName] = function (val) {
25557
- val = mathLog(val) / mathLog(LOG_BASE);
25689
+ val = mathLog(val) / mathLog(this.base);
25558
25690
  return scaleProto[methodName].call(this, val);
25559
25691
  };
25560
25692
  });
@@ -26304,6 +26436,17 @@ return /******/ (function(modules) { // webpackBootstrap
26304
26436
  ? false : !option.scale;
26305
26437
  },
26306
26438
 
26439
+ /**
26440
+ * @return {module:echarts/model/Model}
26441
+ */
26442
+ findGridModel: function () {
26443
+ return this.ecModel.queryComponents({
26444
+ mainType: 'grid',
26445
+ index: this.get('gridIndex'),
26446
+ id: this.get('gridId')
26447
+ })[0];
26448
+ },
26449
+
26307
26450
  /**
26308
26451
  * @private
26309
26452
  */
@@ -26322,7 +26465,8 @@ return /******/ (function(modules) { // webpackBootstrap
26322
26465
  zrUtil.merge(AxisModel.prototype, __webpack_require__(129));
26323
26466
 
26324
26467
  var extraOption = {
26325
- gridIndex: 0,
26468
+ // gridIndex: 0,
26469
+ // gridId: '',
26326
26470
 
26327
26471
  // Offset is for multiple axis on the same position
26328
26472
  offset: 0
@@ -26542,7 +26686,9 @@ return /******/ (function(modules) { // webpackBootstrap
26542
26686
  min: 'dataMin',
26543
26687
  max: 'dataMax'
26544
26688
  }, valueAxis);
26545
- var logAxis = zrUtil.defaults({}, valueAxis);
26689
+ var logAxis = zrUtil.defaults({
26690
+ logBase: 10
26691
+ }, valueAxis);
26546
26692
  logAxis.scale = true;
26547
26693
 
26548
26694
  module.exports = {
@@ -26654,7 +26800,7 @@ return /******/ (function(modules) { // webpackBootstrap
26654
26800
  return;
26655
26801
  }
26656
26802
 
26657
- var gridModel = ecModel.getComponent('grid', axisModel.get('gridIndex'));
26803
+ var gridModel = axisModel.findGridModel();
26658
26804
 
26659
26805
  var layout = layoutAxis(gridModel, axisModel);
26660
26806
 
@@ -27576,8 +27722,8 @@ return /******/ (function(modules) { // webpackBootstrap
27576
27722
  // stack: null
27577
27723
 
27578
27724
  // Cartesian coordinate system
27579
- xAxisIndex: 0,
27580
- yAxisIndex: 0,
27725
+ // xAxisIndex: 0,
27726
+ // yAxisIndex: 0,
27581
27727
 
27582
27728
  // 最小高度改为0
27583
27729
  barMinHeight: 0,
@@ -28770,15 +28916,21 @@ return /******/ (function(modules) { // webpackBootstrap
28770
28916
  // FIXME Performance
28771
28917
  var itemModel = dataAll.getItemModel(rawIdx);
28772
28918
  var filteredIdx = idxMap[rawIdx];
28919
+
28773
28920
  // If series.itemStyle.normal.color is a function. itemVisual may be encoded
28774
- var singleDataColor = data.getItemVisual(filteredIdx, 'color', true);
28921
+ var singleDataColor = filteredIdx != null
28922
+ && data.getItemVisual(filteredIdx, 'color', true);
28775
28923
 
28776
28924
  if (!singleDataColor) {
28777
28925
  var color = itemModel.get('itemStyle.normal.color')
28778
28926
  || seriesModel.getColorFromPalette(dataAll.getName(rawIdx), paletteScope);
28779
28927
  // Legend may use the visual info in data before processed
28780
28928
  dataAll.setItemVisual(rawIdx, 'color', color);
28781
- data.setItemVisual(filteredIdx, 'color', color);
28929
+
28930
+ // Data is not filtered
28931
+ if (filteredIdx != null) {
28932
+ data.setItemVisual(filteredIdx, 'color', color);
28933
+ }
28782
28934
  }
28783
28935
  else {
28784
28936
  // Set data all color for legend