echarts 3.5.4 → 3.6.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 (190) hide show
  1. package/LICENSE +21 -18
  2. package/dist/echarts.common.js +10072 -9330
  3. package/dist/echarts.common.min.js +13 -13
  4. package/dist/echarts.js +13084 -11412
  5. package/dist/echarts.min.js +22 -21
  6. package/dist/echarts.simple.js +9454 -8889
  7. package/dist/echarts.simple.min.js +9 -10
  8. package/index.js +1 -0
  9. package/lib/chart/bar/BarView.js +141 -49
  10. package/lib/chart/bar/BaseBarSeries.js +2 -6
  11. package/lib/chart/bar.js +1 -0
  12. package/lib/chart/boxplot/BoxplotSeries.js +1 -1
  13. package/lib/chart/boxplot/boxplotLayout.js +23 -7
  14. package/lib/chart/candlestick/CandlestickSeries.js +1 -21
  15. package/lib/chart/candlestick/candlestickLayout.js +23 -7
  16. package/lib/chart/custom.js +442 -0
  17. package/lib/chart/graph/categoryVisual.js +3 -2
  18. package/lib/chart/heatmap/HeatmapView.js +75 -73
  19. package/lib/chart/helper/Symbol.js +8 -31
  20. package/lib/chart/helper/createListFromArray.js +15 -10
  21. package/lib/chart/helper/labelHelper.js +48 -0
  22. package/lib/chart/helper/whiskerBoxCommon.js +25 -44
  23. package/lib/chart/map/mapDataStatistic.js +9 -8
  24. package/lib/chart/pie/pieLayout.js +25 -17
  25. package/lib/chart/radar/RadarSeries.js +1 -1
  26. package/lib/chart/scatter/ScatterSeries.js +2 -3
  27. package/lib/chart/themeRiver/ThemeRiverSeries.js +6 -5
  28. package/lib/chart/themeRiver/themeRiverVisual.js +1 -1
  29. package/lib/chart/treemap/TreemapSeries.js +3 -3
  30. package/lib/component/axisPointer/BaseAxisPointer.js +7 -6
  31. package/lib/component/axisPointer/axisTrigger.js +62 -51
  32. package/lib/component/axisPointer.js +1 -2
  33. package/lib/component/calendar/CalendarView.js +5 -5
  34. package/lib/component/dataZoom/AxisProxy.js +76 -13
  35. package/lib/component/dataZoom/DataZoomModel.js +21 -5
  36. package/lib/component/dataZoom/InsideZoomModel.js +4 -1
  37. package/lib/component/dataZoom/InsideZoomView.js +16 -26
  38. package/lib/component/dataZoom/SliderZoomView.js +63 -26
  39. package/lib/component/dataZoom/roams.js +8 -3
  40. package/lib/component/graphic.js +13 -12
  41. package/lib/component/helper/BrushTargetManager.js +5 -5
  42. package/lib/component/helper/MapDraw.js +3 -3
  43. package/lib/component/helper/RoamController.js +43 -20
  44. package/lib/component/helper/brushHelper.js +2 -13
  45. package/lib/component/helper/selectableMixin.js +7 -7
  46. package/lib/component/helper/sliderMove.js +65 -36
  47. package/lib/component/legend/LegendView.js +6 -6
  48. package/lib/component/legend/legendAction.js +1 -1
  49. package/lib/component/marker/MarkAreaView.js +3 -6
  50. package/lib/component/marker/MarkLineView.js +3 -5
  51. package/lib/component/marker/MarkPointView.js +3 -5
  52. package/lib/component/marker/MarkerView.js +10 -12
  53. package/lib/component/polar.js +5 -0
  54. package/lib/component/timeline/SliderTimelineView.js +1 -1
  55. package/lib/component/toolbox/feature/DataZoom.js +14 -1
  56. package/lib/component/tooltip/TooltipView.js +3 -3
  57. package/lib/component/visualMap/ContinuousView.js +6 -4
  58. package/lib/coord/Axis.js +34 -2
  59. package/lib/coord/axisDefault.js +2 -1
  60. package/lib/coord/axisHelper.js +6 -25
  61. package/lib/coord/axisModelCommonMixin.js +1 -1
  62. package/lib/coord/calendar/Calendar.js +14 -17
  63. package/lib/coord/calendar/prepareCustom.js +31 -0
  64. package/lib/coord/cartesian/Axis2D.js +0 -12
  65. package/lib/coord/cartesian/Cartesian2D.js +1 -0
  66. package/lib/coord/cartesian/Grid.js +5 -2
  67. package/lib/coord/cartesian/prepareCustom.js +36 -0
  68. package/lib/coord/geo/Geo.js +9 -14
  69. package/lib/coord/geo/GeoModel.js +5 -5
  70. package/lib/coord/geo/geoCreator.js +3 -3
  71. package/lib/coord/geo/prepareCustom.js +36 -0
  72. package/lib/coord/parallel/Parallel.js +12 -11
  73. package/lib/coord/polar/Polar.js +2 -1
  74. package/lib/coord/polar/prepareCustom.js +53 -0
  75. package/lib/coord/single/Single.js +9 -8
  76. package/lib/coord/single/SingleAxis.js +0 -27
  77. package/lib/coord/single/prepareCustom.js +33 -0
  78. package/lib/data/DataDiffer.js +2 -1
  79. package/lib/data/Graph.js +11 -7
  80. package/lib/data/List.js +58 -19
  81. package/lib/data/helper/completeDimensions.js +184 -23
  82. package/lib/echarts.js +38 -33
  83. package/lib/helper.js +1 -8
  84. package/lib/layout/barGrid.js +87 -18
  85. package/lib/layout/barPolar.js +286 -0
  86. package/lib/layout/points.js +22 -16
  87. package/lib/model/Global.js +34 -31
  88. package/lib/model/Series.js +41 -29
  89. package/lib/model/mixin/colorPalette.js +2 -1
  90. package/lib/model/mixin/textStyle.js +7 -13
  91. package/lib/scale/Interval.js +21 -14
  92. package/lib/scale/Log.js +5 -7
  93. package/lib/scale/Time.js +13 -7
  94. package/lib/scale/helper.js +5 -1
  95. package/lib/util/format.js +12 -0
  96. package/lib/util/graphic.js +53 -1
  97. package/lib/util/model.js +63 -7
  98. package/map/js/world.js +1 -1
  99. package/map/json/world.json +1 -1
  100. package/package.json +3 -3
  101. package/src/chart/bar/BarView.js +141 -49
  102. package/src/chart/bar/BaseBarSeries.js +2 -6
  103. package/src/chart/bar.js +1 -0
  104. package/src/chart/boxplot/BoxplotSeries.js +1 -1
  105. package/src/chart/boxplot/boxplotLayout.js +23 -7
  106. package/src/chart/candlestick/CandlestickSeries.js +1 -21
  107. package/src/chart/candlestick/candlestickLayout.js +23 -7
  108. package/src/chart/custom.js +442 -0
  109. package/src/chart/graph/categoryVisual.js +3 -2
  110. package/src/chart/heatmap/HeatmapView.js +75 -73
  111. package/src/chart/helper/Symbol.js +8 -31
  112. package/src/chart/helper/createListFromArray.js +15 -10
  113. package/src/chart/helper/labelHelper.js +49 -0
  114. package/src/chart/helper/whiskerBoxCommon.js +25 -44
  115. package/src/chart/map/mapDataStatistic.js +9 -8
  116. package/src/chart/pie/pieLayout.js +25 -17
  117. package/src/chart/radar/RadarSeries.js +1 -1
  118. package/src/chart/scatter/ScatterSeries.js +2 -3
  119. package/src/chart/themeRiver/ThemeRiverSeries.js +6 -5
  120. package/src/chart/themeRiver/themeRiverVisual.js +1 -1
  121. package/src/chart/treemap/TreemapSeries.js +3 -3
  122. package/src/component/axisPointer/BaseAxisPointer.js +7 -6
  123. package/src/component/axisPointer/axisTrigger.js +62 -51
  124. package/src/component/axisPointer.js +1 -2
  125. package/src/component/calendar/CalendarView.js +5 -5
  126. package/src/component/dataZoom/AxisProxy.js +76 -13
  127. package/src/component/dataZoom/DataZoomModel.js +21 -5
  128. package/src/component/dataZoom/InsideZoomModel.js +4 -1
  129. package/src/component/dataZoom/InsideZoomView.js +16 -26
  130. package/src/component/dataZoom/SliderZoomView.js +63 -26
  131. package/src/component/dataZoom/roams.js +8 -3
  132. package/src/component/graphic.js +13 -12
  133. package/src/component/helper/BrushTargetManager.js +5 -5
  134. package/src/component/helper/MapDraw.js +3 -3
  135. package/src/component/helper/RoamController.js +43 -20
  136. package/src/component/helper/brushHelper.js +2 -13
  137. package/src/component/helper/selectableMixin.js +7 -7
  138. package/src/component/helper/sliderMove.js +65 -36
  139. package/src/component/legend/LegendView.js +6 -6
  140. package/src/component/legend/legendAction.js +1 -1
  141. package/src/component/marker/MarkAreaView.js +3 -6
  142. package/src/component/marker/MarkLineView.js +3 -5
  143. package/src/component/marker/MarkPointView.js +3 -5
  144. package/src/component/marker/MarkerView.js +10 -12
  145. package/src/component/polar.js +5 -0
  146. package/src/component/timeline/SliderTimelineView.js +1 -1
  147. package/src/component/toolbox/feature/DataZoom.js +14 -1
  148. package/src/component/tooltip/TooltipView.js +3 -3
  149. package/src/component/visualMap/ContinuousView.js +6 -4
  150. package/src/coord/Axis.js +34 -2
  151. package/src/coord/axisDefault.js +2 -1
  152. package/src/coord/axisHelper.js +6 -25
  153. package/src/coord/axisModelCommonMixin.js +1 -1
  154. package/src/coord/calendar/Calendar.js +14 -17
  155. package/src/coord/calendar/prepareCustom.js +32 -0
  156. package/src/coord/cartesian/Axis2D.js +0 -12
  157. package/src/coord/cartesian/Cartesian2D.js +1 -0
  158. package/src/coord/cartesian/Grid.js +5 -2
  159. package/src/coord/cartesian/prepareCustom.js +37 -0
  160. package/src/coord/geo/Geo.js +9 -14
  161. package/src/coord/geo/GeoModel.js +5 -5
  162. package/src/coord/geo/geoCreator.js +3 -3
  163. package/src/coord/geo/prepareCustom.js +37 -0
  164. package/src/coord/parallel/Parallel.js +12 -11
  165. package/src/coord/polar/Polar.js +2 -1
  166. package/src/coord/polar/prepareCustom.js +54 -0
  167. package/src/coord/single/Single.js +9 -8
  168. package/src/coord/single/SingleAxis.js +0 -27
  169. package/src/coord/single/prepareCustom.js +34 -0
  170. package/src/data/DataDiffer.js +2 -1
  171. package/src/data/Graph.js +11 -7
  172. package/src/data/List.js +58 -19
  173. package/src/data/helper/completeDimensions.js +184 -23
  174. package/src/echarts.js +38 -33
  175. package/src/helper.js +1 -8
  176. package/src/layout/barGrid.js +87 -18
  177. package/src/layout/barPolar.js +287 -0
  178. package/src/layout/points.js +22 -16
  179. package/src/model/Global.js +34 -31
  180. package/src/model/Series.js +41 -29
  181. package/src/model/mixin/colorPalette.js +2 -1
  182. package/src/model/mixin/textStyle.js +7 -13
  183. package/src/scale/Interval.js +21 -14
  184. package/src/scale/Log.js +5 -7
  185. package/src/scale/Time.js +13 -7
  186. package/src/scale/helper.js +5 -1
  187. package/src/util/format.js +12 -0
  188. package/src/util/graphic.js +53 -1
  189. package/src/util/model.js +63 -7
  190. package/src/coord/cartesian/axisLabelInterval.js +0 -26
