echarts 4.5.0 → 4.9.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 (329) hide show
  1. package/.DS_Store +0 -0
  2. package/.gitattributes +3 -0
  3. package/.github/pull_request_template.md +66 -0
  4. package/.github/workflows/nodejs.yml +15 -3
  5. package/.huskyrc +5 -0
  6. package/CONTRIBUTING.md +16 -160
  7. package/NOTICE +1 -1
  8. package/README.md +3 -3
  9. package/asset/.DS_Store +0 -0
  10. package/build/.DS_Store +0 -0
  11. package/dist/echarts-en.common.js +3072 -1261
  12. package/dist/echarts-en.common.min.js +1 -1
  13. package/dist/echarts-en.js +4339 -1685
  14. package/dist/echarts-en.js.map +1 -1
  15. package/dist/echarts-en.min.js +1 -1
  16. package/dist/echarts-en.simple.js +2496 -1011
  17. package/dist/echarts-en.simple.min.js +1 -1
  18. package/dist/echarts.common.js +3046 -1261
  19. package/dist/echarts.common.min.js +1 -1
  20. package/dist/echarts.js +4313 -1685
  21. package/dist/echarts.js.map +1 -1
  22. package/dist/echarts.min.js +1 -1
  23. package/dist/echarts.simple.js +2470 -1011
  24. package/dist/echarts.simple.min.js +1 -1
  25. package/dist/extension/bmap.js +33 -11
  26. package/dist/extension/bmap.js.map +1 -1
  27. package/dist/extension/bmap.min.js +1 -1
  28. package/dist/extension/dataTool.js.map +1 -1
  29. package/extension/.DS_Store +0 -0
  30. package/extension/bmap/BMapCoordSys.js +14 -4
  31. package/extension/bmap/BMapModel.js +4 -0
  32. package/extension/bmap/BMapView.js +18 -10
  33. package/extension-src/bmap/BMapCoordSys.js +14 -4
  34. package/extension-src/bmap/BMapModel.js +6 -1
  35. package/extension-src/bmap/BMapView.js +16 -9
  36. package/lib/chart/bar/BarSeries.js +14 -1
  37. package/lib/chart/bar/BarView.js +196 -18
  38. package/lib/chart/bar/BaseBarSeries.js +3 -1
  39. package/lib/chart/bar/PictorialBarSeries.js +1 -1
  40. package/lib/chart/candlestick/candlestickVisual.js +1 -1
  41. package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
  42. package/lib/chart/funnel/FunnelSeries.js +14 -5
  43. package/lib/chart/funnel/funnelLayout.js +162 -46
  44. package/lib/chart/gauge/GaugeSeries.js +0 -2
  45. package/lib/chart/graph/GraphSeries.js +23 -7
  46. package/lib/chart/graph/GraphView.js +30 -12
  47. package/lib/chart/graph/circularLayoutHelper.js +8 -2
  48. package/lib/chart/graph/forceLayout.js +6 -1
  49. package/lib/chart/graph/simpleLayout.js +1 -1
  50. package/lib/chart/graph/simpleLayoutHelper.js +10 -4
  51. package/lib/chart/heatmap/HeatmapView.js +4 -4
  52. package/lib/chart/helper/EffectLine.js +23 -1
  53. package/lib/chart/helper/EffectSymbol.js +2 -1
  54. package/lib/chart/helper/Line.js +129 -42
  55. package/lib/chart/helper/LineDraw.js +5 -1
  56. package/lib/chart/helper/Symbol.js +2 -3
  57. package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
  58. package/lib/chart/helper/createListFromArray.js +14 -8
  59. package/lib/chart/helper/createRenderPlanner.js +6 -3
  60. package/lib/chart/helper/multipleGraphEdgeHelper.js +258 -0
  61. package/lib/chart/helper/whiskerBoxCommon.js +22 -16
  62. package/lib/chart/line/LineSeries.js +3 -1
  63. package/lib/chart/line/LineView.js +41 -2
  64. package/lib/chart/lines/LinesSeries.js +0 -2
  65. package/lib/chart/map/MapSeries.js +14 -5
  66. package/lib/chart/pie/PieSeries.js +27 -6
  67. package/lib/chart/pie/PieView.js +22 -15
  68. package/lib/chart/pie/labelLayout.js +102 -19
  69. package/lib/chart/pie/pieLayout.js +19 -7
  70. package/lib/chart/radar/RadarSeries.js +27 -6
  71. package/lib/chart/radar/RadarView.js +3 -1
  72. package/lib/chart/sankey/SankeySeries.js +13 -1
  73. package/lib/chart/sankey/SankeyView.js +70 -32
  74. package/lib/chart/sankey/sankeyLayout.js +22 -3
  75. package/lib/chart/scatter/ScatterSeries.js +3 -1
  76. package/lib/chart/sunburst/SunburstPiece.js +5 -1
  77. package/lib/chart/sunburst/SunburstSeries.js +29 -12
  78. package/lib/chart/sunburst/SunburstView.js +5 -1
  79. package/lib/chart/themeRiver/ThemeRiverSeries.js +24 -33
  80. package/lib/chart/tree/TreeSeries.js +20 -3
  81. package/lib/chart/tree/TreeView.js +149 -23
  82. package/lib/chart/treemap/TreemapSeries.js +25 -4
  83. package/lib/chart/treemap/TreemapView.js +80 -38
  84. package/lib/chart/treemap/treemapLayout.js +1 -1
  85. package/lib/chart/treemap/treemapVisual.js +9 -15
  86. package/lib/component/axis/AngleAxisView.js +64 -7
  87. package/lib/component/axis/AxisBuilder.js +62 -24
  88. package/lib/component/axis/CartesianAxisView.js +52 -85
  89. package/lib/component/axis/RadiusAxisView.js +36 -4
  90. package/lib/component/axis/SingleAxisView.js +21 -6
  91. package/lib/component/axis/axisSplitHelper.js +132 -0
  92. package/lib/component/axisPointer/axisTrigger.js +1 -1
  93. package/lib/component/brush/BrushView.js +11 -1
  94. package/lib/component/brush/visualEncoding.js +13 -2
  95. package/lib/component/dataZoom/SliderZoomView.js +4 -10
  96. package/lib/component/helper/BrushController.js +33 -43
  97. package/lib/component/helper/MapDraw.js +30 -4
  98. package/lib/component/legend/LegendModel.js +3 -3
  99. package/lib/component/legend/LegendView.js +17 -13
  100. package/lib/component/legend/ScrollableLegendView.js +18 -18
  101. package/lib/component/marker/MarkAreaView.js +53 -15
  102. package/lib/component/marker/MarkLineModel.js +2 -1
  103. package/lib/component/marker/MarkLineView.js +3 -0
  104. package/lib/component/marker/MarkPointView.js +8 -1
  105. package/lib/component/marker/MarkerModel.js +3 -2
  106. package/lib/component/marker/markerHelper.js +7 -4
  107. package/lib/component/timeline/SliderTimelineView.js +7 -1
  108. package/lib/component/title.js +6 -2
  109. package/lib/component/toolbox/ToolboxView.js +5 -1
  110. package/lib/component/toolbox/feature/DataView.js +23 -8
  111. package/lib/component/toolbox/feature/DataZoom.js +6 -6
  112. package/lib/component/toolbox/feature/MagicType.js +20 -14
  113. package/lib/component/toolbox/feature/SaveAsImage.js +4 -2
  114. package/lib/component/tooltip/TooltipContent.js +101 -30
  115. package/lib/component/tooltip/TooltipRichContent.js +56 -8
  116. package/lib/component/tooltip/TooltipView.js +11 -12
  117. package/lib/component/visualMap/PiecewiseModel.js +3 -6
  118. package/lib/component/visualMap/VisualMapModel.js +1 -1
  119. package/lib/coord/Axis.js +30 -2
  120. package/lib/coord/View.js +9 -0
  121. package/lib/coord/axisDefault.js +22 -3
  122. package/lib/coord/axisHelper.js +24 -18
  123. package/lib/coord/calendar/Calendar.js +8 -4
  124. package/lib/coord/geo/GeoModel.js +2 -1
  125. package/lib/coord/geo/geoJSONLoader.js +3 -2
  126. package/lib/coord/geo/geoSourceManager.js +3 -2
  127. package/lib/coord/geo/parseGeoJson.js +3 -2
  128. package/lib/coord/radar/Radar.js +5 -5
  129. package/lib/data/DataDimensionInfo.js +157 -0
  130. package/lib/data/Graph.js +1 -6
  131. package/lib/data/List.js +26 -20
  132. package/lib/data/Tree.js +5 -42
  133. package/lib/data/helper/completeDimensions.js +43 -32
  134. package/lib/data/helper/createDimensions.js +2 -0
  135. package/lib/data/helper/sourceHelper.js +214 -114
  136. package/lib/echarts.js +57 -34
  137. package/lib/langEN.js +26 -0
  138. package/lib/layout/barGrid.js +19 -13
  139. package/lib/layout/barPolar.js +1 -6
  140. package/lib/loading/default.js +43 -27
  141. package/lib/model/Series.js +4 -4
  142. package/lib/model/referHelper.js +40 -12
  143. package/lib/processor/dataSample.js +1 -1
  144. package/lib/scale/Interval.js +87 -2
  145. package/lib/scale/Log.js +9 -2
  146. package/lib/scale/helper.js +1 -43
  147. package/lib/stream/Scheduler.js +10 -2
  148. package/lib/theme/dark.js +3 -0
  149. package/lib/util/format.js +19 -2
  150. package/lib/util/graphic.js +14 -12
  151. package/lib/visual/LegendVisualProvider.js +75 -0
  152. package/lib/visual/VisualMapping.js +1 -1
  153. package/lib/visual/dataColor.js +2 -12
  154. package/lib/visual/seriesColor.js +15 -7
  155. package/lib/visual/symbol.js +12 -2
  156. package/map/.DS_Store +0 -0
  157. package/map/js/.DS_Store +0 -0
  158. package/map/js/china.js +1 -1
  159. package/map/js/province/.DS_Store +0 -0
  160. package/map/js/province/chongqing.js +1 -1
  161. package/map/js/province/gansu.js +2 -2
  162. package/map/js/province/tianjin.js +1 -28
  163. package/map/json/.DS_Store +0 -0
  164. package/map/json/china.json +1 -1
  165. package/map/json/province/chongqing.json +1 -1
  166. package/map/json/province/tianjin.json +1 -1
  167. package/package.json +12 -6
  168. package/src/.DS_Store +0 -0
  169. package/src/chart/.DS_Store +0 -0
  170. package/src/chart/bar/BarSeries.js +15 -1
  171. package/src/chart/bar/BarView.js +198 -17
  172. package/src/chart/bar/BaseBarSeries.js +1 -1
  173. package/src/chart/bar/PictorialBarSeries.js +2 -2
  174. package/src/chart/candlestick/candlestickVisual.js +1 -1
  175. package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
  176. package/src/chart/funnel/FunnelSeries.js +11 -4
  177. package/src/chart/funnel/funnelLayout.js +179 -53
  178. package/src/chart/gauge/GaugeSeries.js +0 -1
  179. package/src/chart/graph/GraphSeries.js +19 -7
  180. package/src/chart/graph/GraphView.js +28 -10
  181. package/src/chart/graph/circularLayoutHelper.js +8 -2
  182. package/src/chart/graph/forceLayout.js +7 -1
  183. package/src/chart/graph/simpleLayout.js +1 -1
  184. package/src/chart/graph/simpleLayoutHelper.js +12 -5
  185. package/src/chart/heatmap/HeatmapView.js +4 -4
  186. package/src/chart/helper/EffectLine.js +23 -1
  187. package/src/chart/helper/EffectSymbol.js +2 -1
  188. package/src/chart/helper/Line.js +122 -37
  189. package/src/chart/helper/LineDraw.js +5 -1
  190. package/src/chart/helper/Symbol.js +4 -4
  191. package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
  192. package/src/chart/helper/createGraphFromNodeEdge.js +2 -1
  193. package/src/chart/helper/createListFromArray.js +13 -8
  194. package/src/chart/helper/createRenderPlanner.js +5 -2
  195. package/src/chart/helper/multipleGraphEdgeHelper.js +229 -0
  196. package/src/chart/helper/whiskerBoxCommon.js +21 -16
  197. package/src/chart/line/LineSeries.js +1 -1
  198. package/src/chart/line/LineView.js +45 -1
  199. package/src/chart/lines/LinesSeries.js +1 -3
  200. package/src/chart/map/MapSeries.js +11 -5
  201. package/src/chart/pie/PieSeries.js +26 -5
  202. package/src/chart/pie/PieView.js +20 -15
  203. package/src/chart/pie/labelLayout.js +114 -22
  204. package/src/chart/pie/pieLayout.js +20 -7
  205. package/src/chart/radar/RadarSeries.js +31 -6
  206. package/src/chart/radar/RadarView.js +4 -2
  207. package/src/chart/sankey/SankeySeries.js +12 -1
  208. package/src/chart/sankey/SankeyView.js +75 -30
  209. package/src/chart/sankey/sankeyLayout.js +25 -5
  210. package/src/chart/scatter/ScatterSeries.js +1 -1
  211. package/src/chart/sunburst/SunburstPiece.js +7 -1
  212. package/src/chart/sunburst/SunburstSeries.js +28 -15
  213. package/src/chart/sunburst/SunburstView.js +2 -1
  214. package/src/chart/themeRiver/ThemeRiverSeries.js +25 -30
  215. package/src/chart/tree/TreeSeries.js +19 -6
  216. package/src/chart/tree/TreeView.js +156 -23
  217. package/src/chart/treemap/TreemapSeries.js +23 -5
  218. package/src/chart/treemap/TreemapView.js +77 -41
  219. package/src/chart/treemap/treemapLayout.js +2 -2
  220. package/src/chart/treemap/treemapVisual.js +8 -25
  221. package/src/component/axis/AngleAxisView.js +75 -7
  222. package/src/component/axis/AxisBuilder.js +77 -32
  223. package/src/component/axis/CartesianAxisView.js +47 -83
  224. package/src/component/axis/RadiusAxisView.js +37 -4
  225. package/src/component/axis/SingleAxisView.js +21 -4
  226. package/src/component/axis/axisSplitHelper.js +114 -0
  227. package/src/component/axisPointer/axisTrigger.js +1 -1
  228. package/src/component/brush/BrushView.js +8 -1
  229. package/src/component/brush/visualEncoding.js +6 -3
  230. package/src/component/dataZoom/SliderZoomView.js +4 -9
  231. package/src/component/helper/BrushController.js +40 -47
  232. package/src/component/helper/MapDraw.js +27 -4
  233. package/src/component/legend/LegendModel.js +3 -3
  234. package/src/component/legend/LegendView.js +18 -12
  235. package/src/component/legend/ScrollableLegendView.js +18 -16
  236. package/src/component/marker/MarkAreaView.js +53 -15
  237. package/src/component/marker/MarkLineModel.js +2 -1
  238. package/src/component/marker/MarkLineView.js +3 -1
  239. package/src/component/marker/MarkPointView.js +7 -1
  240. package/src/component/marker/MarkerModel.js +3 -2
  241. package/src/component/marker/markerHelper.js +8 -5
  242. package/src/component/timeline/SliderTimelineView.js +9 -6
  243. package/src/component/title.js +4 -3
  244. package/src/component/toolbox/.DS_Store +0 -0
  245. package/src/component/toolbox/ToolboxView.js +5 -0
  246. package/src/component/toolbox/feature/DataView.js +20 -8
  247. package/src/component/toolbox/feature/DataZoom.js +6 -6
  248. package/src/component/toolbox/feature/MagicType.js +19 -13
  249. package/src/component/toolbox/feature/SaveAsImage.js +4 -2
  250. package/src/component/tooltip/TooltipContent.js +94 -28
  251. package/src/component/tooltip/TooltipRichContent.js +52 -9
  252. package/src/component/tooltip/TooltipView.js +14 -12
  253. package/src/component/visualMap/PiecewiseModel.js +5 -9
  254. package/src/component/visualMap/VisualMapModel.js +1 -1
  255. package/src/coord/Axis.js +29 -2
  256. package/src/coord/View.js +10 -1
  257. package/src/coord/axisDefault.js +26 -2
  258. package/src/coord/axisHelper.js +30 -21
  259. package/src/coord/calendar/Calendar.js +12 -5
  260. package/src/coord/geo/GeoModel.js +3 -6
  261. package/src/coord/geo/geoJSONLoader.js +3 -2
  262. package/src/coord/geo/geoSourceManager.js +3 -2
  263. package/src/coord/geo/parseGeoJson.js +3 -2
  264. package/src/coord/radar/Radar.js +6 -8
  265. package/src/data/DataDimensionInfo.js +135 -0
  266. package/src/data/Graph.js +0 -5
  267. package/src/data/List.js +30 -17
  268. package/src/data/Tree.js +6 -39
  269. package/src/data/helper/completeDimensions.js +49 -30
  270. package/src/data/helper/createDimensions.js +2 -0
  271. package/src/data/helper/sourceHelper.js +216 -124
  272. package/src/echarts.js +60 -36
  273. package/src/langEN.js +26 -0
  274. package/src/layout/barGrid.js +22 -10
  275. package/src/layout/barPolar.js +4 -6
  276. package/src/loading/default.js +46 -34
  277. package/src/model/.DS_Store +0 -0
  278. package/src/model/Series.js +4 -4
  279. package/src/model/referHelper.js +34 -11
  280. package/src/preprocessor/.DS_Store +0 -0
  281. package/src/processor/dataSample.js +1 -1
  282. package/src/scale/Interval.js +84 -4
  283. package/src/scale/Log.js +9 -2
  284. package/src/scale/helper.js +1 -39
  285. package/src/stream/Scheduler.js +9 -1
  286. package/src/theme/dark.js +3 -0
  287. package/src/util/.DS_Store +0 -0
  288. package/src/util/format.js +17 -1
  289. package/src/util/graphic.js +13 -11
  290. package/src/visual/LegendVisualProvider.js +55 -0
  291. package/src/visual/VisualMapping.js +1 -1
  292. package/src/visual/dataColor.js +0 -13
  293. package/src/visual/seriesColor.js +13 -7
  294. package/src/visual/symbol.js +11 -2
  295. package/theme/.DS_Store +0 -0
  296. package/theme/azul.js +163 -0
  297. package/theme/bee-inspired.js +178 -0
  298. package/theme/blue.js +178 -0
  299. package/theme/caravan.js +178 -0
  300. package/theme/carp.js +163 -0
  301. package/theme/cool.js +180 -0
  302. package/theme/dark-blue.js +168 -0
  303. package/theme/dark-bold.js +168 -0
  304. package/theme/dark-digerati.js +168 -0
  305. package/theme/dark-fresh-cut.js +168 -0
  306. package/theme/dark-mushroom.js +168 -0
  307. package/theme/dark.js +69 -62
  308. package/theme/eduardo.js +178 -0
  309. package/theme/forest.js +163 -0
  310. package/theme/fresh-cut.js +163 -0
  311. package/theme/fruit.js +178 -0
  312. package/theme/gray.js +220 -0
  313. package/theme/green.js +222 -0
  314. package/theme/helianthus.js +263 -0
  315. package/theme/infographic.js +72 -57
  316. package/theme/inspired.js +163 -0
  317. package/theme/jazz.js +163 -0
  318. package/theme/london.js +163 -0
  319. package/theme/macarons.js +80 -57
  320. package/theme/macarons2.js +251 -0
  321. package/theme/mint.js +155 -0
  322. package/theme/red-velvet.js +163 -0
  323. package/theme/red.js +225 -0
  324. package/theme/roma.js +55 -22
  325. package/theme/royal.js +163 -0
  326. package/theme/sakura.js +140 -0
  327. package/theme/shine.js +52 -45
  328. package/theme/tech-blue.js +180 -0
  329. package/theme/vintage.js +37 -23
