echarts 3.7.1 → 3.7.2

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.
Files changed (94) hide show
  1. package/dist/echarts-en.js +77756 -0
  2. package/dist/echarts-en.min.js +38 -0
  3. package/dist/echarts.common-en.js +50169 -0
  4. package/dist/echarts.common-en.min.js +30 -0
  5. package/dist/echarts.common.js +1408 -1186
  6. package/dist/echarts.common.min.js +14 -14
  7. package/dist/echarts.js +1572 -1278
  8. package/dist/echarts.min.js +22 -22
  9. package/dist/echarts.simple-en.js +34988 -0
  10. package/dist/echarts.simple-en.min.js +27 -0
  11. package/dist/echarts.simple.js +1152 -994
  12. package/dist/echarts.simple.min.js +11 -11
  13. package/index.blank.js +4 -0
  14. package/lib/chart/bar/BaseBarSeries.js +3 -3
  15. package/lib/chart/candlestick/candlestickLayout.js +26 -1
  16. package/lib/chart/graph/forceHelper.js +5 -0
  17. package/lib/chart/graph/forceLayout.js +0 -1
  18. package/lib/chart/helper/whiskerBoxCommon.js +6 -1
  19. package/lib/chart/line/LineView.js +14 -2
  20. package/lib/chart/lines/LinesView.js +22 -7
  21. package/lib/chart/pie/PieSeries.js +3 -1
  22. package/lib/chart/pie/PieView.js +1 -1
  23. package/lib/chart/treemap/TreemapView.js +5 -28
  24. package/lib/component/axis/AxisBuilder.js +249 -178
  25. package/lib/component/axis/CartesianAxisView.js +15 -3
  26. package/lib/component/axis/ParallelAxisView.js +1 -1
  27. package/lib/component/axis/RadiusAxisView.js +1 -1
  28. package/lib/component/axis/SingleAxisView.js +8 -2
  29. package/lib/component/helper/RoamController.js +12 -11
  30. package/lib/component/marker/MarkAreaView.js +1 -1
  31. package/lib/component/radar/RadarView.js +1 -1
  32. package/lib/component/toolbox/feature/Brush.js +3 -8
  33. package/lib/component/toolbox/feature/DataView.js +3 -3
  34. package/lib/component/toolbox/feature/DataZoom.js +3 -4
  35. package/lib/component/toolbox/feature/MagicType.js +3 -6
  36. package/lib/component/toolbox/feature/Restore.js +2 -1
  37. package/lib/component/toolbox/feature/SaveAsImage.js +23 -9
  38. package/lib/component/visualMap/ContinuousModel.js +2 -2
  39. package/lib/component/visualMap/ContinuousView.js +3 -3
  40. package/lib/component/visualMap/PiecewiseModel.js +0 -1
  41. package/lib/component/visualMap/VisualMapModel.js +17 -11
  42. package/lib/coord/calendar/Calendar.js +64 -20
  43. package/lib/echarts.js +5 -4
  44. package/lib/lang/cn.js +4 -0
  45. package/lib/lang/default.js +42 -0
  46. package/lib/lang/en.js +42 -0
  47. package/lib/lang.js +42 -0
  48. package/lib/langEN.js +42 -0
  49. package/lib/preprocessor/helper/compatStyle.js +24 -23
  50. package/lib/scale/Time.js +4 -4
  51. package/lib/util/graphic.js +5 -5
  52. package/lib/util/number.js +42 -21
  53. package/lib/visual/VisualMapping.js +3 -3
  54. package/package.json +3 -3
  55. package/rollup.config.js +49 -0
  56. package/src/chart/bar/BaseBarSeries.js +3 -3
  57. package/src/chart/candlestick/candlestickLayout.js +26 -1
  58. package/src/chart/graph/forceHelper.js +5 -0
  59. package/src/chart/graph/forceLayout.js +0 -1
  60. package/src/chart/helper/whiskerBoxCommon.js +6 -2
  61. package/src/chart/line/LineView.js +14 -2
  62. package/src/chart/lines/LinesView.js +22 -7
  63. package/src/chart/pie/PieSeries.js +3 -1
  64. package/src/chart/pie/PieView.js +1 -1
  65. package/src/chart/treemap/TreemapView.js +5 -28
  66. package/src/component/axis/AxisBuilder.js +249 -178
  67. package/src/component/axis/CartesianAxisView.js +15 -3
  68. package/src/component/axis/ParallelAxisView.js +1 -1
  69. package/src/component/axis/RadiusAxisView.js +1 -1
  70. package/src/component/axis/SingleAxisView.js +8 -2
  71. package/src/component/helper/RoamController.js +12 -11
  72. package/src/component/marker/MarkAreaView.js +1 -1
  73. package/src/component/radar/RadarView.js +1 -1
  74. package/src/component/toolbox/feature/Brush.js +3 -8
  75. package/src/component/toolbox/feature/DataView.js +3 -3
  76. package/src/component/toolbox/feature/DataZoom.js +3 -4
  77. package/src/component/toolbox/feature/MagicType.js +3 -6
  78. package/src/component/toolbox/feature/Restore.js +2 -1
  79. package/src/component/toolbox/feature/SaveAsImage.js +23 -10
  80. package/src/component/visualMap/ContinuousModel.js +2 -2
  81. package/src/component/visualMap/ContinuousView.js +3 -3
  82. package/src/component/visualMap/PiecewiseModel.js +0 -1
  83. package/src/component/visualMap/VisualMapModel.js +17 -11
  84. package/src/coord/calendar/Calendar.js +64 -20
  85. package/src/echarts.js +5 -4
  86. package/src/lang.js +43 -0
  87. package/src/langEN.js +43 -0
  88. package/src/preprocessor/helper/compatStyle.js +24 -23
  89. package/src/scale/Time.js +4 -4
  90. package/src/util/graphic.js +5 -5
  91. package/src/util/number.js +42 -21
  92. package/src/visual/VisualMapping.js +3 -3
  93. package/webpack.config.js +21 -7
  94. package/.npmignore +0 -10
@@ -69,15 +69,15 @@ return /******/ (function(modules) { // webpackBootstrap
69
69
  __webpack_require__(324);
70
70
 
71
71
  __webpack_require__(323);
72
- __webpack_require__(369);
73
-
74
- __webpack_require__(398);
75
- __webpack_require__(404);
76
- __webpack_require__(407);
77
72
  __webpack_require__(370);
78
- __webpack_require__(419);
79
73
 
80
- __webpack_require__(431);
74
+ __webpack_require__(399);
75
+ __webpack_require__(405);
76
+ __webpack_require__(408);
77
+ __webpack_require__(371);
78
+ __webpack_require__(420);
79
+
80
+ __webpack_require__(432);
81
81
 
82
82
  /***/ }),
83
83
  /* 1 */