@@ -4,7 +4,6 @@
4
4
  var zrUtil = require('zrender/lib/core/util');
5
5
 
6
6
  var pathTool = require('zrender/lib/tool/path');
7
- var round = Math.round;
8
7
  var Path = require('zrender/lib/graphic/Path');
9
8
  var colorTool = require('zrender/lib/tool/color');
10
9
  var matrix = require('zrender/lib/core/matrix');
@@ -12,6 +11,10 @@
12
11
  var Transformable = require('zrender/lib/mixin/Transformable');
13
12
  var BoundingRect = require('zrender/lib/core/BoundingRect');
14
13
 
14
+ var round = Math.round;
15
+ var mathMax = Math.max;
16
+ var mathMin = Math.min;
17
+
15
18
  var graphic = {};
16
19
 
17
20
  graphic.Group = require('zrender/lib/container/Group');
@@ -406,6 +409,17 @@
406
409
  });
407
410
  };
408
411
 
412
+ graphic.getFont = function (opt, ecModel) {
413
+ var gTextStyleModel = ecModel && ecModel.getModel('textStyle');
414
+ return [
415
+ // FIXME in node-canvas fontWeight is before fontStyle
416
+ opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '',
417
+ opt.fontWeight || gTextStyleModel && gTextStyleModel.getShallow('fontWeight') || '',
418
+ (opt.fontSize || gTextStyleModel && gTextStyleModel.getShallow('fontSize') || 12) + 'px',
419
+ opt.fontFamily || gTextStyleModel && gTextStyleModel.getShallow('fontFamily') || 'sans-serif'
420
+ ].join(' ');
421
+ };
422
+
409
423
  function animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, cb) {
410
424
  if (typeof dataIndex === 'function') {
411
425
  cb = dataIndex;
@@ -587,5 +601,43 @@
587
601
  });