@@ -99,48 +99,6 @@ function fixExtent(niceTickExtent, extent) {
99
99
  }
100
100
  }
101
101
 
102
- function intervalScaleGetTicks(interval, extent, niceTickExtent, intervalPrecision) {
103
- var ticks = []; // If interval is 0, return [];
104
-
105
- if (!interval) {
106
- return ticks;
107
- } // Consider this case: using dataZoom toolbox, zoom and zoom.
108
-
109
-
110
- var safeLimit = 10000;
111
-
112
- if (extent[0] < niceTickExtent[0]) {
113
- ticks.push(extent[0]);
114
- }
115
-
116
- var tick = niceTickExtent[0];
117
-
118
- while (tick <= niceTickExtent[1]) {
119
- ticks.push(tick); // Avoid rounding error
120
-
121
- tick = roundNumber(tick + interval, intervalPrecision);
122
-
123
- if (tick === ticks[ticks.length - 1]) {
124
- // Consider out of safe float point, e.g.,
125
- // -3711126.9907707 + 2e-10 === -3711126.9907707
126
- break;
127
- }
128
-
129
- if (ticks.length > safeLimit) {
130
- return [];
131
- }
132
- } // Consider this case: the last item of ticks is smaller
133
- // than niceTickExtent[1] and niceTickExtent[1] === extent[1].
134
-
135
-
136
- if (extent[1] > (ticks.length ? ticks[ticks.length - 1] : niceTickExtent[1])) {
137
- ticks.push(extent[1]);
138
- }
139
-
140
- return ticks;
141
- }
142
-
143
102
  exports.intervalScaleNiceTicks = intervalScaleNiceTicks;
