echarts 3.6.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 (321) hide show
  1. package/README.md +1 -0
  2. package/dist/echarts-en.js +77756 -0
  3. package/dist/echarts-en.min.js +38 -0
  4. package/dist/echarts.common-en.js +50169 -0
  5. package/dist/echarts.common-en.min.js +30 -0
  6. package/dist/echarts.common.js +5799 -3093
  7. package/dist/echarts.common.min.js +14 -13
  8. package/dist/echarts.js +7628 -4679
  9. package/dist/echarts.min.js +22 -22
  10. package/dist/echarts.simple-en.js +34988 -0
  11. package/dist/echarts.simple-en.min.js +27 -0
  12. package/dist/echarts.simple.js +4472 -2493
  13. package/dist/echarts.simple.min.js +11 -9
  14. package/dist/extension/bmap.js +50 -11
  15. package/dist/extension/bmap.min.js +1 -1
  16. package/dist/extension/dataTool.js +10 -10
  17. package/extension/bmap/BMapCoordSys.js +40 -1
  18. package/index.blank.js +4 -0
  19. package/index.common.js +1 -1
  20. package/index.js +1 -1
  21. package/lib/action/createDataSelectAction.js +6 -2
  22. package/lib/chart/bar/BarView.js +6 -3
  23. package/lib/chart/bar/BaseBarSeries.js +4 -3
  24. package/lib/chart/bar/PictorialBarSeries.js +1 -1
  25. package/lib/chart/bar/PictorialBarView.js +29 -7
  26. package/lib/chart/bar/helper.js +14 -31
  27. package/lib/chart/candlestick/candlestickLayout.js +49 -6
  28. package/lib/chart/chord/chordCircularLayout.js +2 -2
  29. package/lib/chart/custom.js +135 -21
  30. package/lib/chart/funnel/FunnelSeries.js +0 -1
  31. package/lib/chart/funnel/FunnelView.js +15 -22
  32. package/lib/chart/funnel/funnelLayout.js +1 -1
  33. package/lib/chart/gauge/GaugeSeries.js +7 -12
  34. package/lib/chart/gauge/GaugeView.js +32 -53
  35. package/lib/chart/graph/GraphSeries.js +2 -1
  36. package/lib/chart/graph/GraphView.js +39 -45
  37. package/lib/chart/graph/forceHelper.js +5 -0
  38. package/lib/chart/graph/forceLayout.js +1 -1
  39. package/lib/chart/heatmap/HeatmapLayer.js +7 -0
  40. package/lib/chart/heatmap/HeatmapView.js +10 -9
  41. package/lib/chart/helper/EffectSymbol.js +3 -3
  42. package/lib/chart/helper/LargeSymbolDraw.js +6 -1
  43. package/lib/chart/helper/Line.js +40 -22
  44. package/lib/chart/helper/Symbol.js +20 -7
  45. package/lib/chart/helper/SymbolDraw.js +2 -1
  46. package/lib/chart/helper/labelHelper.js +0 -17
  47. package/lib/chart/helper/whiskerBoxCommon.js +11 -3
  48. package/lib/chart/line/LineSeries.js +1 -0
  49. package/lib/chart/line/LineView.js +14 -2
  50. package/lib/chart/line/poly.js +5 -0
  51. package/lib/chart/lines/LinesView.js +22 -7
  52. package/lib/chart/map/MapSeries.js +3 -7
  53. package/lib/chart/map/MapView.js +29 -18
  54. package/lib/chart/pie/PieSeries.js +20 -6
  55. package/lib/chart/pie/PieView.js +20 -23
  56. package/lib/chart/pie/labelLayout.js +3 -3
  57. package/lib/chart/radar/RadarView.js +16 -20
  58. package/lib/chart/sankey/SankeySeries.js +2 -4
  59. package/lib/chart/sankey/SankeyView.js +13 -29
  60. package/lib/chart/sankey/sankeyLayout.js +1 -1
  61. package/lib/chart/scatter/ScatterSeries.js +2 -1
  62. package/lib/chart/themeRiver/ThemeRiverSeries.js +2 -4
  63. package/lib/chart/themeRiver/ThemeRiverView.js +2 -5
  64. package/lib/chart/themeRiver/themeRiverLayout.js +1 -1
  65. package/lib/chart/treemap/Breadcrumb.js +1 -1
  66. package/lib/chart/treemap/TreemapSeries.js +28 -8
  67. package/lib/chart/treemap/TreemapView.js +88 -77
  68. package/lib/chart/treemap/treemapLayout.js +29 -13
  69. package/lib/component/axis/AngleAxisView.js +13 -19
  70. package/lib/component/axis/AxisBuilder.js +260 -186
  71. package/lib/component/axis/CartesianAxisView.js +15 -3
  72. package/lib/component/axis/ParallelAxisView.js +1 -1
  73. package/lib/component/axis/RadiusAxisView.js +1 -1
  74. package/lib/component/axis/SingleAxisView.js +8 -2
  75. package/lib/component/axis/cartesianAxisHelper.js +11 -15
  76. package/lib/component/axisPointer/AxisPointerModel.js +1 -3
  77. package/lib/component/axisPointer/BaseAxisPointer.js +15 -38
  78. package/lib/component/axisPointer/axisTrigger.js +36 -20
  79. package/lib/component/axisPointer/modelHelper.js +3 -4
  80. package/lib/component/axisPointer/viewHelper.js +4 -6
  81. package/lib/component/axisPointer.js +1 -14
  82. package/lib/component/calendar/CalendarView.js +22 -39
  83. package/lib/component/dataZoom/AxisProxy.js +3 -2
  84. package/lib/component/dataZoom/DataZoomModel.js +16 -4
  85. package/lib/component/dataZoom/InsideZoomView.js +5 -3
  86. package/lib/component/dataZoom/SliderZoomView.js +21 -32
  87. package/lib/component/dataZoom/roams.js +33 -9
  88. package/lib/component/dataZoom/typeDefaulter.js +1 -1
  89. package/lib/component/graphic.js +17 -5
  90. package/lib/component/helper/BrushTargetManager.js +1 -1
  91. package/lib/component/helper/MapDraw.js +26 -22
  92. package/lib/component/helper/RoamController.js +12 -11
  93. package/lib/component/helper/listComponent.js +27 -24
  94. package/lib/component/helper/selectableMixin.js +40 -15
  95. package/lib/component/legend/LegendModel.js +11 -3
  96. package/lib/component/legend/LegendView.js +151 -70
  97. package/lib/component/legend/ScrollableLegendModel.js +75 -0
  98. package/lib/component/legend/ScrollableLegendView.js +367 -0
  99. package/lib/component/legend/legendAction.js +1 -0
  100. package/lib/component/legend/scrollableLegendAction.js +24 -0
  101. package/lib/component/legend.js +8 -3
  102. package/lib/component/legendScroll.js +11 -0
  103. package/lib/component/marker/MarkAreaView.js +12 -26
  104. package/lib/component/marker/MarkLineView.js +5 -5
  105. package/lib/component/marker/MarkPointView.js +4 -4
  106. package/lib/component/marker/MarkerModel.js +1 -4
  107. package/lib/component/marker/markerHelper.js +1 -0
  108. package/lib/component/radar/RadarView.js +6 -3
  109. package/lib/component/timeline/SliderTimelineModel.js +4 -6
  110. package/lib/component/timeline/SliderTimelineView.js +14 -16
  111. package/lib/component/timeline/TimelineAxis.js +1 -1
  112. package/lib/component/timeline/TimelineModel.js +1 -3
  113. package/lib/component/title.js +9 -10
  114. package/lib/component/toolbox/ToolboxModel.js +2 -0
  115. package/lib/component/toolbox/ToolboxView.js +15 -27
  116. package/lib/component/toolbox/feature/Brush.js +3 -8
  117. package/lib/component/toolbox/feature/DataView.js +5 -5
  118. package/lib/component/toolbox/feature/DataZoom.js +3 -4
  119. package/lib/component/toolbox/feature/MagicType.js +3 -6
  120. package/lib/component/toolbox/feature/Restore.js +2 -1
  121. package/lib/component/toolbox/feature/SaveAsImage.js +23 -9
  122. package/lib/component/tooltip/TooltipContent.js +4 -4
  123. package/lib/component/tooltip/TooltipView.js +29 -6
  124. package/lib/component/visualMap/ContinuousModel.js +2 -2
  125. package/lib/component/visualMap/ContinuousView.js +12 -8
  126. package/lib/component/visualMap/PiecewiseModel.js +1 -2
  127. package/lib/component/visualMap/PiecewiseView.js +2 -2
  128. package/lib/component/visualMap/VisualMapModel.js +18 -12
  129. package/lib/coord/Axis.js +1 -1
  130. package/lib/coord/axisDefault.js +3 -3
  131. package/lib/coord/axisHelper.js +18 -1
  132. package/lib/coord/axisModelCommonMixin.js +12 -2
  133. package/lib/coord/calendar/Calendar.js +65 -21
  134. package/lib/coord/calendar/CalendarModel.js +6 -12
  135. package/lib/coord/cartesian/Cartesian2D.js +0 -14
  136. package/lib/coord/cartesian/Grid.js +47 -28
  137. package/lib/coord/geo/Geo.js +2 -18
  138. package/lib/coord/geo/GeoModel.js +6 -13
  139. package/lib/coord/geo/fix/diaoyuIsland.js +30 -0
  140. package/lib/coord/geo/geoCreator.js +6 -1
  141. package/lib/coord/polar/Polar.js +0 -13
  142. package/lib/coord/radar/Radar.js +1 -1
  143. package/lib/coord/radar/RadarModel.js +6 -2
  144. package/lib/data/DataDiffer.js +14 -7
  145. package/lib/data/Graph.js +3 -0
  146. package/lib/data/List.js +1 -1
  147. package/lib/data/Tree.js +2 -2
  148. package/lib/data/helper/completeDimensions.js +2 -11
  149. package/lib/echarts.js +33 -10
  150. package/lib/lang/cn.js +4 -0
  151. package/lib/lang/default.js +42 -0
  152. package/lib/lang/en.js +42 -0
  153. package/lib/lang.js +42 -0
  154. package/lib/langEN.js +42 -0
  155. package/lib/layout/barGrid.js +11 -3
  156. package/lib/layout/barPolar.js +9 -2
  157. package/lib/model/Model.js +2 -1
  158. package/lib/model/Series.js +14 -6
  159. package/lib/model/mixin/textStyle.js +11 -9
  160. package/lib/preprocessor/backwardCompat.js +5 -4
  161. package/lib/preprocessor/helper/compatStyle.js +157 -45
  162. package/lib/scale/Interval.js +10 -4
  163. package/lib/scale/Time.js +14 -6
  164. package/lib/scale/helper.js +15 -2
  165. package/lib/util/format.js +4 -24
  166. package/lib/util/graphic.js +412 -21
  167. package/lib/util/layout.js +28 -16
  168. package/lib/util/model.js +26 -11
  169. package/lib/util/number.js +106 -21
  170. package/lib/visual/VisualMapping.js +4 -4
  171. package/package.json +3 -3
  172. package/rollup.config.js +49 -0
  173. package/src/action/createDataSelectAction.js +6 -2
  174. package/src/chart/bar/BarView.js +6 -3
  175. package/src/chart/bar/BaseBarSeries.js +4 -3
  176. package/src/chart/bar/PictorialBarSeries.js +1 -1
  177. package/src/chart/bar/PictorialBarView.js +29 -7
  178. package/src/chart/bar/helper.js +13 -30
  179. package/src/chart/candlestick/candlestickLayout.js +49 -6
  180. package/src/chart/chord/chordCircularLayout.js +2 -2
  181. package/src/chart/custom.js +135 -21
  182. package/src/chart/funnel/FunnelSeries.js +0 -1
  183. package/src/chart/funnel/FunnelView.js +15 -22
  184. package/src/chart/funnel/funnelLayout.js +1 -1
  185. package/src/chart/gauge/GaugeSeries.js +7 -12
  186. package/src/chart/gauge/GaugeView.js +32 -53
  187. package/src/chart/graph/GraphSeries.js +2 -1
  188. package/src/chart/graph/GraphView.js +39 -45
  189. package/src/chart/graph/forceHelper.js +5 -0
  190. package/src/chart/graph/forceLayout.js +1 -1
  191. package/src/chart/heatmap/HeatmapLayer.js +7 -0
  192. package/src/chart/heatmap/HeatmapView.js +10 -9
  193. package/src/chart/helper/EffectSymbol.js +3 -3
  194. package/src/chart/helper/LargeSymbolDraw.js +6 -1
  195. package/src/chart/helper/Line.js +40 -22
  196. package/src/chart/helper/Symbol.js +20 -7
  197. package/src/chart/helper/SymbolDraw.js +2 -1
  198. package/src/chart/helper/labelHelper.js +0 -17
  199. package/src/chart/helper/whiskerBoxCommon.js +11 -4
  200. package/src/chart/line/LineSeries.js +1 -0
  201. package/src/chart/line/LineView.js +14 -2
  202. package/src/chart/line/poly.js +5 -0
  203. package/src/chart/lines/LinesView.js +22 -7
  204. package/src/chart/map/MapSeries.js +3 -7
  205. package/src/chart/map/MapView.js +29 -18
  206. package/src/chart/pie/PieSeries.js +20 -6
  207. package/src/chart/pie/PieView.js +20 -23
  208. package/src/chart/pie/labelLayout.js +3 -3
  209. package/src/chart/radar/RadarView.js +16 -20
  210. package/src/chart/sankey/SankeySeries.js +2 -4
  211. package/src/chart/sankey/SankeyView.js +13 -29
  212. package/src/chart/sankey/sankeyLayout.js +1 -1
  213. package/src/chart/scatter/ScatterSeries.js +2 -1
  214. package/src/chart/themeRiver/ThemeRiverSeries.js +2 -4
  215. package/src/chart/themeRiver/ThemeRiverView.js +2 -5
  216. package/src/chart/themeRiver/themeRiverLayout.js +1 -1
  217. package/src/chart/treemap/Breadcrumb.js +1 -1
  218. package/src/chart/treemap/TreemapSeries.js +28 -8
  219. package/src/chart/treemap/TreemapView.js +88 -77
  220. package/src/chart/treemap/treemapLayout.js +29 -13
  221. package/src/component/axis/AngleAxisView.js +13 -19
  222. package/src/component/axis/AxisBuilder.js +260 -186
  223. package/src/component/axis/CartesianAxisView.js +15 -3
  224. package/src/component/axis/ParallelAxisView.js +1 -1
  225. package/src/component/axis/RadiusAxisView.js +1 -1
  226. package/src/component/axis/SingleAxisView.js +8 -2
  227. package/src/component/axis/cartesianAxisHelper.js +11 -15
  228. package/src/component/axisPointer/AxisPointerModel.js +1 -3
  229. package/src/component/axisPointer/BaseAxisPointer.js +15 -38
  230. package/src/component/axisPointer/axisTrigger.js +36 -20
  231. package/src/component/axisPointer/modelHelper.js +3 -4
  232. package/src/component/axisPointer/viewHelper.js +4 -6
  233. package/src/component/axisPointer.js +1 -14
  234. package/src/component/calendar/CalendarView.js +22 -39
  235. package/src/component/dataZoom/AxisProxy.js +3 -2
  236. package/src/component/dataZoom/DataZoomModel.js +16 -4
  237. package/src/component/dataZoom/InsideZoomView.js +5 -3
  238. package/src/component/dataZoom/SliderZoomView.js +21 -32
  239. package/src/component/dataZoom/roams.js +33 -9
  240. package/src/component/dataZoom/typeDefaulter.js +1 -1
  241. package/src/component/graphic.js +17 -5
  242. package/src/component/helper/BrushTargetManager.js +1 -1
  243. package/src/component/helper/MapDraw.js +26 -22
  244. package/src/component/helper/RoamController.js +12 -11
  245. package/src/component/helper/listComponent.js +27 -24
  246. package/src/component/helper/selectableMixin.js +40 -15
  247. package/src/component/legend/LegendModel.js +11 -3
  248. package/src/component/legend/LegendView.js +151 -70
  249. package/src/component/legend/ScrollableLegendModel.js +76 -0
  250. package/src/component/legend/ScrollableLegendView.js +368 -0
  251. package/src/component/legend/legendAction.js +1 -0
  252. package/src/component/legend/scrollableLegendAction.js +25 -0
  253. package/src/component/legend.js +8 -3
  254. package/src/component/legendScroll.js +12 -0
  255. package/src/component/marker/MarkAreaView.js +12 -26
  256. package/src/component/marker/MarkLineView.js +5 -5
  257. package/src/component/marker/MarkPointView.js +4 -4
  258. package/src/component/marker/MarkerModel.js +1 -4
  259. package/src/component/marker/markerHelper.js +1 -0
  260. package/src/component/radar/RadarView.js +6 -3
  261. package/src/component/timeline/SliderTimelineModel.js +4 -6
  262. package/src/component/timeline/SliderTimelineView.js +14 -16
  263. package/src/component/timeline/TimelineAxis.js +1 -1
  264. package/src/component/timeline/TimelineModel.js +1 -3
  265. package/src/component/title.js +9 -10
  266. package/src/component/toolbox/ToolboxModel.js +2 -0
  267. package/src/component/toolbox/ToolboxView.js +15 -27
  268. package/src/component/toolbox/feature/Brush.js +3 -8
  269. package/src/component/toolbox/feature/DataView.js +5 -5
  270. package/src/component/toolbox/feature/DataZoom.js +3 -4
  271. package/src/component/toolbox/feature/MagicType.js +3 -6
  272. package/src/component/toolbox/feature/Restore.js +2 -1
  273. package/src/component/toolbox/feature/SaveAsImage.js +23 -10
  274. package/src/component/tooltip/TooltipContent.js +4 -4
  275. package/src/component/tooltip/TooltipView.js +29 -7
  276. package/src/component/visualMap/ContinuousModel.js +2 -2
  277. package/src/component/visualMap/ContinuousView.js +12 -8
  278. package/src/component/visualMap/PiecewiseModel.js +1 -2
  279. package/src/component/visualMap/PiecewiseView.js +2 -2
  280. package/src/component/visualMap/VisualMapModel.js +18 -12
  281. package/src/coord/Axis.js +1 -1
  282. package/src/coord/axisDefault.js +3 -3
  283. package/src/coord/axisHelper.js +18 -1
  284. package/src/coord/axisModelCommonMixin.js +12 -2
  285. package/src/coord/calendar/Calendar.js +65 -21
  286. package/src/coord/calendar/CalendarModel.js +6 -12
  287. package/src/coord/cartesian/Cartesian2D.js +0 -14
  288. package/src/coord/cartesian/Grid.js +47 -28
  289. package/src/coord/geo/Geo.js +2 -18
  290. package/src/coord/geo/GeoModel.js +6 -13
  291. package/src/coord/geo/fix/diaoyuIsland.js +30 -0
  292. package/src/coord/geo/geoCreator.js +6 -1
  293. package/src/coord/polar/Polar.js +0 -13
  294. package/src/coord/radar/Radar.js +1 -1
  295. package/src/coord/radar/RadarModel.js +6 -2
  296. package/src/data/DataDiffer.js +14 -7
  297. package/src/data/Graph.js +3 -0
  298. package/src/data/List.js +1 -1
  299. package/src/data/Tree.js +2 -2
  300. package/src/data/helper/completeDimensions.js +2 -11
  301. package/src/echarts.js +33 -10
  302. package/src/lang.js +43 -0
  303. package/src/langEN.js +43 -0
  304. package/src/layout/barGrid.js +11 -3
  305. package/src/layout/barPolar.js +9 -2
  306. package/src/model/Model.js +2 -1
  307. package/src/model/Series.js +14 -6
  308. package/src/model/mixin/textStyle.js +11 -9
  309. package/src/preprocessor/backwardCompat.js +5 -4
  310. package/src/preprocessor/helper/compatStyle.js +157 -45
  311. package/src/scale/Interval.js +10 -4
  312. package/src/scale/Time.js +14 -6
  313. package/src/scale/helper.js +15 -2
  314. package/src/util/format.js +4 -24
  315. package/src/util/graphic.js +412 -21
  316. package/src/util/layout.js +28 -16
  317. package/src/util/model.js +26 -11
  318. package/src/util/number.js +106 -21
  319. package/src/visual/VisualMapping.js +4 -4
  320. package/webpack.config.js +21 -7
  321. package/.npmignore +0 -10