588
602
  };
589
603
 
604
+ /**
605
+ * @param {Array.<Array.<number>>} points Like: [[23, 44], [53, 66], ...]
606
+ * @param {Object} rect {x, y, width, height}
607
+ * @return {Array.<Array.<number>>} A new clipped points.
608
+ */
609
+ graphic.clipPointsByRect = function (points, rect) {
610
+ return zrUtil.map(points, function (point) {
611
+ var x = point[0];
612
+ x = mathMax(x, rect.x);
613
+ x = mathMin(x, rect.x + rect.width);
614
+ var y = point[1];
615
+ y = mathMax(y, rect.y);
616
+ y = mathMin(y, rect.y + rect.height);
617
+ return [x, y];
618
+ });
619
+ };
620
+
621
+ /**
622
+ * @param {Object} targetRect {x, y, width, height}
623
+ * @param {Object} rect {x, y, width, height}
624
+ * @return {Object} A new clipped rect. If rect size are negative, return undefined.
625
+ */
626
+ graphic.clipRectByRect = function (targetRect, rect) {
627
+ var x = mathMax(targetRect.x, rect.x);
628
+ var x2 = mathMin(targetRect.x + targetRect.width, rect.x + rect.width);
629
+ var y = mathMax(targetRect.y, rect.y);
630
+ var y2 = mathMin(targetRect.y + targetRect.height, rect.y + rect.height);
631
+
632
+ if (x2 >= x && y2 >= y) {
633
+ return {
634
+ x: x,
635
+ y: y,
636
+ width: x2 - x,
637
+ height: y2 - y
638
+ };
639
+ }
640
+ };
641
+
590
642
  module.exports = graphic;