144
103
  exports.getIntervalPrecision = getIntervalPrecision;
145
- exports.fixExtent = fixExtent;
146
- exports.intervalScaleGetTicks = intervalScaleGetTicks;
104
+ exports.fixExtent = fixExtent;
@@ -101,7 +101,7 @@ var proto = Scheduler.prototype;
101
101
  */
102
102
 
103
103
  proto.restoreData = function (ecModel, payload) {
104
- // TODO: Only restroe needed series and components, but not all components.
104
+ // TODO: Only restore needed series and components, but not all components.
105
105
  // Currently `restoreData` of all of the series and component will be called.
106
106
  // But some independent components like `title`, `legend`, `graphic`, `toolbox`,
107
107
  // `tooltip`, `axisPointer`, etc, do not need series refresh when `setOption`,
@@ -280,7 +280,15 @@ function performStageTasks(scheduler, stageHandlers, ecModel, payload, opt) {
280
280
  task.dirty();
281
281
  }
282
282
 
283
- var performArgs = scheduler.getPerformArgs(task, opt.block);
283
+ var performArgs = scheduler.getPerformArgs(task, opt.block); // FIXME
284
+ // if intending to decalare `performRawSeries` in handlers, only
285
+ // stream-independent (specifically, data item independent) operations can be
286
+ // performed. Because is a series is filtered, most of the tasks will not
287
+ // be performed. A stream-dependent operation probably cause wrong biz logic.
288
+ // Perhaps we should not provide a separate callback for this case instead
289
+ // of providing the config `performRawSeries`. The stream-dependent operaions
290
+ // and stream-independent operations should better not be mixed.
291
+
284
292
  performArgs.skip = !stageHandler.performRawSeries && ecModel.isSeriesFiltered(task.context.model);
285
293
  updatePayload(task, payload);
286
294
  unfinished |= task.perform(performArgs);
package/lib/theme/dark.js CHANGED
@@ -80,6 +80,9 @@ var theme = {
80
80
  },
81
81
  crossStyle: {
82
82
  color: contrastColor
83
+ },
84
+ label: {
85
+ color: '#000'
83
86
  }
84
87
  }
