echarts 4.5.0-rc.2 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (256) hide show
  1. package/.github/pull_request_template.md +66 -0
  2. package/.github/workflows/nodejs.yml +12 -2
  3. package/CONTRIBUTING.md +16 -160
  4. package/NOTICE +1 -1
  5. package/README.md +2 -2
  6. package/dist/echarts-en.common.js +2808 -1188
  7. package/dist/echarts-en.common.min.js +1 -1
  8. package/dist/echarts-en.js +3559 -1437
  9. package/dist/echarts-en.js.map +1 -1
  10. package/dist/echarts-en.min.js +1 -1
  11. package/dist/echarts-en.simple.js +2453 -1002
  12. package/dist/echarts-en.simple.min.js +1 -1
  13. package/dist/echarts.common.js +2782 -1188
  14. package/dist/echarts.common.min.js +1 -1
  15. package/dist/echarts.js +3533 -1437
  16. package/dist/echarts.js.map +1 -1
  17. package/dist/echarts.min.js +1 -1
  18. package/dist/echarts.simple.js +2427 -1002
  19. package/dist/echarts.simple.min.js +1 -1
  20. package/dist/extension/bmap.js +336 -2
  21. package/dist/extension/bmap.js.map +1 -1
  22. package/dist/extension/bmap.min.js +1 -1
  23. package/extension/bmap/BMapView.js +6 -2
  24. package/extension-src/bmap/BMapView.js +3 -2
  25. package/lib/chart/bar/BarSeries.js +14 -1
  26. package/lib/chart/bar/BarView.js +161 -16
  27. package/lib/chart/bar/BaseBarSeries.js +3 -1
  28. package/lib/chart/candlestick/candlestickVisual.js +1 -1
  29. package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
  30. package/lib/chart/funnel/FunnelSeries.js +13 -5
  31. package/lib/chart/gauge/GaugeSeries.js +0 -2
  32. package/lib/chart/graph/GraphSeries.js +11 -5
  33. package/lib/chart/graph/GraphView.js +30 -12
  34. package/lib/chart/heatmap/HeatmapView.js +4 -4
  35. package/lib/chart/helper/EffectLine.js +23 -1
  36. package/lib/chart/helper/EffectSymbol.js +2 -1
  37. package/lib/chart/helper/Line.js +94 -33
  38. package/lib/chart/helper/LineDraw.js +5 -1
  39. package/lib/chart/helper/Symbol.js +1 -2
  40. package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
  41. package/lib/chart/helper/createListFromArray.js +14 -8
  42. package/lib/chart/helper/createRenderPlanner.js +6 -3
  43. package/lib/chart/helper/whiskerBoxCommon.js +22 -16
  44. package/lib/chart/line/LineSeries.js +3 -1
  45. package/lib/chart/line/LineView.js +41 -2
  46. package/lib/chart/map/MapSeries.js +11 -3
  47. package/lib/chart/pie/PieSeries.js +27 -6
  48. package/lib/chart/pie/PieView.js +22 -15
  49. package/lib/chart/pie/labelLayout.js +102 -19
  50. package/lib/chart/pie/pieLayout.js +19 -7
  51. package/lib/chart/radar/RadarSeries.js +23 -3
  52. package/lib/chart/sankey/SankeySeries.js +13 -1
  53. package/lib/chart/sankey/SankeyView.js +70 -32
  54. package/lib/chart/sankey/sankeyLayout.js +22 -3
  55. package/lib/chart/scatter/ScatterSeries.js +3 -1
  56. package/lib/chart/sunburst/SunburstPiece.js +1 -0
  57. package/lib/chart/sunburst/SunburstSeries.js +12 -7
  58. package/lib/chart/sunburst/SunburstView.js +5 -1
  59. package/lib/chart/themeRiver/ThemeRiverSeries.js +3 -3
  60. package/lib/chart/tree/TreeSeries.js +20 -3
  61. package/lib/chart/tree/TreeView.js +151 -25
  62. package/lib/chart/treemap/TreemapSeries.js +15 -3
  63. package/lib/chart/treemap/TreemapView.js +80 -38
  64. package/lib/component/axis/AngleAxisView.js +64 -7
  65. package/lib/component/axis/AxisBuilder.js +62 -24
  66. package/lib/component/axis/CartesianAxisView.js +52 -85
  67. package/lib/component/axis/RadiusAxisView.js +36 -4
  68. package/lib/component/axis/SingleAxisView.js +21 -6
  69. package/lib/component/axis/axisSplitHelper.js +132 -0
  70. package/lib/component/brush/BrushView.js +11 -1
  71. package/lib/component/brush/visualEncoding.js +13 -2
  72. package/lib/component/dataZoom/SliderZoomView.js +4 -10
  73. package/lib/component/helper/BrushController.js +33 -43
  74. package/lib/component/helper/MapDraw.js +30 -4
  75. package/lib/component/legend/LegendModel.js +3 -3
  76. package/lib/component/legend/LegendView.js +17 -13
  77. package/lib/component/legend/ScrollableLegendView.js +18 -18
  78. package/lib/component/marker/MarkLineModel.js +2 -1
  79. package/lib/component/marker/markerHelper.js +7 -4
  80. package/lib/component/title.js +6 -2
  81. package/lib/component/toolbox/ToolboxView.js +5 -1
  82. package/lib/component/toolbox/feature/MagicType.js +20 -14
  83. package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
  84. package/lib/component/tooltip/TooltipContent.js +60 -23
  85. package/lib/component/tooltip/TooltipView.js +7 -8
  86. package/lib/component/visualMap/PiecewiseModel.js +3 -6
  87. package/lib/coord/Axis.js +30 -2
  88. package/lib/coord/View.js +9 -0
  89. package/lib/coord/axisDefault.js +21 -2
  90. package/lib/coord/axisHelper.js +22 -16
  91. package/lib/coord/calendar/Calendar.js +8 -4
  92. package/lib/coord/geo/geoJSONLoader.js +3 -2
  93. package/lib/coord/geo/geoSourceManager.js +3 -2
  94. package/lib/coord/geo/parseGeoJson.js +3 -2
  95. package/lib/coord/radar/Radar.js +5 -5
  96. package/lib/data/DataDimensionInfo.js +157 -0
  97. package/lib/data/List.js +25 -19
  98. package/lib/data/Tree.js +9 -19
  99. package/lib/data/helper/completeDimensions.js +43 -32
  100. package/lib/data/helper/createDimensions.js +2 -0
  101. package/lib/data/helper/sourceHelper.js +214 -114
  102. package/lib/echarts.js +57 -34
  103. package/lib/langEN.js +26 -0
  104. package/lib/layout/barGrid.js +19 -13
  105. package/lib/layout/barPolar.js +0 -5
  106. package/lib/loading/default.js +43 -27
  107. package/lib/model/Series.js +4 -4
  108. package/lib/model/referHelper.js +40 -12
  109. package/lib/scale/Interval.js +87 -2
  110. package/lib/scale/Log.js +9 -2
  111. package/lib/scale/helper.js +1 -43
  112. package/lib/stream/Scheduler.js +9 -1
  113. package/lib/theme/dark.js +3 -0
  114. package/lib/util/format.js +19 -2
  115. package/lib/util/graphic.js +14 -12
  116. package/lib/visual/LegendVisualProvider.js +75 -0
  117. package/lib/visual/dataColor.js +2 -12
  118. package/lib/visual/seriesColor.js +15 -7
  119. package/lib/visual/symbol.js +12 -2
  120. package/map/js/china.js +1 -1
  121. package/map/js/province/chongqing.js +1 -1
  122. package/map/js/province/gansu.js +2 -2
  123. package/map/js/province/tianjin.js +1 -28
  124. package/map/json/china.json +1 -1
  125. package/map/json/province/chongqing.json +1 -1
  126. package/map/json/province/tianjin.json +1 -1
  127. package/package.json +11 -6
  128. package/src/chart/bar/BarSeries.js +15 -1
  129. package/src/chart/bar/BarView.js +162 -15
  130. package/src/chart/bar/BaseBarSeries.js +1 -1
  131. package/src/chart/candlestick/candlestickVisual.js +1 -1
  132. package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
  133. package/src/chart/funnel/FunnelSeries.js +10 -4
  134. package/src/chart/gauge/GaugeSeries.js +0 -1
  135. package/src/chart/graph/GraphSeries.js +10 -4
  136. package/src/chart/graph/GraphView.js +28 -10
  137. package/src/chart/heatmap/HeatmapView.js +4 -4
  138. package/src/chart/helper/EffectLine.js +23 -1
  139. package/src/chart/helper/EffectSymbol.js +2 -1
  140. package/src/chart/helper/Line.js +84 -26
  141. package/src/chart/helper/LineDraw.js +5 -1
  142. package/src/chart/helper/Symbol.js +2 -2
  143. package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
  144. package/src/chart/helper/createListFromArray.js +13 -8
  145. package/src/chart/helper/createRenderPlanner.js +5 -2
  146. package/src/chart/helper/whiskerBoxCommon.js +21 -16
  147. package/src/chart/line/LineSeries.js +1 -1
  148. package/src/chart/line/LineView.js +45 -1
  149. package/src/chart/map/MapSeries.js +8 -3
  150. package/src/chart/pie/PieSeries.js +26 -5
  151. package/src/chart/pie/PieView.js +20 -15
  152. package/src/chart/pie/labelLayout.js +114 -22
  153. package/src/chart/pie/pieLayout.js +20 -7
  154. package/src/chart/radar/RadarSeries.js +27 -3
  155. package/src/chart/sankey/SankeySeries.js +12 -1
  156. package/src/chart/sankey/SankeyView.js +75 -30
  157. package/src/chart/sankey/sankeyLayout.js +25 -5
  158. package/src/chart/scatter/ScatterSeries.js +1 -1
  159. package/src/chart/sunburst/SunburstPiece.js +2 -0
  160. package/src/chart/sunburst/SunburstSeries.js +12 -7
  161. package/src/chart/sunburst/SunburstView.js +2 -1
  162. package/src/chart/themeRiver/ThemeRiverSeries.js +4 -3
  163. package/src/chart/tree/TreeSeries.js +19 -6
  164. package/src/chart/tree/TreeView.js +155 -22
  165. package/src/chart/treemap/TreemapSeries.js +15 -5
  166. package/src/chart/treemap/TreemapView.js +77 -41
  167. package/src/component/axis/AngleAxisView.js +75 -7
  168. package/src/component/axis/AxisBuilder.js +77 -32
  169. package/src/component/axis/CartesianAxisView.js +47 -83
  170. package/src/component/axis/RadiusAxisView.js +37 -4
  171. package/src/component/axis/SingleAxisView.js +21 -4
  172. package/src/component/axis/axisSplitHelper.js +114 -0
  173. package/src/component/brush/BrushView.js +8 -1
  174. package/src/component/brush/visualEncoding.js +6 -3
  175. package/src/component/dataZoom/SliderZoomView.js +4 -9
  176. package/src/component/helper/BrushController.js +40 -47
  177. package/src/component/helper/MapDraw.js +27 -4
  178. package/src/component/legend/LegendModel.js +3 -3
  179. package/src/component/legend/LegendView.js +18 -12
  180. package/src/component/legend/ScrollableLegendView.js +18 -16
  181. package/src/component/marker/MarkLineModel.js +2 -1
  182. package/src/component/marker/markerHelper.js +8 -5
  183. package/src/component/title.js +3 -2
  184. package/src/component/toolbox/ToolboxView.js +5 -0
  185. package/src/component/toolbox/feature/MagicType.js +19 -13
  186. package/src/component/toolbox/feature/SaveAsImage.js +2 -1
  187. package/src/component/tooltip/TooltipContent.js +59 -22
  188. package/src/component/tooltip/TooltipView.js +10 -8
  189. package/src/component/visualMap/PiecewiseModel.js +5 -9
  190. package/src/coord/Axis.js +29 -2
  191. package/src/coord/View.js +10 -1
  192. package/src/coord/axisDefault.js +25 -1
  193. package/src/coord/axisHelper.js +26 -19
  194. package/src/coord/calendar/Calendar.js +12 -5
  195. package/src/coord/geo/geoJSONLoader.js +3 -2
  196. package/src/coord/geo/geoSourceManager.js +3 -2
  197. package/src/coord/geo/parseGeoJson.js +3 -2
  198. package/src/coord/radar/Radar.js +6 -8
  199. package/src/data/DataDimensionInfo.js +135 -0
  200. package/src/data/List.js +29 -16
  201. package/src/data/Tree.js +12 -17
  202. package/src/data/helper/completeDimensions.js +49 -30
  203. package/src/data/helper/createDimensions.js +2 -0
  204. package/src/data/helper/sourceHelper.js +216 -124
  205. package/src/echarts.js +60 -36
  206. package/src/langEN.js +26 -0
  207. package/src/layout/barGrid.js +22 -10
  208. package/src/layout/barPolar.js +0 -4
  209. package/src/loading/default.js +46 -34
  210. package/src/model/Series.js +4 -4
  211. package/src/model/referHelper.js +34 -11
  212. package/src/scale/Interval.js +84 -4
  213. package/src/scale/Log.js +9 -2
  214. package/src/scale/helper.js +1 -39
  215. package/src/stream/Scheduler.js +8 -0
  216. package/src/theme/dark.js +3 -0
  217. package/src/util/format.js +17 -1
  218. package/src/util/graphic.js +13 -11
  219. package/src/visual/LegendVisualProvider.js +55 -0
  220. package/src/visual/dataColor.js +0 -13
  221. package/src/visual/seriesColor.js +13 -7
  222. package/src/visual/symbol.js +11 -2
  223. package/theme/azul.js +163 -0
  224. package/theme/bee-inspired.js +178 -0
  225. package/theme/blue.js +178 -0
  226. package/theme/caravan.js +178 -0
  227. package/theme/carp.js +163 -0
  228. package/theme/cool.js +180 -0
  229. package/theme/dark-blue.js +168 -0
  230. package/theme/dark-bold.js +168 -0
  231. package/theme/dark-digerati.js +168 -0
  232. package/theme/dark-fresh-cut.js +168 -0
  233. package/theme/dark-mushroom.js +168 -0
  234. package/theme/dark.js +69 -62
  235. package/theme/eduardo.js +178 -0
  236. package/theme/forest.js +163 -0
  237. package/theme/fresh-cut.js +163 -0
  238. package/theme/fruit.js +178 -0
  239. package/theme/gray.js +220 -0
  240. package/theme/green.js +222 -0
  241. package/theme/helianthus.js +263 -0
  242. package/theme/infographic.js +72 -57
  243. package/theme/inspired.js +163 -0
  244. package/theme/jazz.js +163 -0
  245. package/theme/london.js +163 -0
  246. package/theme/macarons.js +80 -57
  247. package/theme/macarons2.js +251 -0
  248. package/theme/mint.js +155 -0
  249. package/theme/red-velvet.js +163 -0
  250. package/theme/red.js +225 -0
  251. package/theme/roma.js +55 -22
  252. package/theme/royal.js +163 -0
  253. package/theme/sakura.js +140 -0
  254. package/theme/shine.js +52 -45
  255. package/theme/tech-blue.js +180 -0
  256. package/theme/vintage.js +37 -23