591
643
 
package/lib/util/model.js CHANGED
@@ -145,6 +145,7 @@
145
145
  var rawDataIndex = data.getRawIndex(dataIndex);
146
146
  var name = data.getName(dataIndex, true);
147
147
  var itemOpt = data.getRawDataItem(dataIndex);
148
+ var color = data.getItemVisual(dataIndex, 'color');
148
149
 
149
150
  return {
150
151
  componentType: this.mainType,
@@ -158,7 +159,8 @@
158
159
  data: itemOpt,
159
160
  dataType: dataType,
160
161
  value: rawValue,
161
- color: data.getItemVisual(dataIndex, 'color'),
162
+ color: color,
163
+ marker: formatUtil.getTooltipMarker(color),
162
164
 
163
165
  // Param name list for mapping `a`, `b`, `c`, `d`, `e`
164
166
  $vars: ['seriesName', 'name', 'value']
@@ -333,22 +335,22 @@
333
335
  // to specify multi components (like series) by one name.
334
336
 
335
337
  // Ensure that each id is distinct.
336
- var idMap = {};
338
+ var idMap = zrUtil.createHashMap();
337
339
 
338
340
  each(mapResult, function (item, index) {
339
341
  var existCpt = item.exist;
340
- existCpt && (idMap[existCpt.id] = item);
342
+ existCpt && idMap.set(existCpt.id, item);
341
343
  });
342
344
 
343
345
  each(mapResult, function (item, index) {
344
346
  var opt = item.option;
345
347
 
346
348
  zrUtil.assert(
347
- !opt || opt.id == null || !idMap[opt.id] || idMap[opt.id] === item,
349
+ !opt || opt.id == null || !idMap.get(opt.id) || idMap.get(opt.id) === item,
348
350
  'id duplicates: ' + (opt && opt.id)
349
351
  );
350
352
 
351
- opt && opt.id != null && (idMap[opt.id] = item);
353
+ opt && opt.id != null && idMap.set(opt.id, item);
352
354
  !item.keyInfo && (item.keyInfo = {});
353
355
  });
354
356
 
@@ -388,10 +390,10 @@
388
390
  do {
389
391
  keyInfo.id = '\0' + keyInfo.name + '\0' + idNum++;
390
392
  }
391
- while (idMap[keyInfo.id]);
393
+ while (idMap.get(keyInfo.id));
392
394
  }
