echarts 4.4.0 → 4.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 (211) hide show
  1. package/.github/ISSUE_TEMPLATE.md +1 -1
  2. package/.github/workflows/nodejs.yml +31 -0
  3. package/CONTRIBUTING.md +2 -2
  4. package/README.md +6 -12
  5. package/dist/echarts-en.common.js +2354 -1029
  6. package/dist/echarts-en.common.min.js +1 -1
  7. package/dist/echarts-en.js +2727 -1138
  8. package/dist/echarts-en.js.map +1 -1
  9. package/dist/echarts-en.min.js +1 -1
  10. package/dist/echarts-en.simple.js +2028 -759
  11. package/dist/echarts-en.simple.min.js +1 -1
  12. package/dist/echarts.common.js +2354 -1029
  13. package/dist/echarts.common.min.js +1 -1
  14. package/dist/echarts.js +2727 -1138
  15. package/dist/echarts.js.map +1 -1
  16. package/dist/echarts.min.js +1 -1
  17. package/dist/echarts.simple.js +2028 -759
  18. package/dist/echarts.simple.min.js +1 -1
  19. package/dist/extension/dataTool.js +9 -0
  20. package/dist/extension/dataTool.js.map +1 -1
  21. package/echarts.all.js +1 -1
  22. package/lib/chart/bar/BarSeries.js +4 -1
  23. package/lib/chart/bar/BarView.js +20 -6
  24. package/lib/chart/bar/BaseBarSeries.js +5 -1
  25. package/lib/chart/candlestick/CandlestickSeries.js +1 -0
  26. package/lib/chart/candlestick/CandlestickView.js +42 -1
  27. package/lib/chart/custom.js +1 -0
  28. package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
  29. package/lib/chart/funnel/FunnelSeries.js +15 -5
  30. package/lib/chart/gauge/GaugeSeries.js +0 -9
  31. package/lib/chart/graph/GraphSeries.js +11 -4
  32. package/lib/chart/graph/GraphView.js +28 -8
  33. package/lib/chart/graph/forceHelper.js +8 -2
  34. package/lib/chart/graph/forceLayout.js +5 -2
  35. package/lib/chart/heatmap/HeatmapView.js +4 -4
  36. package/lib/chart/helper/Symbol.js +8 -0
  37. package/lib/chart/helper/createListFromArray.js +14 -8
  38. package/lib/chart/helper/whiskerBoxCommon.js +22 -16
  39. package/lib/chart/line/LineSeries.js +3 -1
  40. package/lib/chart/line/LineView.js +8 -2
  41. package/lib/chart/map/MapSeries.js +8 -1
  42. package/lib/chart/pie/PieSeries.js +27 -6
  43. package/lib/chart/pie/PieView.js +1 -1
  44. package/lib/chart/pie/labelLayout.js +102 -19
  45. package/lib/chart/pie/pieLayout.js +19 -7
  46. package/lib/chart/radar/RadarSeries.js +3 -3
  47. package/lib/chart/sankey/SankeyView.js +28 -9
  48. package/lib/chart/scatter/ScatterSeries.js +3 -1
  49. package/lib/chart/themeRiver/ThemeRiverSeries.js +3 -3
  50. package/lib/chart/tree/TreeSeries.js +15 -1
  51. package/lib/chart/tree/TreeView.js +4 -2
  52. package/lib/component/axis/AngleAxisView.js +97 -20
  53. package/lib/component/axis/AxisBuilder.js +63 -24
  54. package/lib/component/axis/CartesianAxisView.js +55 -11
  55. package/lib/component/axis/RadiusAxisView.js +36 -4
  56. package/lib/component/brush/BrushView.js +6 -0
  57. package/lib/component/brush/brushAction.js +5 -0
  58. package/lib/component/dataZoom/DataZoomModel.js +15 -1
  59. package/lib/component/dataZoom/SliderZoomView.js +4 -10
  60. package/lib/component/helper/BrushController.js +43 -25
  61. package/lib/component/legend/LegendModel.js +3 -3
  62. package/lib/component/legend/LegendView.js +17 -13
  63. package/lib/component/toolbox/ToolboxView.js +16 -7
  64. package/lib/component/toolbox/feature/MagicType.js +19 -14
  65. package/lib/coord/Axis.js +44 -12
  66. package/lib/coord/axisDefault.js +21 -2
  67. package/lib/coord/axisTickLabelBuilder.js +9 -1
  68. package/lib/coord/cartesian/Cartesian2D.js +0 -15
  69. package/lib/coord/geo/geoJSONLoader.js +1 -1
  70. package/lib/coord/polar/polarCreator.js +11 -2
  71. package/lib/coord/radar/Radar.js +3 -1
  72. package/lib/coord/radar/RadarModel.js +4 -1
  73. package/lib/data/DataDiffer.js +2 -4
  74. package/lib/data/DataDimensionInfo.js +157 -0
  75. package/lib/data/List.js +29 -23
  76. package/lib/data/Tree.js +2 -1
  77. package/lib/data/helper/completeDimensions.js +43 -32
  78. package/lib/data/helper/createDimensions.js +2 -0
  79. package/lib/data/helper/sourceHelper.js +214 -114
  80. package/lib/echarts.js +2 -2
  81. package/lib/layout/barGrid.js +136 -11
  82. package/lib/layout/barPolar.js +2 -2
  83. package/lib/model/Global.js +1 -1
  84. package/lib/model/Series.js +3 -3
  85. package/lib/model/referHelper.js +40 -12
  86. package/lib/scale/Interval.js +87 -2
  87. package/lib/scale/Log.js +9 -2
  88. package/lib/scale/helper.js +1 -43
  89. package/lib/theme/dark.js +3 -0
  90. package/lib/util/graphic.js +1 -2
  91. package/lib/util/number.js +25 -1
  92. package/lib/util/shape/sausage.js +93 -0
  93. package/lib/visual/LegendVisualProvider.js +75 -0
  94. package/lib/visual/dataColor.js +2 -12
  95. package/lib/visual/seriesColor.js +15 -7
  96. package/map/js/china.js +2 -2
  97. package/map/json/china.json +1 -1
  98. package/map/json/province/tianjin.json +1 -1
  99. package/package.json +3 -2
  100. package/src/chart/bar/BarSeries.js +5 -1
  101. package/src/chart/bar/BarView.js +24 -8
  102. package/src/chart/bar/BaseBarSeries.js +5 -1
  103. package/src/chart/candlestick/CandlestickSeries.js +2 -0
  104. package/src/chart/candlestick/CandlestickView.js +44 -1
  105. package/src/chart/custom.js +1 -0
  106. package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
  107. package/src/chart/funnel/FunnelSeries.js +11 -4
  108. package/src/chart/gauge/GaugeSeries.js +0 -6
  109. package/src/chart/graph/GraphSeries.js +10 -3
  110. package/src/chart/graph/GraphView.js +26 -8
  111. package/src/chart/graph/forceHelper.js +7 -3
  112. package/src/chart/graph/forceLayout.js +6 -3
  113. package/src/chart/heatmap/HeatmapView.js +4 -4
  114. package/src/chart/helper/Symbol.js +9 -0
  115. package/src/chart/helper/createClipPathFromCoordSys.js +5 -1
  116. package/src/chart/helper/createGraphFromNodeEdge.js +1 -1
  117. package/src/chart/helper/createListFromArray.js +13 -8
  118. package/src/chart/helper/whiskerBoxCommon.js +21 -16
  119. package/src/chart/line/LineSeries.js +1 -1
  120. package/src/chart/line/LineView.js +6 -1
  121. package/src/chart/map/MapSeries.js +5 -1
  122. package/src/chart/pie/PieSeries.js +26 -5
  123. package/src/chart/pie/PieView.js +1 -1
  124. package/src/chart/pie/labelLayout.js +114 -22
  125. package/src/chart/pie/pieLayout.js +20 -7
  126. package/src/chart/radar/RadarSeries.js +5 -3
  127. package/src/chart/sankey/SankeyView.js +26 -9
  128. package/src/chart/scatter/ScatterSeries.js +1 -1
  129. package/src/chart/themeRiver/ThemeRiverSeries.js +4 -3
  130. package/src/chart/tree/TreeSeries.js +12 -1
  131. package/src/chart/tree/TreeView.js +5 -2
  132. package/src/component/axis/AngleAxisView.js +106 -19
  133. package/src/component/axis/AxisBuilder.js +78 -33
  134. package/src/component/axis/CartesianAxisView.js +58 -11
  135. package/src/component/axis/RadiusAxisView.js +37 -4
  136. package/src/component/brush/BrushView.js +6 -0
  137. package/src/component/brush/brushAction.js +6 -1
  138. package/src/component/dataZoom/DataZoomModel.js +15 -1
  139. package/src/component/dataZoom/SliderZoomView.js +4 -9
  140. package/src/component/helper/BrushController.js +50 -28
  141. package/src/component/legend/LegendModel.js +3 -3
  142. package/src/component/legend/LegendView.js +18 -12
  143. package/src/component/toolbox/ToolboxView.js +18 -5
  144. package/src/component/toolbox/feature/MagicType.js +18 -13
  145. package/src/coord/Axis.js +48 -13
  146. package/src/coord/axisDefault.js +25 -1
  147. package/src/coord/axisTickLabelBuilder.js +10 -0
  148. package/src/coord/cartesian/Cartesian2D.js +0 -13
  149. package/src/coord/geo/geoJSONLoader.js +2 -2
  150. package/src/coord/polar/polarCreator.js +16 -3
  151. package/src/coord/radar/Radar.js +3 -1
  152. package/src/coord/radar/RadarModel.js +5 -2
  153. package/src/data/DataDiffer.js +1 -4
  154. package/src/data/DataDimensionInfo.js +135 -0
  155. package/src/data/Graph.js +1 -1
  156. package/src/data/List.js +33 -20
  157. package/src/data/Tree.js +3 -1
  158. package/src/data/helper/completeDimensions.js +49 -30
  159. package/src/data/helper/createDimensions.js +2 -0
  160. package/src/data/helper/sourceHelper.js +216 -124
  161. package/src/echarts.js +2 -2
  162. package/src/layout/barGrid.js +136 -13
  163. package/src/layout/barPolar.js +3 -2
  164. package/src/model/Global.js +1 -1
  165. package/src/model/Series.js +3 -3
  166. package/src/model/referHelper.js +34 -11
  167. package/src/scale/Interval.js +84 -4
  168. package/src/scale/Log.js +9 -2
  169. package/src/scale/helper.js +1 -39
  170. package/src/theme/dark.js +3 -0
  171. package/src/util/graphic.js +1 -2
  172. package/src/util/number.js +22 -2
  173. package/src/util/shape/sausage.js +93 -0
  174. package/src/visual/LegendVisualProvider.js +55 -0
  175. package/src/visual/dataColor.js +0 -13
  176. package/src/visual/seriesColor.js +13 -7
  177. package/theme/azul.js +163 -0
  178. package/theme/bee-inspired.js +178 -0
  179. package/theme/blue.js +178 -0
  180. package/theme/caravan.js +178 -0
  181. package/theme/carp.js +163 -0
  182. package/theme/cool.js +180 -0
  183. package/theme/dark-blue.js +168 -0
  184. package/theme/dark-bold.js +168 -0
  185. package/theme/dark-digerati.js +168 -0
  186. package/theme/dark-fresh-cut.js +168 -0
  187. package/theme/dark-mushroom.js +168 -0
  188. package/theme/dark.js +69 -62
  189. package/theme/eduardo.js +178 -0
  190. package/theme/forest.js +163 -0
  191. package/theme/fresh-cut.js +163 -0
  192. package/theme/fruit.js +178 -0
  193. package/theme/gray.js +220 -0
  194. package/theme/green.js +222 -0
  195. package/theme/helianthus.js +263 -0
  196. package/theme/infographic.js +72 -57
  197. package/theme/inspired.js +163 -0
  198. package/theme/jazz.js +163 -0
  199. package/theme/london.js +163 -0
  200. package/theme/macarons.js +80 -57
  201. package/theme/macarons2.js +251 -0
  202. package/theme/mint.js +155 -0
  203. package/theme/red-velvet.js +163 -0
  204. package/theme/red.js +225 -0
  205. package/theme/roma.js +55 -22
  206. package/theme/royal.js +163 -0
  207. package/theme/sakura.js +140 -0
  208. package/theme/shine.js +52 -45
  209. package/theme/tech-blue.js +180 -0
  210. package/theme/vintage.js +37 -23
  211. package/.travis.yml +0 -16