@@ -47,7 +47,7 @@ define(function (require) {
47
47
  if (opts.sort && opts.sort != 'none') {
48
48
  groups.sort(compareGroups);
49
49
  if (opts.sort === 'descending') {
50
- groups.revert();
50
+ groups.reverse();
51
51
  }
52
52
  }
53
53
 
@@ -58,7 +58,7 @@ define(function (require) {
58
58
  if (opts.sortSub && opts.sortSub != 'none') {
59
59
  group.subGroups.sort(compareGroups);
60
60
  if (opts.sortSub === 'descending') {
61
- group.subGroups.revert();
61
+ group.subGroups.reverse();
62
62
  }
63
63
  }
64
64
 
@@ -6,11 +6,15 @@ define(function (require) {
6
6
  var labelHelper = require('./helper/labelHelper');
7
7
  var createListFromArray = require('./helper/createListFromArray');
8
8
  var barGrid = require('../layout/barGrid');
9
+ var DataDiffer = require('../data/DataDiffer');
9
10
 
10
11
  var ITEM_STYLE_NORMAL_PATH = ['itemStyle', 'normal'];
11
12
  var ITEM_STYLE_EMPHASIS_PATH = ['itemStyle', 'emphasis'];
12
13
  var LABEL_NORMAL = ['label', 'normal'];
13
14
  var LABEL_EMPHASIS = ['label', 'emphasis'];
15
+ // Use prefix to avoid index to be the same as el.name,
16
+ // which will cause weird udpate animation.
17
+ var GROUP_DIFF_PREFIX = 'e\0\0';
14
18
 
15
19
  /**
16
20
  * To reduce total package size of each coordinate systems, the modules `prepareCustom`
@@ -42,7 +46,7 @@ define(function (require) {
42
46
  dependencies: ['grid', 'polar', 'geo', 'singleAxis', 'calendar'],
43
47
 
44
48
  defaultOption: {
45
- coordinateSystem: 'cartesian2d',
49
+ coordinateSystem: 'cartesian2d', // Can be set as 'none'
46
50
  zlevel: 0,
47
51
  z: 2,
48
52
  legendHoverLink: true
@@ -110,7 +114,12 @@ define(function (require) {
110
114
  .execute();
111
115
 
112
116
  this._data = data;
113
- }
117
+ },
118
+
119
+ /**
120
+ * @override
121
+ */
122
+ dispose: zrUtil.noop
114
123
  });
115
124
 
116
125
 
@@ -154,6 +163,7 @@ define(function (require) {
154
163
  }
155
164
 
156
165
  el.__customGraphicType = graphicType;
166
+ el.name = elOption.name;
157
167
 
158
168
  return el;
159
169
  }
@@ -180,6 +190,14 @@ define(function (require) {
180
190
  zrUtil.each(['x', 'y'], function (prop) {
181
191
  prepareStyleTransition(prop, targetStyle, elOptionStyle, el.style, isInit);
182
192
  });
193
+ // Compatible with previous: both support
194
+ // textFill and fill, textStroke and stroke in 'text' element.
195
+ !elOptionStyle.hasOwnProperty('textFill') && elOptionStyle.fill && (
196
+ elOptionStyle.textFill = elOptionStyle.fill
197
+ );
198
+ !elOptionStyle.hasOwnProperty('textStroke') && elOptionStyle.stroke && (
199
+ elOptionStyle.textStroke = elOptionStyle.stroke
200
+ );
183
201
  }
184
202
 
185
203
  if (el.type !== 'group') {
@@ -204,7 +222,7 @@ define(function (require) {
204
222
  // z2 must not be null/undefined, otherwise sort error may occur.
205
223
  el.attr({z2: elOption.z2 || 0, silent: elOption.silent});
206
224
 
207
- el.styleEmphasis !== false && graphicUtil.setHoverStyle(el, el.styleEmphasis);
225
+ elOption.styleEmphasis !== false && graphicUtil.setHoverStyle(el, elOption.styleEmphasis);
208
226
  }
209
227
 
210
228
  function prepareStyleTransition(prop, targetStyle, elOptionStyle, oldElStyle, isInit) {
@@ -217,13 +235,21 @@ define(function (require) {
217
235
  function makeRenderItem(customSeries, data, ecModel, api) {
218
236
  var renderItem = customSeries.get('renderItem');
219
237
  var coordSys = customSeries.coordinateSystem;
238
+ var prepareResult = {};
220
239
 
221
- if (__DEV__) {
222
- zrUtil.assert(renderItem, 'series.render is required.');
223
- zrUtil.assert(prepareCustoms[coordSys.type], 'This coordSys does not support custom series.');
224
- }
240
+ if (coordSys) {
241
+ if (__DEV__) {
242
+ zrUtil.assert(renderItem, 'series.render is required.');
243
+ zrUtil.assert(
244
+ coordSys.prepareCustoms || prepareCustoms[coordSys.type],
245
+ 'This coordSys does not support custom series.'
246
+ );
247
+ }
225
248
 
226
- var prepareResult = prepareCustoms[coordSys.type](coordSys);
249
+ prepareResult = coordSys.prepareCustoms
250
+ ? coordSys.prepareCustoms()
251
+ : prepareCustoms[coordSys.type](coordSys);
252
+ }
227
253
 
228
254
  var userAPI = zrUtil.defaults({
229
255
  getWidth: api.getWidth,
@@ -237,7 +263,7 @@ define(function (require) {
237
263
  barLayout: barLayout,
238
264
  currentSeriesIndices: currentSeriesIndices,
239
265
  font: font
240
- }, prepareResult.api);
266
+ }, prepareResult.api || {});
241
267
 
242
268
  var userParams = {
243
269
  context: {},
@@ -286,7 +312,7 @@ define(function (require) {
286
312
 
287
313
  /**
288
314
  * @public
289
- * @param {nubmer|string} dim
315
+ * @param {number|string} dim
290
316
  * @param {number} [dataIndexInside=currDataIndexInside]
291
317
  * @return {number|string} value
292
318
  */
@@ -314,10 +340,19 @@ define(function (require) {
314
340
  var opacity = data.getItemVisual(dataIndexInside, 'opacity');
315
341
  opacity != null && (itemStyle.opacity = opacity);
316
342
 
317
- labelHelper.setTextToStyle(
318
- data, dataIndexInside, currLabelValueDim, itemStyle,
319
- customSeries, currLabelNormalModel, currVisualColor
320
- );
343
+ if (currLabelValueDim != null) {
344
+ graphicUtil.setTextStyle(itemStyle, currLabelNormalModel, null, {
345
+ autoColor: currVisualColor,
346
+ isRectText: true
347
+ });
348
+
349
+ itemStyle.text = currLabelNormalModel.getShallow('show')
350
+ ? zrUtil.retrieve2(
351
+ customSeries.getFormattedLabel(dataIndexInside, 'normal'),
352
+ data.get(currLabelValueDim, dataIndexInside)
353
+ )
354
+ : null;
355
+ }
321
356
 
322
357
  extra && zrUtil.extend(itemStyle, extra);
323
358
  return itemStyle;
@@ -334,10 +369,19 @@ define(function (require) {
334
369
 
335
370
  var itemStyle = currItemModel.getModel(ITEM_STYLE_EMPHASIS_PATH).getItemStyle();
336
371
 
337
- labelHelper.setTextToStyle(
338
- data, dataIndexInside, currLabelValueDim, itemStyle,
339
- customSeries, currLabelEmphasisModel, currVisualColor
340
- );
372
+ if (currLabelValueDim != null) {
373
+ graphicUtil.setTextStyle(itemStyle, currLabelEmphasisModel, null, {
374
+ isRectText: true
375
+ }, true);
376
+
377
+ itemStyle.text = currLabelEmphasisModel.getShallow('show')
378
+ ? zrUtil.retrieve3(
379
+ customSeries.getFormattedLabel(dataIndexInside, 'emphasis'),
380
+ customSeries.getFormattedLabel(dataIndexInside, 'normal'),
381
+ data.get(currLabelValueDim, dataIndexInside)
382
+ )
383
+ : null;
384
+ }
341
385
 
342
386
  extra && zrUtil.extend(itemStyle, extra);
343
387
  return itemStyle;
@@ -430,13 +474,83 @@ define(function (require) {
430
474
  !el && (el = createEl(elOption));
431
475
  updateEl(el, dataIndex, elOption, animatableModel, data, isInit);
432
476
 
433
- elOptionType === 'group' && zrUtil.each(elOption.children, function (childOption, index) {
434
- doCreateOrUpdate(el.childAt(index), dataIndex, childOption, animatableModel, el, data);
435
- });
477
+ if (elOptionType === 'group') {
478
+ var oldChildren = el.children() || [];
479
+ var newChildren = elOption.children || [];
480
+
481
+ if (elOption.diffChildrenByName) {
482
+ // lower performance.
483
+ diffGroupChildren({
484
+ oldChildren: oldChildren,
485
+ newChildren: newChildren,
486
+ dataIndex: dataIndex,
487
+ animatableModel: animatableModel,
488
+ group: el,
489
+ data: data
490
+ });
491
+ }
492
+ else {
493
+ // better performance.
494
+ var index = 0;
495
+ for (; index < newChildren.length; index++) {
496
+ doCreateOrUpdate(
497
+ el.childAt(index),
498
+ dataIndex,
499
+ newChildren[index],
500
+ animatableModel,
501
+ el,
502
+ data
503
+ );
504
+ }
505
+ for (; index < oldChildren.length; index++) {
506
+ oldChildren[index] && el.remove(oldChildren[index]);
507
+ }
508
+ }
509
+ }
436
510
 
437
511
  group.add(el);
438
512
 
439
513
  return el;
440
514
  }
441
515
 
516
+ function diffGroupChildren(context) {
517
+ (new DataDiffer(
518
+ context.oldChildren,
519
+ context.newChildren,
520
+ getKey,
521
+ getKey,
522
+ context
523
+ ))
524
+ .add(processAddUpdate)
525
+ .update(processAddUpdate)
526
+ .remove(processRemove)
527
+ .execute();
528
+ }
529
+
530
+ function getKey(item, idx) {
531
+ var name = item && item.name;
532
+ return name != null ? name : GROUP_DIFF_PREFIX + idx;
533
+ }
534
+
535
+ function processAddUpdate(newIndex, oldIndex) {
536
+ var context = this.context;
537
+ var childOption = newIndex != null ? context.newChildren[newIndex] : null;
538
+ var child = oldIndex != null ? context.oldChildren[oldIndex] : null;
539
+
540
+ doCreateOrUpdate(
541
+ child,
542
+ context.dataIndex,
543
+ childOption,
544
+ context.animatableModel,
545
+ context.group,
546
+ context.data
547
+ );
548
+ }
549
+
550
+ function processRemove(oldIndex) {
551
+ var context = this.context;
552
+ var child = context.oldChildren[oldIndex];
553
+ child && context.group.remove(child);
554
+ }
555
+
442
556
  });
@@ -78,7 +78,6 @@ define(function(require) {
78
78
  show: true,
79
79
  position: 'outer'
80
80
  // formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调
81
- // textStyle: null // 默认使用全局文本样式,详见TEXTSTYLE
82
81
  },
83
82
  emphasis: {
84
83
  show: true
@@ -38,21 +38,6 @@ define(function (require) {
38
38
 
39
39
  var funnelPieceProto = FunnelPiece.prototype;
40
40
 
41
- function getLabelStyle(data, idx, state, labelModel) {
42
- var textStyleModel = labelModel.getModel('textStyle');
43
- var position = labelModel.get('position');
44
- var isLabelInside = position === 'inside' || position === 'inner' || position === 'center';
45
- return {
46
- fill: textStyleModel.getTextColor()
47
- || (isLabelInside ? '#fff' : data.getItemVisual(idx, 'color')),
48
- textFont: textStyleModel.getFont(),
49
- text: zrUtil.retrieve(
50
- data.hostModel.getFormattedLabel(idx, state),
51
- data.getName(idx)
52
- )
53
- };
54
- }
55
-
56
41
  var opacityAccessPath = ['itemStyle', 'normal', 'opacity'];
57
42
  funnelPieceProto.updateData = function (data, idx, firstCreate) {
58
43
 
@@ -133,11 +118,6 @@ define(function (require) {
133
118
  }
134
119
  }, seriesModel, idx);
135
120
  labelText.attr({
136
- style: {
137
- textAlign: labelLayout.textAlign,
138
- textVerticalAlign: labelLayout.verticalAlign,
139
- textFont: labelLayout.font
140
- },
141
121
  rotation: labelLayout.rotation,
142
122
  origin: [labelLayout.x, labelLayout.y],
143
123
  z2: 10
@@ -147,8 +127,22 @@ define(function (require) {
147
127
  var labelHoverModel = itemModel.getModel('label.emphasis');
148
128
  var labelLineModel = itemModel.getModel('labelLine.normal');
149
129
  var labelLineHoverModel = itemModel.getModel('labelLine.emphasis');
130
+ var visualColor = data.getItemVisual(idx, 'color');
150
131
 
151
- labelText.setStyle(getLabelStyle(data, idx, 'normal', labelModel));
132
+ graphic.setLabelStyle(
133
+ labelText.style, labelText.hoverStyle = {}, labelModel, labelHoverModel,
134
+ {
135
+ labelFetcher: data.hostModel,
136
+ labelDataIndex: idx,
137
+ defaultText: data.getName(idx),
138
+ autoColor: visualColor,
139
+ useInsideStyle: !!labelLayout.inside
140
+ },
141
+ {
142
+ textAlign: labelLayout.textAlign,
143
+ textVerticalAlign: labelLayout.verticalAlign
144
+ }
145
+ );
152
146
 
153
147
  labelText.ignore = labelText.normalIgnore = !labelModel.get('show');
154
148
  labelText.hoverIgnore = !labelHoverModel.get('show');
@@ -162,7 +156,6 @@ define(function (require) {
162
156
  });
163
157
  labelLine.setStyle(labelLineModel.getModel('lineStyle').getLineStyle());
164
158
 
165
- labelText.hoverStyle = getLabelStyle(data, idx, 'emphasis', labelHoverModel);
166
159
  labelLine.hoverStyle = labelLineHoverModel.getModel('lineStyle').getLineStyle();
167
160
  };
168
161
 
@@ -35,7 +35,7 @@ define(function (require) {
35
35
  return indices;
36
36
  }
37
37
 
38
- function labelLayout (data) {
38
+ function labelLayout(data) {
39
39
  data.each(function (idx) {
40
40
  var itemModel = data.getItemModel(idx);
41
41
  var labelModel = itemModel.getModel('label.normal');
@@ -76,9 +76,7 @@ define(function (require) {
76
76
  show: true,
77
77
  distance: 5,
78
78
  // formatter: null,
79
- textStyle: { // 其余属性默认使用全局文本样式,详见TEXTSTYLE
80
- color: 'auto'
81
- }
79
+ color: 'auto'
82
80
  },
83
81
  pointer: {
84
82
  show: true,
@@ -95,10 +93,8 @@ define(function (require) {
95
93
  // x, y,单位px
96
94
  offsetCenter: [0, '-40%'],
97
95
  // 其余属性默认使用全局文本样式,详见TEXTSTYLE
98
- textStyle: {
99
- color: '#333',
100
- fontSize: 15
101
- }
96
+ color: '#333',
97
+ fontSize: 15
102
98
  },
103
99
  detail: {
104
100
  show: true,
@@ -106,15 +102,14 @@ define(function (require) {
106
102
  borderWidth: 0,
107
103
  borderColor: '#ccc',
108
104
  width: 100,
109
- height: 40,
105
+ height: null, // self-adaption
106
+ padding: [5, 10],
110
107
  // x, y,单位px
111
108
  offsetCenter: [0, '40%'],
112
109
  // formatter: null,
113
110
  // 其余属性默认使用全局文本样式,详见TEXTSTYLE
114
- textStyle: {
115
- color: 'auto',
116
- fontSize: 30
117
- }
111
+ color: 'auto',
112
+ fontSize: 30
118
113
  }
119
114
  }
120
115
  });
@@ -174,7 +174,6 @@ define(function (require) {
174
174
 
175
175
  var splitLineStyle = splitLineModel.getModel('lineStyle').getLineStyle();
176
176
  var tickLineStyle = tickModel.getModel('lineStyle').getLineStyle();
177
- var textStyleModel = labelModel.getModel('textStyle');
178
177
 
179
178
  for (var i = 0; i <= splitNumber; i++) {
180
179
  var unitX = Math.cos(angle);
@@ -207,26 +206,18 @@ define(function (require) {
207
206
  labelModel.get('formatter')
208
207
  );
209
208
  var distance = labelModel.get('distance');
209
+ var autoColor = getColor(i / splitNumber);
210
210
 
211
- var text = new graphic.Text({
212
- style: {
211
+ group.add(new graphic.Text({
212
+ style: graphic.setTextStyle({}, labelModel, {
213
213
  text: label,
214
214
  x: unitX * (r - splitLineLen - distance) + cx,
215
215
  y: unitY * (r - splitLineLen - distance) + cy,
216
- fill: textStyleModel.getTextColor(),
217
- textFont: textStyleModel.getFont(),
218
216
  textVerticalAlign: unitY < -0.4 ? 'top' : (unitY > 0.4 ? 'bottom' : 'middle'),
219
217
  textAlign: unitX < -0.4 ? 'left' : (unitX > 0.4 ? 'right' : 'center')
220
- },
218
+ }, {autoColor: autoColor}),
221
219
  silent: true
222
- });
223
- if (text.style.fill === 'auto') {
224
- text.setStyle({
225
- fill: getColor(i / splitNumber)
226
- });
227
- }
228
-
229
- group.add(text);
220
+ }));
230
221
  }
231
222
 
232
223
  // Axis tick
@@ -352,34 +343,28 @@ define(function (require) {
352
343
  ) {
353
344
  var titleModel = seriesModel.getModel('title');
354
345
  if (titleModel.get('show')) {
355
- var textStyleModel = titleModel.getModel('textStyle');
356
346
  var offsetCenter = titleModel.get('offsetCenter');
357
347
  var x = posInfo.cx + parsePercent(offsetCenter[0], posInfo.r);
358
348
  var y = posInfo.cy + parsePercent(offsetCenter[1], posInfo.r);
359
349
 
360
- var text = new graphic.Text({
361
- style: {
350
+ var minVal = +seriesModel.get('min');
351
+ var maxVal = +seriesModel.get('max');
352
+ var value = seriesModel.getData().get('value', 0);
353
+ var autoColor = getColor(
354
+ numberUtil.linearMap(value, [minVal, maxVal], [0, 1], true)
355
+ );
356
+
357
+ this.group.add(new graphic.Text({
358
+ silent: true,
359
+ style: graphic.setTextStyle({}, titleModel, {
362
360
  x: x,
363
361
  y: y,
364
362
  // FIXME First data name ?
365
363
  text: seriesModel.getData().getName(0),
366
- fill: textStyleModel.getTextColor(),
367
- textFont: textStyleModel.getFont(),
368
364
  textAlign: 'center',
369
365
  textVerticalAlign: 'middle'
370
- }
371
- });
372
-
373
- if (text.style.fill === 'auto') {
374
- var minVal = +seriesModel.get('min');
375
- var maxVal = +seriesModel.get('max');
376
- var value = seriesModel.getData().get('value', 0);
377
- text.setStyle('fill', getColor(
378
- numberUtil.linearMap(value, [minVal, maxVal], [0, 1], true)
379
- ));
380
- }
381
-
382
- this.group.add(text);
366
+ }, {autoColor: autoColor, forceRich: true})
367
+ }));
383
368
  }
384
369
  },
385
370
 
@@ -390,37 +375,31 @@ define(function (require) {
390
375
  var minVal = +seriesModel.get('min');
391
376
  var maxVal = +seriesModel.get('max');
392
377
  if (detailModel.get('show')) {
393
- var textStyleModel = detailModel.getModel('textStyle');
394
378
  var offsetCenter = detailModel.get('offsetCenter');
395
379
  var x = posInfo.cx + parsePercent(offsetCenter[0], posInfo.r);
396
380
  var y = posInfo.cy + parsePercent(offsetCenter[1], posInfo.r);
397
381
  var width = parsePercent(detailModel.get('width'), posInfo.r);
398
382
  var height = parsePercent(detailModel.get('height'), posInfo.r);
399
383
  var value = seriesModel.getData().get('value', 0);
400
- var rect = new graphic.Rect({
401
- shape: {
402
- x: x - width / 2,
403
- y: y - height / 2,
404
- width: width,
405
- height: height
406
- },
407
- style: {
384
+ var autoColor = getColor(
385
+ numberUtil.linearMap(value, [minVal, maxVal], [0, 1], true)
386
+ );
387
+
388
+ this.group.add(new graphic.Text({
389
+ silent: true,
390
+ style: graphic.setTextStyle({}, detailModel, {
391
+ x: x,
392
+ y: y,
408
393
  text: formatLabel(
409
394
  // FIXME First data name ?
410
395
  value, detailModel.get('formatter')
411
396
  ),
412
- fill: detailModel.get('backgroundColor'),
413
- textFill: textStyleModel.getTextColor(),
414
- textFont: textStyleModel.getFont()
415
- }
416
- });
417
- if (rect.style.textFill === 'auto') {
418
- rect.setStyle('textFill', getColor(
419
- numberUtil.linearMap(value, [minVal, maxVal], [0, 1], true)
420
- ));
421
- }
422
- rect.setStyle(detailModel.getItemStyle(['color']));
423
- this.group.add(rect);
397
+ textWidth: isNaN(width) ? null : width,
398
+ textHeight: isNaN(height) ? null : height,
399
+ textAlign: 'center',
400
+ textVerticalAlign: 'middle'
401
+ }, {autoColor: autoColor, forceRich: true})
402
+ }));
424
403
  }
425
404
  }
426
405
  });
@@ -37,7 +37,7 @@ define(function (require) {
37
37
 
38
38
  mergeDefaultAndTheme: function (option) {
39
39
  GraphSeries.superApply(this, 'mergeDefaultAndTheme', arguments);
40
- modelUtil.defaultEmphasis(option.edgeLabel, modelUtil.LABEL_OPTIONS);
40
+ modelUtil.defaultEmphasis(option.edgeLabel, ['show']);
41
41
  },
42
42
 
43
43
  getInitialData: function (option, ecModel) {
@@ -228,6 +228,7 @@ define(function (require) {
228
228
  zoom: 1,
229
229
  // Symbol size scale ratio in roam
230
230
  nodeScaleRatio: 0.6,
231
+ // cursor: null,
231
232
 
232
233
  // categories: [],
233
234
 
@@ -18,6 +18,35 @@ define(function (require) {
18
18
  return item.getVisual('opacity') || item.getModel().get(opacityPath);
19
19
  }
20
20
 
21
+ function fadeOutItem(item, opacityPath, opacityRatio) {
22
+ var el = item.getGraphicEl();
23
+
24
+ var opacity = getItemOpacity(item, opacityPath);
25
+ if (opacityRatio != null) {
26
+ opacity == null && (opacity = 1);
27
+ opacity *= opacityRatio;
28
+ }
29
+
30
+ el.downplay && el.downplay();
31
+ el.traverse(function (child) {
32
+ if (child.type !== 'group') {
33
+ child.setStyle('opacity', opacity);
34
+ }
35
+ });
36
+ }
37
+
38
+ function fadeInItem(item, opacityPath) {
39
+ var opacity = getItemOpacity(item, opacityPath);
40
+ var el = item.getGraphicEl();
41
+
42
+ el.highlight && el.highlight();
43
+ el.traverse(function (child) {
44
+ if (child.type !== 'group') {
45
+ child.setStyle('opacity', opacity);
46
+ }
47
+ });
48
+ }
49
+
21
50
  require('../../echarts').extendChartView({
22
51
 
23
52
  type: 'graph',
@@ -125,7 +154,8 @@ define(function (require) {
125
154
 
126
155
  }, this);
127
156
 
128
- var circularRotateLabel = seriesModel.get('layout') === 'circular' && seriesModel.get('circular.rotateLabel');
157
+ var circularRotateLabel = seriesModel.get('layout') === 'circular'
158
+ && seriesModel.get('circular.rotateLabel');
129
159
  var cx = data.getLayout('cx');
130
160
  var cy = data.getLayout('cy');
131
161
  data.eachItemGraphicEl(function (el, idx) {
@@ -142,8 +172,9 @@ define(function (require) {
142
172
  }
143
173
  var textPosition = isLeft ? 'left' : 'right';
144
174
  symbolPath.setStyle({
145
- textRotation: rad,
146
- textPosition: textPosition
175
+ textRotation: -rad,
176
+ textPosition: textPosition,
177
+ textOrigin: 'center'
147
178
  });
148
179
  symbolPath.hoverStyle && (symbolPath.hoverStyle.textPosition = textPosition);
149
180
  }
@@ -174,38 +205,12 @@ define(function (require) {
174
205
  var graph = data.graph;
175
206
  var dataType = el.dataType;
176
207
 
177
- function fadeOutItem(item, opacityPath) {
178
- var opacity = getItemOpacity(item, opacityPath);
179
- var el = item.getGraphicEl();
180
- if (opacity == null) {
181
- opacity = 1;
182
- }
183
-
184
- el.traverse(function (child) {
185
- child.trigger('normal');
186
- if (child.type !== 'group') {
187
- child.setStyle('opacity', opacity * 0.1);
188
- }
189
- });
190
- }
191
-
192
- function fadeInItem(item, opacityPath) {
193
- var opacity = getItemOpacity(item, opacityPath);
194
- var el = item.getGraphicEl();
195
-
196
- el.traverse(function (child) {
197
- child.trigger('emphasis');
198
- if (child.type !== 'group') {
199
- child.setStyle('opacity', opacity);
200
- }
201
- });
202
- }
203
208
  if (dataIndex !== null && dataType !== 'edge') {
204
209
  graph.eachNode(function (node) {
205
- fadeOutItem(node, nodeOpacityPath);
210
+ fadeOutItem(node, nodeOpacityPath, 0.1);
206
211
  });
207
212
  graph.eachEdge(function (edge) {
208
- fadeOutItem(edge, lineOpacityPath);
213
+ fadeOutItem(edge, lineOpacityPath, 0.1);
209
214
  });
210
215
 
211
216
  var node = graph.getNodeByIndex(dataIndex);
@@ -223,23 +228,12 @@ define(function (require) {
223
228
 
224
229
  unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
225
230
  var graph = this._model.getData().graph;
231
+
226
232
  graph.eachNode(function (node) {
227
- var opacity = getItemOpacity(node, nodeOpacityPath);
228
- node.getGraphicEl().traverse(function (child) {
229
- child.trigger('normal');
230
- if (child.type !== 'group') {
231
- child.setStyle('opacity', opacity);
232
- }
233
- });
233
+ fadeOutItem(node, nodeOpacityPath);
234
234
  });
235
235
  graph.eachEdge(function (edge) {
236
- var opacity = getItemOpacity(edge, lineOpacityPath);
237
- edge.getGraphicEl().traverse(function (child) {
238
- child.trigger('normal');
239
- if (child.type !== 'group') {
240
- child.setStyle('opacity', opacity);
241
- }
242
- });
236
+ fadeOutItem(edge, lineOpacityPath);
243
237
  });
244
238
  },
245
239