85
88
  },
@@ -45,7 +45,7 @@ var numberUtil = require("./number");
45
45
  // import Text from 'zrender/src/graphic/Text';
46
46
 
47
47
  /**
48
- * 每三位默认加,格式化
48
+ * add commas after every three numbers
49
49
  * @param {string|number} x
50
50
  * @return {string}
51
51
  */
@@ -261,6 +261,22 @@ function getTextBoundingRect(opt) {
261
261
  function getTextRect(text, font, textAlign, textVerticalAlign, textPadding, rich, truncate, textLineHeight) {
262
262
  return textContain.getBoundingRect(text, font, textAlign, textVerticalAlign, textPadding, textLineHeight, rich, truncate);
263
263
  }
264
+ /**
265
+ * open new tab
266
+ * @param {string} link url
267
+ * @param {string} target blank or self
268
+ */
269
+
270
+
271
+ function windowOpen(link, target) {
272
+ if (target === '_blank' || target === 'blank') {
273
+ var blank = window.open();
274
+ blank.opener = null;
275
+ blank.location = link;
276
+ } else {
277
+ window.open(link, target);
278
+ }
279
+ }
264
280
 
265
281
  exports.addCommas = addCommas;
266
282
  exports.toCamelCase = toCamelCase;
@@ -273,4 +289,5 @@ exports.formatTime = formatTime;
273
289
  exports.capitalFirst = capitalFirst;
274
290
  exports.truncateText = truncateText;
275
291
  exports.getTextBoundingRect = getTextBoundingRect;
276
- exports.getTextRect = getTextRect;
292
+ exports.getTextRect = getTextRect;
293
+ exports.windowOpen = windowOpen;
@@ -727,11 +727,13 @@ function getHighlightDigit(highlightKey) {
727
727
  * @param {Object} opt Check `opt` of `setTextStyleCommon` to find other props.
728
728
  * @param {string|Function} [opt.defaultText]
729
729
  * @param {module:echarts/model/Model} [opt.labelFetcher] Fetch text by
730
- * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
731
- * @param {module:echarts/model/Model} [opt.labelDataIndex] Fetch text by
732
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
733
- * @param {module:echarts/model/Model} [opt.labelDimIndex] Fetch text by
734
- * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex)`
730
+ * `opt.labelFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
731
+ * @param {number} [opt.labelDataIndex] Fetch text by
732
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
733
+ * @param {number} [opt.labelDimIndex] Fetch text by
734
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
735
+ * @param {string} [opt.labelProp] Fetch text by
736
+ * `opt.textFetcher.getFormattedLabel(opt.labelDataIndex, 'normal'/'emphasis', null, opt.labelDimIndex, opt.labelProp)`
735
737
  * @param {Object} [normalSpecified]
736
738
  * @param {Object} [emphasisSpecified]
737
739
  */
@@ -741,7 +743,8 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
741
743
  opt = opt || EMPTY_OBJ;
742
744
  var labelFetcher = opt.labelFetcher;
743
745
  var labelDataIndex = opt.labelDataIndex;
744
- var labelDimIndex = opt.labelDimIndex; // This scenario, `label.normal.show = true; label.emphasis.show = false`,
746
+ var labelDimIndex = opt.labelDimIndex;
747
+ var labelProp = opt.labelProp; // This scenario, `label.normal.show = true; label.emphasis.show = false`,
745
748
  // is not supported util someone requests.
746
749
 
747
750
  var showNormal = normalModel.getShallow('show');
@@ -753,7 +756,7 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
753
756
 
754
757
  if (showNormal || showEmphasis) {
755
758
  if (labelFetcher) {
756
- baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex);
759
+ baseText = labelFetcher.getFormattedLabel(labelDataIndex, 'normal', null, labelDimIndex, labelProp);
757
760
  }
758
761
 
759
762
  if (baseText == null) {
@@ -762,7 +765,7 @@ function setLabelStyle(normalStyle, emphasisStyle, normalModel, emphasisModel, o
762
765
  }
763
766
 
764
767
  var normalStyleText = showNormal ? baseText : null;
765
- var emphasisStyleText = showEmphasis ? zrUtil.retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex) : null, baseText) : null; // Optimize: If style.text is null, text will not be drawn.
768
+ var emphasisStyleText = showEmphasis ? zrUtil.retrieve2(labelFetcher ? labelFetcher.getFormattedLabel(labelDataIndex, 'emphasis', null, labelDimIndex, labelProp) : null, baseText) : null; // Optimize: If style.text is null, text will not be drawn.
766
769
 
