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
@@ -246,7 +246,6 @@ function doCalBarWidthAndOffset(seriesInfoList) {
246
246
  // only the attributes set on the last series will work.
247
247
  // Do not change this fact unless there will be a break change.
248
248
 
249
- // TODO
250
249
  var barWidth = seriesInfo.barWidth;
251
250
  if (barWidth && !stacks[stackId].width) {
252
251
  // See #6312, do not restrict width.
@@ -286,6 +285,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
286
285
  zrUtil.each(stacks, function (column) {
287
286
  var maxWidth = column.maxWidth;
288
287
  var minWidth = column.minWidth;
288
+
289
289
  if (!column.width) {
290
290
  var finalWidth = autoWidth;
291
291
  if (maxWidth && maxWidth < finalWidth) {
@@ -301,7 +301,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
301
301
  }
302
302
  if (finalWidth !== autoWidth) {
303
303
  column.width = finalWidth;
304
- remainedWidth -= finalWidth;
304
+ remainedWidth -= finalWidth + barGapPercent * finalWidth;
305
305
  autoWidthCount--;
306
306
  }
307
307
  }
@@ -318,7 +318,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
318
318
  finalWidth = Math.max(finalWidth, minWidth);
319
319
  }
320
320
  column.width = finalWidth;
321
- remainedWidth -= finalWidth;
321
+ remainedWidth -= finalWidth + barGapPercent * finalWidth;
322
322
  autoWidthCount--;
323
323
  }
324
324
  });