@@ -263,7 +263,6 @@ function doCalBarWidthAndOffset(seriesInfoList) {
263
263
  // will be shared by series. Consider that they have default values,
264
264
  // only the attributes set on the last series will work.
265
265
  // Do not change this fact unless there will be a break change.
266
- // TODO
267
266
 
268
267
  var barWidth = seriesInfo.barWidth;
269
268
 
@@ -317,7 +316,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
317
316
 
318
317
  if (finalWidth !== autoWidth) {
319
318
  column.width = finalWidth;
320
- remainedWidth -= finalWidth;
319
+ remainedWidth -= finalWidth + barGapPercent * finalWidth;
321
320
  autoWidthCount--;
322
321
  }
323
322
  } else {
@@ -336,7 +335,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
336
335
  }
337
336
 
338
337
  column.width = finalWidth;
339
- remainedWidth -= finalWidth;
338
+ remainedWidth -= finalWidth + barGapPercent * finalWidth;
340
339
  autoWidthCount--;
341
340
  }
342
341
  }); // Recalculate width again
@@ -428,12 +427,7 @@ function layout(seriesType, ecModel) {
428
427
 
429
428
  for (var idx = 0, len = data.count(); idx < len; idx++) {
430
429
  var value = data.get(valueDim, idx);
431
- var baseValue = data.get(baseDim, idx); // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
432
-
433
- if (isNaN(value) || isNaN(baseValue)) {
434
- continue;
435
- }
436
-
430
+ var baseValue = data.get(baseDim, idx);
437
431
  var sign = value >= 0 ? 'p' : 'n';
438
432
  var baseCoord = valueAxisStart; // Because of the barMinHeight, we can not use the value in
439
433
  // stackResultDimension directly.
@@ -467,9 +461,12 @@ function layout(seriesType, ecModel) {
467
461
 
468
462
  if (Math.abs(width) < barMinHeight) {
469
463
  width = (width < 0 ? -1 : 1) * barMinHeight;
470
- }
464
+ } // Ignore stack from NaN value
465
+
471
466
 
472
- stacked && (lastStackCoords[stackId][baseValue][sign] += width);
467
+ if (!isNaN(width)) {
468
+ stacked && (lastStackCoords[stackId][baseValue][sign] += width);
469
+ }
473
470
  } else {
474
471
  var coord = cartesian.dataToPoint([baseValue, value]);
475
472
  x = coord[0] + columnOffset;
@@ -480,9 +477,12 @@ function layout(seriesType, ecModel) {
480
477
  if (Math.abs(height) < barMinHeight) {
481
478
  // Include zero to has a positive bar
482
479
  height = (height <= 0 ? -1 : 1) * barMinHeight;
483
- }
480
+ } // Ignore stack from NaN value
484
481
 
485
- stacked && (lastStackCoords[stackId][baseValue][sign] += height);
482
+
483
+ if (!isNaN(height)) {
484
+ stacked && (lastStackCoords[stackId][baseValue][sign] += height);
485
+ }
486
486
  }
487
487
 
488
488
  data.setItemLayout(idx, {
@@ -506,6 +506,7 @@ var largeLayout = {
506
506
 
507
507
  var data = seriesModel.getData();
508
508
  var cartesian = seriesModel.coordinateSystem;
509
+ var coordLayout = cartesian.grid.getRect();
509
510
  var baseAxis = cartesian.getBaseAxis();
510
511
  var valueAxis = cartesian.getOtherAxis(baseAxis);
511
512
  var valueDim = data.mapDimension(valueAxis.dim);
@@ -526,6 +527,7 @@ var largeLayout = {
526
527
  function progress(params, data) {
527
528
  var count = params.count;
528
529
  var largePoints = new LargeArr(count * 2);
530
+ var largeBackgroundPoints = new LargeArr(count * 2);
529
531
  var largeDataIndices = new LargeArr(count);
530
532
  var dataIndex;
531
533
  var coord = [];
@@ -538,7 +540,9 @@ var largeLayout = {
538
540
  valuePair[1 - valueDimIdx] = data.get(baseDim, dataIndex);
539
541
  coord = cartesian.dataToPoint(valuePair, null, coord); // Data index might not be in order, depends on `progressiveChunkMode`.
540
542
 
543
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coordLayout.x + coordLayout.width : coord[0];
541
544
  largePoints[pointsOffset++] = coord[0];
545
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal ? coord[1] : coordLayout.y + coordLayout.height;
542
546
  largePoints[pointsOffset++] = coord[1];
543
547
  largeDataIndices[idxOffset++] = dataIndex;
544
548
  }
@@ -546,8 +550,10 @@ var largeLayout = {
546
550
  data.setLayout({
547
551
  largePoints: largePoints,
548
552
  largeDataIndices: largeDataIndices,
553
+ largeBackgroundPoints: largeBackgroundPoints,
549
554
  barWidth: barWidth,
550
555
  valueAxisStart: getValueAxisStart(baseAxis, valueAxis, false),
556
+ backgroundStart: valueAxisHorizontal ? coordLayout.x : coordLayout.y,
551
557
  valueAxisHorizontal: valueAxisHorizontal
552
558
  });
553
559
  }
@@ -96,11 +96,6 @@ function barLayoutPolar(seriesType, ecModel, api) {
96
96
  for (var idx = 0, len = data.count(); idx < len; idx++) {
97
97
  var value = data.get(valueDim, idx);
98
98
  var baseValue = data.get(baseDim, idx);
99
-
100
- if (isNaN(value)) {
101
- continue;
102
- }
103
-
104
99
  var sign = value >= 0 ? 'p' : 'n';
105
100
  var baseCoord = valueAxisStart; // Because of the barMinHeight, we can not use the value in
106
101
  // stackResultDimension directly.
@@ -22,6 +22,8 @@ var zrUtil = require("zrender/lib/core/util");
22
22
 
23
23
  var graphic = require("../util/graphic");
24
24
 
25
+ var textContain = require("zrender/lib/contain/text");
26
+
25
27
  /*
26
28
  * Licensed to the Apache Software Foundation (ASF) under one
27
29
  * or more contributor license agreements. See the NOTICE file
@@ -54,11 +56,16 @@ function _default(api, opts) {
54
56
  opts = opts || {};
55
57
  zrUtil.defaults(opts, {
56
58
  text: 'loading',
57
- color: '#c23531',
58
59
  textColor: '#000',
60
+ fontSize: '12px',
59
61
  maskColor: 'rgba(255, 255, 255, 0.8)',
62
+ showSpinner: true,
63
+ color: '#c23531',
64
+ spinnerRadius: 10,
65
+ lineWidth: 5,
60
66
  zlevel: 0
61
67
  });
68
+ var group = new graphic.Group();
62
69
  var mask = new graphic.Rect({
63
70
  style: {
64
71
  fill: opts.maskColor
@@ -66,24 +73,13 @@ function _default(api, opts) {
66
73
  zlevel: opts.zlevel,
67
74
  z: 10000
68
75
  });
69
- var arc = new graphic.Arc({
70
- shape: {
71
- startAngle: -PI / 2,
72
- endAngle: -PI / 2 + 0.1,
73
- r: 10
74
- },
75
- style: {
76
- stroke: opts.color,
77
- lineCap: 'round',
78
- lineWidth: 5
79
- },
80
- zlevel: opts.zlevel,
81
- z: 10001
82
- });
76
+ group.add(mask);
77
+ var font = opts.fontSize + ' sans-serif';
83
78
  var labelRect = new graphic.Rect({
84
79
  style: {
85
80
  fill: 'none',
86
81
  text: opts.text,
82
+ font: font,
87
83
  textPosition: 'right',
88
84
  textDistance: 10,
89
85
  textFill: opts.textColor
@@ -91,25 +87,45 @@ function _default(api, opts) {
91
87
  zlevel: opts.zlevel,
92
88
  z: 10001
93
89
  });
94
- arc.animateShape(true).when(1000, {
95
- endAngle: PI * 3 / 2
96
- }).start('circularInOut');
97
- arc.animateShape(true).when(1000, {
98
- startAngle: PI * 3 / 2
99
- }).delay(300).start('circularInOut');
100
- var group = new graphic.Group();
101
- group.add(arc);
102
90
  group.add(labelRect);
103
- group.add(mask); // Inject resize
91
+
92
+ if (opts.showSpinner) {
93
+ var arc = new graphic.Arc({
94
+ shape: {
95
+ startAngle: -PI / 2,
96
+ endAngle: -PI / 2 + 0.1,
97
+ r: opts.spinnerRadius
98
+ },
99
+ style: {
100
+ stroke: opts.color,
101
+ lineCap: 'round',
102
+ lineWidth: opts.lineWidth
103
+ },
104
+ zlevel: opts.zlevel,
105
+ z: 10001
106
+ });
107
+ arc.animateShape(true).when(1000, {
108
+ endAngle: PI * 3 / 2
109
+ }).start('circularInOut');
110
+ arc.animateShape(true).when(1000, {
111
+ startAngle: PI * 3 / 2
112
+ }).delay(300).start('circularInOut');
113
+ group.add(arc);
114
+ } // Inject resize
115
+
104
116
 
105
117
  group.resize = function () {
106
- var cx = api.getWidth() / 2;
118
+ var textWidth = textContain.getWidth(opts.text, font);
119
+ var r = opts.showSpinner ? opts.spinnerRadius : 0; // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
120
+ // textDistance needs to be calculated when both animation and text exist
121
+
122
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2 // only show the text
123
+ - (opts.showSpinner ? 0 : textWidth / 2);
107
124
  var cy = api.getHeight() / 2;
108
- arc.setShape({
125
+ opts.showSpinner && arc.setShape({
109
126
  cx: cx,
110
127
  cy: cy
111
128
  });
112
- var r = arc.shape.r;
113
129
  labelRect.setShape({
114
130
  x: cx - r,
115
131
  y: cy - r,
@@ -95,11 +95,11 @@ var SeriesModel = ComponentModel.extend({
95
95
  defaultOption: null,
96
96
 
97
97
  /**
98
- * Data provided for legend
99
- * @type {Function}
98
+ * legend visual provider to the legend component
99
+ * @type {Object}
100
100
  */
101
101
  // PENDING
102
- legendDataProvider: null,
102
+ legendVisualProvider: null,
103
103
 
104
104
  /**
105
105
  * Access path of color for visual
@@ -569,7 +569,7 @@ function dataTaskReset(context) {
569
569
 
570
570
  function dataTaskProgress(param, context) {
571
571
  // Avoid repead cloneShallow when data just created in reset.
572
- if (param.end > context.outputData.count()) {
572
+ if (context.outputData && param.end > context.outputData.count()) {
573
573
  context.model.getRawData().cloneShallow(context.outputData);
574
574
  }
575
575
  } // TODO refactor
@@ -56,7 +56,8 @@ var each = _util.each;
56
56
  // check: "modelHelper" of tooltip and "BrushTargetManager".
57
57
 
58
58
  /**
59
- * @return {Object} For example:
59
+ * @class
60
+ * For example:
60
61
  * {
61
62
  * coordSysName: 'cartesian2d',
62
63
  * coordSysDims: ['x', 'y', ...],
@@ -68,19 +69,46 @@ var each = _util.each;
68
69
  * x: xAxisModel,
69
70
  * y: undefined
70
71
  * }),
71
- * // It also indicate that whether there is category axis.
72
+ * // The index of the first category axis in `coordSysDims`.
73
+ * // `null/undefined` means no category axis exists.
72
74
  * firstCategoryDimIndex: 1,
73
75
  * // To replace user specified encode.
74
76
  * }
75
77
  */
76
- function getCoordSysDefineBySeries(seriesModel) {
78
+ function CoordSysInfo(coordSysName) {
79
+ /**
80
+ * @type {string}
81
+ */
82
+ this.coordSysName = coordSysName;
83
+ /**
84
+ * @type {Array.<string>}
85
+ */
86
+
87
+ this.coordSysDims = [];
88
+ /**
89
+ * @type {module:zrender/core/util#HashMap}
90
+ */
91
+
92
+ this.axisMap = createHashMap();
93
+ /**
94
+ * @type {module:zrender/core/util#HashMap}
95
+ */
96
+
97
+ this.categoryAxisMap = createHashMap();
98
+ /**
99
+ * @type {number}
100
+ */
101
+
102
+ this.firstCategoryDimIndex = null;
103
+ }
104
+ /**
105
+ * @return {module:model/referHelper#CoordSysInfo}
106
+ */
107
+
108
+
109
+ function getCoordSysInfoBySeries(seriesModel) {
77
110
  var coordSysName = seriesModel.get('coordinateSystem');
78
- var result = {
79
- coordSysName: coordSysName,
80
- coordSysDims: [],
81
- axisMap: createHashMap(),
82
- categoryAxisMap: createHashMap()
83
- };
111
+ var result = new CoordSysInfo(coordSysName);
84
112
  var fetch = fetchers[coordSysName];
85
113
 
86
114
  if (fetch) {
@@ -104,7 +132,7 @@ var fetchers = {
104
132
 
105
133
  if (isCategory(yAxisModel)) {
106
134
  categoryAxisMap.set('y', yAxisModel);
107
- result.firstCategoryDimIndex = 1;
135
+ result.firstCategoryDimIndex == null & (result.firstCategoryDimIndex = 1);
108
136
  }
109
137
  },
110
138
  singleAxis: function (seriesModel, result, axisMap, categoryAxisMap) {
@@ -132,7 +160,7 @@ var fetchers = {
132
160
 
133
161
  if (isCategory(angleAxisModel)) {
134
162
  categoryAxisMap.set('angle', angleAxisModel);
135
- result.firstCategoryDimIndex = 1;
163
+ result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);
136
164
  }
137
165
  },
138
166
  geo: function (seriesModel, result, axisMap, categoryAxisMap) {
@@ -159,4 +187,4 @@ function isCategory(axisModel) {
159
187
  return axisModel.get('type') === 'category';
160
188
  }
161
189
 
162
- exports.getCoordSysDefineBySeries = getCoordSysDefineBySeries;
190
+ exports.getCoordSysInfoBySeries = getCoordSysInfoBySeries;
@@ -97,10 +97,95 @@ var IntervalScale = Scale.extend({
97
97
  },
98
98
 
99
99
  /**
100
+ * @param {boolean} [expandToNicedExtent=false] If expand the ticks to niced extent.
100
101
  * @return {Array.<number>}
101
102
  */
102
- getTicks: function () {
103
- return helper.intervalScaleGetTicks(this._interval, this._extent, this._niceExtent, this._intervalPrecision);
103
+ getTicks: function (expandToNicedExtent) {
104
+ var interval = this._interval;
105
+ var extent = this._extent;
106
+ var niceTickExtent = this._niceExtent;
107
+ var intervalPrecision = this._intervalPrecision;
108
+ var ticks = []; // If interval is 0, return [];
109
+
110
+ if (!interval) {
111
+ return ticks;
112
+ } // Consider this case: using dataZoom toolbox, zoom and zoom.
113
+
114
+
115
+ var safeLimit = 10000;
116
+
117
+ if (extent[0] < niceTickExtent[0]) {
118
+ if (expandToNicedExtent) {
119
+ ticks.push(roundNumber(niceTickExtent[0] - interval, intervalPrecision));
120
+ } else {
121
+ ticks.push(extent[0]);
122
+ }
123
+ }
124
+
125
+ var tick = niceTickExtent[0];
126
+
127
+ while (tick <= niceTickExtent[1]) {
128
+ ticks.push(tick); // Avoid rounding error
129
+
130
+ tick = roundNumber(tick + interval, intervalPrecision);
131
+
132
+ if (tick === ticks[ticks.length - 1]) {
133
+ // Consider out of safe float point, e.g.,
134
+ // -3711126.9907707 + 2e-10 === -3711126.9907707
135
+ break;
136
+ }
137
+
138
+ if (ticks.length > safeLimit) {
139
+ return [];
140
+ }
141
+ } // Consider this case: the last item of ticks is smaller
142
+ // than niceTickExtent[1] and niceTickExtent[1] === extent[1].
143
+
144
+
145
+ var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
146
+
147
+ if (extent[1] > lastNiceTick) {
148
+ if (expandToNicedExtent) {
149
+ ticks.push(roundNumber(lastNiceTick + interval, intervalPrecision));
150
+ } else {
151
+ ticks.push(extent[1]);
152
+ }
153
+ }
154
+
155
+ return ticks;
156
+ },
157
+
158
+ /**
159
+ * @param {number} [splitNumber=5]
160
+ * @return {Array.<Array.<number>>}
161
+ */
162
+ getMinorTicks: function (splitNumber) {
163
+ var ticks = this.getTicks(true);
164
+ var minorTicks = [];
165
+ var extent = this.getExtent();
166
+
167
+ for (var i = 1; i < ticks.length; i++) {
168
+ var nextTick = ticks[i];
169
+ var prevTick = ticks[i - 1];
170
+ var count = 0;
171
+ var minorTicksGroup = [];
172
+ var interval = nextTick - prevTick;
173
+ var minorInterval = interval / splitNumber;
174
+
175
+ while (count < splitNumber - 1) {
176
+ var minorTick = numberUtil.round(prevTick + (count + 1) * minorInterval); // For the first and last interval. The count may be less than splitNumber.
177
+
178
+ if (minorTick > extent[0] && minorTick < extent[1]) {
179
+ minorTicksGroup.push(minorTick);
180
+ }
181
+
182
+ count++;
183
+ }
184
+
185
+ minorTicks.push(minorTicksGroup);
186
+ }
187
+
188
+ return minorTicks;
104
189
  },
105
190
 
106
191
  /**
package/lib/scale/Log.js CHANGED
@@ -67,13 +67,14 @@ var LogScale = Scale.extend({
67
67
  },
68
68
 
69
69
  /**
70
+ * @param {boolean} [expandToNicedExtent=false] If expand the ticks to niced extent.
70
71
  * @return {Array.<number>}
71
72
  */
72
- getTicks: function () {
73
+ getTicks: function (expandToNicedExtent) {
73
74
  var originalScale = this._originalScale;
74
75
  var extent = this._extent;
75
76
  var originalExtent = originalScale.getExtent();
76
- return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) {
77
+ return zrUtil.map(intervalScaleProto.getTicks.call(this, expandToNicedExtent), function (val) {
77
78
  var powVal = numberUtil.round(mathPow(this.base, val)); // Fix #4158
78
79
 
79
80
  powVal = val === extent[0] && originalScale.__fixMin ? fixRoundingError(powVal, originalExtent[0]) : powVal;
@@ -82,6 +83,12 @@ var LogScale = Scale.extend({
82
83
  }, this);
83
84
  },
84
85
 
86
+ /**
87
+ * @param {number} splitNumber
88
+ * @return {Array.<Array.<number>>}
89
+ */
90
+ getMinorTicks: intervalScaleProto.getMinorTicks,
91
+
85
92
  /**
86
93
  * @param {number} val
87
94
  * @return {string}
@@ -99,48 +99,6 @@ function fixExtent(niceTickExtent, extent) {
99
99
  }
100
100
  }
101
101
 
102
- function intervalScaleGetTicks(interval, extent, niceTickExtent, intervalPrecision) {
103
- var ticks = []; // If interval is 0, return [];
104
-
105
- if (!interval) {
106
- return ticks;
107
- } // Consider this case: using dataZoom toolbox, zoom and zoom.
108
-
109
-
110
- var safeLimit = 10000;
111
-
112
- if (extent[0] < niceTickExtent[0]) {
113
- ticks.push(extent[0]);
114
- }
115
-
116
- var tick = niceTickExtent[0];
117
-
118
- while (tick <= niceTickExtent[1]) {
119
- ticks.push(tick); // Avoid rounding error
120
-
121
- tick = roundNumber(tick + interval, intervalPrecision);
122
-
123
- if (tick === ticks[ticks.length - 1]) {
124
- // Consider out of safe float point, e.g.,
125
- // -3711126.9907707 + 2e-10 === -3711126.9907707
126
- break;
127
- }
128
-
129
- if (ticks.length > safeLimit) {
130
- return [];
131
- }
132
- } // Consider this case: the last item of ticks is smaller
133
- // than niceTickExtent[1] and niceTickExtent[1] === extent[1].
134
-
135
-
136
- if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1])) {
137
- ticks.push(extent[1]);
138
- }
139
-
140
- return ticks;
141
- }
142
-
143
102
  exports.intervalScaleNiceTicks = intervalScaleNiceTicks;
144
103
  exports.getIntervalPrecision = getIntervalPrecision;
145
- exports.fixExtent = fixExtent;
146
- exports.intervalScaleGetTicks = intervalScaleGetTicks;
104
+ exports.fixExtent = fixExtent;
@@ -280,7 +280,15 @@ function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
280
280
  task.dirty();
281
281
  }
282
282
 
283
- var performArgs = scheduler.getPerformArgs(task, opt.block);
283
+ var performArgs = scheduler.getPerformArgs(task, opt.block); // FIXME
284
+ // if intending to decalare `performRawSeries` in handlers, only
285
+ // stream-independent (specifically, data item independent) operations can be
286
+ // performed. Because is a series is filtered, most of the tasks will not
287
+ // be performed. A stream-dependent operation probably cause wrong biz logic.
288
+ // Perhaps we should not provide a separate callback for this case instead
289
+ // of providing the config `performRawSeries`. The stream-dependent operaions
290
+ // and stream-independent operations should better not be mixed.
291
+
284
292
  performArgs.skip = !stageHandler.performRawSeries && ecModel.isSeriesFiltered(task.context.model);
285
293
  updatePayload(task, payload);
286
294
  unfinished |= task.perform(performArgs);
package/lib/theme/dark.js CHANGED
@@ -80,6 +80,9 @@ var theme = {
80
80
  },
81
81
  crossStyle: {
82
82
  color: contrastColor
83
+ },
84
+ label: {
85
+ color: '#000'
83
86
  }
84
87
  }
85
88
  },
@@ -45,7 +45,7 @@ var numberUtil = require("./number");
45
45
  // import Text from 'zrender/src/graphic/Text';
46
46
 
47
47
  /**
48
- * 每三位默认加,格式化
48
+ * add commas after every three numbers
49
49
  * @param {string|number} x
50
50
  * @return {string}
51
51
  */
@@ -261,6 +261,22 @@ function getTextBoundingRect(opt) {
261
261
  function getTextRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate, textLineHeight) {
262
262
  return textContain.getBoundingRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate);
263
263
  }
264
+ /**
265
+ * open new tab
266
+ * @param {string} link url
267
+ * @param {string} target blank or self
268
+ */
269
+
270
+
271
+ function windowOpen(link, target) {
272
+ if (target === '_blank' || target === 'blank') {
273
+ var blank = window.open();
274
+ blank.opener = null;
275
+ blank.location = link;
276
+ } else {
277
+ window.open(link, target);
278
+ }
279
+ }
264
280
 
265
281
  exports.addCommas = addCommas;
266
282
  exports.toCamelCase = toCamelCase;
@@ -273,4 +289,5 @@ exports.formatTime = formatTime;
273
289
  exports.capitalFirst = capitalFirst;
274
290
  exports.truncateText = truncateText;
275
291
  exports.getTextBoundingRect = getTextBoundingRect;
276
- exports.getTextRect = getTextRect;
292
+ exports.getTextRect = getTextRect;
293
+ exports.windowOpen = windowOpen;
@@ -727,11 +727,13 @@ function getHighlightDigit(highlightKey) {
727
727
  * @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
728
728
  * @param {string|Function} [opt.defaultText]
729
729
  * @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
730
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
731
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
732
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
733
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
734
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
730
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
731
+ * @param {number} [opt.labelDataIndex] Fetch text by
732
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
733
+ * @param {number} [opt.labelDimIndex] Fetch text by
734
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
735
+ * @param {string} [opt.labelProp] Fetch text by
736
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
735
737
  * @param {Object} [normalSpecified]
736
738
  * @param {Object} [emphasisSpecified]
737
739
  */
@@ -741,7 +743,8 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
741
743
  opt = opt || EMPTY_OBJ;
742
744
  var labelFetcher = opt.labelFetcher;
743
745
  var labelDataIndex = opt.labelDataIndex;
744
- var labelDimIndex = opt.labelDimIndex; // This scenario, `label.normal.show = true; label.emphasis.show = false`,
746
+ var labelDimIndex = opt.labelDimIndex;
747
+ var labelProp = opt.labelProp; // This scenario, `label.normal.show = true; label.emphasis.show = false`,
745
748
  // is not supported util someone requests.
746
749
 
747
750
  var showNormal = normalModel.getShallow('show');
@@ -753,7 +756,7 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
753
756
 
754
757
  if (showNormal || showEmphasis) {
755
758
  if (labelFetcher) {
756
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
759
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
757
760
  }
758
761
 
759
762
  if (baseText == null) {
@@ -762,7 +765,7 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
762
765
  }
763
766
 
764
767
  var normalStyleText = showNormal ? baseText : null;
765
- var emphasisStyleText = showEmphasis ? zrUtil.retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex) : null, baseText) : null; // Optimize: If style.text is null, text will not be drawn.
768
+ var emphasisStyleText = showEmphasis ? zrUtil.retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp) : null, baseText) : null; // Optimize: If style.text is null, text will not be drawn.
766
769
 
767
770
  if (normalStyleText != null || emphasisStyleText != null) {
768
771
  // Always set `textStyle` even if `normalStyle.text` is null, because default
@@ -1125,8 +1128,7 @@ function rollbackDefaultTextStyle(style) {
1125
1128
  }
1126
1129
 
1127
1130
  function getFont(opt, ecModel) {
1128
- // ecModel or default text style model.
1129
- var gTextStyleModel = ecModel || ecModel.getModel('textStyle');
1131
+ var gTextStyleModel = ecModel && ecModel.getModel('textStyle');
1130
1132
  return zrUtil.trim([// FIXME in node-canvas fontWeight is before fontStyle
1131
1133
  opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '', opt.fontWeight || gTextStyleModel && gTextStyleModel.getShallow('fontWeight') || '', (opt.fontSize || gTextStyleModel && gTextStyleModel.getShallow('fontSize') || 12) + 'px', opt.fontFamily || gTextStyleModel && gTextStyleModel.getShallow('fontFamily') || 'sans-serif'].join(' '));
1132
1134
  }
@@ -1168,7 +1170,7 @@ function animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, cb)
1168
1170
  * configuration in series.
1169
1171
  *
1170
1172
  * Caution: this method will stop previous animation.
1171
- * So if do not use this method to one element twice before
1173
+ * So do not use this method to one element twice before
1172
1174
  * animation starts, unless you know what you are doing.
1173
1175
  *
1174
1176
  * @param {module:zrender/Element} el
@@ -1195,7 +1197,7 @@ function updateProps(el, props, animatableModel, dataIndex, cb) {
1195
1197
  * configuration in series.
1196
1198
  *
1197
1199
  * Caution: this method will stop previous animation.
1198
- * So if do not use this method to one element twice before
1200
+ * So do not use this method to one element twice before
1199
1201
  * animation starts, unless you know what you are doing.
1200
1202
  *
1201
1203
  * @param {module:zrender/Element} el