393
395
 
394
- idMap[keyInfo.id] = item;
396
+ idMap.set(keyInfo.id, item);
395
397
  });
396
398
  };
397
399
 
@@ -597,6 +599,60 @@
597
599
  return result;
598
600
  };
599
601
 
602
+ /**
603
+ * @see {module:echarts/data/helper/completeDimensions}
604
+ * @param {module:echarts/data/List} data
605
+ * @param {string|number} dataDim
606
+ * @return {string}
607
+ */
608
+ modelUtil.dataDimToCoordDim = function (data, dataDim) {
609
+ var dimensions = data.dimensions;
610
+ dataDim = data.getDimension(dataDim);
611
+ for (var i = 0; i < dimensions.length; i++) {
612
+ var dimItem = data.getDimensionInfo(dimensions[i]);
613
+ if (dimItem.name === dataDim) {
614
+ return dimItem.coordDim;
615
+ }
616
+ }
617
+ };
618
+
619
+ /**
620
+ * @see {module:echarts/data/helper/completeDimensions}
621
+ * @param {module:echarts/data/List} data
622
+ * @param {string} coordDim
623
+ * @return {Array.<string>} data dimensions on the coordDim.
624
+ */
625
+ modelUtil.coordDimToDataDim = function (data, coordDim) {
626
+ var dataDim = [];
627
+ each(data.dimensions, function (dimName) {
628
+ var dimItem = data.getDimensionInfo(dimName);
629
+ if (dimItem.coordDim === coordDim) {
630
+ dataDim[dimItem.coordDimIndex] = dimItem.name;
631
+ }
632
+ });
633
+ return dataDim;
634
+ };
635
+
636
+ /**
637
+ * @see {module:echarts/data/helper/completeDimensions}
638
+ * @param {module:echarts/data/List} data
639
+ * @param {string} otherDim Can be `otherDims`
640
+ * like 'label' or 'tooltip'.
641
+ * @return {Array.<string>} data dimensions on the otherDim.
642
+ */
643
+ modelUtil.otherDimToDataDim = function (data, otherDim) {
644
+ var dataDim = [];
645
+ each(data.dimensions, function (dimName) {
646
+ var dimItem = data.getDimensionInfo(dimName);
647
+ var otherDims = dimItem.otherDims;
648
+ var dimIndex = otherDims[otherDim];
649
+ if (dimIndex != null && dimIndex !== false) {
650
+ dataDim[dimIndex] = dimItem.name;
651
+ }
652
+ });
653
+ return dataDim;
654
+ };
655
+
600
656
  function has(obj, prop) {
601
657
  return obj && obj.hasOwnProperty(prop);
602
658
  }