767
770
  if (normalStyleText != null || emphasisStyleText != null) {
768
771
  // Always set `textStyle` even if `normalStyle.text` is null, because default
@@ -1125,8 +1128,7 @@ function rollbackDefaultTextStyle(style) {
1125
1128
  }
1126
1129
 
1127
1130
  function getFont(opt, ecModel) {
1128
- // ecModel or default text style model.
1129
- var gTextStyleModel = ecModel || ecModel.getModel('textStyle');
1131
+ var gTextStyleModel = ecModel && ecModel.getModel('textStyle');
1130
1132
  return zrUtil.trim([// FIXME in node-canvas fontWeight is before fontStyle
1131
1133
  opt.fontStyle || gTextStyleModel && gTextStyleModel.getShallow('fontStyle') || '', opt.fontWeight || gTextStyleModel && gTextStyleModel.getShallow('fontWeight') || '', (opt.fontSize || gTextStyleModel && gTextStyleModel.getShallow('fontSize') || 12) + 'px', opt.fontFamily || gTextStyleModel && gTextStyleModel.getShallow('fontFamily') || 'sans-serif'].join(' '));
1132
1134
  }
@@ -1168,7 +1170,7 @@ function animateOrSetProps(isUpdate, el, props, animatableModel, dataIndex, cb)
1168
1170
  * configuration in series.
1169
1171
  *
1170
1172
  * Caution: this method will stop previous animation.
1171
- * So if do not use this method to one element twice before
1173
+ * So do not use this method to one element twice before
1172
1174
  * animation starts, unless you know what you are doing.
1173
1175
  *
1174
1176
  * @param {module:zrender/Element} el
@@ -1195,7 +1197,7 @@ function updateProps(el, props, animatableModel, dataIndex, cb) {
1195
1197
  * configuration in series.
1196
1198
  *
1197
1199
  * Caution: this method will stop previous animation.
1198
- * So if do not use this method to one element twice before
1200
+ * So do not use this method to one element twice before
1199
1201
  * animation starts, unless you know what you are doing.
1200
1202
  *
1201
1203
  * @param {module:zrender/Element} el
@@ -0,0 +1,75 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+ /*
22
+ * Licensed to the Apache Software Foundation (ASF) under one
23
+ * or more contributor license agreements. See the NOTICE file
24
+ * distributed with this work for additional information
25
+ * regarding copyright ownership. The ASF licenses this file
26
+ * to you under the Apache License, Version 2.0 (the
27
+ * "License"); you may not use this file except in compliance
28
+ * with the License. You may obtain a copy of the License at
29
+ *
30
+ * http://www.apache.org/licenses/LICENSE-2.0
31
+ *
32
+ * Unless required by applicable law or agreed to in writing,
33
+ * software distributed under the License is distributed on an
34
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35
+ * KIND, either express or implied. See the License for the
36
+ * specific language governing permissions and limitations
37
+ * under the License.
38
+ */
39
+
40
+ /**
41
+ * LegendVisualProvider is an bridge that pick encoded color from data and
42
+ * provide to the legend component.
43
+ * @param {Function} getDataWithEncodedVisual Function to get data after filtered. It stores all the encoding info
44
+ * @param {Function} getRawData Function to get raw data before filtered.
45
+ */
46
+ function LegendVisualProvider(getDataWithEncodedVisual, getRawData) {
47
+ this.getAllNames = function () {
48
+ var rawData = getRawData(); // We find the name from the raw data. In case it's filtered by the legend component.
49
+ // Normally, the name can be found in rawData, but can't be found in filtered data will display as gray.
50
+
51
+ return rawData.mapArray(rawData.getName);
52
+ };
53
+
54
+ this.containName = function (name) {
55
+ var rawData = getRawData();
56
+ return rawData.indexOfName(name) >= 0;
57
+ };
58
+
59
+ this.indexOfName = function (name) {
60
+ // Only get data when necessary.
61
+ // Because LegendVisualProvider constructor may be new in the stage that data is not prepared yet.
62
+ // Invoking Series#getData immediately will throw an error.
63
+ var dataWithEncodedVisual = getDataWithEncodedVisual();
64
+ return dataWithEncodedVisual.indexOfName(name);
65
+ };
66
+
67
+ this.getItemVisual = function (dataIndex, key) {
68
+ // Get encoded visual properties from final filtered data.
69
+ var dataWithEncodedVisual = getDataWithEncodedVisual();
70
+ return dataWithEncodedVisual.getItemVisual(dataIndex, key);
71
+ };
72
+ }
73
+
74
+ var _default = LegendVisualProvider;
75
+ module.exports = _default;
@@ -70,7 +70,7 @@ var CATEGORY_DEFAULT_VISUAL_INDEX = -1;
70
70
  * visual data can be array or object
71
71
  * (like: {cate1: '#222', none: '#fff'})
72
72
  * or primary types (which represents
73
- * defualt category visual), otherwise visual
73
+ * default category visual), otherwise visual
74
74
  * can be array or primary (which will be
75
75
  * normalized to array).
76
76
  *
@@ -76,29 +76,19 @@ function _default(seriesType) {
76
76
  }
77
77
 
78
78
  if (!singleDataColor) {
79
- var color = itemModel.get('itemStyle.color') || seriesModel.getColorFromPalette(dataAll.getName(rawIdx) || rawIdx + '', seriesModel.__paletteScope, dataAll.count()); // Legend may use the visual info in data before processed
80
-
81
- dataAll.setItemVisual(rawIdx, 'color', color); // Data is not filtered
79
+ var color = itemModel.get('itemStyle.color') || seriesModel.getColorFromPalette(dataAll.getName(rawIdx) || rawIdx + '', seriesModel.__paletteScope, dataAll.count()); // Data is not filtered
82
80
 
83
81
  if (filteredIdx != null) {
84
82
  data.setItemVisual(filteredIdx, 'color', color);
85
83
  }
86
- } else {
87
- // Set data all color for legend
88
- dataAll.setItemVisual(rawIdx, 'color', singleDataColor);
89
84
  }
90
85
 
91
86
  if (!singleDataBorderColor) {
92
- var borderColor = itemModel.get('itemStyle.borderColor'); // Legend may use the visual info in data before processed
93
-
94
- dataAll.setItemVisual(rawIdx, 'borderColor', borderColor); // Data is not filtered
87
+ var borderColor = itemModel.get('itemStyle.borderColor'); // Data is not filtered
95
88
 
96
89
  if (filteredIdx != null) {
97
90
  data.setItemVisual(filteredIdx, 'borderColor', borderColor);
98
91
  }
99
- } else {
100
- // Set data all borderColor for legend
101
- dataAll.setItemVisual(rawIdx, 'borderColor', singleDataBorderColor);
102
92
  }
103
93
  });