@@ -326,8 +326,10 @@ function doCalBarWidthAndOffset(seriesInfoList) {
326
326
  // Recalculate width again
327
327
  autoWidth = (remainedWidth - categoryGap)
328
328
  / (autoWidthCount + (autoWidthCount - 1) * barGapPercent);
329
+
329
330
  autoWidth = Math.max(autoWidth, 0);
330
331
 
332
+
331
333
  var widthSum = 0;
332
334
  var lastColumn;
333
335
  zrUtil.each(stacks, function (column, idx) {
@@ -418,11 +420,6 @@ export function layout(seriesType, ecModel) {
418
420
  var value = data.get(valueDim, idx);
419
421
  var baseValue = data.get(baseDim, idx);
420
422
 
421
- // If dataZoom in filteMode: 'empty', the baseValue can be set as NaN in "axisProxy".
422
- if (isNaN(value) || isNaN(baseValue)) {
423
- continue;
424
- }
425
-
426
423
  var sign = value >= 0 ? 'p' : 'n';
427
424
  var baseCoord = valueAxisStart;
428
425
 
@@ -455,7 +452,10 @@ export function layout(seriesType, ecModel) {
455
452
  if (Math.abs(width) < barMinHeight) {
456
453
  width = (width < 0 ? -1 : 1) * barMinHeight;
457
454
  }
458
- stacked && (lastStackCoords[stackId][baseValue][sign] += width);
455
+ // Ignore stack from NaN value
456
+ if (!isNaN(width)) {
457
+ stacked && (lastStackCoords[stackId][baseValue][sign] += width);
458
+ }
459
459
  }
460
460
  else {
461
461
  var coord = cartesian.dataToPoint([baseValue, value]);
@@ -468,8 +468,12 @@ export function layout(seriesType, ecModel) {
468
468
  // Include zero to has a positive bar
469
469
  height = (height <= 0 ? -1 : 1) * barMinHeight;
470
470
  }
471
- stacked && (lastStackCoords[stackId][baseValue][sign] += height);
471
+ // Ignore stack from NaN value
472
+ if (!isNaN(height)) {
473
+ stacked && (lastStackCoords[stackId][baseValue][sign] += height);
474
+ }
472
475
  }
476
+
473
477
  data.setItemLayout(idx, {
474
478
  x: x,
475
479
  y: y,
@@ -495,6 +499,7 @@ export var largeLayout = {
495
499
 
496
500
  var data = seriesModel.getData();
497
501
  var cartesian = seriesModel.coordinateSystem;
502
+ var coordLayout = cartesian.grid.getRect();
498
503
  var baseAxis = cartesian.getBaseAxis();
499
504
  var valueAxis = cartesian.getOtherAxis(baseAxis);
500
505
  var valueDim = data.mapDimension(valueAxis.dim);
@@ -514,6 +519,7 @@ export var largeLayout = {
514
519
  function progress(params, data) {
515
520
  var count = params.count;
516
521
  var largePoints = new LargeArr(count * 2);
522
+ var largeBackgroundPoints = new LargeArr(count * 2);
517
523
  var largeDataIndices = new LargeArr(count);
518
524
  var dataIndex;
519
525
  var coord = [];
@@ -527,7 +533,11 @@ export var largeLayout = {
527
533
 
528
534
  coord = cartesian.dataToPoint(valuePair, null, coord);
529
535
  // Data index might not be in order, depends on `progressiveChunkMode`.
536
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
537
+ ? coordLayout.x + coordLayout.width : coord[0];
530
538
  largePoints[pointsOffset++] = coord[0];
539
+ largeBackgroundPoints[pointsOffset] = valueAxisHorizontal
540
+ ? coord[1] : coordLayout.y + coordLayout.height;
531
541
  largePoints[pointsOffset++] = coord[1];
532
542
  largeDataIndices[idxOffset++] = dataIndex;
533
543
  }
@@ -535,8 +545,10 @@ export var largeLayout = {
535
545
  data.setLayout({
536
546
  largePoints: largePoints,
537
547
  largeDataIndices: largeDataIndices,
548
+ largeBackgroundPoints: largeBackgroundPoints,
538
549
  barWidth: barWidth,
539
550
  valueAxisStart: getValueAxisStart(baseAxis, valueAxis, false),
551
+ backgroundStart: valueAxisHorizontal ? coordLayout.x : coordLayout.y,
540
552
  valueAxisHorizontal: valueAxisHorizontal
541
553
  });
542
554
  }
@@ -88,10 +88,6 @@ function barLayoutPolar(seriesType, ecModel, api) {
88
88
  var value = data.get(valueDim, idx);
89
89
  var baseValue = data.get(baseDim, idx);
90
90
 
91
- if (isNaN(value)) {
92
- continue;
93
- }
94
-
95
91
  var sign = value >= 0 ? 'p' : 'n';
96
92
  var baseCoord = valueAxisStart;
97
93
 
@@ -19,6 +19,7 @@
19
19
 
20
20
  import * as zrUtil from 'zrender/src/core/util';
21
21
  import * as graphic from '../util/graphic';
22
+ import * as textContain from 'zrender/src/contain/text';
22
23
 
23
24
  var PI = Math.PI;
24
25
 
@@ -34,11 +35,16 @@ export default function (api, opts) {
34
35
  opts = opts || {};
35
36
  zrUtil.defaults(opts, {
36
37
  text: 'loading',
37
- color: '#c23531',
38
38
  textColor: '#000',
39
+ fontSize: '12px',
39
40
  maskColor: 'rgba(255, 255, 255, 0.8)',
41
+ showSpinner: true,
42
+ color: '#c23531',
43
+ spinnerRadius: 10,
44
+ lineWidth: 5,
40
45
  zlevel: 0
41
46
  });
47
+ var group = new graphic.Group();
42
48
  var mask = new graphic.Rect({
43
49
  style: {
44
50
  fill: opts.maskColor
@@ -46,24 +52,13 @@ export default function (api, opts) {
46
52
  zlevel: opts.zlevel,
47
53
  z: 10000
48
54
  });
49
- var arc = new graphic.Arc({
50
- shape: {
51
- startAngle: -PI / 2,
52
- endAngle: -PI / 2 + 0.1,
53
- r: 10
54
- },
55
- style: {
56
- stroke: opts.color,
57
- lineCap: 'round',
58
- lineWidth: 5
59
- },
60
- zlevel: opts.zlevel,
61
- z: 10001
62
- });
55
+ group.add(mask);
56
+ var font = opts.fontSize + ' sans-serif';
63
57
  var labelRect = new graphic.Rect({
64
58
  style: {
65
59
  fill: 'none',
66
60
  text: opts.text,
61
+ font: font,
67
62
  textPosition: 'right',
68
63
  textDistance: 10,
69
64
  textFill: opts.textColor
@@ -71,32 +66,49 @@ export default function (api, opts) {
71
66
  zlevel: opts.zlevel,
72
67
  z: 10001
73
68
  });
74
-
75
- arc.animateShape(true)
76
- .when(1000, {
77
- endAngle: PI * 3 / 2
78
- })
79
- .start('circularInOut');
80
- arc.animateShape(true)
81
- .when(1000, {
82
- startAngle: PI * 3 / 2
83
- })
84
- .delay(300)
85
- .start('circularInOut');
86
-
87
- var group = new graphic.Group();
88
- group.add(arc);
89
69
  group.add(labelRect);
90
- group.add(mask);
70
+ if (opts.showSpinner) {
71
+ var arc = new graphic.Arc({
72
+ shape: {
73
+ startAngle: -PI / 2,
74
+ endAngle: -PI / 2 + 0.1,
75
+ r: opts.spinnerRadius
76
+ },
77
+ style: {
78
+ stroke: opts.color,
79
+ lineCap: 'round',
80
+ lineWidth: opts.lineWidth
81
+ },
82
+ zlevel: opts.zlevel,
83
+ z: 10001
84
+ });
85
+ arc.animateShape(true)
86
+ .when(1000, {
87
+ endAngle: PI * 3 / 2
88
+ })
89
+ .start('circularInOut');
90
+ arc.animateShape(true)
91
+ .when(1000, {
92
+ startAngle: PI * 3 / 2
93
+ })
94
+ .delay(300)
95
+ .start('circularInOut');
96
+ group.add(arc);
97
+ }
91
98
  // Inject resize
92
99
  group.resize = function () {
93
- var cx = api.getWidth() / 2;
100
+ var textWidth = textContain.getWidth(opts.text, font);
101
+ var r = opts.showSpinner ? opts.spinnerRadius : 0;
102
+ // cx = (containerWidth - arcDiameter - textDistance - textWidth) / 2
103
+ // textDistance needs to be calculated when both animation and text exist
104
+ var cx = (api.getWidth() - r * 2 - (opts.showSpinner && textWidth ? 10 : 0) - textWidth) / 2
105
+ // only show the text
106
+ - (opts.showSpinner ? 0 : textWidth / 2);
94
107
  var cy = api.getHeight() / 2;
95
- arc.setShape({
108
+ opts.showSpinner && arc.setShape({
96
109
  cx: cx,
97
110
  cy: cy
98
111
  });
99
- var r = arc.shape.r;
100
112
  labelRect.setShape({
101
113
  x: cx - r,
102
114
  y: cy - r,
@@ -62,11 +62,11 @@ var SeriesModel = ComponentModel.extend({
62
62
  defaultOption: null,
63
63
 
64
64
  /**
65
- * Data provided for legend
66
- * @type {Function}
65
+ * legend visual provider to the legend component
66
+ * @type {Object}
67
67
  */
68
68
  // PENDING
69
- legendDataProvider: null,
69
+ legendVisualProvider: null,
70
70
 
71
71
  /**
72
72
  * Access path of color for visual
@@ -584,7 +584,7 @@ function dataTaskReset(context) {
584
584
 
585
585
  function dataTaskProgress(param, context) {
586
586
  // Avoid repead cloneShallow when data just created in reset.
587
- if (param.end > context.outputData.count()) {
587
+ if (context.outputData && param.end > context.outputData.count()) {
588
588
  context.model.getRawData().cloneShallow(context.outputData);
589
589
  }
590
590
  }
@@ -30,7 +30,8 @@ import {__DEV__} from '../config';
30
30
  import {createHashMap, retrieve, each} from 'zrender/src/core/util';
31
31
 
32
32
  /**
33
- * @return {Object} For example:
33
+ * @class
34
+ * For example:
34
35
  * {
35
36
  * coordSysName: 'cartesian2d',
36
37
  * coordSysDims: ['x', 'y', ...],
@@ -42,19 +43,41 @@ import {createHashMap, retrieve, each} from 'zrender/src/core/util';
42
43
  * x: xAxisModel,
43
44
  * y: undefined
44
45
  * }),
45
- * // It also indicate that whether there is category axis.
46
+ * // The index of the first category axis in `coordSysDims`.
47
+ * // `null/undefined` means no category axis exists.
46
48
  * firstCategoryDimIndex: 1,
47
49
  * // To replace user specified encode.
48
50
  * }
49
51
  */
50
- export function getCoordSysDefineBySeries(seriesModel) {
52
+ function CoordSysInfo(coordSysName) {
53
+ /**
54
+ * @type {string}
55
+ */
56
+ this.coordSysName = coordSysName;
57
+ /**
58
+ * @type {Array.<string>}
59
+ */
60
+ this.coordSysDims = [];
61
+ /**
62
+ * @type {module:zrender/core/util#HashMap}
63
+ */
64
+ this.axisMap = createHashMap();
65
+ /**
66
+ * @type {module:zrender/core/util#HashMap}
67
+ */
68
+ this.categoryAxisMap = createHashMap();
69
+ /**
70
+ * @type {number}
71
+ */
72
+ this.firstCategoryDimIndex = null;
73
+ }
74
+
75
+ /**
76
+ * @return {module:model/referHelper#CoordSysInfo}
77
+ */
78
+ export function getCoordSysInfoBySeries(seriesModel) {
51
79
  var coordSysName = seriesModel.get('coordinateSystem');
52
- var result = {
53
- coordSysName: coordSysName,
54
- coordSysDims: [],
55
- axisMap: createHashMap(),
56
- categoryAxisMap: createHashMap()
57
- };
80
+ var result = new CoordSysInfo(coordSysName);
58
81
  var fetch = fetchers[coordSysName];
59
82
  if (fetch) {
60
83
  fetch(seriesModel, result, result.axisMap, result.categoryAxisMap);
@@ -95,7 +118,7 @@ var fetchers = {
95
118
  }
96
119
  if (isCategory(yAxisModel)) {
97
120
  categoryAxisMap.set('y', yAxisModel);
98
- result.firstCategoryDimIndex = 1;
121
+ result.firstCategoryDimIndex == null & (result.firstCategoryDimIndex = 1);
99
122
  }
100
123
  },
101
124
 
@@ -141,7 +164,7 @@ var fetchers = {
141
164
  }
142
165
  if (isCategory(angleAxisModel)) {
143
166
  categoryAxisMap.set('angle', angleAxisModel);
144
- result.firstCategoryDimIndex = 1;
167
+ result.firstCategoryDimIndex == null && (result.firstCategoryDimIndex = 1);
145
168
  }
146
169
  },
147
170
 
@@ -81,12 +81,92 @@ var IntervalScale = Scale.extend({
81
81
  },
82
82
 
83
83
  /**
84
+ * @param {boolean} [expandToNicedExtent=false] If expand the ticks to niced extent.
84
85
  * @return {Array.<number>}
85
86
  */
86
- getTicks: function () {
87
- return helper.intervalScaleGetTicks(
88
- this._interval, this._extent, this._niceExtent, this._intervalPrecision
89
- );
87
+ getTicks: function (expandToNicedExtent) {
88
+ var interval = this._interval;
89
+ var extent = this._extent;
90
+ var niceTickExtent = this._niceExtent;
91
+ var intervalPrecision = this._intervalPrecision;
92
+
93
+ var ticks = [];
94
+ // If interval is 0, return [];
95
+ if (!interval) {
96
+ return ticks;
97
+ }
98
+
99
+ // Consider this case: using dataZoom toolbox, zoom and zoom.
100
+ var safeLimit = 10000;
101
+
102
+ if (extent[0] < niceTickExtent[0]) {
103
+ if (expandToNicedExtent) {
104
+ ticks.push(roundNumber(niceTickExtent[0] - interval, intervalPrecision));
105
+ }
106
+ else {
107
+ ticks.push(extent[0]);
108
+ }
109
+ }
110
+ var tick = niceTickExtent[0];
111
+
112
+ while (tick <= niceTickExtent[1]) {
113
+ ticks.push(tick);
114
+ // Avoid rounding error
115
+ tick = roundNumber(tick + interval, intervalPrecision);
116
+ if (tick === ticks[ticks.length - 1]) {
117
+ // Consider out of safe float point, e.g.,
118
+ // -3711126.9907707 + 2e-10 === -3711126.9907707
119
+ break;
120
+ }
121
+ if (ticks.length > safeLimit) {
122
+ return [];
123
+ }
124
+ }
125
+ // Consider this case: the last item of ticks is smaller
126
+ // than niceTickExtent[1] and niceTickExtent[1] === extent[1].
127
+ var lastNiceTick = ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1];
128
+ if (extent[1] > lastNiceTick) {
129
+ if (expandToNicedExtent) {
130
+ ticks.push(roundNumber(lastNiceTick + interval, intervalPrecision));
131
+ }
132
+ else {
133
+ ticks.push(extent[1]);
134
+ }
135
+ }
136
+
137
+ return ticks;
138
+ },
139
+
140
+ /**
141
+ * @param {number} [splitNumber=5]
142
+ * @return {Array.<Array.<number>>}
143
+ */
144
+ getMinorTicks: function (splitNumber) {
145
+ var ticks = this.getTicks(true);
146
+ var minorTicks = [];
147
+ var extent = this.getExtent();
148
+
149
+ for (var i = 1; i < ticks.length; i++) {
150
+ var nextTick = ticks[i];
151
+ var prevTick = ticks[i - 1];
152
+ var count = 0;
153
+ var minorTicksGroup = [];
154
+ var interval = nextTick - prevTick;
155
+ var minorInterval = interval / splitNumber;
156
+
157
+ while (count < splitNumber - 1) {
158
+ var minorTick = numberUtil.round(prevTick + (count + 1) * minorInterval);
159
+
160
+ // For the first and last interval. The count may be less than splitNumber.
161
+ if (minorTick > extent[0] && minorTick < extent[1]) {
162
+ minorTicksGroup.push(minorTick);
163
+ }
164
+ count++;
165
+ }
166
+ minorTicks.push(minorTicksGroup);
167
+ }
168
+
169
+ return minorTicks;
90
170
  },
91
171
 
92
172
  /**
package/src/scale/Log.js CHANGED
@@ -53,14 +53,15 @@ var LogScale = Scale.extend({
53
53
  },
54
54
 
55
55
  /**
56
+ * @param {boolean} [expandToNicedExtent=false] If expand the ticks to niced extent.
56
57
  * @return {Array.<number>}
57
58
  */
58
- getTicks: function () {
59
+ getTicks: function (expandToNicedExtent) {
59
60
  var originalScale = this._originalScale;
60
61
  var extent = this._extent;
61
62
  var originalExtent = originalScale.getExtent();
62
63
 
63
- return zrUtil.map(intervalScaleProto.getTicks.call(this), function (val) {
64
+ return zrUtil.map(intervalScaleProto.getTicks.call(this, expandToNicedExtent), function (val) {
64
65
  var powVal = numberUtil.round(mathPow(this.base, val));
65
66
 
66
67
  // Fix #4158
@@ -75,6 +76,12 @@ var LogScale = Scale.extend({
75
76
  }, this);
76
77
  },
77
78
 
79
+ /**
80
+ * @param {number} splitNumber
81
+ * @return {Array.<Array.<number>>}
82
+ */
83
+ getMinorTicks: intervalScaleProto.getMinorTicks,
84
+
78
85
  /**
79
86
  * @param {number} val
80
87
  * @return {string}
@@ -79,42 +79,4 @@ export function fixExtent(niceTickExtent, extent) {
79
79
  if (niceTickExtent[0] > niceTickExtent[1]) {
80
80
  niceTickExtent[0] = niceTickExtent[1];
81
81
  }
82
- }
83
-
84
- export function intervalScaleGetTicks(interval, extent, niceTickExtent, intervalPrecision) {
85
- var ticks = [];
86
-
87
- // If interval is 0, return [];
88
- if (!interval) {
89
- return ticks;
90
- }
91
-
92
- // Consider this case: using dataZoom toolbox, zoom and zoom.
93
- var safeLimit = 10000;
94
-
95
- if (extent[0] < niceTickExtent[0]) {
96
- ticks.push(extent[0]);
97
- }
98
- var tick = niceTickExtent[0];
99
-
100
- while (tick <= niceTickExtent[1]) {
101
- ticks.push(tick);
102
- // Avoid rounding error
103
- tick = roundNumber(tick + interval, intervalPrecision);
104
- if (tick === ticks[ticks.length - 1]) {
105
- // Consider out of safe float point, e.g.,
106
- // -3711126.9907707 + 2e-10 === -3711126.9907707
107
- break;
108
- }
109
- if (ticks.length > safeLimit) {
110
- return [];
111
- }
112
- }
113
- // Consider this case: the last item of ticks is smaller
114
- // than niceTickExtent[1] and niceTickExtent[1] === extent[1].
115
- if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1])) {
116
- ticks.push(extent[1]);
117
- }
118
-
119
- return ticks;
120
- }
82
+ }
@@ -260,6 +260,14 @@ function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
260
260
  task.dirty();
261
261
  }
262
262
  var performArgs = scheduler.getPerformArgs(task, opt.block);
263
+ // FIXME
264
+ // if intending to decalare `performRawSeries` in handlers, only
265
+ // stream-independent (specifically, data item independent) operations can be
266
+ // performed. Because is a series is filtered, most of the tasks will not
267
+ // be performed. A stream-dependent operation probably cause wrong biz logic.
268
+ // Perhaps we should not provide a separate callback for this case instead
269
+ // of providing the config `performRawSeries`. The stream-dependent operaions
270
+ // and stream-independent operations should better not be mixed.
263
271
  performArgs.skip = !stageHandler.performRawSeries
264
272
  && ecModel.isSeriesFiltered(task.context.model);
265
273
  updatePayload(task, payload);
package/src/theme/dark.js CHANGED
@@ -63,6 +63,9 @@ var theme = {
63
63
  },
64
64
  crossStyle: {
65
65
  color: contrastColor
66
+ },
67
+ label: {
68
+ color: '#000'
66
69
  }
67
70
  }
68
71
  },
@@ -23,7 +23,7 @@ import * as numberUtil from './number';
23
23
  // import Text from 'zrender/src/graphic/Text';
24
24
 
25
25
  /**
26
- * 每三位默认加,格式化
26
+ * add commas after every three numbers
27
27
  * @param {string|number} x
28
28
  * @return {string}
29
29
  */
@@ -275,3 +275,19 @@ export function getTextRect(
275
275
  text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate
276
276
  );
277
277
  }
278
+
279
+ /**
280
+ * open new tab
281
+ * @param {string} link url
282
+ * @param {string} target blank or self
283
+ */
284
+ export function windowOpen(link, target) {
285
+ if (target === '_blank' || target === 'blank') {
286
+ var blank = window.open();
287
+ blank.opener = null;
288
+ blank.location = link;
289
+ }
290
+ else {
291
+ window.open(link, target);
292
+ }
293
+ }
@@ -652,11 +652,13 @@ export function getHighlightDigit(highlightKey) {
652
652
  * @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
653
653
  * @param {string|Function} [opt.defaultText]
654
654
  * @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
655
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
656
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
657
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
658
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
659
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
655
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
656
+ * @param {number} [opt.labelDataIndex] Fetch text by
657
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
658
+ * @param {number} [opt.labelDimIndex] Fetch text by
659
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
660
+ * @param {string} [opt.labelProp] Fetch text by
661
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
660
662
  * @param {Object} [normalSpecified]
661
663
  * @param {Object} [emphasisSpecified]
662
664
  */
@@ -670,6 +672,7 @@ export function setLabelStyle(
670
672
  var labelFetcher = opt.labelFetcher;
671
673
  var labelDataIndex = opt.labelDataIndex;
672
674
  var labelDimIndex = opt.labelDimIndex;
675
+ var labelProp = opt.labelProp;
673
676
 
674
677
  // This scenario, `label.normal.show = true; label.emphasis.show = false`,
675
678
  // is not supported util someone requests.
@@ -683,7 +686,7 @@ export function setLabelStyle(
683
686
  var baseText;
684
687
  if (showNormal || showEmphasis) {
685
688
  if (labelFetcher) {
686
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
689
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
687
690
  }
688
691
  if (baseText == null) {
689
692
  baseText = zrUtil.isFunction(opt.defaultText) ? opt.defaultText(labelDataIndex, opt) : opt.defaultText;
@@ -693,7 +696,7 @@ export function setLabelStyle(
693
696
  var emphasisStyleText = showEmphasis
694
697
  ? zrUtil.retrieve2(
695
698
  labelFetcher
696
- ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex)
699
+ ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp)
697
700
  : null,
698
701
  baseText
699
702
  )
@@ -1071,8 +1074,7 @@ function rollbackDefaultTextStyle(style) {
1071
1074
  }
1072
1075
 
1073
1076
  export function getFont(opt, ecModel) {
1074
- // ecModel or default text style model.
1075
- var gTextStyleModel = ecModel || ecModel.getModel('textStyle');
1077
+ var gTextStyleModel = ecModel && ecModel.getModel('textStyle');
1076
1078
  return zrUtil.trim([
1077
1079
  // FIXME in node-canvas fontWeight is before fontStyle
1078
1080
  opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '',
@@ -1125,7 +1127,7 @@ function animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, cb)
1125
1127
  * configuration in series.
1126
1128
  *
1127
1129
  * Caution: this method will stop previous animation.
1128
- * So if do not use this method to one element twice before
1130
+ * So do not use this method to one element twice before
1129
1131
  * animation starts, unless you know what you are doing.
1130
1132
  *
1131
1133
  * @param {module:zrender/Element} el
@@ -1151,7 +1153,7 @@ export function updateProps(el, props, animatableModel, dataIndex, cb) {
1151
1153
  * configuration in series.
1152
1154
  *
1153
1155
  * Caution: this method will stop previous animation.
1154
- * So if do not use this method to one element twice before
1156
+ * So do not use this method to one element twice before
1155
1157
  * animation starts, unless you know what you are doing.
1156
1158
  *
1157
1159
  * @param {module:zrender/Element} el