package/src/data/List.js CHANGED
@@ -31,6 +31,7 @@ import DataDiffer from './DataDiffer';
31
31
  import Source from './Source';
32
32
  import {defaultDimValueGetters, DefaultDataProvider} from './helper/dataProvider';
33
33
  import {summarizeDimensions} from './helper/dimensionHelper';
34
+ import DataDimensionInfo from './DataDimensionInfo';
34
35
 
35
36
  var isObject = zrUtil.isObject;
36
37
 
@@ -102,13 +103,9 @@ function transferProperties(target, source) {
102
103
  * @constructor
103
104
  * @alias module:echarts/data/List
104
105
  *
105
- * @param {Array.<string|Object>} dimensions
106
+ * @param {Array.<string|Object|module:data/DataDimensionInfo>} dimensions
106
107
  * For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].
107
108
  * Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
108
- * Spetial fields: {
109
- * ordinalMeta: <module:echarts/data/OrdinalMeta>
110
- * createInvertedIndices: <boolean>
111
- * }
112
109
  * @param {module:echarts/model/Model} hostModel
113
110
  */
114
111
  var List = function (dimensions, hostModel) {
@@ -124,7 +121,10 @@ var List = function (dimensions, hostModel) {
124
121
  var dimensionInfo = dimensions[i];
125
122
 
126
123
  if (zrUtil.isString(dimensionInfo)) {
127
- dimensionInfo = {name: dimensionInfo};
124
+ dimensionInfo = new DataDimensionInfo({name: dimensionInfo});
125
+ }
126
+ else if (!(dimensionInfo instanceof DataDimensionInfo)) {
127
+ dimensionInfo = new DataDimensionInfo(dimensionInfo);
128
128
  }
129
129
 
130
130
  var dimensionName = dimensionInfo.name;
@@ -1105,14 +1105,14 @@ listProto.indexOfName = function (name) {
1105
1105
  * @return {number}
1106
1106
  */
1107
1107
  listProto.indexOfRawIndex = function (rawIndex) {
1108
- if (!this._indices) {
1109
- return rawIndex;
1110
- }
1111
-
1112
1108
  if (rawIndex >= this._rawCount || rawIndex < 0) {
1113
1109
  return -1;
1114
1110
  }
1115
1111
 
1112
+ if (!this._indices) {
1113
+ return rawIndex;
1114
+ }
1115
+
1116
1116
  // Indices are ascending
1117
1117
  var indices = this._indices;
1118
1118
 
@@ -1144,7 +1144,8 @@ listProto.indexOfRawIndex = function (rawIndex) {
1144
1144
  * @param {string} dim
1145
1145
  * @param {number} value
1146
1146
  * @param {number} [maxDistance=Infinity]
1147
- * @return {Array.<number>} Considere multiple points has the same value.
1147
+ * @return {Array.<number>} If and only if multiple indices has
1148
+ * the same value, they are put to the result.
1148
1149
  */
1149
1150
  listProto.indicesOfNearest = function (dim, value, maxDistance) {
1150
1151
  var storage = this._storage;
@@ -1159,23 +1160,35 @@ listProto.indicesOfNearest = function (dim, value, maxDistance) {
1159
1160
  maxDistance = Infinity;
1160
1161
  }
1161
1162
 
1162
- var minDist = Number.MAX_VALUE;
1163
+ var minDist = Infinity;
1163
1164
  var minDiff = -1;
1165
+ var nearestIndicesLen = 0;
1166
+
1167
+ // Check the test case of `test/ut/spec/data/List.js`.
1164
1168
  for (var i = 0, len = this.count(); i < len; i++) {
1165
- var diff = value - this.get(dim, i /*, stack */);
1169
+ var diff = value - this.get(dim, i);
1166
1170
  var dist = Math.abs(diff);
1167
- if (diff <= maxDistance && dist <= minDist) {
1168
- // For the case of two data are same on xAxis, which has sequence data.
1169
- // Show the nearest index
1170
- // https://github.com/ecomfe/echarts/issues/2869
1171
- if (dist < minDist || (diff >= 0 && minDiff < 0)) {
1171
+ if (dist <= maxDistance) {
1172
+ // When the `value` is at the middle of `this.get(dim, i)` and `this.get(dim, i+1)`,
1173
+ // we'd better not push both of them to `nearestIndices`, otherwise it is easy to
1174
+ // get more than one item in `nearestIndices` (more specifically, in `tooltip`).
1175
+ // So we chose the one that `diff >= 0` in this csae.
1176
+ // But if `this.get(dim, i)` and `this.get(dim, j)` get the same value, both of them
1177
+ // should be push to `nearestIndices`.
1178
+ if (dist < minDist
1179
+ || (dist === minDist && diff >= 0 && minDiff < 0)
1180
+ ) {
1172
1181
  minDist = dist;
1173
1182
  minDiff = diff;
1174
- nearestIndices.length = 0;
1183
+ nearestIndicesLen = 0;
1184
+ }
1185
+ if (diff === minDiff) {
1186
+ nearestIndices[nearestIndicesLen++] = i;
1175
1187
  }
1176
- nearestIndices.push(i);
1177
1188
  }
1178
1189
  }
1190
+ nearestIndices.length = nearestIndicesLen;
1191
+
1179
1192
  return nearestIndices;
1180
1193
  };
1181
1194
 
package/src/data/Tree.js CHANGED
@@ -472,7 +472,7 @@ Tree.prototype = {
472
472
  * @param {Array.<Object>} treeOptions.leaves
473
473
  * @return module:echarts/data/Tree
474
474
  */
475
- Tree.createTree = function (dataRoot, hostModel, treeOptions) {
475
+ Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
476
476
 
477
477
  var tree = new Tree(hostModel, treeOptions.levels, treeOptions.leaves);
478
478
  var listData = [];
@@ -519,6 +519,8 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions) {
519
519
 
520
520
  tree.update();
521
521
 
522
+ beforeLink && beforeLink(list);
523
+
522
524
  return tree;
523
525
  };
524
526
 
@@ -24,15 +24,20 @@
24
24
 
25
25
  import {createHashMap, each, isString, defaults, extend, isObject, clone} from 'zrender/src/core/util';
26
26
  import {normalizeToArray} from '../../util/model';
27
- import {guessOrdinal} from './sourceHelper';
27
+ import {guessOrdinal, BE_ORDINAL} from './sourceHelper';
28
28
  import Source from '../Source';
29
29
  import {OTHER_DIMENSIONS} from './dimensionHelper';
30
+ import DataDimensionInfo from '../DataDimensionInfo';
30
31
 
31
32
  /**
32
33
  * @see {module:echarts/test/ut/spec/data/completeDimensions}
33
34
  *
34
- * Complete the dimensions array, by user defined `dimension` and `encode`,
35
- * and guessing from the data structure.
35
+ * This method builds the relationship between:
36
+ * + "what the coord sys or series requires (see `sysDims`)",
37
+ * + "what the user defines (in `encode` and `dimensions`, see `opt.dimsDef` and `opt.encodeDef`)"
38
+ * + "what the data source provids (see `source`)".
39
+ *
40
+ * Some guess strategy will be adapted if user does not define something.
36
41
  * If no 'value' dimension specified, the first no-named dimension will be
37
42
  * named as 'value'.
38
43
  *
@@ -48,32 +53,20 @@ import {OTHER_DIMENSIONS} from './dimensionHelper';
48
53
  * @param {Array.<Object|string>} [opt.dimsDef] option.series.dimensions User defined dimensions
49
54
  * For example: ['asdf', {name, type}, ...].
50
55
  * @param {Object|HashMap} [opt.encodeDef] option.series.encode {x: 2, y: [3, 1], tooltip: [1, 2], label: 3}
56
+ * @param {Function} [opt.encodeDefaulter] Called if no `opt.encodeDef` exists.
57
+ * If not specified, auto find the next available data dim.
58
+ * param source {module:data/Source}
59
+ * param dimCount {number}
60
+ * return {Object} encode Never be `null/undefined`.
51
61
  * @param {string} [opt.generateCoord] Generate coord dim with the given name.
52
- * If not specified, extra dim names will be:
53
- * 'value', 'value0', 'value1', ...
62
+ * If not specified, extra dim names will be:
63
+ * 'value', 'value0', 'value1', ...
54
64
  * @param {number} [opt.generateCoordCount] By default, the generated dim name is `generateCoord`.
55
- * If `generateCoordCount` specified, the generated dim names will be:
56
- * `generateCoord` + 0, `generateCoord` + 1, ...
57
- * can be Infinity, indicate that use all of the remain columns.
65
+ * If `generateCoordCount` specified, the generated dim names will be:
66
+ * `generateCoord` + 0, `generateCoord` + 1, ...
67
+ * can be Infinity, indicate that use all of the remain columns.
58
68
  * @param {number} [opt.dimCount] If not specified, guess by the first data item.
59
- * @param {number} [opt.encodeDefaulter] If not specified, auto find the next available data dim.
60
- * @return {Array.<Object>} [{
61
- * name: string mandatory,
62
- * displayName: string, the origin name in dimsDef, see source helper.
63
- * If displayName given, the tooltip will displayed vertically.
64
- * coordDim: string mandatory,
65
- * coordDimIndex: number mandatory,
66
- * type: string optional,
67
- * otherDims: { never null/undefined
68
- * tooltip: number optional,
69
- * label: number optional,
70
- * itemName: number optional,
71
- * seriesName: number optional,
72
- * },
73
- * isExtraCoord: boolean true if coord is generated
74
- * (not specified in encode and not series specified)
75
- * other props ...
76
- * }]
69
+ * @return {Array.<module:data/DataDimensionInfo>}
77
70
  */
78
71
  function completeDimensions(sysDims, source, opt) {
79
72
  if (!Source.isInstance(source)) {
@@ -83,7 +76,6 @@ function completeDimensions(sysDims, source, opt) {
83
76
  opt = opt || {};
84
77
  sysDims = (sysDims || []).slice();
85
78
  var dimsDef = (opt.dimsDef || []).slice();
86
- var encodeDef = createHashMap(opt.encodeDef);
87
79
  var dataDimNameMap = createHashMap();
88
80
  var coordDimNameMap = createHashMap();
89
81
  // var valueCandidate;
@@ -97,7 +89,7 @@ function completeDimensions(sysDims, source, opt) {
97
89
  {}, isObject(dimsDef[i]) ? dimsDef[i] : {name: dimsDef[i]}
98
90
  );
99
91
  var userDimName = dimDefItem.name;
100
- var resultItem = result[i] = {otherDims: {}};
92
+ var resultItem = result[i] = new DataDimensionInfo();
101
93
  // Name will be applied later for avoiding duplication.
102
94
  if (userDimName != null && dataDimNameMap.get(userDimName) == null) {
103
95
  // Only if `series.dimensions` is defined in option
@@ -110,6 +102,12 @@ function completeDimensions(sysDims, source, opt) {
110
102
  dimDefItem.displayName != null && (resultItem.displayName = dimDefItem.displayName);
111
103
  }
112
104
 
105
+ var encodeDef = opt.encodeDef;
106
+ if (!encodeDef && opt.encodeDefaulter) {
107
+ encodeDef = opt.encodeDefaulter(source, dimCount);
108
+ }
109
+ encodeDef = createHashMap(encodeDef);
110
+
113
111
  // Set `coordDim` and `coordDimIndex` by `encodeDef` and normalize `encodeDef`.
114
112
  encodeDef.each(function (dataDims, coordDim) {
115
113
  dataDims = normalizeToArray(dataDims).slice();
@@ -211,7 +209,7 @@ function completeDimensions(sysDims, source, opt) {
211
209
 
212
210
  // Set dim `name` and other `coordDim` and other props.
213
211
  for (var resultDimIdx = 0; resultDimIdx < dimCount; resultDimIdx++) {
214
- var resultItem = result[resultDimIdx] = result[resultDimIdx] || {};
212
+ var resultItem = result[resultDimIdx] = result[resultDimIdx] || new DataDimensionInfo();
215
213
  var coordDim = resultItem.coordDim;
216
214
 
217
215
  if (coordDim == null) {
@@ -230,7 +228,28 @@ function completeDimensions(sysDims, source, opt) {
230
228
  dataDimNameMap
231
229
  ));
232
230
 
233
- if (resultItem.type == null && guessOrdinal(source, resultDimIdx, resultItem.name)) {
231
+ if (resultItem.type == null
232
+ && (
233
+ guessOrdinal(source, resultDimIdx, resultItem.name) === BE_ORDINAL.Must
234
+ // Consider the case:
235
+ // {
236
+ // dataset: {source: [
237
+ // ['2001', 123],
238
+ // ['2002', 456],
239
+ // ...
240
+ // ['The others', 987],
241
+ // ]},
242
+ // series: {type: 'pie'}
243
+ // }
244
+ // The first colum should better be treated as a "ordinal" although it
245
+ // might not able to be detected as an "ordinal" by `guessOrdinal`.
246
+ || (resultItem.isExtraCoord
247
+ && (resultItem.otherDims.itemName != null
248
+ || resultItem.otherDims.seriesName != null
249
+ )
250
+ )
251
+ )
252
+ ) {
234
253
  resultItem.type = 'ordinal';
235
254
  }
236
255
  }
@@ -32,6 +32,7 @@ import completeDimensions from './completeDimensions';
32
32
  * @param {string} [opt.generateCoordCount]
33
33
  * @param {Array.<string|Object>} [opt.dimensionsDefine=source.dimensionsDefine] Overwrite source define.
34
34
  * @param {Object|HashMap} [opt.encodeDefine=source.encodeDefine] Overwrite source define.
35
+ * @param {Function} [opt.encodeDefaulter] Make default encode if user not specified.
35
36
  * @return {Array.<Object>} dimensionsInfo
36
37
  */
37
38
  export default function (source, opt) {
@@ -40,6 +41,7 @@ export default function (source, opt) {
40
41
  dimsDef: opt.dimensionsDefine || source.dimensionsDefine,
41
42
  encodeDef: opt.encodeDefine || source.encodeDefine,
42
43
  dimCount: opt.dimensionsCount,
44
+ encodeDefaulter: opt.encodeDefaulter,
43
45
  generateCoord: opt.generateCoord,
44
46
  generateCoordCount: opt.generateCoordCount
45
47
  });