104
94
  }
@@ -20,6 +20,10 @@
20
20
 
21
21
  var Gradient = require("zrender/lib/graphic/Gradient");
22
22
 
23
+ var _util = require("zrender/lib/core/util");
24
+
25
+ var isFunction = _util.isFunction;
26
+
23
27
  /*
24
28
  * Licensed to the Apache Software Foundation (ASF) under one
25
29
  * or more contributor license agreements. See the NOTICE file
@@ -43,11 +47,15 @@ var _default = {
43
47
  performRawSeries: true,
44
48
  reset: function (seriesModel, ecModel) {
45
49
  var data = seriesModel.getData();
46
- var colorAccessPath = (seriesModel.visualColorAccessPath || 'itemStyle.color').split('.');
47
- var color = seriesModel.get(colorAccessPath) // Set in itemStyle
48
- || seriesModel.getColorFromPalette( // TODO series count changed.
49
- seriesModel.name, null, ecModel.getSeriesCount()); // Default color
50
- // FIXME Set color function or use the platte color
50
+ var colorAccessPath = (seriesModel.visualColorAccessPath || 'itemStyle.color').split('.'); // Set in itemStyle
51
+
52
+ var color = seriesModel.get(colorAccessPath);
53
+ var colorCallback = isFunction(color) && !(color instanceof Gradient) ? color : null; // Default color
54
+
55
+ if (!color || colorCallback) {
56
+ color = seriesModel.getColorFromPalette( // TODO series count changed.
57
+ seriesModel.name, null, ecModel.getSeriesCount());
58
+ }
51
59
 
52
60
  data.setVisual('color', color);
53
61
  var borderColorAccessPath = (seriesModel.visualBorderColorAccessPath || 'itemStyle.borderColor').split('.');
@@ -55,9 +63,9 @@ var _default = {
55
63
  data.setVisual('borderColor', borderColor); // Only visible series has each data be visual encoded
56
64
 
57
65
  if (!ecModel.isSeriesFiltered(seriesModel)) {
58
- if (typeof color === 'function' && !(color instanceof Gradient)) {
66
+ if (colorCallback) {
59
67
  data.each(function (idx) {
60
- data.setItemVisual(idx, 'color', color(seriesModel.getDataParams(idx)));
68
+ data.setItemVisual(idx, 'color', colorCallback(seriesModel.getDataParams(idx)));
61
69
  });
62
70
  } // itemStyle in each data item
63
71
 
@@ -51,11 +51,14 @@ function _default(seriesType, defaultSymbolType, legendSymbol) {
51
51
  var symbolType = seriesModel.get('symbol');
52
52
  var symbolSize = seriesModel.get('symbolSize');
53
53
  var keepAspect = seriesModel.get('symbolKeepAspect');
54
+ var symbolRotate = seriesModel.get('symbolRotate');
54
55
  var hasSymbolTypeCallback = isFunction(symbolType);
55
56
  var hasSymbolSizeCallback = isFunction(symbolSize);
56
- var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback;
57
+ var hasSymbolRotateCallback = isFunction(symbolRotate);
58
+ var hasCallback = hasSymbolTypeCallback || hasSymbolSizeCallback || hasSymbolRotateCallback;
57
59
  var seriesSymbol = !hasSymbolTypeCallback && symbolType ? symbolType : defaultSymbolType;
58
60
  var seriesSymbolSize = !hasSymbolSizeCallback ? symbolSize : null;
61
+ var seriesSymbolRotate = !hasSymbolRotateCallback ? seriesSymbolRotate : null;
59
62
  data.setVisual({
60
63
  legendSymbol: legendSymbol || seriesSymbol,
61
64
  // If seting callback functions on `symbol` or `symbolSize`, for simplicity and avoiding
@@ -64,7 +67,8 @@ function _default(seriesType, defaultSymbolType, legendSymbol) {
64
67
  // some cases but generally it is not recommanded.
65
68
  symbol: seriesSymbol,
66
69
  symbolSize: seriesSymbolSize,
67
- symbolKeepAspect: keepAspect
70
+ symbolKeepAspect: keepAspect,
71
+ symbolRotate: symbolRotate
68
72
  }); // Only visible series has each data be visual encoded
69
73
 
70
74
  if (ecModel.isSeriesFiltered(seriesModel)) {
@@ -77,12 +81,14 @@ function _default(seriesType, defaultSymbolType, legendSymbol) {
77
81
  var params = seriesModel.getDataParams(idx);
78
82
  hasSymbolTypeCallback && data.setItemVisual(idx, 'symbol', symbolType(rawValue, params));
79
83
  hasSymbolSizeCallback && data.setItemVisual(idx, 'symbolSize', symbolSize(rawValue, params));
84
+ hasSymbolRotateCallback && data.setItemVisual(idx, 'symbolRotate', symbolRotate(rawValue, params));
80
85
  }
81
86
 
82
87
  if (data.hasItemOption) {
83
88
  var itemModel = data.getItemModel(idx);
84
89
  var itemSymbolType = itemModel.getShallow('symbol', true);
85
90
  var itemSymbolSize = itemModel.getShallow('symbolSize', true);
91
+ var itemSymbolRotate = itemModel.getShallow('symbolRotate', true);
86
92
  var itemSymbolKeepAspect = itemModel.getShallow('symbolKeepAspect', true); // If has item symbol
87
93
 
88
94
  if (itemSymbolType != null) {
@@ -94,6 +100,10 @@ function _default(seriesType, defaultSymbolType, legendSymbol) {
94
100
  data.setItemVisual(idx, 'symbolSize', itemSymbolSize);
95
101
  }
96
102
 
103
+ if (itemSymbolRotate != null) {
104
+ data.setItemVisual(idx, 'symbolRotate', itemSymbolRotate);
105
+ }
106
+
97
107
  if (itemSymbolKeepAspect != null) {
98
108
  data.setItemVisual(idx, 'symbolKeepAspect', itemSymbolKeepAspect);
99
109
  }
package/map/.DS_Store ADDED
Binary file
Binary file