@@ -131,10 +131,11 @@ return /******/ (function(modules) { // webpackBootstrap
131
131
 
132
132
  var zrender = __webpack_require__(87);
133
133
  var zrUtil = __webpack_require__(4);
134
- var colorTool = __webpack_require__(35);
135
- var Eventful = __webpack_require__(29);
134
+ var colorTool = __webpack_require__(33);
135
+ var Eventful = __webpack_require__(27);
136
136
  var timsort = __webpack_require__(91);
137
137
 
138
+
138
139
  var each = zrUtil.each;
139
140
  var parseClassType = ComponentModel.parseClassType;
140
141
 
@@ -160,6 +161,7 @@ return /******/ (function(modules) { // webpackBootstrap
160
161
  var OPTION_UPDATED = '__optionUpdated';
161
162
  var ACTION_REG = /^[a-zA-Z0-9_]+$/;
162
163
 
164
+
163
165
  function createRegisterEventWithLowercaseName(method) {
164
166
  return function (eventName, handler, context) {
165
167
  // Event name is all lowercase
@@ -1609,9 +1611,9 @@ return /******/ (function(modules) { // webpackBootstrap
1609
1611
  /**
1610
1612
  * @type {number}
1611
1613
  */
1612
- version: '3.7.1',
1614
+ version: '3.7.2',
1613
1615
  dependencies: {
1614
- zrender: '3.6.1'
1616
+ zrender: '3.6.2'
1615
1617
  }
1616
1618
  };
1617
1619
 
@@ -2043,7 +2045,6 @@ return /******/ (function(modules) { // webpackBootstrap
2043
2045
  update: 'downplay'
2044
2046
  }, zrUtil.noop);
2045
2047
 
2046
-
2047
2048
  // --------
2048
2049
  // Exports
2049
2050
  // --------
@@ -2060,7 +2061,7 @@ return /******/ (function(modules) { // webpackBootstrap
2060
2061
  echarts.throttle = throttle.throttle;
2061
2062
  echarts.matrix = __webpack_require__(11);
2062
2063
  echarts.vector = __webpack_require__(10);
2063
- echarts.color = __webpack_require__(35);
2064
+ echarts.color = __webpack_require__(33);
2064
2065
 
2065
2066
  echarts.util = {};
2066
2067
  each([
@@ -4756,11 +4757,14 @@ return /******/ (function(modules) { // webpackBootstrap
4756
4757
  var TIME_REG = /^(?:(\d{4})(?:[-\/](\d{1,2})(?:[-\/](\d{1,2})(?:[T ](\d{1,2})(?::(\d\d)(?::(\d\d)(?:[.,](\d+))?)?)?(Z|[\+\-]\d\d:?\d\d)?)?)?)?)?$/; // jshint ignore:line
4757
4758
 
4758
4759
  /**
4760
+ * Consider DST, it is incorrect to provide a method `getTimezoneOffset`
4761
+ * without time specified. So this method is removed.
4762
+ *
4759
4763
  * @return {number} in minutes
4760
4764
  */
4761
- number.getTimezoneOffset = function () {
4762
- return (new Date()).getTimezoneOffset();
4763
- };
4765
+ // number.getTimezoneOffset = function () {
4766
+ // return (new Date()).getTimezoneOffset();
4767
+ // };
4764
4768
 
4765
4769
  /**
4766
4770
  * @param {string|Date|number} value These values can be accepted:
@@ -4794,24 +4798,42 @@ return /******/ (function(modules) { // webpackBootstrap
4794
4798
  return new Date(NaN);
4795
4799
  }
4796
4800
 
4797
- var timezoneOffset = number.getTimezoneOffset();
4798
- var timeOffset = !match[8]
4799
- ? 0
4800
- : match[8].toUpperCase() === 'Z'
4801
- ? timezoneOffset
4802
- : +match[8].slice(0, 3) * 60 + timezoneOffset;
4803
-
4804
- // match[n] can only be string or undefined.
4805
- // But take care of '12' + 1 => '121'.
4806
- return new Date(
4807
- +match[1],
4808
- +(match[2] || 1) - 1,
4809
- +match[3] || 1,
4810
- +match[4] || 0,
4811
- +(match[5] || 0) - timeOffset,
4812
- +match[6] || 0,
4813
- +match[7] || 0
4814
- );
4801
+ // Use local time when no timezone offset specifed.
4802
+ if (!match[8]) {
4803
+ // match[n] can only be string or undefined.
4804
+ // But take care of '12' + 1 => '121'.
4805
+ return new Date(
4806
+ +match[1],
4807
+ +(match[2] || 1) - 1,
4808
+ +match[3] || 1,
4809
+ +match[4] || 0,
4810
+ +(match[5] || 0),
4811
+ +match[6] || 0,
4812
+ +match[7] || 0
4813
+ );
4814
+ }
4815
+ // Timezoneoffset of Javascript Date has considered DST (Daylight Saving Time,
4816
+ // https://tc39.github.io/ecma262/#sec-daylight-saving-time-adjustment).
4817
+ // For example, system timezone is set as "Time Zone: America/Toronto",
4818
+ // then these code will get different result:
4819
+ // `new Date(1478411999999).getTimezoneOffset(); // get 240`
4820
+ // `new Date(1478412000000).getTimezoneOffset(); // get 300`
4821
+ // So we should not use `new Date`, but use `Date.UTC`.
4822
+ else {
4823
+ var hour = +match[4] || 0;
4824
+ if (match[8].toUpperCase() !== 'Z') {
4825
+ hour -= match[8].slice(0, 3);
4826
+ }
4827
+ return new Date(Date.UTC(
4828
+ +match[1],
4829
+ +(match[2] || 1) - 1,
4830
+ +match[3] || 1,
4831
+ hour,
4832
+ +(match[5] || 0),
4833
+ +match[6] || 0,
4834
+ +match[7] || 0
4835
+ ));
4836
+ }
4815
4837
  }
4816
4838
  else if (value == null) {
4817
4839
  return new Date(NaN);
@@ -7239,10 +7261,10 @@ return /******/ (function(modules) { // webpackBootstrap
7239
7261
 
7240
7262
  var pathTool = __webpack_require__(21);
7241
7263
  var Path = __webpack_require__(22);
7242
- var colorTool = __webpack_require__(35);
7264
+ var colorTool = __webpack_require__(33);
7243
7265
  var matrix = __webpack_require__(11);
7244
7266
  var vector = __webpack_require__(10);
7245
- var Transformable = __webpack_require__(30);
7267
+ var Transformable = __webpack_require__(28);
7246
7268
  var BoundingRect = __webpack_require__(9);
7247
7269
 
7248
7270
  var round = Math.round;
@@ -7784,7 +7806,7 @@ return /******/ (function(modules) { // webpackBootstrap
7784
7806
  * for textFill, textStroke, textBackgroundColor, and textBorderColor.
7785
7807
  * If autoColor specified, it is used as default textFill.
7786
7808
  * useInsideStyle:
7787
- * `true`: Use inside style (textFill, textStroke, textLineWidth)
7809
+ * `true`: Use inside style (textFill, textStroke, textStrokeWidth)
7788
7810
  * if `textFill` is not specified.
7789
7811
  * `false`: Do not use inside style.
7790
7812
  * `null/undefined`: use inside style if `isRectText` is true and
@@ -7897,7 +7919,7 @@ return /******/ (function(modules) { // webpackBootstrap
7897
7919
  || globalTextStyle.color;
7898
7920
  textStyle.textStroke = getAutoColor(textStyleModel.getShallow('textBorderColor'), opt)
7899
7921
  || globalTextStyle.textBorderColor;
7900
- textStyle.textLineWidth = zrUtil.retrieve2(
7922
+ textStyle.textStrokeWidth = zrUtil.retrieve2(
7901
7923
  textStyleModel.getShallow('textBorderWidth'),
7902
7924
  globalTextStyle.textBorderWidth
7903
7925
  );
@@ -7981,13 +8003,13 @@ return /******/ (function(modules) { // webpackBootstrap
7981
8003
  insideRollback = {
7982
8004
  textFill: null,
7983
8005
  textStroke: textStyle.textStroke,
7984
- textLineWidth: textStyle.textLineWidth
8006
+ textStrokeWidth: textStyle.textStrokeWidth
7985
8007
  };
7986
8008
  textStyle.textFill = '#fff';
7987
8009
  // Consider text with #fff overflow its container.
7988
8010
  if (textStyle.textStroke == null) {
7989
8011
  textStyle.textStroke = opt.autoColor;
7990
- textStyle.textLineWidth == null && (textStyle.textLineWidth = 2);
8012
+ textStyle.textStrokeWidth == null && (textStyle.textStrokeWidth = 2);
7991
8013
  }
7992
8014
  }
7993
8015
 
@@ -7999,7 +8021,7 @@ return /******/ (function(modules) { // webpackBootstrap
7999
8021
  if (insideRollback) {
8000
8022
  style.textFill = insideRollback.textFill;
8001
8023
  style.textStroke = insideRollback.textStroke;
8002
- style.textLineWidth = insideRollback.textLineWidth;
8024
+ style.textStrokeWidth = insideRollback.textStrokeWidth;
8003
8025
  }
8004
8026
  }
8005
8027
 
@@ -9074,8 +9096,8 @@ return /******/ (function(modules) { // webpackBootstrap
9074
9096
 
9075
9097
  var Style = __webpack_require__(24);
9076
9098
 
9077
- var Element = __webpack_require__(27);
9078
- var RectText = __webpack_require__(38);
9099
+ var Element = __webpack_require__(25);
9100
+ var RectText = __webpack_require__(36);
9079
9101
  // var Stateful = require('./mixin/Stateful');
9080
9102
 
9081
9103
  /**
@@ -9334,15 +9356,13 @@ return /******/ (function(modules) { // webpackBootstrap
9334
9356
 
9335
9357
  /***/ }),
9336
9358
  /* 24 */
9337
- /***/ (function(module, exports, __webpack_require__) {
9359
+ /***/ (function(module, exports) {
9338
9360
 
9339
9361
  /**
9340
9362
  * @module zrender/graphic/Style
9341
9363
  */
9342
9364
 
9343
9365
 
9344
- var textHelper = __webpack_require__(25);
9345
-
9346
9366
  var STYLE_COMMON_PROPS = [
9347
9367
  ['shadowBlur', 0], ['shadowOffsetX', 0], ['shadowOffsetY', 0], ['shadowColor', '#000'],
9348
9368
  ['lineCap', 'butt'], ['lineJoin', 'miter'], ['miterLimit', 10]
@@ -9532,11 +9552,11 @@ return /******/ (function(modules) { // webpackBootstrap
9532
9552
  /**
9533
9553
  * textStroke may be set as some color as a default
9534
9554
  * value in upper applicaion, where the default value
9535
- * of textLineWidth should be 0 to make sure that
9555
+ * of textStrokeWidth should be 0 to make sure that
9536
9556
  * user can choose to do not use text stroke.
9537
9557
  * @type {number}
9538
9558
  */
9539
- textLineWidth: 0,
9559
+ textStrokeWidth: 0,
9540
9560
 
9541
9561
  /**
9542
9562
  * @type {number}
@@ -9816,597 +9836,16 @@ return /******/ (function(modules) { // webpackBootstrap
9816
9836
  /* 25 */
9817
9837
  /***/ (function(module, exports, __webpack_require__) {
9818
9838
 
9819
-
9820
-
9821
- var textContain = __webpack_require__(8);
9822
- var util = __webpack_require__(4);
9823
- var roundRectHelper = __webpack_require__(26);
9824
- var imageHelper = __webpack_require__(12);
9825
-
9826
- var retrieve3 = util.retrieve3;
9827
- var retrieve2 = util.retrieve2;
9828
-
9829
- // TODO: Have not support 'start', 'end' yet.
9830
- var VALID_TEXT_ALIGN = {left: 1, right: 1, center: 1};
9831
- var VALID_TEXT_VERTICAL_ALIGN = {top: 1, bottom: 1, middle: 1};
9832
-
9833
- var helper = {};
9834
-
9835
- /**
9836
- * @param {module:zrender/graphic/Style} style
9837
- * @return {module:zrender/graphic/Style} The input style.
9838
- */
9839
- helper.normalizeTextStyle = function (style) {
9840
- normalizeStyle(style);
9841
- util.each(style.rich, normalizeStyle);
9842
- return style;
9843
- };
9844
-
9845
- function normalizeStyle(style) {
9846
- if (style) {
9847
-
9848
- style.font = textContain.makeFont(style);
9849
-
9850
- var textAlign = style.textAlign;
9851
- textAlign === 'middle' && (textAlign = 'center');
9852
- style.textAlign = (
9853
- textAlign == null || VALID_TEXT_ALIGN[textAlign]
9854
- ) ? textAlign : 'left';
9855
-
9856
- // Compatible with textBaseline.
9857
- var textVerticalAlign = style.textVerticalAlign || style.textBaseline;
9858
- textVerticalAlign === 'center' && (textVerticalAlign = 'middle');
9859
- style.textVerticalAlign = (
9860
- textVerticalAlign == null || VALID_TEXT_VERTICAL_ALIGN[textVerticalAlign]
9861
- ) ? textVerticalAlign : 'top';
9862
-
9863
- var textPadding = style.textPadding;
9864
- if (textPadding) {
9865
- style.textPadding = util.normalizeCssArray(style.textPadding);
9866
- }
9867
- }
9868
- }
9869
-
9870
- /**
9871
- * @param {CanvasRenderingContext2D} ctx
9872
- * @param {string} text
9873
- * @param {module:zrender/graphic/Style} style
9874
- * @param {Object|boolean} [rect] {x, y, width, height}
9875
- * If set false, rect text is not used.
9876
- */
9877
- helper.renderText = function (hostEl, ctx, text, style, rect) {
9878
- style.rich
9879
- ? renderRichText(hostEl, ctx, text, style, rect)
9880
- : renderPlainText(hostEl, ctx, text, style, rect);
9881
- };
9882
-
9883
- function renderPlainText(hostEl, ctx, text, style, rect) {
9884
- var font = setCtx(ctx, 'font', style.font || textContain.DEFAULT_FONT);
9885
-
9886
- var textPadding = style.textPadding;
9887
-
9888
- var contentBlock = hostEl.__textCotentBlock;
9889
- if (!contentBlock || hostEl.__dirty) {
9890
- contentBlock = hostEl.__textCotentBlock = textContain.parsePlainText(
9891
- text, font, textPadding, style.truncate
9892
- );
9893
- }
9894
-
9895
- var outerHeight = contentBlock.outerHeight;
9896
-
9897
- var textLines = contentBlock.lines;
9898
- var lineHeight = contentBlock.lineHeight;
9899
-
9900
- var boxPos = getBoxPosition(outerHeight, style, rect);
9901
- var baseX = boxPos.baseX;
9902
- var baseY = boxPos.baseY;
9903
- var textAlign = boxPos.textAlign;
9904
- var textVerticalAlign = boxPos.textVerticalAlign;
9905
-
9906
- // Origin of textRotation should be the base point of text drawing.
9907
- applyTextRotation(ctx, style, rect, baseX, baseY);
9908
-
9909
- var boxY = textContain.adjustTextY(baseY, outerHeight, textVerticalAlign);
9910
- var textX = baseX;
9911
- var textY = boxY;
9912
-
9913
- var needDrawBg = needDrawBackground(style);
9914
- if (needDrawBg || textPadding) {
9915
- // Consider performance, do not call getTextWidth util necessary.
9916
- var textWidth = textContain.getWidth(text, font);
9917
- var outerWidth = textWidth;
9918
- textPadding && (outerWidth += textPadding[1] + textPadding[3]);
9919
- var boxX = textContain.adjustTextX(baseX, outerWidth, textAlign);
9920
-
9921
- needDrawBg && drawBackground(hostEl, ctx, style, boxX, boxY, outerWidth, outerHeight);
9922
-
9923
- if (textPadding) {
9924
- textX = getTextXForPadding(baseX, textAlign, textPadding);
9925
- textY += textPadding[0];
9926
- }
9927
- }
9928
-
9929
- setCtx(ctx, 'textAlign', textAlign || 'left');
9930
- // Force baseline to be "middle". Otherwise, if using "top", the
9931
- // text will offset downward a little bit in font "Microsoft YaHei".
9932
- setCtx(ctx, 'textBaseline', 'middle');
9933
-
9934
- // Always set shadowBlur and shadowOffset to avoid leak from displayable.
9935
- setCtx(ctx, 'shadowBlur', style.textShadowBlur || 0);
9936
- setCtx(ctx, 'shadowColor', style.textShadowColor || 'transparent');
9937
- setCtx(ctx, 'shadowOffsetX', style.textShadowOffsetX || 0);
9938
- setCtx(ctx, 'shadowOffsetY', style.textShadowOffsetY || 0);
9939
-
9940
- // `textBaseline` is set as 'middle'.
9941
- textY += lineHeight / 2;
9942
-
9943
- var textLineWidth = style.textLineWidth;
9944
- var textStroke = getStroke(style.textStroke, textLineWidth);
9945
- var textFill = getFill(style.textFill);
9946
-
9947
- if (textStroke) {
9948
- setCtx(ctx, 'lineWidth', textLineWidth);
9949
- setCtx(ctx, 'strokeStyle', textStroke);
9950
- }
9951
- if (textFill) {
9952
- setCtx(ctx, 'fillStyle', textFill);
9953
- }
9954
-
9955
- for (var i = 0; i < textLines.length; i++) {
9956
- // Fill after stroke so the outline will not cover the main part.
9957
- textStroke && ctx.strokeText(textLines[i], textX, textY);
9958
- textFill && ctx.fillText(textLines[i], textX, textY);
9959
- textY += lineHeight;
9960
- }
9961
- }
9962
-
9963
- function renderRichText(hostEl, ctx, text, style, rect) {
9964
- var contentBlock = hostEl.__textCotentBlock;
9965
-
9966
- if (!contentBlock || hostEl.__dirty) {
9967
- contentBlock = hostEl.__textCotentBlock = textContain.parseRichText(text, style);
9968
- }
9969
-
9970
- drawRichText(hostEl, ctx, contentBlock, style, rect);
9971
- }
9972
-
9973
- function drawRichText(hostEl, ctx, contentBlock, style, rect) {
9974
- var contentWidth = contentBlock.width;
9975
- var outerWidth = contentBlock.outerWidth;
9976
- var outerHeight = contentBlock.outerHeight;
9977
- var textPadding = style.textPadding;
9978
-
9979
- var boxPos = getBoxPosition(outerHeight, style, rect);
9980
- var baseX = boxPos.baseX;
9981
- var baseY = boxPos.baseY;
9982
- var textAlign = boxPos.textAlign;
9983
- var textVerticalAlign = boxPos.textVerticalAlign;
9984
-
9985
- // Origin of textRotation should be the base point of text drawing.
9986
- applyTextRotation(ctx, style, rect, baseX, baseY);
9987
-
9988
- var boxX = textContain.adjustTextX(baseX, outerWidth, textAlign);
9989
- var boxY = textContain.adjustTextY(baseY, outerHeight, textVerticalAlign);
9990
- var xLeft = boxX;
9991
- var lineTop = boxY;
9992
- if (textPadding) {
9993
- xLeft += textPadding[3];
9994
- lineTop += textPadding[0];
9995
- }
9996
- var xRight = xLeft + contentWidth;
9997
-
9998
- needDrawBackground(style) && drawBackground(
9999
- hostEl, ctx, style, boxX, boxY, outerWidth, outerHeight
10000
- );
10001
-
10002
- for (var i = 0; i < contentBlock.lines.length; i++) {
10003
- var line = contentBlock.lines[i];
10004
- var tokens = line.tokens;
10005
- var tokenCount = tokens.length;
10006
- var lineHeight = line.lineHeight;
10007
- var usedWidth = line.width;
10008
-
10009
- var leftIndex = 0;
10010
- var lineXLeft = xLeft;
10011
- var lineXRight = xRight;
10012
- var rightIndex = tokenCount - 1;
10013
- var token;
10014
-
10015
- while (
10016
- leftIndex < tokenCount
10017
- && (token = tokens[leftIndex], !token.textAlign || token.textAlign === 'left')
10018
- ) {
10019
- placeToken(hostEl, ctx, token, style, lineHeight, lineTop, lineXLeft, 'left');
10020
- usedWidth -= token.width;
10021
- lineXLeft += token.width;
10022
- leftIndex++;
10023
- }
10024
-
10025
- while (
10026
- rightIndex >= 0
10027
- && (token = tokens[rightIndex], token.textAlign === 'right')
10028
- ) {
10029
- placeToken(hostEl, ctx, token, style, lineHeight, lineTop, lineXRight, 'right');
10030
- usedWidth -= token.width;
10031
- lineXRight -= token.width;
10032
- rightIndex--;
10033
- }
10034
-
10035
- // The other tokens are placed as textAlign 'center' if there is enough space.
10036
- lineXLeft += (contentWidth - (lineXLeft - xLeft) - (xRight - lineXRight) - usedWidth) / 2;
10037
- while (leftIndex <= rightIndex) {
10038
- token = tokens[leftIndex];
10039
- // Consider width specified by user, use 'center' rather than 'left'.
10040
- placeToken(hostEl, ctx, token, style, lineHeight, lineTop, lineXLeft + token.width / 2, 'center');
10041
- lineXLeft += token.width;
10042
- leftIndex++;
10043
- }
10044
-
10045
- lineTop += lineHeight;
10046
- }
10047
- }
10048
-
10049
- function applyTextRotation(ctx, style, rect, x, y) {
10050
- // textRotation only apply in RectText.
10051
- if (rect && style.textRotation) {
10052
- var origin = style.textOrigin;
10053
- if (origin === 'center') {
10054
- x = rect.width / 2 + rect.x;
10055
- y = rect.height / 2 + rect.y;
10056
- }
10057
- else if (origin) {
10058
- x = origin[0] + rect.x;
10059
- y = origin[1] + rect.y;
10060
- }
10061
-
10062
- ctx.translate(x, y);
10063
- // Positive: anticlockwise
10064
- ctx.rotate(-style.textRotation);
10065
- ctx.translate(-x, -y);
10066
- }
10067
- }
10068
-
10069
- function placeToken(hostEl, ctx, token, style, lineHeight, lineTop, x, textAlign) {
10070
- var tokenStyle = style.rich[token.styleName] || {};
10071
-
10072
- // 'ctx.textBaseline' is always set as 'middle', for sake of
10073
- // the bias of "Microsoft YaHei".
10074
- var textVerticalAlign = token.textVerticalAlign;
10075
- var y = lineTop + lineHeight / 2;
10076
- if (textVerticalAlign === 'top') {
10077
- y = lineTop + token.height / 2;
10078
- }
10079
- else if (textVerticalAlign === 'bottom') {
10080
- y = lineTop + lineHeight - token.height / 2;
10081
- }
10082
-
10083
- !token.isLineHolder && needDrawBackground(tokenStyle) && drawBackground(
10084
- hostEl,
10085
- ctx,
10086
- tokenStyle,
10087
- textAlign === 'right'
10088
- ? x - token.width
10089
- : textAlign === 'center'
10090
- ? x - token.width / 2
10091
- : x,
10092
- y - token.height / 2,
10093
- token.width,
10094
- token.height
10095
- );
10096
-
10097
- var textPadding = token.textPadding;
10098
- if (textPadding) {
10099
- x = getTextXForPadding(x, textAlign, textPadding);
10100
- y -= token.height / 2 - textPadding[2] - token.textHeight / 2;
10101
- }
10102
-
10103
- setCtx(ctx, 'shadowBlur', retrieve3(tokenStyle.textShadowBlur, style.textShadowBlur, 0));
10104
- setCtx(ctx, 'shadowColor', tokenStyle.textShadowColor || style.textShadowColor || 'transparent');
10105
- setCtx(ctx, 'shadowOffsetX', retrieve3(tokenStyle.textShadowOffsetX, style.textShadowOffsetX, 0));
10106
- setCtx(ctx, 'shadowOffsetY', retrieve3(tokenStyle.textShadowOffsetY, style.textShadowOffsetY, 0));
10107
-
10108
- setCtx(ctx, 'textAlign', textAlign);
10109
- // Force baseline to be "middle". Otherwise, if using "top", the
10110
- // text will offset downward a little bit in font "Microsoft YaHei".
10111
- setCtx(ctx, 'textBaseline', 'middle');
10112
-
10113
- setCtx(ctx, 'font', token.font || textContain.DEFAULT_FONT);
10114
-
10115
- var textStroke = getStroke(tokenStyle.textStroke || style.textStroke, textLineWidth);
10116
- var textFill = getFill(tokenStyle.textFill || style.textFill);
10117
- var textLineWidth = retrieve2(tokenStyle.textLineWidth, style.textLineWidth);
10118
-
10119
- // Fill after stroke so the outline will not cover the main part.
10120
- if (textStroke) {
10121
- setCtx(ctx, 'lineWidth', textLineWidth);
10122
- setCtx(ctx, 'strokeStyle', textStroke);
10123
- ctx.strokeText(token.text, x, y);
10124
- }
10125
- if (textFill) {
10126
- setCtx(ctx, 'fillStyle', textFill);
10127
- ctx.fillText(token.text, x, y);
10128
- }
10129
- }
10130
-
10131
- function needDrawBackground(style) {
10132
- return style.textBackgroundColor
10133
- || (style.textBorderWidth && style.textBorderColor);
10134
- }
10135
-
10136
- // style: {textBackgroundColor, textBorderWidth, textBorderColor, textBorderRadius}
10137
- // shape: {x, y, width, height}
10138
- function drawBackground(hostEl, ctx, style, x, y, width, height) {
10139
- var textBackgroundColor = style.textBackgroundColor;
10140
- var textBorderWidth = style.textBorderWidth;
10141
- var textBorderColor = style.textBorderColor;
10142
- var isPlainBg = util.isString(textBackgroundColor);
10143
-
10144
- setCtx(ctx, 'shadowBlur', style.textBoxShadowBlur || 0);
10145
- setCtx(ctx, 'shadowColor', style.textBoxShadowColor || 'transparent');
10146
- setCtx(ctx, 'shadowOffsetX', style.textBoxShadowOffsetX || 0);
10147
- setCtx(ctx, 'shadowOffsetY', style.textBoxShadowOffsetY || 0);
10148
-
10149
- if (isPlainBg || (textBorderWidth && textBorderColor)) {
10150
- ctx.beginPath();
10151
- var textBorderRadius = style.textBorderRadius;
10152
- if (!textBorderRadius) {
10153
- ctx.rect(x, y, width, height);
10154
- }
10155
- else {
10156
- roundRectHelper.buildPath(ctx, {
10157
- x: x, y: y, width: width, height: height, r: textBorderRadius
10158
- });
10159
- }
10160
- ctx.closePath();
10161
- }
10162
-
10163
- if (isPlainBg) {
10164
- setCtx(ctx, 'fillStyle', textBackgroundColor);
10165
- ctx.fill();
10166
- }
10167
- else if (util.isObject(textBackgroundColor)) {
10168
- var image = textBackgroundColor.image;
10169
-
10170
- image = imageHelper.createOrUpdateImage(
10171
- image, null, hostEl, onBgImageLoaded, textBackgroundColor
10172
- );
10173
- if (image && imageHelper.isImageReady(image)) {
10174
- ctx.drawImage(image, x, y, width, height);
10175
- }
10176
- }
10177
-
10178
- if (textBorderWidth && textBorderColor) {
10179
- setCtx(ctx, 'lineWidth', textBorderWidth);
10180
- setCtx(ctx, 'strokeStyle', textBorderColor);
10181
- ctx.stroke();
10182
- }
10183
- }
10184
-
10185
- function onBgImageLoaded(image, textBackgroundColor) {
10186
- // Replace image, so that `contain/text.js#parseRichText`
10187
- // will get correct result in next tick.
10188
- textBackgroundColor.image = image;
10189
- }
10190
-
10191
- function getBoxPosition(blockHeiht, style, rect) {
10192
- var baseX = style.x || 0;
10193
- var baseY = style.y || 0;
10194
- var textAlign = style.textAlign;
10195
- var textVerticalAlign = style.textVerticalAlign;
10196
-
10197
- // Text position represented by coord
10198
- if (rect) {
10199
- var textPosition = style.textPosition;
10200
- if (textPosition instanceof Array) {
10201
- // Percent
10202
- baseX = rect.x + parsePercent(textPosition[0], rect.width);
10203
- baseY = rect.y + parsePercent(textPosition[1], rect.height);
10204
- }
10205
- else {
10206
- var res = textContain.adjustTextPositionOnRect(
10207
- textPosition, rect, style.textDistance
10208
- );
10209
- baseX = res.x;
10210
- baseY = res.y;
10211
- // Default align and baseline when has textPosition
10212
- textAlign = textAlign || res.textAlign;
10213
- textVerticalAlign = textVerticalAlign || res.textVerticalAlign;
10214
- }
10215
-
10216
- // textOffset is only support in RectText, otherwise
10217
- // we have to adjust boundingRect for textOffset.
10218
- var textOffset = style.textOffset;
10219
- if (textOffset) {
10220
- baseX += textOffset[0];
10221
- baseY += textOffset[1];
10222
- }
10223
- }
10224
-
10225
- return {
10226
- baseX: baseX,
10227
- baseY: baseY,
10228
- textAlign: textAlign,
10229
- textVerticalAlign: textVerticalAlign
10230
- };
10231
- }
10232
-
10233
- function setCtx(ctx, prop, value) {
10234
- // FIXME ??? performance try
10235
- // if (ctx.__currentValues[prop] !== value) {
10236
- ctx[prop] = ctx.__currentValues[prop] = value;
10237
- // }
10238
- return ctx[prop];
10239
- }
10240
-
10241
- /**
10242
- * @param {string} [stroke] If specified, do not check style.textStroke.
10243
- * @param {string} [lineWidth] If specified, do not check style.textStroke.
10244
- * @param {number} style
10245
- */
10246
- var getStroke = helper.getStroke = function (stroke, lineWidth) {
10247
- return (stroke == null || lineWidth <= 0 || stroke === 'transparent' || stroke === 'none')
10248
- ? null
10249
- // TODO pattern and gradient?
10250
- : (stroke.image || stroke.colorStops)
10251
- ? '#000'
10252
- : stroke;
10253
- };
10254
-
10255
- var getFill = helper.getFill = function (fill) {
10256
- return (fill == null || fill === 'none')
10257
- ? null
10258
- // TODO pattern and gradient?
10259
- : (fill.image || fill.colorStops)
10260
- ? '#000'
10261
- : fill;
10262
- };
10263
-
10264
- function parsePercent(value, maxValue) {
10265
- if (typeof value === 'string') {
10266
- if (value.lastIndexOf('%') >= 0) {
10267
- return parseFloat(value) / 100 * maxValue;
10268
- }
10269
- return parseFloat(value);
10270
- }
10271
- return value;
10272
- }
10273
-
10274
- function getTextXForPadding(x, textAlign, textPadding) {
10275
- return textAlign === 'right'
10276
- ? (x - textPadding[1])
10277
- : textAlign === 'center'
10278
- ? (x + textPadding[3] / 2 - textPadding[1] / 2)
10279
- : (x + textPadding[3]);
10280
- }
10281
-
10282
- /**
10283
- * @param {string} text
10284
- * @param {module:zrender/Style} style
10285
- * @return {boolean}
10286
- */
10287
- helper.needDrawText = function (text, style) {
10288
- return text != null
10289
- && (text
10290
- || style.textBackgroundColor
10291
- || (style.textBorderWidth && style.textBorderColor)
10292
- || style.textPadding
10293
- );
10294
- };
10295
-
10296
- module.exports = helper;
10297
-
10298
-
10299
-
10300
-
10301
- /***/ }),
10302
- /* 26 */
10303
- /***/ (function(module, exports) {
10304
-
10305
-
10306
-
10307
- module.exports = {
10308
- buildPath: function (ctx, shape) {
10309
- var x = shape.x;
10310
- var y = shape.y;
10311
- var width = shape.width;
10312
- var height = shape.height;
10313
- var r = shape.r;
10314
- var r1;
10315
- var r2;
10316
- var r3;
10317
- var r4;
10318
-
10319
- // Convert width and height to positive for better borderRadius
10320
- if (width < 0) {
10321
- x = x + width;
10322
- width = -width;
10323
- }
10324
- if (height < 0) {
10325
- y = y + height;
10326
- height = -height;
10327
- }
10328
-
10329
- if (typeof r === 'number') {
10330
- r1 = r2 = r3 = r4 = r;
10331
- }
10332
- else if (r instanceof Array) {
10333
- if (r.length === 1) {
10334
- r1 = r2 = r3 = r4 = r[0];
10335
- }
10336
- else if (r.length === 2) {
10337
- r1 = r3 = r[0];
10338
- r2 = r4 = r[1];
10339
- }
10340
- else if (r.length === 3) {
10341
- r1 = r[0];
10342
- r2 = r4 = r[1];
10343
- r3 = r[2];
10344
- }
10345
- else {
10346
- r1 = r[0];
10347
- r2 = r[1];
10348
- r3 = r[2];
10349
- r4 = r[3];
10350
- }
10351
- }
10352
- else {
10353
- r1 = r2 = r3 = r4 = 0;
10354
- }
10355
-
10356
- var total;
10357
- if (r1 + r2 > width) {
10358
- total = r1 + r2;
10359
- r1 *= width / total;
10360
- r2 *= width / total;
10361
- }
10362
- if (r3 + r4 > width) {
10363
- total = r3 + r4;
10364
- r3 *= width / total;
10365
- r4 *= width / total;
10366
- }
10367
- if (r2 + r3 > height) {
10368
- total = r2 + r3;
10369
- r2 *= height / total;
10370
- r3 *= height / total;
10371
- }
10372
- if (r1 + r4 > height) {
10373
- total = r1 + r4;
10374
- r1 *= height / total;
10375
- r4 *= height / total;
10376
- }
10377
- ctx.moveTo(x + r1, y);
10378
- ctx.lineTo(x + width - r2, y);
10379
- r2 !== 0 && ctx.quadraticCurveTo(
10380
- x + width, y, x + width, y + r2
10381
- );
10382
- ctx.lineTo(x + width, y + height - r3);
10383
- r3 !== 0 && ctx.quadraticCurveTo(
10384
- x + width, y + height, x + width - r3, y + height
10385
- );
10386
- ctx.lineTo(x + r4, y + height);
10387
- r4 !== 0 && ctx.quadraticCurveTo(
10388
- x, y + height, x, y + height - r4
10389
- );
10390
- ctx.lineTo(x, y + r1);
10391
- r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
10392
- }
10393
- };
10394
-
10395
-
10396
- /***/ }),
10397
- /* 27 */
10398
- /***/ (function(module, exports, __webpack_require__) {
10399
-
10400
9839
  'use strict';
10401
9840
  /**
10402
9841
  * @module zrender/Element
10403
9842
  */
10404
9843
 
10405
9844
 
10406
- var guid = __webpack_require__(28);
10407
- var Eventful = __webpack_require__(29);
10408
- var Transformable = __webpack_require__(30);
10409
- var Animatable = __webpack_require__(31);
9845
+ var guid = __webpack_require__(26);
9846
+ var Eventful = __webpack_require__(27);
9847
+ var Transformable = __webpack_require__(28);
9848
+ var Animatable = __webpack_require__(29);
10410
9849
  var zrUtil = __webpack_require__(4);
10411
9850
 
10412
9851
  /**
@@ -10662,7 +10101,7 @@ return /******/ (function(modules) { // webpackBootstrap
10662
10101
 
10663
10102
 
10664
10103
  /***/ }),
10665
- /* 28 */
10104
+ /* 26 */
10666
10105
  /***/ (function(module, exports) {
10667
10106
 
10668
10107
  /**
@@ -10681,7 +10120,7 @@ return /******/ (function(modules) { // webpackBootstrap
10681
10120
 
10682
10121
 
10683
10122
  /***/ }),
10684
- /* 29 */
10123
+ /* 27 */
10685
10124
  /***/ (function(module, exports) {
10686
10125
 
10687
10126
  /**
@@ -10989,7 +10428,7 @@ return /******/ (function(modules) { // webpackBootstrap
10989
10428
 
10990
10429
 
10991
10430
  /***/ }),
10992
- /* 30 */
10431
+ /* 28 */
10993
10432
  /***/ (function(module, exports, __webpack_require__) {
10994
10433
 
10995
10434
  'use strict';
@@ -11257,7 +10696,7 @@ return /******/ (function(modules) { // webpackBootstrap
11257
10696
 
11258
10697
 
11259
10698
  /***/ }),
11260
- /* 31 */
10699
+ /* 29 */
11261
10700
  /***/ (function(module, exports, __webpack_require__) {
11262
10701
 
11263
10702
  'use strict';
@@ -11266,12 +10705,12 @@ return /******/ (function(modules) { // webpackBootstrap
11266
10705
  */
11267
10706
 
11268
10707
 
11269
- var Animator = __webpack_require__(32);
10708
+ var Animator = __webpack_require__(30);
11270
10709
  var util = __webpack_require__(4);
11271
10710
  var isString = util.isString;
11272
10711
  var isFunction = util.isFunction;
11273
10712
  var isObject = util.isObject;
11274
- var log = __webpack_require__(36);
10713
+ var log = __webpack_require__(34);
11275
10714
 
11276
10715
  /**
11277
10716
  * @alias modue:zrender/mixin/Animatable
@@ -11536,7 +10975,7 @@ return /******/ (function(modules) { // webpackBootstrap
11536
10975
 
11537
10976
 
11538
10977
  /***/ }),
11539
- /* 32 */
10978
+ /* 30 */
11540
10979
  /***/ (function(module, exports, __webpack_require__) {
11541
10980
 
11542
10981
  /**
@@ -11544,8 +10983,8 @@ return /******/ (function(modules) { // webpackBootstrap
11544
10983
  */
11545
10984
 
11546
10985
 
11547
- var Clip = __webpack_require__(33);
11548
- var color = __webpack_require__(35);
10986
+ var Clip = __webpack_require__(31);
10987
+ var color = __webpack_require__(33);
11549
10988
  var util = __webpack_require__(4);
11550
10989
  var isArrayLike = util.isArrayLike;
11551
10990
 
@@ -12196,7 +11635,7 @@ return /******/ (function(modules) { // webpackBootstrap
12196
11635
 
12197
11636
 
12198
11637
  /***/ }),
12199
- /* 33 */
11638
+ /* 31 */
12200
11639
  /***/ (function(module, exports, __webpack_require__) {
12201
11640
 
12202
11641
  /**
@@ -12215,7 +11654,7 @@ return /******/ (function(modules) { // webpackBootstrap
12215
11654
  */
12216
11655
 
12217
11656
 
12218
- var easingFuncs = __webpack_require__(34);
11657
+ var easingFuncs = __webpack_require__(32);
12219
11658
 
12220
11659
  function Clip(options) {
12221
11660
 
@@ -12325,7 +11764,7 @@ return /******/ (function(modules) { // webpackBootstrap
12325
11764
 
12326
11765
 
12327
11766
  /***/ }),
12328
- /* 34 */
11767
+ /* 32 */
12329
11768
  /***/ (function(module, exports) {
12330
11769
 
12331
11770
  /**
@@ -12676,7 +12115,7 @@ return /******/ (function(modules) { // webpackBootstrap
12676
12115
 
12677
12116
 
12678
12117
  /***/ }),
12679
- /* 35 */
12118
+ /* 33 */
12680
12119
  /***/ (function(module, exports, __webpack_require__) {
12681
12120
 
12682
12121
  /**
@@ -12811,7 +12250,7 @@ return /******/ (function(modules) { // webpackBootstrap
12811
12250
  return m1;
12812
12251
  }
12813
12252
 
12814
- function lerp(a, b, p) {
12253
+ function lerpNumber(a, b, p) {
12815
12254
  return a + (b - a) * p;
12816
12255
  }
12817
12256
 
@@ -13077,13 +12516,13 @@ return /******/ (function(modules) { // webpackBootstrap
13077
12516
  }
13078
12517
 
13079
12518
  /**
13080
- * Map value to color. Faster than mapToColor methods because color is represented by rgba array.
12519
+ * Map value to color. Faster than lerp methods because color is represented by rgba array.
13081
12520
  * @param {number} normalizedValue A float between 0 and 1.
13082
12521
  * @param {Array.<Array.<number>>} colors List of rgba color array
13083
12522
  * @param {Array.<number>} [out] Mapped gba color array
13084
12523
  * @return {Array.<number>} will be null/undefined if input illegal.
13085
12524
  */
13086
- function fastMapToColor(normalizedValue, colors, out) {
12525
+ function fastLerp(normalizedValue, colors, out) {
13087
12526
  if (!(colors && colors.length)
13088
12527
  || !(normalizedValue >= 0 && normalizedValue <= 1)
13089
12528
  ) {
@@ -13098,13 +12537,14 @@ return /******/ (function(modules) { // webpackBootstrap
13098
12537
  var leftColor = colors[leftIndex];
13099
12538
  var rightColor = colors[rightIndex];
13100
12539
  var dv = value - leftIndex;
13101
- out[0] = clampCssByte(lerp(leftColor[0], rightColor[0], dv));
13102
- out[1] = clampCssByte(lerp(leftColor[1], rightColor[1], dv));
13103
- out[2] = clampCssByte(lerp(leftColor[2], rightColor[2], dv));
13104
- out[3] = clampCssFloat(lerp(leftColor[3], rightColor[3], dv));
12540
+ out[0] = clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv));
12541
+ out[1] = clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv));
12542
+ out[2] = clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv));
12543
+ out[3] = clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv));
13105
12544
 
13106
12545
  return out;
13107
12546
  }
12547
+
13108
12548
  /**
13109
12549
  * @param {number} normalizedValue A float between 0 and 1.
13110
12550
  * @param {Array.<string>} colors Color list.
@@ -13113,7 +12553,7 @@ return /******/ (function(modules) { // webpackBootstrap
13113
12553
  * return {color: ..., leftIndex: ..., rightIndex: ..., value: ...},
13114
12554
  * @memberOf module:zrender/util/color
13115
12555
  */
13116
- function mapToColor(normalizedValue, colors, fullOutput) {
12556
+ function lerp(normalizedValue, colors, fullOutput) {
13117
12557
  if (!(colors && colors.length)
13118
12558
  || !(normalizedValue >= 0 && normalizedValue <= 1)
13119
12559
  ) {
@@ -13129,229 +12569,813 @@ return /******/ (function(modules) { // webpackBootstrap
13129
12569
 
13130
12570
  var color = stringify(
13131
12571
  [
13132
- clampCssByte(lerp(leftColor[0], rightColor[0], dv)),
13133
- clampCssByte(lerp(leftColor[1], rightColor[1], dv)),
13134
- clampCssByte(lerp(leftColor[2], rightColor[2], dv)),
13135
- clampCssFloat(lerp(leftColor[3], rightColor[3], dv))
12572
+ clampCssByte(lerpNumber(leftColor[0], rightColor[0], dv)),
12573
+ clampCssByte(lerpNumber(leftColor[1], rightColor[1], dv)),
12574
+ clampCssByte(lerpNumber(leftColor[2], rightColor[2], dv)),
12575
+ clampCssFloat(lerpNumber(leftColor[3], rightColor[3], dv))
13136
12576
  ],
13137
12577
  'rgba'
13138
12578
  );
13139
12579
 
13140
- return fullOutput
13141
- ? {
13142
- color: color,
13143
- leftIndex: leftIndex,
13144
- rightIndex: rightIndex,
13145
- value: value
12580
+ return fullOutput
12581
+ ? {
12582
+ color: color,
12583
+ leftIndex: leftIndex,
12584
+ rightIndex: rightIndex,
12585
+ value: value
12586
+ }
12587
+ : color;
12588
+ }
12589
+
12590
+ /**
12591
+ * @param {string} color
12592
+ * @param {number=} h 0 ~ 360, ignore when null.
12593
+ * @param {number=} s 0 ~ 1, ignore when null.
12594
+ * @param {number=} l 0 ~ 1, ignore when null.
12595
+ * @return {string} Color string in rgba format.
12596
+ * @memberOf module:zrender/util/color
12597
+ */
12598
+ function modifyHSL(color, h, s, l) {
12599
+ color = parse(color);
12600
+
12601
+ if (color) {
12602
+ color = rgba2hsla(color);
12603
+ h != null && (color[0] = clampCssAngle(h));
12604
+ s != null && (color[1] = parseCssFloat(s));
12605
+ l != null && (color[2] = parseCssFloat(l));
12606
+
12607
+ return stringify(hsla2rgba(color), 'rgba');
12608
+ }
12609
+ }
12610
+
12611
+ /**
12612
+ * @param {string} color
12613
+ * @param {number=} alpha 0 ~ 1
12614
+ * @return {string} Color string in rgba format.
12615
+ * @memberOf module:zrender/util/color
12616
+ */
12617
+ function modifyAlpha(color, alpha) {
12618
+ color = parse(color);
12619
+
12620
+ if (color && alpha != null) {
12621
+ color[3] = clampCssFloat(alpha);
12622
+ return stringify(color, 'rgba');
12623
+ }
12624
+ }
12625
+
12626
+ /**
12627
+ * @param {Array.<number>} arrColor like [12,33,44,0.4]
12628
+ * @param {string} type 'rgba', 'hsva', ...
12629
+ * @return {string} Result color. (If input illegal, return undefined).
12630
+ */
12631
+ function stringify(arrColor, type) {
12632
+ if (!arrColor || !arrColor.length) {
12633
+ return;
12634
+ }
12635
+ var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];
12636
+ if (type === 'rgba' || type === 'hsva' || type === 'hsla') {
12637
+ colorStr += ',' + arrColor[3];
12638
+ }
12639
+ return type + '(' + colorStr + ')';
12640
+ }
12641
+
12642
+ module.exports = {
12643
+ parse: parse,
12644
+ lift: lift,
12645
+ toHex: toHex,
12646
+ fastLerp: fastLerp,
12647
+ fastMapToColor: fastLerp, // Deprecated
12648
+ lerp: lerp,
12649
+ mapToColor: lerp, // Deprecated
12650
+ modifyHSL: modifyHSL,
12651
+ modifyAlpha: modifyAlpha,
12652
+ stringify: stringify
12653
+ };
12654
+
12655
+
12656
+
12657
+
12658
+ /***/ }),
12659
+ /* 34 */
12660
+ /***/ (function(module, exports, __webpack_require__) {
12661
+
12662
+
12663
+ var config = __webpack_require__(35);
12664
+
12665
+ /**
12666
+ * @exports zrender/tool/log
12667
+ * @author Kener (@Kener-林峰, kener.linfeng@gmail.com)
12668
+ */
12669
+ module.exports = function() {
12670
+ if (config.debugMode === 0) {
12671
+ return;
12672
+ }
12673
+ else if (config.debugMode == 1) {
12674
+ for (var k in arguments) {
12675
+ throw new Error(arguments[k]);
12676
+ }
12677
+ }
12678
+ else if (config.debugMode > 1) {
12679
+ for (var k in arguments) {
12680
+ console.log(arguments[k]);
12681
+ }
12682
+ }
12683
+ };
12684
+
12685
+ /* for debug
12686
+ return function(mes) {
12687
+ document.getElementById('wrong-message').innerHTML =
12688
+ mes + ' ' + (new Date() - 0)
12689
+ + '<br/>'
12690
+ + document.getElementById('wrong-message').innerHTML;
12691
+ };
12692
+ */
12693
+
12694
+
12695
+
12696
+ /***/ }),
12697
+ /* 35 */
12698
+ /***/ (function(module, exports) {
12699
+
12700
+
12701
+ var dpr = 1;
12702
+ // If in browser environment
12703
+ if (typeof window !== 'undefined') {
12704
+ dpr = Math.max(window.devicePixelRatio || 1, 1);
12705
+ }
12706
+ /**
12707
+ * config默认配置项
12708
+ * @exports zrender/config
12709
+ * @author Kener (@Kener-林峰, kener.linfeng@gmail.com)
12710
+ */
12711
+ var config = {
12712
+ /**
12713
+ * debug日志选项:catchBrushException为true下有效
12714
+ * 0 : 不生成debug数据,发布用
12715
+ * 1 : 异常抛出,调试用
12716
+ * 2 : 控制台输出,调试用
12717
+ */
12718
+ debugMode: 0,
12719
+
12720
+ // retina 屏幕优化
12721
+ devicePixelRatio: dpr
12722
+ };
12723
+ module.exports = config;
12724
+
12725
+
12726
+
12727
+
12728
+ /***/ }),
12729
+ /* 36 */
12730
+ /***/ (function(module, exports, __webpack_require__) {
12731
+
12732
+ /**
12733
+ * Mixin for drawing text in a element bounding rect
12734
+ * @module zrender/mixin/RectText
12735
+ */
12736
+
12737
+
12738
+
12739
+ var textHelper = __webpack_require__(37);
12740
+ var BoundingRect = __webpack_require__(9);
12741
+
12742
+ var tmpRect = new BoundingRect();
12743
+
12744
+ var RectText = function () {};
12745
+
12746
+ RectText.prototype = {
12747
+
12748
+ constructor: RectText,
12749
+
12750
+ /**
12751
+ * Draw text in a rect with specified position.
12752
+ * @param {CanvasRenderingContext2D} ctx
12753
+ * @param {Object} rect Displayable rect
12754
+ */
12755
+ drawRectText: function (ctx, rect) {
12756
+ var style = this.style;
12757
+
12758
+ rect = style.textRect || rect;
12759
+
12760
+ // Optimize, avoid normalize every time.
12761
+ this.__dirty && textHelper.normalizeTextStyle(style, true);
12762
+
12763
+ var text = style.text;
12764
+
12765
+ // Convert to string
12766
+ text != null && (text += '');
12767
+
12768
+ if (!textHelper.needDrawText(text, style)) {
12769
+ return;
12770
+ }
12771
+
12772
+ // FIXME
12773
+ ctx.save();
12774
+
12775
+ // Transform rect to view space
12776
+ var transform = this.transform;
12777
+ if (!style.transformText) {
12778
+ if (transform) {
12779
+ tmpRect.copy(rect);
12780
+ tmpRect.applyTransform(transform);
12781
+ rect = tmpRect;
12782
+ }
12783
+ }
12784
+ else {
12785
+ this.setTransform(ctx);
12786
+ }
12787
+
12788
+ // transformText and textRotation can not be used at the same time.
12789
+ textHelper.renderText(this, ctx, text, style, rect);
12790
+
12791
+ ctx.restore();
12792
+ }
12793
+ };
12794
+
12795
+ module.exports = RectText;
12796
+
12797
+
12798
+ /***/ }),
12799
+ /* 37 */
12800
+ /***/ (function(module, exports, __webpack_require__) {
12801
+
12802
+
12803
+
12804
+ var textContain = __webpack_require__(8);
12805
+ var util = __webpack_require__(4);
12806
+ var roundRectHelper = __webpack_require__(38);
12807
+ var imageHelper = __webpack_require__(12);
12808
+
12809
+ var retrieve3 = util.retrieve3;
12810
+ var retrieve2 = util.retrieve2;
12811
+
12812
+ // TODO: Have not support 'start', 'end' yet.
12813
+ var VALID_TEXT_ALIGN = {left: 1, right: 1, center: 1};
12814
+ var VALID_TEXT_VERTICAL_ALIGN = {top: 1, bottom: 1, middle: 1};
12815
+
12816
+ var helper = {};
12817
+
12818
+ /**
12819
+ * @param {module:zrender/graphic/Style} style
12820
+ * @return {module:zrender/graphic/Style} The input style.
12821
+ */
12822
+ helper.normalizeTextStyle = function (style) {
12823
+ normalizeStyle(style);
12824
+ util.each(style.rich, normalizeStyle);
12825
+ return style;
12826
+ };
12827
+
12828
+ function normalizeStyle(style) {
12829
+ if (style) {
12830
+
12831
+ style.font = textContain.makeFont(style);
12832
+
12833
+ var textAlign = style.textAlign;
12834
+ textAlign === 'middle' && (textAlign = 'center');
12835
+ style.textAlign = (
12836
+ textAlign == null || VALID_TEXT_ALIGN[textAlign]
12837
+ ) ? textAlign : 'left';
12838
+
12839
+ // Compatible with textBaseline.
12840
+ var textVerticalAlign = style.textVerticalAlign || style.textBaseline;
12841
+ textVerticalAlign === 'center' && (textVerticalAlign = 'middle');
12842
+ style.textVerticalAlign = (
12843
+ textVerticalAlign == null || VALID_TEXT_VERTICAL_ALIGN[textVerticalAlign]
12844
+ ) ? textVerticalAlign : 'top';
12845
+
12846
+ var textPadding = style.textPadding;
12847
+ if (textPadding) {
12848
+ style.textPadding = util.normalizeCssArray(style.textPadding);
12849
+ }
12850
+ }
12851
+ }
12852
+
12853
+ /**
12854
+ * @param {CanvasRenderingContext2D} ctx
12855
+ * @param {string} text
12856
+ * @param {module:zrender/graphic/Style} style
12857
+ * @param {Object|boolean} [rect] {x, y, width, height}
12858
+ * If set false, rect text is not used.
12859
+ */
12860
+ helper.renderText = function (hostEl, ctx, text, style, rect) {
12861
+ style.rich
12862
+ ? renderRichText(hostEl, ctx, text, style, rect)
12863
+ : renderPlainText(hostEl, ctx, text, style, rect);
12864
+ };
12865
+
12866
+ function renderPlainText(hostEl, ctx, text, style, rect) {
12867
+ var font = setCtx(ctx, 'font', style.font || textContain.DEFAULT_FONT);
12868
+
12869
+ var textPadding = style.textPadding;
12870
+
12871
+ var contentBlock = hostEl.__textCotentBlock;
12872
+ if (!contentBlock || hostEl.__dirty) {
12873
+ contentBlock = hostEl.__textCotentBlock = textContain.parsePlainText(
12874
+ text, font, textPadding, style.truncate
12875
+ );
12876
+ }
12877
+
12878
+ var outerHeight = contentBlock.outerHeight;
12879
+
12880
+ var textLines = contentBlock.lines;
12881
+ var lineHeight = contentBlock.lineHeight;
12882
+
12883
+ var boxPos = getBoxPosition(outerHeight, style, rect);
12884
+ var baseX = boxPos.baseX;
12885
+ var baseY = boxPos.baseY;
12886
+ var textAlign = boxPos.textAlign;
12887
+ var textVerticalAlign = boxPos.textVerticalAlign;
12888
+
12889
+ // Origin of textRotation should be the base point of text drawing.
12890
+ applyTextRotation(ctx, style, rect, baseX, baseY);
12891
+
12892
+ var boxY = textContain.adjustTextY(baseY, outerHeight, textVerticalAlign);
12893
+ var textX = baseX;
12894
+ var textY = boxY;
12895
+
12896
+ var needDrawBg = needDrawBackground(style);
12897
+ if (needDrawBg || textPadding) {
12898
+ // Consider performance, do not call getTextWidth util necessary.
12899
+ var textWidth = textContain.getWidth(text, font);
12900
+ var outerWidth = textWidth;
12901
+ textPadding && (outerWidth += textPadding[1] + textPadding[3]);
12902
+ var boxX = textContain.adjustTextX(baseX, outerWidth, textAlign);
12903
+
12904
+ needDrawBg && drawBackground(hostEl, ctx, style, boxX, boxY, outerWidth, outerHeight);
12905
+
12906
+ if (textPadding) {
12907
+ textX = getTextXForPadding(baseX, textAlign, textPadding);
12908
+ textY += textPadding[0];
12909
+ }
12910
+ }
12911
+
12912
+ setCtx(ctx, 'textAlign', textAlign || 'left');
12913
+ // Force baseline to be "middle". Otherwise, if using "top", the
12914
+ // text will offset downward a little bit in font "Microsoft YaHei".
12915
+ setCtx(ctx, 'textBaseline', 'middle');
12916
+
12917
+ // Always set shadowBlur and shadowOffset to avoid leak from displayable.
12918
+ setCtx(ctx, 'shadowBlur', style.textShadowBlur || 0);
12919
+ setCtx(ctx, 'shadowColor', style.textShadowColor || 'transparent');
12920
+ setCtx(ctx, 'shadowOffsetX', style.textShadowOffsetX || 0);
12921
+ setCtx(ctx, 'shadowOffsetY', style.textShadowOffsetY || 0);
12922
+
12923
+ // `textBaseline` is set as 'middle'.
12924
+ textY += lineHeight / 2;
12925
+
12926
+ var textStrokeWidth = style.textStrokeWidth;
12927
+ var textStroke = getStroke(style.textStroke, textStrokeWidth);
12928
+ var textFill = getFill(style.textFill);
12929
+
12930
+ if (textStroke) {
12931
+ setCtx(ctx, 'lineWidth', textStrokeWidth);
12932
+ setCtx(ctx, 'strokeStyle', textStroke);
12933
+ }
12934
+ if (textFill) {
12935
+ setCtx(ctx, 'fillStyle', textFill);
12936
+ }
12937
+
12938
+ for (var i = 0; i < textLines.length; i++) {
12939
+ // Fill after stroke so the outline will not cover the main part.
12940
+ textStroke && ctx.strokeText(textLines[i], textX, textY);
12941
+ textFill && ctx.fillText(textLines[i], textX, textY);
12942
+ textY += lineHeight;
12943
+ }
12944
+ }
12945
+
12946
+ function renderRichText(hostEl, ctx, text, style, rect) {
12947
+ var contentBlock = hostEl.__textCotentBlock;
12948
+
12949
+ if (!contentBlock || hostEl.__dirty) {
12950
+ contentBlock = hostEl.__textCotentBlock = textContain.parseRichText(text, style);
12951
+ }
12952
+
12953
+ drawRichText(hostEl, ctx, contentBlock, style, rect);
12954
+ }
12955
+
12956
+ function drawRichText(hostEl, ctx, contentBlock, style, rect) {
12957
+ var contentWidth = contentBlock.width;
12958
+ var outerWidth = contentBlock.outerWidth;
12959
+ var outerHeight = contentBlock.outerHeight;
12960
+ var textPadding = style.textPadding;
12961
+
12962
+ var boxPos = getBoxPosition(outerHeight, style, rect);
12963
+ var baseX = boxPos.baseX;
12964
+ var baseY = boxPos.baseY;
12965
+ var textAlign = boxPos.textAlign;
12966
+ var textVerticalAlign = boxPos.textVerticalAlign;
12967
+
12968
+ // Origin of textRotation should be the base point of text drawing.
12969
+ applyTextRotation(ctx, style, rect, baseX, baseY);
12970
+
12971
+ var boxX = textContain.adjustTextX(baseX, outerWidth, textAlign);
12972
+ var boxY = textContain.adjustTextY(baseY, outerHeight, textVerticalAlign);
12973
+ var xLeft = boxX;
12974
+ var lineTop = boxY;
12975
+ if (textPadding) {
12976
+ xLeft += textPadding[3];
12977
+ lineTop += textPadding[0];
12978
+ }
12979
+ var xRight = xLeft + contentWidth;
12980
+
12981
+ needDrawBackground(style) && drawBackground(
12982
+ hostEl, ctx, style, boxX, boxY, outerWidth, outerHeight
12983
+ );
12984
+
12985
+ for (var i = 0; i < contentBlock.lines.length; i++) {
12986
+ var line = contentBlock.lines[i];
12987
+ var tokens = line.tokens;
12988
+ var tokenCount = tokens.length;
12989
+ var lineHeight = line.lineHeight;
12990
+ var usedWidth = line.width;
12991
+
12992
+ var leftIndex = 0;
12993
+ var lineXLeft = xLeft;
12994
+ var lineXRight = xRight;
12995
+ var rightIndex = tokenCount - 1;
12996
+ var token;
12997
+
12998
+ while (
12999
+ leftIndex < tokenCount
13000
+ && (token = tokens[leftIndex], !token.textAlign || token.textAlign === 'left')
13001
+ ) {
13002
+ placeToken(hostEl, ctx, token, style, lineHeight, lineTop, lineXLeft, 'left');
13003
+ usedWidth -= token.width;
13004
+ lineXLeft += token.width;
13005
+ leftIndex++;
13146
13006
  }
13147
- : color;
13148
- }
13149
13007
 
13150
- /**
13151
- * @param {string} color
13152
- * @param {number=} h 0 ~ 360, ignore when null.
13153
- * @param {number=} s 0 ~ 1, ignore when null.
13154
- * @param {number=} l 0 ~ 1, ignore when null.
13155
- * @return {string} Color string in rgba format.
13156
- * @memberOf module:zrender/util/color
13157
- */
13158
- function modifyHSL(color, h, s, l) {
13159
- color = parse(color);
13008
+ while (
13009
+ rightIndex >= 0
13010
+ && (token = tokens[rightIndex], token.textAlign === 'right')
13011
+ ) {
13012
+ placeToken(hostEl, ctx, token, style, lineHeight, lineTop, lineXRight, 'right');
13013
+ usedWidth -= token.width;
13014
+ lineXRight -= token.width;
13015
+ rightIndex--;
13016
+ }
13160
13017
 
13161
- if (color) {
13162
- color = rgba2hsla(color);
13163
- h != null && (color[0] = clampCssAngle(h));
13164
- s != null && (color[1] = parseCssFloat(s));
13165
- l != null && (color[2] = parseCssFloat(l));
13018
+ // The other tokens are placed as textAlign 'center' if there is enough space.
13019
+ lineXLeft += (contentWidth - (lineXLeft - xLeft) - (xRight - lineXRight) - usedWidth) / 2;
13020
+ while (leftIndex <= rightIndex) {
13021
+ token = tokens[leftIndex];
13022
+ // Consider width specified by user, use 'center' rather than 'left'.
13023
+ placeToken(hostEl, ctx, token, style, lineHeight, lineTop, lineXLeft + token.width / 2, 'center');
13024
+ lineXLeft += token.width;
13025
+ leftIndex++;
13026
+ }
13166
13027
 
13167
- return stringify(hsla2rgba(color), 'rgba');
13028
+ lineTop += lineHeight;
13168
13029
  }
13169
13030
  }
13170
13031
 
13171
- /**
13172
- * @param {string} color
13173
- * @param {number=} alpha 0 ~ 1
13174
- * @return {string} Color string in rgba format.
13175
- * @memberOf module:zrender/util/color
13176
- */
13177
- function modifyAlpha(color, alpha) {
13178
- color = parse(color);
13032
+ function applyTextRotation(ctx, style, rect, x, y) {
13033
+ // textRotation only apply in RectText.
13034
+ if (rect && style.textRotation) {
13035
+ var origin = style.textOrigin;
13036
+ if (origin === 'center') {
13037
+ x = rect.width / 2 + rect.x;
13038
+ y = rect.height / 2 + rect.y;
13039
+ }
13040
+ else if (origin) {
13041
+ x = origin[0] + rect.x;
13042
+ y = origin[1] + rect.y;
13043
+ }
13179
13044
 
13180
- if (color && alpha != null) {
13181
- color[3] = clampCssFloat(alpha);
13182
- return stringify(color, 'rgba');
13045
+ ctx.translate(x, y);
13046
+ // Positive: anticlockwise
13047
+ ctx.rotate(-style.textRotation);
13048
+ ctx.translate(-x, -y);
13183
13049
  }
13184
13050
  }
13185
13051
 
13186
- /**
13187
- * @param {Array.<number>} arrColor like [12,33,44,0.4]
13188
- * @param {string} type 'rgba', 'hsva', ...
13189
- * @return {string} Result color. (If input illegal, return undefined).
13190
- */
13191
- function stringify(arrColor, type) {
13192
- if (!arrColor || !arrColor.length) {
13193
- return;
13052
+ function placeToken(hostEl, ctx, token, style, lineHeight, lineTop, x, textAlign) {
13053
+ var tokenStyle = style.rich[token.styleName] || {};
13054
+
13055
+ // 'ctx.textBaseline' is always set as 'middle', for sake of
13056
+ // the bias of "Microsoft YaHei".
13057
+ var textVerticalAlign = token.textVerticalAlign;
13058
+ var y = lineTop + lineHeight / 2;
13059
+ if (textVerticalAlign === 'top') {
13060
+ y = lineTop + token.height / 2;
13194
13061
  }
13195
- var colorStr = arrColor[0] + ',' + arrColor[1] + ',' + arrColor[2];
13196
- if (type === 'rgba' || type === 'hsva' || type === 'hsla') {
13197
- colorStr += ',' + arrColor[3];
13062
+ else if (textVerticalAlign === 'bottom') {
13063
+ y = lineTop + lineHeight - token.height / 2;
13198
13064
  }
13199
- return type + '(' + colorStr + ')';
13200
- }
13201
13065
 
13202
- module.exports = {
13203
- parse: parse,
13204
- lift: lift,
13205
- toHex: toHex,
13206
- fastMapToColor: fastMapToColor,
13207
- mapToColor: mapToColor,
13208
- modifyHSL: modifyHSL,
13209
- modifyAlpha: modifyAlpha,
13210
- stringify: stringify
13211
- };
13066
+ !token.isLineHolder && needDrawBackground(tokenStyle) && drawBackground(
13067
+ hostEl,
13068
+ ctx,
13069
+ tokenStyle,
13070
+ textAlign === 'right'
13071
+ ? x - token.width
13072
+ : textAlign === 'center'
13073
+ ? x - token.width / 2
13074
+ : x,
13075
+ y - token.height / 2,
13076
+ token.width,
13077
+ token.height
13078
+ );
13079
+
13080
+ var textPadding = token.textPadding;
13081
+ if (textPadding) {
13082
+ x = getTextXForPadding(x, textAlign, textPadding);
13083
+ y -= token.height / 2 - textPadding[2] - token.textHeight / 2;
13084
+ }
13212
13085
 
13086
+ setCtx(ctx, 'shadowBlur', retrieve3(tokenStyle.textShadowBlur, style.textShadowBlur, 0));
13087
+ setCtx(ctx, 'shadowColor', tokenStyle.textShadowColor || style.textShadowColor || 'transparent');
13088
+ setCtx(ctx, 'shadowOffsetX', retrieve3(tokenStyle.textShadowOffsetX, style.textShadowOffsetX, 0));
13089
+ setCtx(ctx, 'shadowOffsetY', retrieve3(tokenStyle.textShadowOffsetY, style.textShadowOffsetY, 0));
13213
13090
 
13091
+ setCtx(ctx, 'textAlign', textAlign);
13092
+ // Force baseline to be "middle". Otherwise, if using "top", the
13093
+ // text will offset downward a little bit in font "Microsoft YaHei".
13094
+ setCtx(ctx, 'textBaseline', 'middle');
13214
13095
 
13096
+ setCtx(ctx, 'font', token.font || textContain.DEFAULT_FONT);
13215
13097
 
13216
- /***/ }),
13217
- /* 36 */
13218
- /***/ (function(module, exports, __webpack_require__) {
13098
+ var textStroke = getStroke(tokenStyle.textStroke || style.textStroke, textStrokeWidth);
13099
+ var textFill = getFill(tokenStyle.textFill || style.textFill);
13100
+ var textStrokeWidth = retrieve2(tokenStyle.textStrokeWidth, style.textStrokeWidth);
13219
13101
 
13220
-
13221
- var config = __webpack_require__(37);
13102
+ // Fill after stroke so the outline will not cover the main part.
13103
+ if (textStroke) {
13104
+ setCtx(ctx, 'lineWidth', textStrokeWidth);
13105
+ setCtx(ctx, 'strokeStyle', textStroke);
13106
+ ctx.strokeText(token.text, x, y);
13107
+ }
13108
+ if (textFill) {
13109
+ setCtx(ctx, 'fillStyle', textFill);
13110
+ ctx.fillText(token.text, x, y);
13111
+ }
13112
+ }
13222
13113
 
13223
- /**
13224
- * @exports zrender/tool/log
13225
- * @author Kener (@Kener-林峰, kener.linfeng@gmail.com)
13226
- */
13227
- module.exports = function() {
13228
- if (config.debugMode === 0) {
13229
- return;
13230
- }
13231
- else if (config.debugMode == 1) {
13232
- for (var k in arguments) {
13233
- throw new Error(arguments[k]);
13234
- }
13114
+ function needDrawBackground(style) {
13115
+ return style.textBackgroundColor
13116
+ || (style.textBorderWidth && style.textBorderColor);
13117
+ }
13118
+
13119
+ // style: {textBackgroundColor, textBorderWidth, textBorderColor, textBorderRadius}
13120
+ // shape: {x, y, width, height}
13121
+ function drawBackground(hostEl, ctx, style, x, y, width, height) {
13122
+ var textBackgroundColor = style.textBackgroundColor;
13123
+ var textBorderWidth = style.textBorderWidth;
13124
+ var textBorderColor = style.textBorderColor;
13125
+ var isPlainBg = util.isString(textBackgroundColor);
13126
+
13127
+ setCtx(ctx, 'shadowBlur', style.textBoxShadowBlur || 0);
13128
+ setCtx(ctx, 'shadowColor', style.textBoxShadowColor || 'transparent');
13129
+ setCtx(ctx, 'shadowOffsetX', style.textBoxShadowOffsetX || 0);
13130
+ setCtx(ctx, 'shadowOffsetY', style.textBoxShadowOffsetY || 0);
13131
+
13132
+ if (isPlainBg || (textBorderWidth && textBorderColor)) {
13133
+ ctx.beginPath();
13134
+ var textBorderRadius = style.textBorderRadius;
13135
+ if (!textBorderRadius) {
13136
+ ctx.rect(x, y, width, height);
13235
13137
  }
13236
- else if (config.debugMode > 1) {
13237
- for (var k in arguments) {
13238
- console.log(arguments[k]);
13239
- }
13138
+ else {
13139
+ roundRectHelper.buildPath(ctx, {
13140
+ x: x, y: y, width: width, height: height, r: textBorderRadius
13141
+ });
13240
13142
  }
13241
- };
13242
-
13243
- /* for debug
13244
- return function(mes) {
13245
- document.getElementById('wrong-message').innerHTML =
13246
- mes + ' ' + (new Date() - 0)
13247
- + '<br/>'
13248
- + document.getElementById('wrong-message').innerHTML;
13249
- };
13250
- */
13251
-
13143
+ ctx.closePath();
13144
+ }
13252
13145
 
13146
+ if (isPlainBg) {
13147
+ setCtx(ctx, 'fillStyle', textBackgroundColor);
13148
+ ctx.fill();
13149
+ }
13150
+ else if (util.isObject(textBackgroundColor)) {
13151
+ var image = textBackgroundColor.image;
13253
13152
 
13254
- /***/ }),
13255
- /* 37 */
13256
- /***/ (function(module, exports) {
13153
+ image = imageHelper.createOrUpdateImage(
13154
+ image, null, hostEl, onBgImageLoaded, textBackgroundColor
13155
+ );
13156
+ if (image && imageHelper.isImageReady(image)) {
13157
+ ctx.drawImage(image, x, y, width, height);
13158
+ }
13159
+ }
13257
13160
 
13258
-
13259
- var dpr = 1;
13260
- // If in browser environment
13261
- if (typeof window !== 'undefined') {
13262
- dpr = Math.max(window.devicePixelRatio || 1, 1);
13161
+ if (textBorderWidth && textBorderColor) {
13162
+ setCtx(ctx, 'lineWidth', textBorderWidth);
13163
+ setCtx(ctx, 'strokeStyle', textBorderColor);
13164
+ ctx.stroke();
13165
+ }
13263
13166
  }
13264
- /**
13265
- * config默认配置项
13266
- * @exports zrender/config
13267
- * @author Kener (@Kener-林峰, kener.linfeng@gmail.com)
13268
- */
13269
- var config = {
13270
- /**
13271
- * debug日志选项:catchBrushException为true下有效
13272
- * 0 : 不生成debug数据,发布用
13273
- * 1 : 异常抛出,调试用
13274
- * 2 : 控制台输出,调试用
13275
- */
13276
- debugMode: 0,
13277
13167
 
13278
- // retina 屏幕优化
13279
- devicePixelRatio: dpr
13280
- };
13281
- module.exports = config;
13168
+ function onBgImageLoaded(image, textBackgroundColor) {
13169
+ // Replace image, so that `contain/text.js#parseRichText`
13170
+ // will get correct result in next tick.
13171
+ textBackgroundColor.image = image;
13172
+ }
13282
13173
 
13174
+ function getBoxPosition(blockHeiht, style, rect) {
13175
+ var baseX = style.x || 0;
13176
+ var baseY = style.y || 0;
13177
+ var textAlign = style.textAlign;
13178
+ var textVerticalAlign = style.textVerticalAlign;
13283
13179
 
13180
+ // Text position represented by coord
13181
+ if (rect) {
13182
+ var textPosition = style.textPosition;
13183
+ if (textPosition instanceof Array) {
13184
+ // Percent
13185
+ baseX = rect.x + parsePercent(textPosition[0], rect.width);
13186
+ baseY = rect.y + parsePercent(textPosition[1], rect.height);
13187
+ }
13188
+ else {
13189
+ var res = textContain.adjustTextPositionOnRect(
13190
+ textPosition, rect, style.textDistance
13191
+ );
13192
+ baseX = res.x;
13193
+ baseY = res.y;
13194
+ // Default align and baseline when has textPosition
13195
+ textAlign = textAlign || res.textAlign;
13196
+ textVerticalAlign = textVerticalAlign || res.textVerticalAlign;
13197
+ }
13284
13198
 
13199
+ // textOffset is only support in RectText, otherwise
13200
+ // we have to adjust boundingRect for textOffset.
13201
+ var textOffset = style.textOffset;
13202
+ if (textOffset) {
13203
+ baseX += textOffset[0];
13204
+ baseY += textOffset[1];
13205
+ }
13206
+ }
13285
13207
 
13286
- /***/ }),
13287
- /* 38 */
13288
- /***/ (function(module, exports, __webpack_require__) {
13208
+ return {
13209
+ baseX: baseX,
13210
+ baseY: baseY,
13211
+ textAlign: textAlign,
13212
+ textVerticalAlign: textVerticalAlign
13213
+ };
13214
+ }
13289
13215
 
13290
- /**
13291
- * Mixin for drawing text in a element bounding rect
13292
- * @module zrender/mixin/RectText
13293
- */
13216
+ function setCtx(ctx, prop, value) {
13217
+ // FIXME ??? performance try
13218
+ // if (ctx.__currentValues[prop] !== value) {
13219
+ // ctx[prop] = ctx.__currentValues[prop] = value;
13220
+ ctx[prop] = value;
13221
+ // }
13222
+ return ctx[prop];
13223
+ }
13294
13224
 
13225
+ /**
13226
+ * @param {string} [stroke] If specified, do not check style.textStroke.
13227
+ * @param {string} [lineWidth] If specified, do not check style.textStroke.
13228
+ * @param {number} style
13229
+ */
13230
+ var getStroke = helper.getStroke = function (stroke, lineWidth) {
13231
+ return (stroke == null || lineWidth <= 0 || stroke === 'transparent' || stroke === 'none')
13232
+ ? null
13233
+ // TODO pattern and gradient?
13234
+ : (stroke.image || stroke.colorStops)
13235
+ ? '#000'
13236
+ : stroke;
13237
+ };
13295
13238
 
13239
+ var getFill = helper.getFill = function (fill) {
13240
+ return (fill == null || fill === 'none')
13241
+ ? null
13242
+ // TODO pattern and gradient?
13243
+ : (fill.image || fill.colorStops)
13244
+ ? '#000'
13245
+ : fill;
13246
+ };
13296
13247
 
13297
- var textHelper = __webpack_require__(25);
13298
- var BoundingRect = __webpack_require__(9);
13248
+ function parsePercent(value, maxValue) {
13249
+ if (typeof value === 'string') {
13250
+ if (value.lastIndexOf('%') >= 0) {
13251
+ return parseFloat(value) / 100 * maxValue;
13252
+ }
13253
+ return parseFloat(value);
13254
+ }
13255
+ return value;
13256
+ }
13299
13257
 
13300
- var tmpRect = new BoundingRect();
13258
+ function getTextXForPadding(x, textAlign, textPadding) {
13259
+ return textAlign === 'right'
13260
+ ? (x - textPadding[1])
13261
+ : textAlign === 'center'
13262
+ ? (x + textPadding[3] / 2 - textPadding[1] / 2)
13263
+ : (x + textPadding[3]);
13264
+ }
13301
13265
 
13302
- var RectText = function () {};
13266
+ /**
13267
+ * @param {string} text
13268
+ * @param {module:zrender/Style} style
13269
+ * @return {boolean}
13270
+ */
13271
+ helper.needDrawText = function (text, style) {
13272
+ return text != null
13273
+ && (text
13274
+ || style.textBackgroundColor
13275
+ || (style.textBorderWidth && style.textBorderColor)
13276
+ || style.textPadding
13277
+ );
13278
+ };
13303
13279
 
13304
- RectText.prototype = {
13280
+ module.exports = helper;
13305
13281
 
13306
- constructor: RectText,
13307
13282
 
13308
- /**
13309
- * Draw text in a rect with specified position.
13310
- * @param {CanvasRenderingContext2D} ctx
13311
- * @param {Object} rect Displayable rect
13312
- */
13313
- drawRectText: function (ctx, rect) {
13314
- var style = this.style;
13315
13283
 
13316
- rect = style.textRect || rect;
13317
13284
 
13318
- // Optimize, avoid normalize every time.
13319
- this.__dirty && textHelper.normalizeTextStyle(style, true);
13285
+ /***/ }),
13286
+ /* 38 */
13287
+ /***/ (function(module, exports) {
13320
13288
 
13321
- var text = style.text;
13289
+
13322
13290
 
13323
- // Convert to string
13324
- text != null && (text += '');
13291
+ module.exports = {
13292
+ buildPath: function (ctx, shape) {
13293
+ var x = shape.x;
13294
+ var y = shape.y;
13295
+ var width = shape.width;
13296
+ var height = shape.height;
13297
+ var r = shape.r;
13298
+ var r1;
13299
+ var r2;
13300
+ var r3;
13301
+ var r4;
13325
13302
 
13326
- if (!textHelper.needDrawText(text, style)) {
13327
- return;
13303
+ // Convert width and height to positive for better borderRadius
13304
+ if (width < 0) {
13305
+ x = x + width;
13306
+ width = -width;
13307
+ }
13308
+ if (height < 0) {
13309
+ y = y + height;
13310
+ height = -height;
13328
13311
  }
13329
13312
 
13330
- // FIXME
13331
- ctx.save();
13332
-
13333
- // Transform rect to view space
13334
- var transform = this.transform;
13335
- if (!style.transformText) {
13336
- if (transform) {
13337
- tmpRect.copy(rect);
13338
- tmpRect.applyTransform(transform);
13339
- rect = tmpRect;
13313
+ if (typeof r === 'number') {
13314
+ r1 = r2 = r3 = r4 = r;
13315
+ }
13316
+ else if (r instanceof Array) {
13317
+ if (r.length === 1) {
13318
+ r1 = r2 = r3 = r4 = r[0];
13319
+ }
13320
+ else if (r.length === 2) {
13321
+ r1 = r3 = r[0];
13322
+ r2 = r4 = r[1];
13323
+ }
13324
+ else if (r.length === 3) {
13325
+ r1 = r[0];
13326
+ r2 = r4 = r[1];
13327
+ r3 = r[2];
13328
+ }
13329
+ else {
13330
+ r1 = r[0];
13331
+ r2 = r[1];
13332
+ r3 = r[2];
13333
+ r4 = r[3];
13340
13334
  }
13341
13335
  }
13342
13336
  else {
13343
- this.setTransform(ctx);
13337
+ r1 = r2 = r3 = r4 = 0;
13344
13338
  }
13345
13339
 
13346
- // transformText and textRotation can not be used at the same time.
13347
- textHelper.renderText(this, ctx, text, style, rect);
13348
-
13349
- ctx.restore();
13340
+ var total;
13341
+ if (r1 + r2 > width) {
13342
+ total = r1 + r2;
13343
+ r1 *= width / total;
13344
+ r2 *= width / total;
13345
+ }
13346
+ if (r3 + r4 > width) {
13347
+ total = r3 + r4;
13348
+ r3 *= width / total;
13349
+ r4 *= width / total;
13350
+ }
13351
+ if (r2 + r3 > height) {
13352
+ total = r2 + r3;
13353
+ r2 *= height / total;
13354
+ r3 *= height / total;
13355
+ }
13356
+ if (r1 + r4 > height) {
13357
+ total = r1 + r4;
13358
+ r1 *= height / total;
13359
+ r4 *= height / total;
13360
+ }
13361
+ ctx.moveTo(x + r1, y);
13362
+ ctx.lineTo(x + width - r2, y);
13363
+ r2 !== 0 && ctx.quadraticCurveTo(
13364
+ x + width, y, x + width, y + r2
13365
+ );
13366
+ ctx.lineTo(x + width, y + height - r3);
13367
+ r3 !== 0 && ctx.quadraticCurveTo(
13368
+ x + width, y + height, x + width - r3, y + height
13369
+ );
13370
+ ctx.lineTo(x + r4, y + height);
13371
+ r4 !== 0 && ctx.quadraticCurveTo(
13372
+ x, y + height, x, y + height - r4
13373
+ );
13374
+ ctx.lineTo(x, y + r1);
13375
+ r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
13350
13376
  }
13351
13377
  };
13352
13378
 
13353
- module.exports = RectText;
13354
-
13355
13379
 
13356
13380
  /***/ }),
13357
13381
  /* 39 */
@@ -13373,7 +13397,7 @@ return /******/ (function(modules) { // webpackBootstrap
13373
13397
  var vec2 = __webpack_require__(10);
13374
13398
  var bbox = __webpack_require__(41);
13375
13399
  var BoundingRect = __webpack_require__(9);
13376
- var dpr = __webpack_require__(37).devicePixelRatio;
13400
+ var dpr = __webpack_require__(35).devicePixelRatio;
13377
13401
 
13378
13402
  var CMD = {
13379
13403
  M: 1,
@@ -15738,7 +15762,7 @@ return /******/ (function(modules) { // webpackBootstrap
15738
15762
 
15739
15763
 
15740
15764
  var zrUtil = __webpack_require__(4);
15741
- var Element = __webpack_require__(27);
15765
+ var Element = __webpack_require__(25);
15742
15766
  var BoundingRect = __webpack_require__(9);
15743
15767
 
15744
15768
  /**
@@ -16174,7 +16198,7 @@ return /******/ (function(modules) { // webpackBootstrap
16174
16198
  var Displayable = __webpack_require__(23);
16175
16199
  var zrUtil = __webpack_require__(4);
16176
16200
  var textContain = __webpack_require__(8);
16177
- var textHelper = __webpack_require__(25);
16201
+ var textHelper = __webpack_require__(37);
16178
16202
 
16179
16203
  /**
16180
16204
  * @alias zrender/graphic/Text
@@ -16242,8 +16266,8 @@ return /******/ (function(modules) { // webpackBootstrap
16242
16266
  rect.x += style.x || 0;
16243
16267
  rect.y += style.y || 0;
16244
16268
 
16245
- if (textHelper.getStroke(style.textStroke, style.textLineWidth)) {
16246
- var w = style.textLineWidth;
16269
+ if (textHelper.getStroke(style.textStroke, style.textStrokeWidth)) {
16270
+ var w = style.textStrokeWidth;
16247
16271
  rect.x -= w / 2;
16248
16272
  rect.y -= w / 2;
16249
16273
  rect.width += w;
@@ -16790,7 +16814,7 @@ return /******/ (function(modules) { // webpackBootstrap
16790
16814
  */
16791
16815
 
16792
16816
 
16793
- var roundRectHelper = __webpack_require__(26);
16817
+ var roundRectHelper = __webpack_require__(38);
16794
16818
 
16795
16819
  module.exports = __webpack_require__(22).extend({
16796
16820
 
@@ -19055,30 +19079,31 @@ return /******/ (function(modules) { // webpackBootstrap
19055
19079
  compatItemStyle(data[i]);
19056
19080
  compatLabelTextStyle(data[i] && data[i].label);
19057
19081
  }
19058
- // mark point data
19059
- var markPoint = seriesOpt.markPoint;
19060
- if (markPoint && markPoint.data) {
19061
- var mpData = markPoint.data;
19062
- for (var i = 0; i < mpData.length; i++) {
19063
- compatItemStyle(mpData[i]);
19064
- compatLabelTextStyle(mpData[i] && mpData[i].label);
19065
- }
19066
- }
19067
- // mark line data
19068
- var markLine = seriesOpt.markLine;
19069
- if (markLine && markLine.data) {
19070
- var mlData = markLine.data;
19071
- for (var i = 0; i < mlData.length; i++) {
19072
- if (zrUtil.isArray(mlData[i])) {
19073
- compatItemStyle(mlData[i][0]);
19074
- compatLabelTextStyle(mlData[i][0] && mlData[i][0].label);
19075
- compatItemStyle(mlData[i][1]);
19076
- compatLabelTextStyle(mlData[i][1] && mlData[i][1].label);
19077
- }
19078
- else {
19079
- compatItemStyle(mlData[i]);
19080
- compatLabelTextStyle(mlData[i] && mlData[i].label);
19081
- }
19082
+ }
19083
+
19084
+ // mark point data
19085
+ var markPoint = seriesOpt.markPoint;
19086
+ if (markPoint && markPoint.data) {
19087
+ var mpData = markPoint.data;
19088
+ for (var i = 0; i < mpData.length; i++) {
19089
+ compatItemStyle(mpData[i]);
19090
+ compatLabelTextStyle(mpData[i] && mpData[i].label);
19091
+ }
19092
+ }
19093
+ // mark line data
19094
+ var markLine = seriesOpt.markLine;
19095
+ if (markLine && markLine.data) {
19096
+ var mlData = markLine.data;
19097
+ for (var i = 0; i < mlData.length; i++) {
19098
+ if (zrUtil.isArray(mlData[i])) {
19099
+ compatItemStyle(mlData[i][0]);
19100
+ compatLabelTextStyle(mlData[i][0] && mlData[i][0].label);
19101
+ compatItemStyle(mlData[i][1]);
19102
+ compatLabelTextStyle(mlData[i][1] && mlData[i][1].label);
19103
+ }
19104
+ else {
19105
+ compatItemStyle(mlData[i]);
19106
+ compatLabelTextStyle(mlData[i] && mlData[i].label);
19082
19107
  }
19083
19108
  }
19084
19109
  }
@@ -19871,7 +19896,7 @@ return /******/ (function(modules) { // webpackBootstrap
19871
19896
  */
19872
19897
  // Global defines
19873
19898
 
19874
- var guid = __webpack_require__(28);
19899
+ var guid = __webpack_require__(26);
19875
19900
  var env = __webpack_require__(2);
19876
19901
  var zrUtil = __webpack_require__(4);
19877
19902
 
@@ -19893,7 +19918,7 @@ return /******/ (function(modules) { // webpackBootstrap
19893
19918
  /**
19894
19919
  * @type {string}
19895
19920
  */
19896
- zrender.version = '3.6.1';
19921
+ zrender.version = '3.6.2';
19897
19922
 
19898
19923
  /**
19899
19924
  * Initializing a zrender instance
@@ -20316,9 +20341,10 @@ return /******/ (function(modules) { // webpackBootstrap
20316
20341
 
20317
20342
 
20318
20343
  var util = __webpack_require__(4);
20344
+ var vec2 = __webpack_require__(10);
20319
20345
  var Draggable = __webpack_require__(89);
20320
20346
 
20321
- var Eventful = __webpack_require__(29);
20347
+ var Eventful = __webpack_require__(27);
20322
20348
 
20323
20349
  var SILENT = 'silent';
20324
20350
 
@@ -20338,7 +20364,8 @@ return /******/ (function(modules) { // webpackBootstrap
20338
20364
  pinchY: event.pinchY,
20339
20365
  pinchScale: event.pinchScale,
20340
20366
  wheelDelta: event.zrDelta,
20341
- zrByTouch: event.zrByTouch
20367
+ zrByTouch: event.zrByTouch,
20368
+ which: event.which
20342
20369
  };
20343
20370
  }
20344
20371
 
@@ -20593,17 +20620,27 @@ return /******/ (function(modules) { // webpackBootstrap
20593
20620
  var hoveredTarget = hovered.target;
20594
20621
 
20595
20622
  if (name === 'mousedown') {
20596
- this._downel = hoveredTarget;
20623
+ this._downEl = hoveredTarget;
20624
+ this._downPoint = [event.zrX, event.zrY];
20597
20625
  // In case click triggered before mouseup
20598
- this._upel = hoveredTarget;
20626
+ this._upEl = hoveredTarget;
20599
20627
  }
20600
20628
  else if (name === 'mosueup') {
20601
- this._upel = hoveredTarget;
20629
+ this._upEl = hoveredTarget;
20602
20630
  }
20603
20631
  else if (name === 'click') {
20604
- if (this._downel !== this._upel) {
20632
+ if (this._downEl !== this._upEl
20633
+ // Original click event is triggered on the whole canvas element,
20634
+ // including the case that `mousedown` - `mousemove` - `mouseup`,
20635
+ // which should be filtered, otherwise it will bring trouble to
20636
+ // pan and zoom.
20637
+ || !this._downPoint
20638
+ // Arbitrary value
20639
+ || vec2.dist(this._downPoint, [event.zrX, event.zrY]) > 4
20640
+ ) {
20605
20641
  return;
20606
20642
  }
20643
+ this._downPoint = null;
20607
20644
  }
20608
20645
 
20609
20646
  this.dispatchToElement(hovered, name, event);
@@ -21691,7 +21728,7 @@ return /******/ (function(modules) { // webpackBootstrap
21691
21728
 
21692
21729
  var requestAnimationFrame = __webpack_require__(94);
21693
21730
 
21694
- var Animator = __webpack_require__(32);
21731
+ var Animator = __webpack_require__(30);
21695
21732
  /**
21696
21733
  * @typedef {Object} IZRenderStage
21697
21734
  * @property {Function} update
@@ -21942,11 +21979,13 @@ return /******/ (function(modules) { // webpackBootstrap
21942
21979
  */
21943
21980
 
21944
21981
 
21945
- var Eventful = __webpack_require__(29);
21982
+ var Eventful = __webpack_require__(27);
21946
21983
  var env = __webpack_require__(2);
21947
21984
 
21948
21985
  var isDomLevel2 = (typeof window !== 'undefined') && !!window.addEventListener;
21949
21986
 
21987
+ var MOUSE_EVENT_REG = /^(?:mouse|pointer|contextmenu|drag|drop)|click/;
21988
+
21950
21989
  function getBoundingClientRect(el) {
21951
21990
  // BlackBerry 5, iOS 3 (original iPhone) don't have getBoundingRect
21952
21991
  return el.getBoundingClientRect ? el.getBoundingClientRect() : {left: 0, top: 0};
@@ -22027,6 +22066,15 @@ return /******/ (function(modules) { // webpackBootstrap
22027
22066
  touch && clientToLocal(el, touch, e, calculate);
22028
22067
  }
22029
22068
 
22069
+ // Add which for click: 1 === left; 2 === middle; 3 === right; otherwise: 0;
22070
+ // See jQuery: https://github.com/jquery/jquery/blob/master/src/event.js
22071
+ // If e.which has been defined, if may be readonly,
22072
+ // see: https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which
22073
+ var button = e.button;
22074
+ if (e.which == null && button !== undefined && MOUSE_EVENT_REG.test(e.type)) {
22075
+ e.which = (button & 1 ? 1 : (button & 2 ? 3 : (button & 4 ? 2 : 0)));
22076
+ }
22077
+
22030
22078
  return e;
22031
22079
  }
22032
22080
 
@@ -22068,11 +22116,17 @@ return /******/ (function(modules) { // webpackBootstrap
22068
22116
  e.cancelBubble = true;
22069
22117
  };
22070
22118
 
22119
+ function notLeftMouse(e) {
22120
+ // If e.which is undefined, considered as left mouse event.
22121
+ return e.which > 1;
22122
+ }
22123
+
22071
22124
  module.exports = {
22072
22125
  clientToLocal: clientToLocal,
22073
22126
  normalizeEvent: normalizeEvent,
22074
22127
  addEventListener: addEventListener,
22075
22128
  removeEventListener: removeEventListener,
22129
+ notLeftMouse: notLeftMouse,
22076
22130
 
22077
22131
  stop: stop,
22078
22132
  // 做向上兼容
@@ -22108,7 +22162,7 @@ return /******/ (function(modules) { // webpackBootstrap
22108
22162
 
22109
22163
  var eventTool = __webpack_require__(93);
22110
22164
  var zrUtil = __webpack_require__(4);
22111
- var Eventful = __webpack_require__(29);
22165
+ var Eventful = __webpack_require__(27);
22112
22166
  var env = __webpack_require__(2);
22113
22167
  var GestureMgr = __webpack_require__(96);
22114
22168
 
@@ -22624,9 +22678,9 @@ return /******/ (function(modules) { // webpackBootstrap
22624
22678
  */
22625
22679
 
22626
22680
 
22627
- var config = __webpack_require__(37);
22681
+ var config = __webpack_require__(35);
22628
22682
  var util = __webpack_require__(4);
22629
- var log = __webpack_require__(36);
22683
+ var log = __webpack_require__(34);
22630
22684
  var BoundingRect = __webpack_require__(9);
22631
22685
  var timsort = __webpack_require__(91);
22632
22686
 
@@ -22737,6 +22791,9 @@ return /******/ (function(modules) { // webpackBootstrap
22737
22791
  * @param {Object} opts
22738
22792
  */
22739
22793
  var Painter = function (root, storage, opts) {
22794
+
22795
+ this.type = 'canvas';
22796
+
22740
22797
  // In node environment using node-canvas
22741
22798
  var singleCanvas = !root.nodeName // In node ?
22742
22799
  || root.nodeName.toUpperCase() === 'CANVAS';
@@ -22842,6 +22899,10 @@ return /******/ (function(modules) { // webpackBootstrap
22842
22899
 
22843
22900
  constructor: Painter,
22844
22901
 
22902
+ getType: function () {
22903
+ return 'canvas';
22904
+ },
22905
+
22845
22906
  /**
22846
22907
  * If painter use a single canvas
22847
22908
  * @return {boolean}
@@ -23749,7 +23810,7 @@ return /******/ (function(modules) { // webpackBootstrap
23749
23810
 
23750
23811
 
23751
23812
  var util = __webpack_require__(4);
23752
- var config = __webpack_require__(37);
23813
+ var config = __webpack_require__(35);
23753
23814
  var Style = __webpack_require__(24);
23754
23815
  var Pattern = __webpack_require__(49);
23755
23816
 
@@ -26670,7 +26731,7 @@ return /******/ (function(modules) { // webpackBootstrap
26670
26731
  // If there are no data and extent are [Infinity, -Infinity]
26671
26732
  if (extent[1] === -Infinity && extent[0] === Infinity) {
26672
26733
  var d = new Date();
26673
- extent[1] = new Date(d.getFullYear(), d.getMonth(), d.getDate());
26734
+ extent[1] = +new Date(d.getFullYear(), d.getMonth(), d.getDate());
26674
26735
  extent[0] = extent[1] - ONE_DAY;
26675
26736
  }
26676
26737
 
@@ -26691,8 +26752,6 @@ return /******/ (function(modules) { // webpackBootstrap
26691
26752
  * @override
26692
26753
  */
26693
26754
  niceTicks: function (approxTickNum, minInterval, maxInterval) {
26694
- var timezoneOffset = this.getSetting('useUTC')
26695
- ? 0 : numberUtil.getTimezoneOffset() * 60 * 1000;
26696
26755
  approxTickNum = approxTickNum || 10;
26697
26756
 
26698
26757
  var extent = this._extent;
@@ -26722,9 +26781,11 @@ return /******/ (function(modules) { // webpackBootstrap
26722
26781
  interval *= yearStep;
26723
26782
  }
26724
26783
 
26784
+ var timezoneOffset = this.getSetting('useUTC')
26785
+ ? 0 : (new Date(+extent[0] || +extent[1])).getTimezoneOffset() * 60 * 1000;
26725
26786
  var niceExtent = [
26726
26787
  Math.round(mathCeil((extent[0] - timezoneOffset) / interval) * interval + timezoneOffset),
26727
- Math.round(mathFloor((extent[1] - timezoneOffset)/ interval) * interval + timezoneOffset)
26788
+ Math.round(mathFloor((extent[1] - timezoneOffset) / interval) * interval + timezoneOffset)
26728
26789
  ];
26729
26790
 
26730
26791
  scaleHelper.fixExtent(niceExtent, extent);
@@ -28272,8 +28333,20 @@ return /******/ (function(modules) { // webpackBootstrap
28272
28333
  function getStackedOnPoints(coordSys, data) {
28273
28334
  var baseAxis = coordSys.getBaseAxis();
28274
28335
  var valueAxis = coordSys.getOtherAxis(baseAxis);
28275
- var valueStart = baseAxis.onZero
28276
- ? 0 : valueAxis.scale.getExtent()[0];
28336
+
28337
+ var valueStart = 0;
28338
+ if (!baseAxis.onZero) {
28339
+ var extent = valueAxis.scale.getExtent();
28340
+ if (extent[0] > 0) {
28341
+ // Both positive
28342
+ valueStart = extent[0];
28343
+ }
28344
+ else if (extent[1] < 0) {
28345
+ // Both negative
28346
+ valueStart = extent[1];
28347
+ }
28348
+ // If is one positive, and one negative, onZero shall be true
28349
+ }
28277
28350
 
28278
28351
  var valueDim = valueAxis.dim;
28279
28352
 
@@ -31440,7 +31513,7 @@ return /******/ (function(modules) { // webpackBootstrap
31440
31513
  var getInterval = AxisBuilder.getInterval;
31441
31514
 
31442
31515
  var axisBuilderAttrs = [
31443
- 'axisLine', 'axisLabel', 'axisTick', 'axisName'
31516
+ 'axisLine', 'axisTickLabel', 'axisName'
31444
31517
  ];
31445
31518
  var selfBuilderAttrs = [
31446
31519
  'splitArea', 'splitLine'
@@ -31528,13 +31601,19 @@ return /******/ (function(modules) { // webpackBootstrap
31528
31601
  );
31529
31602
  var ticks = axis.scale.getTicks();
31530
31603
 
31604
+ var showMinLabel = axisModel.get('axisLabel.showMinLabel');
31605
+ var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
31606
+
31531
31607
  var p1 = [];
31532
31608
  var p2 = [];
31533
31609
  // Simple optimization
31534
31610
  // Batching the lines if color are the same
31535
31611
  var lineStyle = lineStyleModel.getLineStyle();
31536
31612
  for (var i = 0; i < ticksCoords.length; i++) {
31537
- if (ifIgnoreOnTick(axis, i, lineInterval)) {
31613
+ if (ifIgnoreOnTick(
31614
+ axis, i, lineInterval, ticksCoords.length,
31615
+ showMinLabel, showMaxLabel
31616
+ )) {
31538
31617
  continue;
31539
31618
  }
31540
31619
 
@@ -31605,8 +31684,14 @@ return /******/ (function(modules) { // webpackBootstrap
31605
31684
  var areaStyle = areaStyleModel.getAreaStyle();
31606
31685
  areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors];
31607
31686
 
31687
+ var showMinLabel = axisModel.get('axisLabel.showMinLabel');
31688
+ var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
31689
+
31608
31690
  for (var i = 1; i < ticksCoords.length; i++) {
31609
- if (ifIgnoreOnTick(axis, i, areaInterval)) {
31691
+ if (ifIgnoreOnTick(
31692
+ axis, i, areaInterval, ticksCoords.length,
31693
+ showMinLabel, showMaxLabel
31694
+ )) {
31610
31695
  continue;
31611
31696
  }
31612
31697
 
@@ -31715,7 +31800,7 @@ return /******/ (function(modules) { // webpackBootstrap
31715
31800
  * @param {Object} opt Standard axis parameters.
31716
31801
  * @param {Array.<number>} opt.position [x, y]
31717
31802
  * @param {number} opt.rotation by radian
31718
- * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle'.
31803
+ * @param {number} [opt.nameDirection=1] 1 or -1 Used when nameLocation is 'middle' or 'center'.
31719
31804
  * @param {number} [opt.tickDirection=1] 1 or -1
31720
31805
  * @param {number} [opt.labelDirection=1] 1 or -1
31721
31806
  * @param {number} [opt.labelOffset=0] Usefull when onZero.
@@ -31837,173 +31922,14 @@ return /******/ (function(modules) { // webpackBootstrap
31837
31922
  /**
31838
31923
  * @private
31839
31924
  */
31840
- axisTick: function () {
31925
+ axisTickLabel: function () {
31841
31926
  var axisModel = this.axisModel;
31842
- var axis = axisModel.axis;
31843
-
31844
- if (!axisModel.get('axisTick.show') || axis.scale.isBlank()) {
31845
- return;
31846
- }
31847
-
31848
- var tickModel = axisModel.getModel('axisTick');
31849
31927
  var opt = this.opt;
31850
31928
 
31851
- var lineStyleModel = tickModel.getModel('lineStyle');
31852
- var tickLen = tickModel.get('length');
31853
-
31854
- var tickInterval = getInterval(tickModel, opt.labelInterval);
31855
- var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel'));
31856
- var ticks = axis.scale.getTicks();
31857
-
31858
- var pt1 = [];
31859
- var pt2 = [];
31860
- var matrix = this._transform;
31861
-
31862
- for (var i = 0; i < ticksCoords.length; i++) {
31863
- // Only ordinal scale support tick interval
31864
- if (ifIgnoreOnTick(axis, i, tickInterval)) {
31865
- continue;
31866
- }
31867
-
31868
- var tickCoord = ticksCoords[i];
31869
-
31870
- pt1[0] = tickCoord;
31871
- pt1[1] = 0;
31872
- pt2[0] = tickCoord;
31873
- pt2[1] = opt.tickDirection * tickLen;
31874
-
31875
- if (matrix) {
31876
- v2ApplyTransform(pt1, pt1, matrix);
31877
- v2ApplyTransform(pt2, pt2, matrix);
31878
- }
31879
- // Tick line, Not use group transform to have better line draw
31880
- this.group.add(new graphic.Line(graphic.subPixelOptimizeLine({
31881
-
31882
- // Id for animation
31883
- anid: 'tick_' + ticks[i],
31884
-
31885
- shape: {
31886
- x1: pt1[0],
31887
- y1: pt1[1],
31888
- x2: pt2[0],
31889
- y2: pt2[1]
31890
- },
31891
- style: zrUtil.defaults(
31892
- lineStyleModel.getLineStyle(),
31893
- {
31894
- stroke: axisModel.get('axisLine.lineStyle.color')
31895
- }
31896
- ),
31897
- z2: 2,
31898
- silent: true
31899
- })));
31900
- }
31901
- },
31902
-
31903
- /**
31904
- * @param {module:echarts/coord/cartesian/AxisModel} axisModel
31905
- * @param {module:echarts/coord/cartesian/GridModel} gridModel
31906
- * @private
31907
- */
31908
- axisLabel: function () {
31909
- var opt = this.opt;
31910
- var axisModel = this.axisModel;
31911
- var axis = axisModel.axis;
31912
- var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show'));
31913
-
31914
- if (!show || axis.scale.isBlank()) {
31915
- return;
31916
- }
31917
-
31918
- var labelModel = axisModel.getModel('axisLabel');
31919
- var labelMargin = labelModel.get('margin');
31920
- var ticks = axis.scale.getTicks();
31921
- var labels = axisModel.getFormattedLabels();
31922
-
31923
- // Special label rotate.
31924
- var labelRotation = (
31925
- retrieve(opt.labelRotate, labelModel.get('rotate')) || 0
31926
- ) * PI / 180;
31927
-
31928
- var labelLayout = innerTextLayout(opt.rotation, labelRotation, opt.labelDirection);
31929
- var categoryData = axisModel.get('data');
31930
-
31931
- var textEls = [];
31932
- var silent = isSilent(axisModel);
31933
- var triggerEvent = axisModel.get('triggerEvent');
31934
-
31935
- zrUtil.each(ticks, function (tickVal, index) {
31936
- if (ifIgnoreOnTick(axis, index, opt.labelInterval)) {
31937
- return;
31938
- }
31939
-
31940
- var itemLabelModel = labelModel;
31941
- if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) {
31942
- itemLabelModel = new Model(
31943
- categoryData[tickVal].textStyle, labelModel, axisModel.ecModel
31944
- );
31945
- }
31946
-
31947
- var textColor = itemLabelModel.getTextColor()
31948
- || axisModel.get('axisLine.lineStyle.color');
31949
-
31950
- var tickCoord = axis.dataToCoord(tickVal);
31951
- var pos = [
31952
- tickCoord,
31953
- opt.labelOffset + opt.labelDirection * labelMargin
31954
- ];
31955
- var labelStr = axis.scale.getLabel(tickVal);
31956
-
31957
- var textEl = new graphic.Text({
31958
- // Id for animation
31959
- anid: 'label_' + tickVal,
31960
- position: pos,
31961
- rotation: labelLayout.rotation,
31962
- silent: silent,
31963
- z2: 10
31964
- });
31965
-
31966
- graphic.setTextStyle(textEl.style, itemLabelModel, {
31967
- text: labels[index],
31968
- textAlign: itemLabelModel.getShallow('align', true)
31969
- || labelLayout.textAlign,
31970
- textVerticalAlign: itemLabelModel.getShallow('verticalAlign', true)
31971
- || itemLabelModel.getShallow('baseline', true)
31972
- || labelLayout.textVerticalAlign,
31973
- textFill: typeof textColor === 'function'
31974
- ? textColor(
31975
- // (1) In category axis with data zoom, tick is not the original
31976
- // index of axis.data. So tick should not be exposed to user
31977
- // in category axis.
31978
- // (2) Compatible with previous version, which always returns labelStr.
31979
- // But in interval scale labelStr is like '223,445', which maked
31980
- // user repalce ','. So we modify it to return original val but remain
31981
- // it as 'string' to avoid error in replacing.
31982
- axis.type === 'category' ? labelStr : axis.type === 'value' ? tickVal + '' : tickVal,
31983
- index
31984
- )
31985
- : textColor
31986
- });
31987
-
31988
- // Pack data for mouse event
31989
- if (triggerEvent) {
31990
- textEl.eventData = makeAxisEventDataBase(axisModel);
31991
- textEl.eventData.targetType = 'axisLabel';
31992
- textEl.eventData.value = labelStr;
31993
- }
31929
+ var tickEls = buildAxisTick(this, axisModel, opt);
31930
+ var labelEls = buildAxisLabel(this, axisModel, opt);
31994
31931
 
31995
- // FIXME
31996
- this._dumbGroup.add(textEl);
31997
- textEl.updateTransform();
31998
-
31999
- textEls.push(textEl);
32000
- this.group.add(textEl);
32001
-
32002
- textEl.decomposeTransform();
32003
-
32004
- }, this);
32005
-
32006
- fixMinMaxLabelShow(axisModel, textEls);
31932
+ fixMinMaxLabelShow(axisModel, labelEls, tickEls);
32007
31933
  },
32008
31934
 
32009
31935
  /**
@@ -32032,7 +31958,7 @@ return /******/ (function(modules) { // webpackBootstrap
32032
31958
  ? extent[1] + gapSignal * gap
32033
31959
  : (extent[0] + extent[1]) / 2, // 'middle'
32034
31960
  // Reuse labelOffset.
32035
- nameLocation === 'middle' ? opt.labelOffset + nameDirection * gap : 0
31961
+ isNameLocationCenter(nameLocation) ? opt.labelOffset + nameDirection * gap : 0
32036
31962
  ];
32037
31963
 
32038
31964
  var labelLayout;
@@ -32044,7 +31970,7 @@ return /******/ (function(modules) { // webpackBootstrap
32044
31970
 
32045
31971
  var axisNameAvailableWidth;
32046
31972
 
32047
- if (nameLocation === 'middle') {
31973
+ if (isNameLocationCenter(nameLocation)) {
32048
31974
  labelLayout = innerTextLayout(
32049
31975
  opt.rotation,
32050
31976
  nameRotation != null ? nameRotation : opt.rotation, // Adapt to axis.
@@ -32225,32 +32151,64 @@ return /******/ (function(modules) { // webpackBootstrap
32225
32151
  );
32226
32152
  }
32227
32153
 
32228
- function fixMinMaxLabelShow(axisModel, textEls) {
32154
+ function fixMinMaxLabelShow(axisModel, labelEls, tickEls) {
32229
32155
  // If min or max are user set, we need to check
32230
32156
  // If the tick on min(max) are overlap on their neighbour tick
32231
32157
  // If they are overlapped, we need to hide the min(max) tick label
32232
32158
  var showMinLabel = axisModel.get('axisLabel.showMinLabel');
32233
32159
  var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
32234
- var firstLabel = textEls[0];
32235
- var nextLabel = textEls[1];
32236
- var lastLabel = textEls[textEls.length - 1];
32237
- var prevLabel = textEls[textEls.length - 2];
32160
+
32161
+ // FIXME
32162
+ // Have not consider onBand yet, where tick els is more than label els.
32163
+
32164
+ labelEls = labelEls || [];
32165
+ tickEls = tickEls || [];
32166
+
32167
+ var firstLabel = labelEls[0];
32168
+ var nextLabel = labelEls[1];
32169
+ var lastLabel = labelEls[labelEls.length - 1];
32170
+ var prevLabel = labelEls[labelEls.length - 2];
32171
+
32172
+ var firstTick = tickEls[0];
32173
+ var nextTick = tickEls[1];
32174
+ var lastTick = tickEls[tickEls.length - 1];
32175
+ var prevTick = tickEls[tickEls.length - 2];
32238
32176
 
32239
32177
  if (showMinLabel === false) {
32240
- firstLabel.ignore = true;
32178
+ ignoreEl(firstLabel);
32179
+ ignoreEl(firstTick);
32241
32180
  }
32242
- else if (axisModel.getMin() != null && isTwoLabelOverlapped(firstLabel, nextLabel)) {
32243
- showMinLabel ? (nextLabel.ignore = true) : (firstLabel.ignore = true);
32181
+ else if (isTwoLabelOverlapped(firstLabel, nextLabel)) {
32182
+ if (showMinLabel) {
32183
+ ignoreEl(nextLabel);
32184
+ ignoreEl(nextTick);
32185
+ }
32186
+ else {
32187
+ ignoreEl(firstLabel);
32188
+ ignoreEl(firstTick);
32189
+ }
32244
32190
  }
32245
32191
 
32246
32192
  if (showMaxLabel === false) {
32247
- lastLabel.ignore = true;
32193
+ ignoreEl(lastLabel);
32194
+ ignoreEl(lastTick);
32248
32195
  }
32249
- else if (axisModel.getMax() != null && isTwoLabelOverlapped(prevLabel, lastLabel)) {
32250
- showMaxLabel ? (prevLabel.ignore = true) : (lastLabel.ignore = true);
32196
+ else if (isTwoLabelOverlapped(prevLabel, lastLabel)) {
32197
+ if (showMaxLabel) {
32198
+ ignoreEl(prevLabel);
32199
+ ignoreEl(prevTick);
32200
+ }
32201
+ else {
32202
+ ignoreEl(lastLabel);
32203
+ ignoreEl(lastTick);
32204
+ }
32251
32205
  }
32252
32206
  }
32253
32207
 
32208
+ function ignoreEl(el) {
32209
+ el && (el.ignore = true);
32210
+ }
32211
+
32254
32212
  function isTwoLabelOverlapped(current, next, labelLayout) {
32255
32213
  // current and next has the same rotation.
32256
32214
  var firstRect = current && current.getBoundingRect().clone();
@@ -32271,11 +32229,28 @@ return /******/ (function(modules) { // webpackBootstrap
32271
32229
  return firstRect.intersect(nextRect);
32272
32230
  }
32273
32231
 
32232
+ function isNameLocationCenter(nameLocation) {
32233
+ return nameLocation === 'middle' || nameLocation === 'center';
32234
+ }
32274
32235
 
32275
32236
  /**
32276
32237
  * @static
32277
32238
  */
32278
- var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick = function (axis, i, interval) {
32239
+ var ifIgnoreOnTick = AxisBuilder.ifIgnoreOnTick = function (
32240
+ axis,
32241
+ i,
32242
+ interval,
32243
+ ticksCnt,
32244
+ showMinLabel,
32245
+ showMaxLabel
32246
+ ) {
32247
+ if (i === 0 && showMinLabel || i === ticksCnt - 1 && showMaxLabel) {
32248
+ return false;
32249
+ }
32250
+
32251
+ // FIXME
32252
+ // Have not consider label overlap (if label is too long) yet.
32253
+
32279
32254
  var rawTick;
32280
32255
  var scale = axis.scale;
32281
32256
  return scale.type === 'ordinal'
@@ -32300,6 +32275,187 @@ return /******/ (function(modules) { // webpackBootstrap
32300
32275
  return interval;
32301
32276
  };
32302
32277
 
32278
+ function buildAxisTick(axisBuilder, axisModel, opt) {
32279
+ var axis = axisModel.axis;
32280
+
32281
+ if (!axisModel.get('axisTick.show') || axis.scale.isBlank()) {
32282
+ return;
32283
+ }
32284
+
32285
+ var tickModel = axisModel.getModel('axisTick');
32286
+
32287
+ var lineStyleModel = tickModel.getModel('lineStyle');
32288
+ var tickLen = tickModel.get('length');
32289
+
32290
+ var tickInterval = getInterval(tickModel, opt.labelInterval);
32291
+ var ticksCoords = axis.getTicksCoords(tickModel.get('alignWithLabel'));
32292
+ // FIXME
32293
+ // Corresponds to ticksCoords ?
32294
+ var ticks = axis.scale.getTicks();
32295
+
32296
+ var showMinLabel = axisModel.get('axisLabel.showMinLabel');
32297
+ var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
32298
+
32299
+ var pt1 = [];
32300
+ var pt2 = [];
32301
+ var matrix = axisBuilder._transform;
32302
+
32303
+ var tickEls = [];
32304
+
32305
+ var ticksCnt = ticksCoords.length;
32306
+ for (var i = 0; i < ticksCnt; i++) {
32307
+ // Only ordinal scale support tick interval
32308
+ if (ifIgnoreOnTick(
32309
+ axis, i, tickInterval, ticksCnt,
32310
+ showMinLabel, showMaxLabel
32311
+ )) {
32312
+ continue;
32313
+ }
32314
+
32315
+ var tickCoord = ticksCoords[i];
32316
+
32317
+ pt1[0] = tickCoord;
32318
+ pt1[1] = 0;
32319
+ pt2[0] = tickCoord;
32320
+ pt2[1] = opt.tickDirection * tickLen;
32321
+
32322
+ if (matrix) {
32323
+ v2ApplyTransform(pt1, pt1, matrix);
32324
+ v2ApplyTransform(pt2, pt2, matrix);
32325
+ }
32326
+ // Tick line, Not use group transform to have better line draw
32327
+ var tickEl = new graphic.Line(graphic.subPixelOptimizeLine({
32328
+ // Id for animation
32329
+ anid: 'tick_' + ticks[i],
32330
+
32331
+ shape: {
32332
+ x1: pt1[0],
32333
+ y1: pt1[1],
32334
+ x2: pt2[0],
32335
+ y2: pt2[1]
32336
+ },
32337
+ style: zrUtil.defaults(
32338
+ lineStyleModel.getLineStyle(),
32339
+ {
32340
+ stroke: axisModel.get('axisLine.lineStyle.color')
32341
+ }
32342
+ ),
32343
+ z2: 2,
32344
+ silent: true
32345
+ }));
32346
+ axisBuilder.group.add(tickEl);
32347
+ tickEls.push(tickEl);
32348
+ }
32349
+
32350
+ return tickEls;
32351
+ }
32352
+
32353
+ function buildAxisLabel(axisBuilder, axisModel, opt) {
32354
+ var axis = axisModel.axis;
32355
+ var show = retrieve(opt.axisLabelShow, axisModel.get('axisLabel.show'));
32356
+
32357
+ if (!show || axis.scale.isBlank()) {
32358
+ return;
32359
+ }
32360
+
32361
+ var labelModel = axisModel.getModel('axisLabel');
32362
+ var labelMargin = labelModel.get('margin');
32363
+ var ticks = axis.scale.getTicks();
32364
+ var labels = axisModel.getFormattedLabels();
32365
+
32366
+ // Special label rotate.
32367
+ var labelRotation = (
32368
+ retrieve(opt.labelRotate, labelModel.get('rotate')) || 0
32369
+ ) * PI / 180;
32370
+
32371
+ var labelLayout = innerTextLayout(opt.rotation, labelRotation, opt.labelDirection);
32372
+ var categoryData = axisModel.get('data');
32373
+
32374
+ var labelEls = [];
32375
+ var silent = isSilent(axisModel);
32376
+ var triggerEvent = axisModel.get('triggerEvent');
32377
+
32378
+ var showMinLabel = axisModel.get('axisLabel.showMinLabel');
32379
+ var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
32380
+
32381
+ zrUtil.each(ticks, function (tickVal, index) {
32382
+ if (ifIgnoreOnTick(
32383
+ axis, index, opt.labelInterval, ticks.length,
32384
+ showMinLabel, showMaxLabel
32385
+ )) {
32386
+ return;
32387
+ }
32388
+
32389
+ var itemLabelModel = labelModel;
32390
+ if (categoryData && categoryData[tickVal] && categoryData[tickVal].textStyle) {
32391
+ itemLabelModel = new Model(
32392
+ categoryData[tickVal].textStyle, labelModel, axisModel.ecModel
32393
+ );
32394
+ }
32395
+
32396
+ var textColor = itemLabelModel.getTextColor()
32397
+ || axisModel.get('axisLine.lineStyle.color');
32398
+
32399
+ var tickCoord = axis.dataToCoord(tickVal);
32400
+ var pos = [
32401
+ tickCoord,
32402
+ opt.labelOffset + opt.labelDirection * labelMargin
32403
+ ];
32404
+ var labelStr = axis.scale.getLabel(tickVal);
32405
+
32406
+ var textEl = new graphic.Text({
32407
+ // Id for animation
32408
+ anid: 'label_' + tickVal,
32409
+ position: pos,
32410
+ rotation: labelLayout.rotation,
32411
+ silent: silent,
32412
+ z2: 10
32413
+ });
32414
+
32415
+ graphic.setTextStyle(textEl.style, itemLabelModel, {
32416
+ text: labels[index],
32417
+ textAlign: itemLabelModel.getShallow('align', true)
32418
+ || labelLayout.textAlign,
32419
+ textVerticalAlign: itemLabelModel.getShallow('verticalAlign', true)
32420
+ || itemLabelModel.getShallow('baseline', true)
32421
+ || labelLayout.textVerticalAlign,
32422
+ textFill: typeof textColor === 'function'
32423
+ ? textColor(
32424
+ // (1) In category axis with data zoom, tick is not the original
32425
+ // index of axis.data. So tick should not be exposed to user
32426
+ // in category axis.
32427
+ // (2) Compatible with previous version, which always returns labelStr.
32428
+ // But in interval scale labelStr is like '223,445', which maked
32429
+ // user repalce ','. So we modify it to return original val but remain
32430
+ // it as 'string' to avoid error in replacing.
32431
+ axis.type === 'category' ? labelStr : axis.type === 'value' ? tickVal + '' : tickVal,
32432
+ index
32433
+ )
32434
+ : textColor
32435
+ });
32436
+
32437
+ // Pack data for mouse event
32438
+ if (triggerEvent) {
32439
+ textEl.eventData = makeAxisEventDataBase(axisModel);
32440
+ textEl.eventData.targetType = 'axisLabel';
32441
+ textEl.eventData.value = labelStr;
32442
+ }
32443
+
32444
+ // FIXME
32445
+ axisBuilder._dumbGroup.add(textEl);
32446
+ textEl.updateTransform();
32447
+
32448
+ labelEls.push(textEl);
32449
+ axisBuilder.group.add(textEl);
32450
+
32451
+ textEl.decomposeTransform();
32452
+
32453
+ });
32454
+
32455
+ return labelEls;
32456
+ }
32457
+
32458
+
32303
32459
  module.exports = AxisBuilder;
32304
32460
 
32305
32461
 
@@ -32938,10 +33094,10 @@ return /******/ (function(modules) { // webpackBootstrap
32938
33094
  // }
32939
33095
  // },
32940
33096
  itemStyle: {
32941
- normal: {
33097
+ // normal: {
32942
33098
  // color: '各异'
32943
- },
32944
- emphasis: {}
33099
+ // },
33100
+ // emphasis: {}
32945
33101
  }
32946
33102
  }
32947
33103
  });
@@ -33766,8 +33922,10 @@ return /******/ (function(modules) { // webpackBootstrap
33766
33922
  startAngle: 90,
33767
33923
  // 最小角度改为0
33768
33924
  minAngle: 0,
33769
- // 选中是扇区偏移量
33925
+ // 选中时扇区偏移量
33770
33926
  selectedOffset: 10,
33927
+ // 高亮扇区偏移量
33928
+ hoverOffset: 10,
33771
33929
 
33772
33930
  // If use strategy to avoid label overlapping
33773
33931
  avoidLabelOverlap: true,
@@ -34102,7 +34260,7 @@ return /******/ (function(modules) { // webpackBootstrap
34102
34260
  sector.stopAnimation(true);
34103
34261
  sector.animateTo({
34104
34262
  shape: {
34105
- r: layout.r + 10
34263
+ r: layout.r + seriesModel.get('hoverOffset')
34106
34264
  }
34107
34265
  }, 300, 'elasticOut');
34108
34266
  }
@@ -35169,7 +35327,7 @@ return /******/ (function(modules) { // webpackBootstrap
35169
35327
  */
35170
35328
 
35171
35329
 
35172
- var Eventful = __webpack_require__(29);
35330
+ var Eventful = __webpack_require__(27);
35173
35331
  var zrUtil = __webpack_require__(4);
35174
35332
  var eventTool = __webpack_require__(93);
35175
35333
  var interactionMutex = __webpack_require__(187);
@@ -35279,7 +35437,9 @@ return /******/ (function(modules) { // webpackBootstrap
35279
35437
 
35280
35438
 
35281
35439
  function mousedown(e) {
35282
- if (e.target && e.target.draggable) {
35440
+ if (eventTool.notLeftMouse(e)
35441
+ || (e.target && e.target.draggable)
35442
+ ) {
35283
35443
  return;
35284
35444
  }
35285
35445
 
@@ -35296,15 +35456,12 @@ return /******/ (function(modules) { // webpackBootstrap
35296
35456
  }
35297
35457
 
35298
35458
  function mousemove(e) {
35299
- if (!checkKeyBinding(this, 'moveOnMouseMove', e) || !this._dragging) {
35300
- return;
35301
- }
35302
-
35303
- if (e.gestureEvent === 'pinch') {
35304
- return;
35305
- }
35306
-
35307
- if (interactionMutex.isTaken(this._zr, 'globalPan')) {
35459
+ if (eventTool.notLeftMouse(e)
35460
+ || !checkKeyBinding(this, 'moveOnMouseMove', e)
35461
+ || !this._dragging
35462
+ || e.gestureEvent === 'pinch'
35463
+ || interactionMutex.isTaken(this._zr, 'globalPan')
35464
+ ) {
35308
35465
  return;
35309
35466
  }
35310
35467
 
@@ -35326,7 +35483,9 @@ return /******/ (function(modules) { // webpackBootstrap
35326
35483
  }
35327
35484
 
35328
35485
  function mouseup(e) {
35329
- this._dragging = false;
35486
+ if (!eventTool.notLeftMouse(e)) {
35487
+ this._dragging = false;
35488
+ }
35330
35489
  }
35331
35490
 
35332
35491
  function mousewheel(e) {
@@ -36146,7 +36305,7 @@ return /******/ (function(modules) { // webpackBootstrap
36146
36305
 
36147
36306
 
36148
36307
 
36149
- var Eventful = __webpack_require__(29);
36308
+ var Eventful = __webpack_require__(27);
36150
36309
  var zrUtil = __webpack_require__(4);
36151
36310
  var graphic = __webpack_require__(20);
36152
36311
  var interactionMutex = __webpack_require__(187);
@@ -41887,7 +42046,7 @@ return /******/ (function(modules) { // webpackBootstrap
41887
42046
 
41888
42047
 
41889
42048
  var zrUtil = __webpack_require__(4);
41890
- var zrColor = __webpack_require__(35);
42049
+ var zrColor = __webpack_require__(33);
41891
42050
  var eventUtil = __webpack_require__(93);
41892
42051
  var formatUtil = __webpack_require__(6);
41893
42052
  var each = zrUtil.each;
@@ -42637,11 +42796,59 @@ return /******/ (function(modules) { // webpackBootstrap
42637
42796
 
42638
42797
 
42639
42798
  /***/ }),
42640
- /* 365 */,
42799
+ /* 365 */
42800
+ /***/ (function(module, exports) {
42801
+
42802
+
42803
+
42804
+ module.exports = {
42805
+ toolbox: {
42806
+ brush: {
42807
+ title: {
42808
+ rect: '矩形选择',
42809
+ polygon: '圈选',
42810
+ lineX: '横向选择',
42811
+ lineY: '纵向选择',
42812
+ keep: '保持选择',
42813
+ clear: '清除选择'
42814
+ }
42815
+ },
42816
+ dataView: {
42817
+ title: '数据视图',
42818
+ lang: ['数据视图', '关闭', '刷新']
42819
+ },
42820
+ dataZoom: {
42821
+ title: {
42822
+ zoom: '区域缩放',
42823
+ back: '区域缩放还原'
42824
+ }
42825
+ },
42826
+ magicType: {
42827
+ title: {
42828
+ line: '切换为折线图',
42829
+ bar: '切换为柱状图',
42830
+ stack: '切换为堆叠',
42831
+ tiled: '切换为平铺'
42832
+ }
42833
+ },
42834
+ restore: {
42835
+ title: '还原'
42836
+ },
42837
+ saveAsImage: {
42838
+ title: '保存为图片',
42839
+ lang: ['右键另存为图片']
42840
+ }
42841
+ }
42842
+ };
42843
+
42844
+
42845
+
42846
+ /***/ }),
42641
42847
  /* 366 */,
42642
42848
  /* 367 */,
42643
42849
  /* 368 */,
42644
- /* 369 */
42850
+ /* 369 */,
42851
+ /* 370 */
42645
42852
  /***/ (function(module, exports, __webpack_require__) {
42646
42853
 
42647
42854
  'use strict';
@@ -42854,7 +43061,7 @@ return /******/ (function(modules) { // webpackBootstrap
42854
43061
 
42855
43062
 
42856
43063
  /***/ }),
42857
- /* 370 */
43064
+ /* 371 */
42858
43065
  /***/ (function(module, exports, __webpack_require__) {
42859
43066
 
42860
43067
  /**
@@ -42862,24 +43069,24 @@ return /******/ (function(modules) { // webpackBootstrap
42862
43069
  */
42863
43070
 
42864
43071
 
42865
- __webpack_require__(371);
42866
-
42867
43072
  __webpack_require__(372);
42868
- __webpack_require__(375);
42869
43073
 
43074
+ __webpack_require__(373);
42870
43075
  __webpack_require__(376);
42871
- __webpack_require__(377);
42872
43076
 
43077
+ __webpack_require__(377);
42873
43078
  __webpack_require__(378);
43079
+
42874
43080
  __webpack_require__(379);
43081
+ __webpack_require__(380);
42875
43082
 
42876
- __webpack_require__(381);
42877
43083
  __webpack_require__(382);
43084
+ __webpack_require__(383);
42878
43085
 
42879
43086
 
42880
43087
 
42881
43088
  /***/ }),
42882
- /* 371 */
43089
+ /* 372 */
42883
43090
  /***/ (function(module, exports, __webpack_require__) {
42884
43091
 
42885
43092
 
@@ -42892,7 +43099,7 @@ return /******/ (function(modules) { // webpackBootstrap
42892
43099
 
42893
43100
 
42894
43101
  /***/ }),
42895
- /* 372 */
43102
+ /* 373 */
42896
43103
  /***/ (function(module, exports, __webpack_require__) {
42897
43104
 
42898
43105
  /**
@@ -42904,8 +43111,8 @@ return /******/ (function(modules) { // webpackBootstrap
42904
43111
  var env = __webpack_require__(2);
42905
43112
  var echarts = __webpack_require__(1);
42906
43113
  var modelUtil = __webpack_require__(5);
42907
- var helper = __webpack_require__(373);
42908
- var AxisProxy = __webpack_require__(374);
43114
+ var helper = __webpack_require__(374);
43115
+ var AxisProxy = __webpack_require__(375);
42909
43116
  var each = zrUtil.each;
42910
43117
  var eachAxisDim = helper.eachAxisDim;
42911
43118
 
@@ -43454,7 +43661,7 @@ return /******/ (function(modules) { // webpackBootstrap
43454
43661
 
43455
43662
 
43456
43663
  /***/ }),
43457
- /* 373 */
43664
+ /* 374 */
43458
43665
  /***/ (function(module, exports, __webpack_require__) {
43459
43666
 
43460
43667
 
@@ -43592,7 +43799,7 @@ return /******/ (function(modules) { // webpackBootstrap
43592
43799
 
43593
43800
 
43594
43801
  /***/ }),
43595
- /* 374 */
43802
+ /* 375 */
43596
43803
  /***/ (function(module, exports, __webpack_require__) {
43597
43804
 
43598
43805
  /**
@@ -43602,7 +43809,7 @@ return /******/ (function(modules) { // webpackBootstrap
43602
43809
 
43603
43810
  var zrUtil = __webpack_require__(4);
43604
43811
  var numberUtil = __webpack_require__(7);
43605
- var helper = __webpack_require__(373);
43812
+ var helper = __webpack_require__(374);
43606
43813
  var each = zrUtil.each;
43607
43814
  var asc = numberUtil.asc;
43608
43815
 
@@ -44066,7 +44273,7 @@ return /******/ (function(modules) { // webpackBootstrap
44066
44273
 
44067
44274
 
44068
44275
  /***/ }),
44069
- /* 375 */
44276
+ /* 376 */
44070
44277
  /***/ (function(module, exports, __webpack_require__) {
44071
44278
 
44072
44279
 
@@ -44143,7 +44350,7 @@ return /******/ (function(modules) { // webpackBootstrap
44143
44350
 
44144
44351
 
44145
44352
  /***/ }),
44146
- /* 376 */
44353
+ /* 377 */
44147
44354
  /***/ (function(module, exports, __webpack_require__) {
44148
44355
 
44149
44356
  /**
@@ -44151,7 +44358,7 @@ return /******/ (function(modules) { // webpackBootstrap
44151
44358
  */
44152
44359
 
44153
44360
 
44154
- var DataZoomModel = __webpack_require__(372);
44361
+ var DataZoomModel = __webpack_require__(373);
44155
44362
 
44156
44363
  var SliderZoomModel = DataZoomModel.extend({
44157
44364
 
@@ -44222,7 +44429,7 @@ return /******/ (function(modules) { // webpackBootstrap
44222
44429
 
44223
44430
 
44224
44431
  /***/ }),
44225
- /* 377 */
44432
+ /* 378 */
44226
44433
  /***/ (function(module, exports, __webpack_require__) {
44227
44434
 
44228
44435
 
@@ -44230,7 +44437,7 @@ return /******/ (function(modules) { // webpackBootstrap
44230
44437
  var zrUtil = __webpack_require__(4);
44231
44438
  var graphic = __webpack_require__(20);
44232
44439
  var throttle = __webpack_require__(86);
44233
- var DataZoomView = __webpack_require__(375);
44440
+ var DataZoomView = __webpack_require__(376);
44234
44441
  var Rect = graphic.Rect;
44235
44442
  var numberUtil = __webpack_require__(7);
44236
44443
  var linearMap = numberUtil.linearMap;
@@ -45018,7 +45225,7 @@ return /******/ (function(modules) { // webpackBootstrap
45018
45225
 
45019
45226
 
45020
45227
  /***/ }),
45021
- /* 378 */
45228
+ /* 379 */
45022
45229
  /***/ (function(module, exports, __webpack_require__) {
45023
45230
 
45024
45231
  /**
@@ -45026,7 +45233,7 @@ return /******/ (function(modules) { // webpackBootstrap
45026
45233
  */
45027
45234
 
45028
45235
 
45029
- module.exports = __webpack_require__(372).extend({
45236
+ module.exports = __webpack_require__(373).extend({
45030
45237
 
45031
45238
  type: 'dataZoom.inside',
45032
45239
 
@@ -45044,15 +45251,15 @@ return /******/ (function(modules) { // webpackBootstrap
45044
45251
 
45045
45252
 
45046
45253
  /***/ }),
45047
- /* 379 */
45254
+ /* 380 */
45048
45255
  /***/ (function(module, exports, __webpack_require__) {
45049
45256
 
45050
45257
 
45051
45258
 
45052
- var DataZoomView = __webpack_require__(375);
45259
+ var DataZoomView = __webpack_require__(376);
45053
45260
  var zrUtil = __webpack_require__(4);
45054
45261
  var sliderMove = __webpack_require__(242);
45055
- var roams = __webpack_require__(380);
45262
+ var roams = __webpack_require__(381);
45056
45263
  var bind = zrUtil.bind;
45057
45264
 
45058
45265
  var InsideZoomView = DataZoomView.extend({
@@ -45272,7 +45479,7 @@ return /******/ (function(modules) { // webpackBootstrap
45272
45479
 
45273
45480
 
45274
45481
  /***/ }),
45275
- /* 380 */
45482
+ /* 381 */
45276
45483
  /***/ (function(module, exports, __webpack_require__) {
45277
45484
 
45278
45485
  /**
@@ -45496,7 +45703,7 @@ return /******/ (function(modules) { // webpackBootstrap
45496
45703
 
45497
45704
 
45498
45705
  /***/ }),
45499
- /* 381 */
45706
+ /* 382 */
45500
45707
  /***/ (function(module, exports, __webpack_require__) {
45501
45708
 
45502
45709
  /**
@@ -45559,7 +45766,7 @@ return /******/ (function(modules) { // webpackBootstrap
45559
45766
 
45560
45767
 
45561
45768
  /***/ }),
45562
- /* 382 */
45769
+ /* 383 */
45563
45770
  /***/ (function(module, exports, __webpack_require__) {
45564
45771
 
45565
45772
  /**
@@ -45568,7 +45775,7 @@ return /******/ (function(modules) { // webpackBootstrap
45568
45775
 
45569
45776
 
45570
45777
  var zrUtil = __webpack_require__(4);
45571
- var helper = __webpack_require__(373);
45778
+ var helper = __webpack_require__(374);
45572
45779
  var echarts = __webpack_require__(1);
45573
45780
 
45574
45781
 
@@ -45607,7 +45814,6 @@ return /******/ (function(modules) { // webpackBootstrap
45607
45814
 
45608
45815
 
45609
45816
  /***/ }),
45610
- /* 383 */,
45611
45817
  /* 384 */,
45612
45818
  /* 385 */,
45613
45819
  /* 386 */,
@@ -45622,14 +45828,15 @@ return /******/ (function(modules) { // webpackBootstrap
45622
45828
  /* 395 */,
45623
45829
  /* 396 */,
45624
45830
  /* 397 */,
45625
- /* 398 */
45831
+ /* 398 */,
45832
+ /* 399 */
45626
45833
  /***/ (function(module, exports, __webpack_require__) {
45627
45834
 
45628
45835
  // HINT Markpoint can't be used too much
45629
45836
 
45630
45837
 
45631
- __webpack_require__(399);
45632
- __webpack_require__(401);
45838
+ __webpack_require__(400);
45839
+ __webpack_require__(402);
45633
45840
 
45634
45841
  __webpack_require__(1).registerPreprocessor(function (opt) {
45635
45842
  // Make sure markPoint component is enabled
@@ -45638,12 +45845,12 @@ return /******/ (function(modules) { // webpackBootstrap
45638
45845
 
45639
45846
 
45640
45847
  /***/ }),
45641
- /* 399 */
45848
+ /* 400 */
45642
45849
  /***/ (function(module, exports, __webpack_require__) {
45643
45850
 
45644
45851
 
45645
45852
 
45646
- module.exports = __webpack_require__(400).extend({
45853
+ module.exports = __webpack_require__(401).extend({
45647
45854
 
45648
45855
  type: 'markPoint',
45649
45856
 
@@ -45676,7 +45883,7 @@ return /******/ (function(modules) { // webpackBootstrap
45676
45883
 
45677
45884
 
45678
45885
  /***/ }),
45679
- /* 400 */
45886
+ /* 401 */
45680
45887
  /***/ (function(module, exports, __webpack_require__) {
45681
45888
 
45682
45889
 
@@ -45811,7 +46018,7 @@ return /******/ (function(modules) { // webpackBootstrap
45811
46018
 
45812
46019
 
45813
46020
  /***/ }),
45814
- /* 401 */
46021
+ /* 402 */
45815
46022
  /***/ (function(module, exports, __webpack_require__) {
45816
46023
 
45817
46024
 
@@ -45822,7 +46029,7 @@ return /******/ (function(modules) { // webpackBootstrap
45822
46029
 
45823
46030
  var List = __webpack_require__(101);
45824
46031
 
45825
- var markerHelper = __webpack_require__(402);
46032
+ var markerHelper = __webpack_require__(403);
45826
46033
 
45827
46034
  function updateMarkerLayout(mpData, seriesModel, api) {
45828
46035
  var coordSys = seriesModel.coordinateSystem;
@@ -45860,7 +46067,7 @@ return /******/ (function(modules) { // webpackBootstrap
45860
46067
  });
45861
46068
  }
45862
46069
 
45863
- __webpack_require__(403).extend({
46070
+ __webpack_require__(404).extend({
45864
46071
 
45865
46072
  type: 'markPoint',
45866
46073
 
@@ -45970,7 +46177,7 @@ return /******/ (function(modules) { // webpackBootstrap
45970
46177
 
45971
46178
 
45972
46179
  /***/ }),
45973
- /* 402 */
46180
+ /* 403 */
45974
46181
  /***/ (function(module, exports, __webpack_require__) {
45975
46182
 
45976
46183
 
@@ -46175,7 +46382,7 @@ return /******/ (function(modules) { // webpackBootstrap
46175
46382
 
46176
46383
 
46177
46384
  /***/ }),
46178
- /* 403 */
46385
+ /* 404 */
46179
46386
  /***/ (function(module, exports, __webpack_require__) {
46180
46387
 
46181
46388
 
@@ -46217,13 +46424,13 @@ return /******/ (function(modules) { // webpackBootstrap
46217
46424
 
46218
46425
 
46219
46426
  /***/ }),
46220
- /* 404 */
46427
+ /* 405 */
46221
46428
  /***/ (function(module, exports, __webpack_require__) {
46222
46429
 
46223
46430
 
46224
46431
 
46225
- __webpack_require__(405);
46226
46432
  __webpack_require__(406);
46433
+ __webpack_require__(407);
46227
46434
 
46228
46435
  __webpack_require__(1).registerPreprocessor(function (opt) {
46229
46436
  // Make sure markLine component is enabled
@@ -46232,12 +46439,12 @@ return /******/ (function(modules) { // webpackBootstrap
46232
46439
 
46233
46440
 
46234
46441
  /***/ }),
46235
- /* 405 */
46442
+ /* 406 */
46236
46443
  /***/ (function(module, exports, __webpack_require__) {
46237
46444
 
46238
46445
 
46239
46446
 
46240
- module.exports = __webpack_require__(400).extend({
46447
+ module.exports = __webpack_require__(401).extend({
46241
46448
 
46242
46449
  type: 'markLine',
46243
46450
 
@@ -46277,7 +46484,7 @@ return /******/ (function(modules) { // webpackBootstrap
46277
46484
 
46278
46485
 
46279
46486
  /***/ }),
46280
- /* 406 */
46487
+ /* 407 */
46281
46488
  /***/ (function(module, exports, __webpack_require__) {
46282
46489
 
46283
46490
 
@@ -46286,7 +46493,7 @@ return /******/ (function(modules) { // webpackBootstrap
46286
46493
  var List = __webpack_require__(101);
46287
46494
  var numberUtil = __webpack_require__(7);
46288
46495
 
46289
- var markerHelper = __webpack_require__(402);
46496
+ var markerHelper = __webpack_require__(403);
46290
46497
 
46291
46498
  var LineDraw = __webpack_require__(213);
46292
46499
 
@@ -46458,7 +46665,7 @@ return /******/ (function(modules) { // webpackBootstrap
46458
46665
  data.setItemLayout(idx, point);
46459
46666
  }
46460
46667
 
46461
- __webpack_require__(403).extend({
46668
+ __webpack_require__(404).extend({
46462
46669
 
46463
46670
  type: 'markLine',
46464
46671
 
@@ -46635,13 +46842,13 @@ return /******/ (function(modules) { // webpackBootstrap
46635
46842
 
46636
46843
 
46637
46844
  /***/ }),
46638
- /* 407 */
46845
+ /* 408 */
46639
46846
  /***/ (function(module, exports, __webpack_require__) {
46640
46847
 
46641
46848
 
46642
46849
 
46643
- __webpack_require__(408);
46644
46850
  __webpack_require__(409);
46851
+ __webpack_require__(410);
46645
46852
 
46646
46853
  __webpack_require__(1).registerPreprocessor(function (opt) {
46647
46854
  // Make sure markArea component is enabled
@@ -46650,12 +46857,12 @@ return /******/ (function(modules) { // webpackBootstrap
46650
46857
 
46651
46858
 
46652
46859
  /***/ }),
46653
- /* 408 */
46860
+ /* 409 */
46654
46861
  /***/ (function(module, exports, __webpack_require__) {
46655
46862
 
46656
46863
 
46657
46864
 
46658
- module.exports = __webpack_require__(400).extend({
46865
+ module.exports = __webpack_require__(401).extend({
46659
46866
 
46660
46867
  type: 'markArea',
46661
46868
 
@@ -46691,7 +46898,7 @@ return /******/ (function(modules) { // webpackBootstrap
46691
46898
 
46692
46899
 
46693
46900
  /***/ }),
46694
- /* 409 */
46901
+ /* 410 */
46695
46902
  /***/ (function(module, exports, __webpack_require__) {
46696
46903
 
46697
46904
  // TODO Better on polar
@@ -46701,9 +46908,9 @@ return /******/ (function(modules) { // webpackBootstrap
46701
46908
  var List = __webpack_require__(101);
46702
46909
  var numberUtil = __webpack_require__(7);
46703
46910
  var graphic = __webpack_require__(20);
46704
- var colorUtil = __webpack_require__(35);
46911
+ var colorUtil = __webpack_require__(33);
46705
46912
 
46706
- var markerHelper = __webpack_require__(402);
46913
+ var markerHelper = __webpack_require__(403);
46707
46914
 
46708
46915
  var markAreaTransform = function (seriesModel, coordSys, maModel, item) {
46709
46916
  var lt = markerHelper.dataTransform(seriesModel, item[0]);
@@ -46823,7 +47030,7 @@ return /******/ (function(modules) { // webpackBootstrap
46823
47030
 
46824
47031
  var dimPermutations = [['x0', 'y0'], ['x1', 'y0'], ['x1', 'y1'], ['x0', 'y1']];
46825
47032
 
46826
- __webpack_require__(403).extend({
47033
+ __webpack_require__(404).extend({
46827
47034
 
46828
47035
  type: 'markArea',
46829
47036
 
@@ -46917,7 +47124,7 @@ return /******/ (function(modules) { // webpackBootstrap
46917
47124
  )
46918
47125
  );
46919
47126
 
46920
- polygon.hoverStyle = itemModel.getModel('itemStyle.normal').getItemStyle();
47127
+ polygon.hoverStyle = itemModel.getModel('itemStyle.emphasis').getItemStyle();
46921
47128
 
46922
47129
  graphic.setLabelStyle(
46923
47130
  polygon.style, polygon.hoverStyle, labelModel, labelHoverModel,
@@ -46996,7 +47203,6 @@ return /******/ (function(modules) { // webpackBootstrap
46996
47203
 
46997
47204
 
46998
47205
  /***/ }),
46999
- /* 410 */,
47000
47206
  /* 411 */,
47001
47207
  /* 412 */,
47002
47208
  /* 413 */,
@@ -47005,23 +47211,24 @@ return /******/ (function(modules) { // webpackBootstrap
47005
47211
  /* 416 */,
47006
47212
  /* 417 */,
47007
47213
  /* 418 */,
47008
- /* 419 */
47214
+ /* 419 */,
47215
+ /* 420 */
47009
47216
  /***/ (function(module, exports, __webpack_require__) {
47010
47217
 
47011
47218
 
47012
47219
 
47013
- __webpack_require__(420);
47014
47220
  __webpack_require__(421);
47015
-
47016
47221
  __webpack_require__(422);
47222
+
47017
47223
  __webpack_require__(423);
47018
47224
  __webpack_require__(424);
47019
47225
  __webpack_require__(425);
47020
- __webpack_require__(430);
47226
+ __webpack_require__(426);
47227
+ __webpack_require__(431);
47021
47228
 
47022
47229
 
47023
47230
  /***/ }),
47024
- /* 420 */
47231
+ /* 421 */
47025
47232
  /***/ (function(module, exports, __webpack_require__) {
47026
47233
 
47027
47234
 
@@ -47099,7 +47306,7 @@ return /******/ (function(modules) { // webpackBootstrap
47099
47306
 
47100
47307
 
47101
47308
  /***/ }),
47102
- /* 421 */
47309
+ /* 422 */
47103
47310
  /***/ (function(module, exports, __webpack_require__) {
47104
47311
 
47105
47312
  /* WEBPACK VAR INJECTION */(function(process) {
@@ -47342,12 +47549,13 @@ return /******/ (function(modules) { // webpackBootstrap
47342
47549
  /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(313)))
47343
47550
 
47344
47551
  /***/ }),
47345
- /* 422 */
47552
+ /* 423 */
47346
47553
  /***/ (function(module, exports, __webpack_require__) {
47347
47554
 
47348
47555
 
47349
47556
 
47350
47557
  var env = __webpack_require__(2);
47558
+ var lang = __webpack_require__(365).toolbox.saveAsImage;
47351
47559
 
47352
47560
  function SaveAsImage (model) {
47353
47561
  this.model = model;
@@ -47356,14 +47564,14 @@ return /******/ (function(modules) { // webpackBootstrap
47356
47564
  SaveAsImage.defaultOption = {
47357
47565
  show: true,
47358
47566
  icon: 'M4.7,22.9L29.3,45.5L54.7,23.4M4.6,43.6L4.6,58L53.8,58L53.8,43.6M29.2,45.1L29.2,0',
47359
- title: '保存为图片',
47567
+ title: lang.title,
47360
47568
  type: 'png',
47361
47569
  // Default use option.backgroundColor
47362
47570
  // backgroundColor: '#fff',
47363
47571
  name: '',
47364
47572
  excludeComponents: ['toolbox'],
47365
47573
  pixelRatio: 1,
47366
- lang: ['右键另存为图片']
47574
+ lang: lang.lang.slice()
47367
47575
  };
47368
47576
 
47369
47577
  SaveAsImage.prototype.unusable = !env.canvasSupported;
@@ -47396,13 +47604,25 @@ return /******/ (function(modules) { // webpackBootstrap
47396
47604
  }
47397
47605
  // IE
47398
47606
  else {
47399
- var lang = model.get('lang');
47400
- var html = ''
47401
- + '<body style="margin:0;">'
47402
- + '<img src="' + url + '" style="max-width:100%;" title="' + ((lang && lang[0]) || '') + '" />'
47403
- + '</body>';
47404
- var tab = window.open();
47405
- tab.document.write(html);
47607
+ if (window.navigator.msSaveOrOpenBlob) {
47608
+ var bstr = atob(url.split(',')[1]);
47609
+ var n = bstr.length;
47610
+ var u8arr = new Uint8Array(n);
47611
+ while(n--) {
47612
+ u8arr[n] = bstr.charCodeAt(n);
47613
+ }
47614
+ var blob = new Blob([u8arr]);
47615
+ window.navigator.msSaveOrOpenBlob(blob, title + '.' + type);
47616
+ }
47617
+ else {
47618
+ var lang = model.get('lang');
47619
+ var html = '' +
47620
+ '<body style="margin:0;">' +
47621
+ '<img src="' + url + '" style="max-width:100%;" title="' + ((lang && lang[0]) || '') + '" />' +
47622
+ '</body>';
47623
+ var tab = window.open();
47624
+ tab.document.write(html);
47625
+ }
47406
47626
  }
47407
47627
  };
47408
47628
 
@@ -47413,14 +47633,16 @@ return /******/ (function(modules) { // webpackBootstrap
47413
47633
  module.exports = SaveAsImage;
47414
47634
 
47415
47635
 
47636
+
47416
47637
  /***/ }),
47417
- /* 423 */
47638
+ /* 424 */
47418
47639
  /***/ (function(module, exports, __webpack_require__) {
47419
47640
 
47420
47641
  'use strict';
47421
47642
 
47422
47643
 
47423
47644
  var zrUtil = __webpack_require__(4);
47645
+ var lang = __webpack_require__(365).toolbox.magicType;
47424
47646
 
47425
47647
  function MagicType(model) {
47426
47648
  this.model = model;
@@ -47436,12 +47658,8 @@ return /******/ (function(modules) { // webpackBootstrap
47436
47658
  stack: 'M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z', // jshint ignore:line
47437
47659
  tiled: 'M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z'
47438
47660
  },
47439
- title: {
47440
- line: '切换为折线图',
47441
- bar: '切换为柱状图',
47442
- stack: '切换为堆叠',
47443
- tiled: '切换为平铺'
47444
- },
47661
+ // `line`, `bar`, `stack`, `tiled`
47662
+ title: zrUtil.clone(lang.title),
47445
47663
  option: {},
47446
47664
  seriesIndex: {}
47447
47665
  };
@@ -47594,7 +47812,7 @@ return /******/ (function(modules) { // webpackBootstrap
47594
47812
 
47595
47813
 
47596
47814
  /***/ }),
47597
- /* 424 */
47815
+ /* 425 */
47598
47816
  /***/ (function(module, exports, __webpack_require__) {
47599
47817
 
47600
47818
  /**
@@ -47605,7 +47823,7 @@ return /******/ (function(modules) { // webpackBootstrap
47605
47823
 
47606
47824
  var zrUtil = __webpack_require__(4);
47607
47825
  var eventTool = __webpack_require__(93);
47608
-
47826
+ var lang = __webpack_require__(365).toolbox.dataView;
47609
47827
 
47610
47828
  var BLOCK_SPLITER = new Array(60).join('-');
47611
47829
  var ITEM_SPLITER = '\t';
@@ -47876,8 +48094,8 @@ return /******/ (function(modules) { // webpackBootstrap
47876
48094
  contentToOption: null,
47877
48095
 
47878
48096
  icon: 'M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28',
47879
- title: '数据视图',
47880
- lang: ['数据视图', '关闭', '刷新'],
48097
+ title: zrUtil.clone(lang.title),
48098
+ lang: zrUtil.clone(lang.lang),
47881
48099
  backgroundColor: '#fff',
47882
48100
  textColor: '#000',
47883
48101
  textareaColor: '#fff',
@@ -48077,7 +48295,7 @@ return /******/ (function(modules) { // webpackBootstrap
48077
48295
 
48078
48296
 
48079
48297
  /***/ }),
48080
- /* 425 */
48298
+ /* 426 */
48081
48299
  /***/ (function(module, exports, __webpack_require__) {
48082
48300
 
48083
48301
  'use strict';
@@ -48086,13 +48304,14 @@ return /******/ (function(modules) { // webpackBootstrap
48086
48304
  var zrUtil = __webpack_require__(4);
48087
48305
  var BrushController = __webpack_require__(248);
48088
48306
  var BrushTargetManager = __webpack_require__(359);
48089
- var history = __webpack_require__(426);
48307
+ var history = __webpack_require__(427);
48090
48308
  var sliderMove = __webpack_require__(242);
48309
+ var lang = __webpack_require__(365).toolbox.dataZoom;
48091
48310
 
48092
48311
  var each = zrUtil.each;
48093
48312
 
48094
48313
  // Use dataZoomSelect
48095
- __webpack_require__(427);
48314
+ __webpack_require__(428);
48096
48315
 
48097
48316
  // Spectial component id start with \0ec\0, see echarts/model/Global.js~hasInnerId
48098
48317
  var DATA_ZOOM_ID_BASE = '\0_ec_\0toolbox-dataZoom_';
@@ -48121,10 +48340,8 @@ return /******/ (function(modules) { // webpackBootstrap
48121
48340
  zoom: 'M0,13.5h26.9 M13.5,26.9V0 M32.1,13.5H58V58H13.5 V32.1',
48122
48341
  back: 'M22,1.4L9.9,13.5l12.3,12.3 M10.3,13.5H54.9v44.6 H10.3v-26'
48123
48342
  },
48124
- title: {
48125
- zoom: '区域缩放',
48126
- back: '区域缩放还原'
48127
- }
48343
+ // `zoom`, `back`
48344
+ title: zrUtil.clone(lang.title)
48128
48345
  };
48129
48346
 
48130
48347
  var proto = DataZoom.prototype;
@@ -48386,7 +48603,7 @@ return /******/ (function(modules) { // webpackBootstrap
48386
48603
 
48387
48604
 
48388
48605
  /***/ }),
48389
- /* 426 */
48606
+ /* 427 */
48390
48607
  /***/ (function(module, exports, __webpack_require__) {
48391
48608
 
48392
48609
  /**
@@ -48500,7 +48717,7 @@ return /******/ (function(modules) { // webpackBootstrap
48500
48717
 
48501
48718
 
48502
48719
  /***/ }),
48503
- /* 427 */
48720
+ /* 428 */
48504
48721
  /***/ (function(module, exports, __webpack_require__) {
48505
48722
 
48506
48723
  /**
@@ -48508,21 +48725,21 @@ return /******/ (function(modules) { // webpackBootstrap
48508
48725
  */
48509
48726
 
48510
48727
 
48511
- __webpack_require__(371);
48512
-
48513
48728
  __webpack_require__(372);
48514
- __webpack_require__(375);
48515
48729
 
48516
- __webpack_require__(428);
48730
+ __webpack_require__(373);
48731
+ __webpack_require__(376);
48732
+
48517
48733
  __webpack_require__(429);
48734
+ __webpack_require__(430);
48518
48735
 
48519
- __webpack_require__(381);
48520
48736
  __webpack_require__(382);
48737
+ __webpack_require__(383);
48521
48738
 
48522
48739
 
48523
48740
 
48524
48741
  /***/ }),
48525
- /* 428 */
48742
+ /* 429 */
48526
48743
  /***/ (function(module, exports, __webpack_require__) {
48527
48744
 
48528
48745
  /**
@@ -48530,7 +48747,7 @@ return /******/ (function(modules) { // webpackBootstrap
48530
48747
  */
48531
48748
 
48532
48749
 
48533
- var DataZoomModel = __webpack_require__(372);
48750
+ var DataZoomModel = __webpack_require__(373);
48534
48751
 
48535
48752
  module.exports = DataZoomModel.extend({
48536
48753
 
@@ -48541,12 +48758,12 @@ return /******/ (function(modules) { // webpackBootstrap
48541
48758
 
48542
48759
 
48543
48760
  /***/ }),
48544
- /* 429 */
48761
+ /* 430 */
48545
48762
  /***/ (function(module, exports, __webpack_require__) {
48546
48763
 
48547
48764
 
48548
48765
 
48549
- module.exports = __webpack_require__(375).extend({
48766
+ module.exports = __webpack_require__(376).extend({
48550
48767
 
48551
48768
  type: 'dataZoom.select'
48552
48769
 
@@ -48555,13 +48772,14 @@ return /******/ (function(modules) { // webpackBootstrap
48555
48772
 
48556
48773
 
48557
48774
  /***/ }),
48558
- /* 430 */
48775
+ /* 431 */
48559
48776
  /***/ (function(module, exports, __webpack_require__) {
48560
48777
 
48561
48778
  'use strict';
48562
48779
 
48563
48780
 
48564
- var history = __webpack_require__(426);
48781
+ var history = __webpack_require__(427);
48782
+ var lang = __webpack_require__(365).toolbox.restore;
48565
48783
 
48566
48784
  function Restore(model) {
48567
48785
  this.model = model;
@@ -48570,7 +48788,7 @@ return /******/ (function(modules) { // webpackBootstrap
48570
48788
  Restore.defaultOption = {
48571
48789
  show: true,
48572
48790
  icon: 'M3.8,33.4 M47,18.9h9.8V8.7 M56.3,20.1 C52.1,9,40.5,0.6,26.8,2.1C12.6,3.7,1.6,16.2,2.1,30.6 M13,41.1H3.1v10.2 M3.7,39.9c4.2,11.1,15.8,19.5,29.5,18 c14.2-1.6,25.2-14.1,24.7-28.5',
48573
- title: '还原'
48791
+ title: lang.title
48574
48792
  };
48575
48793
 
48576
48794
  var proto = Restore.prototype;
@@ -48599,16 +48817,16 @@ return /******/ (function(modules) { // webpackBootstrap
48599
48817
 
48600
48818
 
48601
48819
  /***/ }),
48602
- /* 431 */
48820
+ /* 432 */
48603
48821
  /***/ (function(module, exports, __webpack_require__) {
48604
48822
 
48605
48823
 
48606
- __webpack_require__(432);
48607
- __webpack_require__(87).registerPainter('vml', __webpack_require__(434));
48824
+ __webpack_require__(433);
48825
+ __webpack_require__(87).registerPainter('vml', __webpack_require__(435));
48608
48826
 
48609
48827
 
48610
48828
  /***/ }),
48611
- /* 432 */
48829
+ /* 433 */
48612
48830
  /***/ (function(module, exports, __webpack_require__) {
48613
48831
 
48614
48832
  // http://www.w3.org/TR/NOTE-VML
@@ -48619,10 +48837,10 @@ return /******/ (function(modules) { // webpackBootstrap
48619
48837
  var vec2 = __webpack_require__(10);
48620
48838
  var BoundingRect = __webpack_require__(9);
48621
48839
  var CMD = __webpack_require__(39).CMD;
48622
- var colorTool = __webpack_require__(35);
48840
+ var colorTool = __webpack_require__(33);
48623
48841
  var textContain = __webpack_require__(8);
48624
- var textHelper = __webpack_require__(25);
48625
- var RectText = __webpack_require__(38);
48842
+ var textHelper = __webpack_require__(37);
48843
+ var RectText = __webpack_require__(36);
48626
48844
  var Displayable = __webpack_require__(23);
48627
48845
  var ZImage = __webpack_require__(52);
48628
48846
  var Text = __webpack_require__(53);
@@ -48631,7 +48849,7 @@ return /******/ (function(modules) { // webpackBootstrap
48631
48849
 
48632
48850
  var Gradient = __webpack_require__(69);
48633
48851
 
48634
- var vmlCore = __webpack_require__(433);
48852
+ var vmlCore = __webpack_require__(434);
48635
48853
 
48636
48854
  var round = Math.round;
48637
48855
  var sqrt = Math.sqrt;
@@ -49682,7 +49900,7 @@ return /******/ (function(modules) { // webpackBootstrap
49682
49900
 
49683
49901
 
49684
49902
  /***/ }),
49685
- /* 433 */
49903
+ /* 434 */
49686
49904
  /***/ (function(module, exports, __webpack_require__) {
49687
49905
 
49688
49906
 
@@ -49735,7 +49953,7 @@ return /******/ (function(modules) { // webpackBootstrap
49735
49953
 
49736
49954
 
49737
49955
  /***/ }),
49738
- /* 434 */
49956
+ /* 435 */
49739
49957
  /***/ (function(module, exports, __webpack_require__) {
49740
49958
 
49741
49959
  /**
@@ -49746,8 +49964,8 @@ return /******/ (function(modules) { // webpackBootstrap
49746
49964
 
49747
49965
 
49748
49966
 
49749
- var zrLog = __webpack_require__(36);
49750
- var vmlCore = __webpack_require__(433);
49967
+ var zrLog = __webpack_require__(34);
49968
+ var vmlCore = __webpack_require__(434);
49751
49969
 
49752
49970
  function parseInt10(val) {
49753
49971
  return parseInt(val, 10);
@@ -49804,6 +50022,10 @@ return /******/ (function(modules) { // webpackBootstrap
49804
50022
 
49805
50023
  constructor: VMLPainter,
49806
50024
 
50025
+ getType: function () {
50026
+ return 'vml';
50027
+ },
50028
+
49807
50029
  /**
49808
50030
  * @return {HTMLDivElement}
49809
50031
  */