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.
- package/.github/ISSUE_TEMPLATE.md +1 -1
- package/.github/workflows/nodejs.yml +31 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +6 -12
- package/dist/echarts-en.common.js +2354 -1029
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +2727 -1138
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +2028 -759
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +2354 -1029
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +2727 -1138
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +2028 -759
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/dataTool.js +9 -0
- package/dist/extension/dataTool.js.map +1 -1
- package/echarts.all.js +1 -1
- package/lib/chart/bar/BarSeries.js +4 -1
- package/lib/chart/bar/BarView.js +20 -6
- package/lib/chart/bar/BaseBarSeries.js +5 -1
- package/lib/chart/candlestick/CandlestickSeries.js +1 -0
- package/lib/chart/candlestick/CandlestickView.js +42 -1
- package/lib/chart/custom.js +1 -0
- package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
- package/lib/chart/funnel/FunnelSeries.js +15 -5
- package/lib/chart/gauge/GaugeSeries.js +0 -9
- package/lib/chart/graph/GraphSeries.js +11 -4
- package/lib/chart/graph/GraphView.js +28 -8
- package/lib/chart/graph/forceHelper.js +8 -2
- package/lib/chart/graph/forceLayout.js +5 -2
- package/lib/chart/heatmap/HeatmapView.js +4 -4
- package/lib/chart/helper/Symbol.js +8 -0
- package/lib/chart/helper/createListFromArray.js +14 -8
- package/lib/chart/helper/whiskerBoxCommon.js +22 -16
- package/lib/chart/line/LineSeries.js +3 -1
- package/lib/chart/line/LineView.js +8 -2
- package/lib/chart/map/MapSeries.js +8 -1
- package/lib/chart/pie/PieSeries.js +27 -6
- package/lib/chart/pie/PieView.js +1 -1
- package/lib/chart/pie/labelLayout.js +102 -19
- package/lib/chart/pie/pieLayout.js +19 -7
- package/lib/chart/radar/RadarSeries.js +3 -3
- package/lib/chart/sankey/SankeyView.js +28 -9
- package/lib/chart/scatter/ScatterSeries.js +3 -1
- package/lib/chart/themeRiver/ThemeRiverSeries.js +3 -3
- package/lib/chart/tree/TreeSeries.js +15 -1
- package/lib/chart/tree/TreeView.js +4 -2
- package/lib/component/axis/AngleAxisView.js +97 -20
- package/lib/component/axis/AxisBuilder.js +63 -24
- package/lib/component/axis/CartesianAxisView.js +55 -11
- package/lib/component/axis/RadiusAxisView.js +36 -4
- package/lib/component/brush/BrushView.js +6 -0
- package/lib/component/brush/brushAction.js +5 -0
- package/lib/component/dataZoom/DataZoomModel.js +15 -1
- package/lib/component/dataZoom/SliderZoomView.js +4 -10
- package/lib/component/helper/BrushController.js +43 -25
- package/lib/component/legend/LegendModel.js +3 -3
- package/lib/component/legend/LegendView.js +17 -13
- package/lib/component/toolbox/ToolboxView.js +16 -7
- package/lib/component/toolbox/feature/MagicType.js +19 -14
- package/lib/coord/Axis.js +44 -12
- package/lib/coord/axisDefault.js +21 -2
- package/lib/coord/axisTickLabelBuilder.js +9 -1
- package/lib/coord/cartesian/Cartesian2D.js +0 -15
- package/lib/coord/geo/geoJSONLoader.js +1 -1
- package/lib/coord/polar/polarCreator.js +11 -2
- package/lib/coord/radar/Radar.js +3 -1
- package/lib/coord/radar/RadarModel.js +4 -1
- package/lib/data/DataDiffer.js +2 -4
- package/lib/data/DataDimensionInfo.js +157 -0
- package/lib/data/List.js +29 -23
- package/lib/data/Tree.js +2 -1
- package/lib/data/helper/completeDimensions.js +43 -32
- package/lib/data/helper/createDimensions.js +2 -0
- package/lib/data/helper/sourceHelper.js +214 -114
- package/lib/echarts.js +2 -2
- package/lib/layout/barGrid.js +136 -11
- package/lib/layout/barPolar.js +2 -2
- package/lib/model/Global.js +1 -1
- package/lib/model/Series.js +3 -3
- package/lib/model/referHelper.js +40 -12
- package/lib/scale/Interval.js +87 -2
- package/lib/scale/Log.js +9 -2
- package/lib/scale/helper.js +1 -43
- package/lib/theme/dark.js +3 -0
- package/lib/util/graphic.js +1 -2
- package/lib/util/number.js +25 -1
- package/lib/util/shape/sausage.js +93 -0
- package/lib/visual/LegendVisualProvider.js +75 -0
- package/lib/visual/dataColor.js +2 -12
- package/lib/visual/seriesColor.js +15 -7
- package/map/js/china.js +2 -2
- package/map/json/china.json +1 -1
- package/map/json/province/tianjin.json +1 -1
- package/package.json +3 -2
- package/src/chart/bar/BarSeries.js +5 -1
- package/src/chart/bar/BarView.js +24 -8
- package/src/chart/bar/BaseBarSeries.js +5 -1
- package/src/chart/candlestick/CandlestickSeries.js +2 -0
- package/src/chart/candlestick/CandlestickView.js +44 -1
- package/src/chart/custom.js +1 -0
- package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
- package/src/chart/funnel/FunnelSeries.js +11 -4
- package/src/chart/gauge/GaugeSeries.js +0 -6
- package/src/chart/graph/GraphSeries.js +10 -3
- package/src/chart/graph/GraphView.js +26 -8
- package/src/chart/graph/forceHelper.js +7 -3
- package/src/chart/graph/forceLayout.js +6 -3
- package/src/chart/heatmap/HeatmapView.js +4 -4
- package/src/chart/helper/Symbol.js +9 -0
- package/src/chart/helper/createClipPathFromCoordSys.js +5 -1
- package/src/chart/helper/createGraphFromNodeEdge.js +1 -1
- package/src/chart/helper/createListFromArray.js +13 -8
- package/src/chart/helper/whiskerBoxCommon.js +21 -16
- package/src/chart/line/LineSeries.js +1 -1
- package/src/chart/line/LineView.js +6 -1
- package/src/chart/map/MapSeries.js +5 -1
- package/src/chart/pie/PieSeries.js +26 -5
- package/src/chart/pie/PieView.js +1 -1
- package/src/chart/pie/labelLayout.js +114 -22
- package/src/chart/pie/pieLayout.js +20 -7
- package/src/chart/radar/RadarSeries.js +5 -3
- package/src/chart/sankey/SankeyView.js +26 -9
- package/src/chart/scatter/ScatterSeries.js +1 -1
- package/src/chart/themeRiver/ThemeRiverSeries.js +4 -3
- package/src/chart/tree/TreeSeries.js +12 -1
- package/src/chart/tree/TreeView.js +5 -2
- package/src/component/axis/AngleAxisView.js +106 -19
- package/src/component/axis/AxisBuilder.js +78 -33
- package/src/component/axis/CartesianAxisView.js +58 -11
- package/src/component/axis/RadiusAxisView.js +37 -4
- package/src/component/brush/BrushView.js +6 -0
- package/src/component/brush/brushAction.js +6 -1
- package/src/component/dataZoom/DataZoomModel.js +15 -1
- package/src/component/dataZoom/SliderZoomView.js +4 -9
- package/src/component/helper/BrushController.js +50 -28
- package/src/component/legend/LegendModel.js +3 -3
- package/src/component/legend/LegendView.js +18 -12
- package/src/component/toolbox/ToolboxView.js +18 -5
- package/src/component/toolbox/feature/MagicType.js +18 -13
- package/src/coord/Axis.js +48 -13
- package/src/coord/axisDefault.js +25 -1
- package/src/coord/axisTickLabelBuilder.js +10 -0
- package/src/coord/cartesian/Cartesian2D.js +0 -13
- package/src/coord/geo/geoJSONLoader.js +2 -2
- package/src/coord/polar/polarCreator.js +16 -3
- package/src/coord/radar/Radar.js +3 -1
- package/src/coord/radar/RadarModel.js +5 -2
- package/src/data/DataDiffer.js +1 -4
- package/src/data/DataDimensionInfo.js +135 -0
- package/src/data/Graph.js +1 -1
- package/src/data/List.js +33 -20
- package/src/data/Tree.js +3 -1
- package/src/data/helper/completeDimensions.js +49 -30
- package/src/data/helper/createDimensions.js +2 -0
- package/src/data/helper/sourceHelper.js +216 -124
- package/src/echarts.js +2 -2
- package/src/layout/barGrid.js +136 -13
- package/src/layout/barPolar.js +3 -2
- package/src/model/Global.js +1 -1
- package/src/model/Series.js +3 -3
- package/src/model/referHelper.js +34 -11
- package/src/scale/Interval.js +84 -4
- package/src/scale/Log.js +9 -2
- package/src/scale/helper.js +1 -39
- package/src/theme/dark.js +3 -0
- package/src/util/graphic.js +1 -2
- package/src/util/number.js +22 -2
- package/src/util/shape/sausage.js +93 -0
- package/src/visual/LegendVisualProvider.js +55 -0
- package/src/visual/dataColor.js +0 -13
- package/src/visual/seriesColor.js +13 -7
- package/theme/azul.js +163 -0
- package/theme/bee-inspired.js +178 -0
- package/theme/blue.js +178 -0
- package/theme/caravan.js +178 -0
- package/theme/carp.js +163 -0
- package/theme/cool.js +180 -0
- package/theme/dark-blue.js +168 -0
- package/theme/dark-bold.js +168 -0
- package/theme/dark-digerati.js +168 -0
- package/theme/dark-fresh-cut.js +168 -0
- package/theme/dark-mushroom.js +168 -0
- package/theme/dark.js +69 -62
- package/theme/eduardo.js +178 -0
- package/theme/forest.js +163 -0
- package/theme/fresh-cut.js +163 -0
- package/theme/fruit.js +178 -0
- package/theme/gray.js +220 -0
- package/theme/green.js +222 -0
- package/theme/helianthus.js +263 -0
- package/theme/infographic.js +72 -57
- package/theme/inspired.js +163 -0
- package/theme/jazz.js +163 -0
- package/theme/london.js +163 -0
- package/theme/macarons.js +80 -57
- package/theme/macarons2.js +251 -0
- package/theme/mint.js +155 -0
- package/theme/red-velvet.js +163 -0
- package/theme/red.js +225 -0
- package/theme/roma.js +55 -22
- package/theme/royal.js +163 -0
- package/theme/sakura.js +140 -0
- package/theme/shine.js +52 -45
- package/theme/tech-blue.js +180 -0
- package/theme/vintage.js +37 -23
- package/.travis.yml +0 -16
|
@@ -45,6 +45,7 @@ var featureManager = require("../featureManager");
|
|
|
45
45
|
* under the License.
|
|
46
46
|
*/
|
|
47
47
|
var magicTypeLang = lang.toolbox.magicType;
|
|
48
|
+
var INNER_STACK_KEYWORD = '__ec_magicType_stack__';
|
|
48
49
|
|
|
49
50
|
function MagicType(model) {
|
|
50
51
|
this.model = model;
|
|
@@ -58,9 +59,8 @@ MagicType.defaultOption = {
|
|
|
58
59
|
/* eslint-disable */
|
|
59
60
|
line: 'M4.1,28.9h7.1l9.3-22l7.4,38l9.7-19.7l3,12.8h14.9M4.1,58h51.4',
|
|
60
61
|
bar: 'M6.7,22.9h10V48h-10V22.9zM24.9,13h10v35h-10V13zM43.2,2h10v46h-10V2zM3.1,58h53.7',
|
|
61
|
-
stack: 'M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z'
|
|
62
|
-
|
|
63
|
-
tiled: 'M2.3,2.2h22.8V25H2.3V2.2z M35,2.2h22.8V25H35V2.2zM2.3,35h22.8v22.8H2.3V35z M35,35h22.8v22.8H35V35z'
|
|
62
|
+
stack: 'M8.2,38.4l-8.4,4.1l30.6,15.3L60,42.5l-8.1-4.1l-21.5,11L8.2,38.4z M51.9,30l-8.1,4.2l-13.4,6.9l-13.9-6.9L8.2,30l-8.4,4.2l8.4,4.2l22.2,11l21.5-11l8.1-4.2L51.9,30z M51.9,21.7l-8.1,4.2L35.7,30l-5.3,2.8L24.9,30l-8.4-4.1l-8.3-4.2l-8.4,4.2L8.2,30l8.3,4.2l13.9,6.9l13.4-6.9l8.1-4.2l8.1-4.1L51.9,21.7zM30.4,2.2L-0.2,17.5l8.4,4.1l8.3,4.2l8.4,4.2l5.5,2.7l5.3-2.7l8.1-4.2l8.1-4.2l8.1-4.1L30.4,2.2z' // jshint ignore:line
|
|
63
|
+
|
|
64
64
|
/* eslint-enable */
|
|
65
65
|
|
|
66
66
|
},
|
|
@@ -111,23 +111,18 @@ var seriesOptGenreator = {
|
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
'stack': function (seriesType, seriesId, seriesModel, model) {
|
|
114
|
+
var isStack = seriesModel.get('stack') === INNER_STACK_KEYWORD;
|
|
115
|
+
|
|
114
116
|
if (seriesType === 'line' || seriesType === 'bar') {
|
|
117
|
+
model.setIconStatus('stack', isStack ? 'normal' : 'emphasis');
|
|
115
118
|
return zrUtil.merge({
|
|
116
119
|
id: seriesId,
|
|
117
|
-
stack: '
|
|
120
|
+
stack: isStack ? '' : INNER_STACK_KEYWORD
|
|
118
121
|
}, model.get('option.stack') || {}, true);
|
|
119
122
|
}
|
|
120
|
-
},
|
|
121
|
-
'tiled': function (seriesType, seriesId, seriesModel, model) {
|
|
122
|
-
if (seriesType === 'line' || seriesType === 'bar') {
|
|
123
|
-
return zrUtil.merge({
|
|
124
|
-
id: seriesId,
|
|
125
|
-
stack: ''
|
|
126
|
-
}, model.get('option.tiled') || {}, true);
|
|
127
|
-
}
|
|
128
123
|
}
|
|
129
124
|
};
|
|
130
|
-
var radioTypes = [['line', 'bar'], ['stack'
|
|
125
|
+
var radioTypes = [['line', 'bar'], ['stack']];
|
|
131
126
|
|
|
132
127
|
proto.onclick = function (ecModel, api, type) {
|
|
133
128
|
var model = this.model;
|
|
@@ -192,10 +187,20 @@ proto.onclick = function (ecModel, api, type) {
|
|
|
192
187
|
seriesIndex: seriesIndex
|
|
193
188
|
}
|
|
194
189
|
}, generateNewSeriesTypes);
|
|
190
|
+
var newTitle; // Change title of stack
|
|
191
|
+
|
|
192
|
+
if (type === 'stack') {
|
|
193
|
+
var isStack = newOption.series && newOption.series[0] && newOption.series[0].stack === INNER_STACK_KEYWORD;
|
|
194
|
+
newTitle = isStack ? zrUtil.merge({
|
|
195
|
+
stack: magicTypeLang.title.tiled
|
|
196
|
+
}, magicTypeLang.title) : zrUtil.clone(magicTypeLang.title);
|
|
197
|
+
}
|
|
198
|
+
|
|
195
199
|
api.dispatchAction({
|
|
196
200
|
type: 'changeMagicType',
|
|
197
201
|
currentType: type,
|
|
198
|
-
newOption: newOption
|
|
202
|
+
newOption: newOption,
|
|
203
|
+
newTitle: newTitle
|
|
199
204
|
});
|
|
200
205
|
};
|
|
201
206
|
|
package/lib/coord/Axis.js
CHANGED
|
@@ -27,6 +27,7 @@ var _number = require("../util/number");
|
|
|
27
27
|
|
|
28
28
|
var linearMap = _number.linearMap;
|
|
29
29
|
var getPixelPrecision = _number.getPixelPrecision;
|
|
30
|
+
var round = _number.round;
|
|
30
31
|
|
|
31
32
|
var _axisTickLabelBuilder = require("./axisTickLabelBuilder");
|
|
32
33
|
|
|
@@ -110,7 +111,7 @@ Axis.prototype = {
|
|
|
110
111
|
* @return {boolean}
|
|
111
112
|
*/
|
|
112
113
|
containData: function (data) {
|
|
113
|
-
return this.contain(
|
|
114
|
+
return this.scale.contain(data);
|
|
114
115
|
},
|
|
115
116
|
|
|
116
117
|
/**
|
|
@@ -193,7 +194,7 @@ Axis.prototype = {
|
|
|
193
194
|
* `axis.getTicksCoords` considers `onBand`, which is used by
|
|
194
195
|
* `boundaryGap:true` of category axis and splitLine and splitArea.
|
|
195
196
|
* @param {Object} [opt]
|
|
196
|
-
* @param {
|
|
197
|
+
* @param {Model} [opt.tickModel=axis.model.getModel('axisTick')]
|
|
197
198
|
* @param {boolean} [opt.clamp] If `true`, the first and the last
|
|
198
199
|
* tick must be at the axis end points. Otherwise, clip ticks
|
|
199
200
|
* that outside the axis extent.
|
|
@@ -214,10 +215,38 @@ Axis.prototype = {
|
|
|
214
215
|
};
|
|
215
216
|
}, this);
|
|
216
217
|
var alignWithLabel = tickModel.get('alignWithLabel');
|
|
217
|
-
fixOnBandTicksCoords(this, ticksCoords,
|
|
218
|
+
fixOnBandTicksCoords(this, ticksCoords, alignWithLabel, opt.clamp);
|
|
218
219
|
return ticksCoords;
|
|
219
220
|
},
|
|
220
221
|
|
|
222
|
+
/**
|
|
223
|
+
* @return {Array.<Array.<Object>>} [{ coord: ..., tickValue: ...}]
|
|
224
|
+
*/
|
|
225
|
+
getMinorTicksCoords: function () {
|
|
226
|
+
if (this.scale.type === 'ordinal') {
|
|
227
|
+
// Category axis doesn't support minor ticks
|
|
228
|
+
return [];
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
var minorTickModel = this.model.getModel('minorTick');
|
|
232
|
+
var splitNumber = minorTickModel.get('splitNumber'); // Protection.
|
|
233
|
+
|
|
234
|
+
if (!(splitNumber > 0 && splitNumber < 100)) {
|
|
235
|
+
splitNumber = 5;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
var minorTicks = this.scale.getMinorTicks(splitNumber);
|
|
239
|
+
var minorTicksCoords = map(minorTicks, function (minorTicksGroup) {
|
|
240
|
+
return map(minorTicksGroup, function (minorTick) {
|
|
241
|
+
return {
|
|
242
|
+
coord: this.dataToCoord(minorTick),
|
|
243
|
+
tickValue: minorTick
|
|
244
|
+
};
|
|
245
|
+
}, this);
|
|
246
|
+
}, this);
|
|
247
|
+
return minorTicksCoords;
|
|
248
|
+
},
|
|
249
|
+
|
|
221
250
|
/**
|
|
222
251
|
* @return {Array.<Object>} [{
|
|
223
252
|
* formattedLabel: string,
|
|
@@ -301,7 +330,7 @@ function fixExtentWithBands(extent, nTick) {
|
|
|
301
330
|
// case).
|
|
302
331
|
|
|
303
332
|
|
|
304
|
-
function fixOnBandTicksCoords(axis, ticksCoords,
|
|
333
|
+
function fixOnBandTicksCoords(axis, ticksCoords, alignWithLabel, clamp) {
|
|
305
334
|
var ticksLen = ticksCoords.length;
|
|
306
335
|
|
|
307
336
|
if (!axis.onBand || alignWithLabel || !ticksLen) {
|
|
@@ -310,6 +339,7 @@ function fixOnBandTicksCoords(axis, ticksCoords, tickCategoryInterval, alignWith
|
|
|
310
339
|
|
|
311
340
|
var axisExtent = axis.getExtent();
|
|
312
341
|
var last;
|
|
342
|
+
var diffSize;
|
|
313
343
|
|
|
314
344
|
if (ticksLen === 1) {
|
|
315
345
|
ticksCoords[0].coord = axisExtent[0];
|
|
@@ -317,22 +347,20 @@ function fixOnBandTicksCoords(axis, ticksCoords, tickCategoryInterval, alignWith
|
|
|
317
347
|
coord: axisExtent[0]
|
|
318
348
|
};
|
|
319
349
|
} else {
|
|
320
|
-
var
|
|
350
|
+
var crossLen = ticksCoords[ticksLen - 1].tickValue - ticksCoords[0].tickValue;
|
|
351
|
+
var shift = (ticksCoords[ticksLen - 1].coord - ticksCoords[0].coord) / crossLen;
|
|
321
352
|
each(ticksCoords, function (ticksItem) {
|
|
322
353
|
ticksItem.coord -= shift / 2;
|
|
323
|
-
var tickCategoryInterval = tickCategoryInterval || 0; // Avoid split a single data item when odd interval.
|
|
324
|
-
|
|
325
|
-
if (tickCategoryInterval % 2 > 0) {
|
|
326
|
-
ticksItem.coord -= shift / ((tickCategoryInterval + 1) * 2);
|
|
327
|
-
}
|
|
328
354
|
});
|
|
355
|
+
var dataExtent = axis.scale.getExtent();
|
|
356
|
+
diffSize = 1 + dataExtent[1] - ticksCoords[ticksLen - 1].tickValue;
|
|
329
357
|
last = {
|
|
330
|
-
coord: ticksCoords[ticksLen - 1].coord + shift
|
|
358
|
+
coord: ticksCoords[ticksLen - 1].coord + shift * diffSize
|
|
331
359
|
};
|
|
332
360
|
ticksCoords.push(last);
|
|
333
361
|
}
|
|
334
362
|
|
|
335
|
-
var inverse = axisExtent[0] > axisExtent[1];
|
|
363
|
+
var inverse = axisExtent[0] > axisExtent[1]; // Handling clamp.
|
|
336
364
|
|
|
337
365
|
if (littleThan(ticksCoords[0].coord, axisExtent[0])) {
|
|
338
366
|
clamp ? ticksCoords[0].coord = axisExtent[0] : ticksCoords.shift();
|
|
@@ -355,6 +383,10 @@ function fixOnBandTicksCoords(axis, ticksCoords, tickCategoryInterval, alignWith
|
|
|
355
383
|
}
|
|
356
384
|
|
|
357
385
|
function littleThan(a, b) {
|
|
386
|
+
// Avoid rounding error cause calculated tick coord different with extent.
|
|
387
|
+
// It may cause an extra unecessary tick added.
|
|
388
|
+
a = round(a);
|
|
389
|
+
b = round(b);
|
|
358
390
|
return inverse ? a > b : a < b;
|
|
359
391
|
}
|
|
360
392
|
}
|
package/lib/coord/axisDefault.js
CHANGED
|
@@ -170,13 +170,32 @@ axisDefault.valueAxis = zrUtil.merge({
|
|
|
170
170
|
// + `true`: the extent do not consider value 0.
|
|
171
171
|
// scale: false,
|
|
172
172
|
// AxisTick and axisLabel and splitLine are caculated based on splitNumber.
|
|
173
|
-
splitNumber: 5
|
|
173
|
+
splitNumber: 5,
|
|
174
|
+
// Interval specifies the span of the ticks is mandatorily.
|
|
174
175
|
// interval: null
|
|
175
176
|
// Specify min interval when auto calculate tick interval.
|
|
176
177
|
// minInterval: null
|
|
177
178
|
// Specify max interval when auto calculate tick interval.
|
|
178
179
|
// maxInterval: null
|
|
179
|
-
|
|
180
|
+
minorTick: {
|
|
181
|
+
// Minor tick, not available for cateogry axis.
|
|
182
|
+
show: false,
|
|
183
|
+
// Split number of minor ticks. The value should be in range of (0, 100)
|
|
184
|
+
splitNumber: 5,
|
|
185
|
+
// Lenght of minor tick
|
|
186
|
+
length: 3,
|
|
187
|
+
// Same inside with axisTick
|
|
188
|
+
// Line style
|
|
189
|
+
lineStyle: {// Default to be same with axisTick
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
minorSplitLine: {
|
|
193
|
+
show: false,
|
|
194
|
+
lineStyle: {
|
|
195
|
+
color: '#eee',
|
|
196
|
+
width: 1
|
|
197
|
+
}
|
|
198
|
+
}
|
|
180
199
|
}, defaultOption);
|
|
181
200
|
axisDefault.timeAxis = zrUtil.defaults({
|
|
182
201
|
scale: true,
|
|
@@ -258,20 +258,28 @@ function calculateCategoryInterval(axis) {
|
|
|
258
258
|
isNaN(dh) && (dh = Infinity);
|
|
259
259
|
var interval = Math.max(0, Math.floor(Math.min(dw, dh)));
|
|
260
260
|
var cache = inner(axis.model);
|
|
261
|
+
var axisExtent = axis.getExtent();
|
|
261
262
|
var lastAutoInterval = cache.lastAutoInterval;
|
|
262
263
|
var lastTickCount = cache.lastTickCount; // Use cache to keep interval stable while moving zoom window,
|
|
263
264
|
// otherwise the calculated interval might jitter when the zoom
|
|
264
265
|
// window size is close to the interval-changing size.
|
|
266
|
+
// For example, if all of the axis labels are `a, b, c, d, e, f, g`.
|
|
267
|
+
// The jitter will cause that sometimes the displayed labels are
|
|
268
|
+
// `a, d, g` (interval: 2) sometimes `a, c, e`(interval: 1).
|
|
265
269
|
|
|
266
270
|
if (lastAutoInterval != null && lastTickCount != null && Math.abs(lastAutoInterval - interval) <= 1 && Math.abs(lastTickCount - tickCount) <= 1 // Always choose the bigger one, otherwise the critical
|
|
267
271
|
// point is not the same when zooming in or zooming out.
|
|
268
|
-
&& lastAutoInterval > interval
|
|
272
|
+
&& lastAutoInterval > interval // If the axis change is caused by chart resize, the cache should not
|
|
273
|
+
// be used. Otherwise some hiden labels might not be shown again.
|
|
274
|
+
&& cache.axisExtend0 === axisExtent[0] && cache.axisExtend1 === axisExtent[1]) {
|
|
269
275
|
interval = lastAutoInterval;
|
|
270
276
|
} // Only update cache if cache not used, otherwise the
|
|
271
277
|
// changing of interval is too insensitive.
|
|
272
278
|
else {
|
|
273
279
|
cache.lastTickCount = tickCount;
|
|
274
280
|
cache.lastAutoInterval = interval;
|
|
281
|
+
cache.axisExtend0 = axisExtent[0];
|
|
282
|
+
cache.axisExtend1 = axisExtent[1];
|
|
275
283
|
}
|
|
276
284
|
|
|
277
285
|
return interval;
|
|
@@ -42,21 +42,6 @@ var Cartesian = require("./Cartesian");
|
|
|
42
42
|
* specific language governing permissions and limitations
|
|
43
43
|
* under the License.
|
|
44
44
|
*/
|
|
45
|
-
// A helper function to calculate extent of axis.
|
|
46
|
-
function getAxisExtentWithGap(axis) {
|
|
47
|
-
var extent = axis.getGlobalExtent();
|
|
48
|
-
|
|
49
|
-
if (axis.onBand) {
|
|
50
|
-
// Remove extra 1px to avoid line miter in clipped edge
|
|
51
|
-
var halfBandWidth = axis.getBandWidth() / 2 - 1;
|
|
52
|
-
var dir = extent[1] > extent[0] ? 1 : -1;
|
|
53
|
-
extent[0] += dir * halfBandWidth;
|
|
54
|
-
extent[1] -= dir * halfBandWidth;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return extent;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
45
|
function Cartesian2D(name) {
|
|
61
46
|
Cartesian.call(this, name);
|
|
62
47
|
}
|
|
@@ -79,6 +79,7 @@ var _default = {
|
|
|
79
79
|
throw new Error('Invalid geoJson format\n' + e.message);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
fixNanhai(mapName, regions);
|
|
82
83
|
each(regions, function (region) {
|
|
83
84
|
var regionName = region.name;
|
|
84
85
|
fixTextCoord(mapName, region);
|
|
@@ -92,7 +93,6 @@ var _default = {
|
|
|
92
93
|
region.transformTo(specialArea.left, specialArea.top, specialArea.width, specialArea.height);
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
|
-
fixNanhai(mapName, regions);
|
|
96
96
|
return inner(mapRecord).parsed = {
|
|
97
97
|
regions: regions,
|
|
98
98
|
boundingRect: getBoundingRect(regions)
|
|
@@ -76,8 +76,17 @@ function resizePolar(polar, polarModel, api) {
|
|
|
76
76
|
polar.cy = parsePercent(center[1], height);
|
|
77
77
|
var radiusAxis = polar.getRadiusAxis();
|
|
78
78
|
var size = Math.min(width, height) / 2;
|
|
79
|
-
var radius =
|
|
80
|
-
|
|
79
|
+
var radius = polarModel.get('radius');
|
|
80
|
+
|
|
81
|
+
if (radius == null) {
|
|
82
|
+
radius = [0, '100%'];
|
|
83
|
+
} else if (!zrUtil.isArray(radius)) {
|
|
84
|
+
// r0 = 0
|
|
85
|
+
radius = [0, radius];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
radius = [parsePercent(radius[0], size), parsePercent(radius[1], size)];
|
|
89
|
+
radiusAxis.inverse ? radiusAxis.setExtent(radius[1], radius[0]) : radiusAxis.setExtent(radius[0], radius[1]);
|
|
81
90
|
}
|
|
82
91
|
/**
|
|
83
92
|
* Update polar
|
package/lib/coord/radar/Radar.js
CHANGED
|
@@ -33,6 +33,8 @@ var niceScaleExtent = _axisHelper.niceScaleExtent;
|
|
|
33
33
|
|
|
34
34
|
var CoordinateSystem = require("../../CoordinateSystem");
|
|
35
35
|
|
|
36
|
+
var LogScale = require("../../scale/Log");
|
|
37
|
+
|
|
36
38
|
/*
|
|
37
39
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
38
40
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -62,7 +64,7 @@ function Radar(radarModel, ecModel, api) {
|
|
|
62
64
|
this.dimensions = [];
|
|
63
65
|
this._indicatorAxes = zrUtil.map(radarModel.getIndicatorModels(), function (indicatorModel, idx) {
|
|
64
66
|
var dim = 'indicator_' + idx;
|
|
65
|
-
var indicatorAxis = new IndicatorAxis(dim, new IntervalScale());
|
|
67
|
+
var indicatorAxis = new IndicatorAxis(dim, indicatorModel.get('axisType') === 'log' ? new LogScale() : new IntervalScale());
|
|
66
68
|
indicatorAxis.name = indicatorModel.get('name'); // Inject model and axis
|
|
67
69
|
|
|
68
70
|
indicatorAxis.model = indicatorModel;
|
|
@@ -62,6 +62,7 @@ var RadarModel = echarts.extendComponentModel({
|
|
|
62
62
|
var scale = this.get('scale');
|
|
63
63
|
var axisLine = this.get('axisLine');
|
|
64
64
|
var axisTick = this.get('axisTick');
|
|
65
|
+
var axisType = this.get('axisType');
|
|
65
66
|
var axisLabel = this.get('axisLabel');
|
|
66
67
|
var nameTextStyle = this.get('name');
|
|
67
68
|
var showName = this.get('name.show');
|
|
@@ -91,8 +92,9 @@ var RadarModel = echarts.extendComponentModel({
|
|
|
91
92
|
scale: scale,
|
|
92
93
|
axisLine: axisLine,
|
|
93
94
|
axisTick: axisTick,
|
|
95
|
+
axisType: axisType,
|
|
94
96
|
axisLabel: axisLabel,
|
|
95
|
-
//
|
|
97
|
+
// Compatible with 2 and use text
|
|
96
98
|
name: indicatorOpt.text,
|
|
97
99
|
nameLocation: 'end',
|
|
98
100
|
nameGap: nameGap,
|
|
@@ -147,6 +149,7 @@ var RadarModel = echarts.extendComponentModel({
|
|
|
147
149
|
}, valueAxisDefault.axisLine),
|
|
148
150
|
axisLabel: defaultsShow(valueAxisDefault.axisLabel, false),
|
|
149
151
|
axisTick: defaultsShow(valueAxisDefault.axisTick, false),
|
|
152
|
+
axisType: 'interval',
|
|
150
153
|
splitLine: defaultsShow(valueAxisDefault.splitLine, true),
|
|
151
154
|
splitArea: defaultsShow(valueAxisDefault.splitArea, true),
|
|
152
155
|
// {text, min, max}
|
package/lib/data/DataDiffer.js
CHANGED
|
@@ -91,9 +91,7 @@ DataDiffer.prototype = {
|
|
|
91
91
|
var newDataKeyArr = [];
|
|
92
92
|
var i;
|
|
93
93
|
initIndexMap(oldArr, oldDataIndexMap, oldDataKeyArr, '_oldKeyGetter', this);
|
|
94
|
-
initIndexMap(newArr, newDataIndexMap, newDataKeyArr, '_newKeyGetter', this);
|
|
95
|
-
// when duplicate keys exists (consider newDataIndex.pop() below).
|
|
96
|
-
// For performance consideration, these code below do not look neat.
|
|
94
|
+
initIndexMap(newArr, newDataIndexMap, newDataKeyArr, '_newKeyGetter', this);
|
|
97
95
|
|
|
98
96
|
for (i = 0; i < oldArr.length; i++) {
|
|
99
97
|
var key = oldDataKeyArr[i];
|
|
@@ -106,7 +104,7 @@ DataDiffer.prototype = {
|
|
|
106
104
|
|
|
107
105
|
if (len) {
|
|
108
106
|
len === 1 && (newDataIndexMap[key] = null);
|
|
109
|
-
idx = idx.
|
|
107
|
+
idx = idx.shift();
|
|
110
108
|
} else {
|
|
111
109
|
newDataIndexMap[key] = null;
|
|
112
110
|
}
|
|
@@ -0,0 +1,157 @@
|
|
|
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
|
+
var zrUtil = require("zrender/lib/core/util");
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
25
|
+
* or more contributor license agreements. See the NOTICE file
|
|
26
|
+
* distributed with this work for additional information
|
|
27
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
28
|
+
* to you under the Apache License, Version 2.0 (the
|
|
29
|
+
* "License"); you may not use this file except in compliance
|
|
30
|
+
* with the License. You may obtain a copy of the License at
|
|
31
|
+
*
|
|
32
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
33
|
+
*
|
|
34
|
+
* Unless required by applicable law or agreed to in writing,
|
|
35
|
+
* software distributed under the License is distributed on an
|
|
36
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
37
|
+
* KIND, either express or implied. See the License for the
|
|
38
|
+
* specific language governing permissions and limitations
|
|
39
|
+
* under the License.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @class
|
|
44
|
+
* @param {Object|DataDimensionInfo} [opt] All of the fields will be shallow copied.
|
|
45
|
+
*/
|
|
46
|
+
function DataDimensionInfo(opt) {
|
|
47
|
+
if (opt != null) {
|
|
48
|
+
zrUtil.extend(this, opt);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Dimension name.
|
|
52
|
+
* Mandatory.
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
// this.name;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The origin name in dimsDef, see source helper.
|
|
59
|
+
* If displayName given, the tooltip will displayed vertically.
|
|
60
|
+
* Optional.
|
|
61
|
+
* @type {string}
|
|
62
|
+
*/
|
|
63
|
+
// this.displayName;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Which coordSys dimension this dimension mapped to.
|
|
67
|
+
* A `coordDim` can be a "coordSysDim" that the coordSys required
|
|
68
|
+
* (for example, an item in `coordSysDims` of `model/referHelper#CoordSysInfo`),
|
|
69
|
+
* or an generated "extra coord name" if does not mapped to any "coordSysDim"
|
|
70
|
+
* (That is determined by whether `isExtraCoord` is `true`).
|
|
71
|
+
* Mandatory.
|
|
72
|
+
* @type {string}
|
|
73
|
+
*/
|
|
74
|
+
// this.coordDim;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The index of this dimension in `series.encode[coordDim]`.
|
|
78
|
+
* Mandatory.
|
|
79
|
+
* @type {number}
|
|
80
|
+
*/
|
|
81
|
+
// this.coordDimIndex;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Dimension type. The enumerable values are the key of
|
|
85
|
+
* `dataCtors` of `data/List`.
|
|
86
|
+
* Optional.
|
|
87
|
+
* @type {string}
|
|
88
|
+
*/
|
|
89
|
+
// this.type;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* This index of this dimension info in `data/List#_dimensionInfos`.
|
|
93
|
+
* Mandatory after added to `data/List`.
|
|
94
|
+
* @type {number}
|
|
95
|
+
*/
|
|
96
|
+
// this.index;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The format of `otherDims` is:
|
|
100
|
+
* ```js
|
|
101
|
+
* {
|
|
102
|
+
* tooltip: number optional,
|
|
103
|
+
* label: number optional,
|
|
104
|
+
* itemName: number optional,
|
|
105
|
+
* seriesName: number optional,
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* A `series.encode` can specified these fields:
|
|
110
|
+
* ```js
|
|
111
|
+
* encode: {
|
|
112
|
+
* // "3, 1, 5" is the index of data dimension.
|
|
113
|
+
* tooltip: [3, 1, 5],
|
|
114
|
+
* label: [0, 3],
|
|
115
|
+
* ...
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
* `otherDims` is the parse result of the `series.encode` above, like:
|
|
119
|
+
* ```js
|
|
120
|
+
* // Suppose the index of this data dimension is `3`.
|
|
121
|
+
* this.otherDims = {
|
|
122
|
+
* // `3` is at the index `0` of the `encode.tooltip`
|
|
123
|
+
* tooltip: 0,
|
|
124
|
+
* // `3` is at the index `1` of the `encode.tooltip`
|
|
125
|
+
* label: 1
|
|
126
|
+
* };
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* This prop should never be `null`/`undefined` after initialized.
|
|
130
|
+
* @type {Object}
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
this.otherDims = {};
|
|
135
|
+
/**
|
|
136
|
+
* Be `true` if this dimension is not mapped to any "coordSysDim" that the
|
|
137
|
+
* "coordSys" required.
|
|
138
|
+
* Mandatory.
|
|
139
|
+
* @type {boolean}
|
|
140
|
+
*/
|
|
141
|
+
// this.isExtraCoord;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @type {module:data/OrdinalMeta}
|
|
145
|
+
*/
|
|
146
|
+
// this.ordinalMeta;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Whether to create inverted indices.
|
|
150
|
+
* @type {boolean}
|
|
151
|
+
*/
|
|
152
|
+
// this.createInvertedIndices;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
;
|
|
156
|
+
var _default = DataDimensionInfo;
|
|
157
|
+
module.exports = _default;
|
package/lib/data/List.js
CHANGED
|
@@ -39,6 +39,8 @@ var _dimensionHelper = require("./helper/dimensionHelper");
|
|
|
39
39
|
|
|
40
40
|
var summarizeDimensions = _dimensionHelper.summarizeDimensions;
|
|
41
41
|
|
|
42
|
+
var DataDimensionInfo = require("./DataDimensionInfo");
|
|
43
|
+
|
|
42
44
|
/*
|
|
43
45
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
44
46
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -114,13 +116,9 @@ function transferProperties(target, source) {
|
|
|
114
116
|
* @constructor
|
|
115
117
|
* @alias module:echarts/data/List
|
|
116
118
|
*
|
|
117
|
-
* @param {Array.<string|Object>} dimensions
|
|
119
|
+
* @param {Array.<string|Object|module:data/DataDimensionInfo>} dimensions
|
|
118
120
|
* For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].
|
|
119
121
|
* Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
|
|
120
|
-
* Spetial fields: {
|
|
121
|
-
* ordinalMeta: <module:echarts/data/OrdinalMeta>
|
|
122
|
-
* createInvertedIndices: <boolean>
|
|
123
|
-
* }
|
|
124
122
|
* @param {module:echarts/model/Model} hostModel
|
|
125
123
|
*/
|
|
126
124
|
|
|
@@ -136,9 +134,11 @@ var List = function (dimensions, hostModel) {
|
|
|
136
134
|
var dimensionInfo = dimensions[i];
|
|
137
135
|
|
|
138
136
|
if (zrUtil.isString(dimensionInfo)) {
|
|
139
|
-
dimensionInfo = {
|
|
137
|
+
dimensionInfo = new DataDimensionInfo({
|
|
140
138
|
name: dimensionInfo
|
|
141
|
-
};
|
|
139
|
+
});
|
|
140
|
+
} else if (!(dimensionInfo instanceof DataDimensionInfo)) {
|
|
141
|
+
dimensionInfo = new DataDimensionInfo(dimensionInfo);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
var dimensionName = dimensionInfo.name;
|
|
@@ -1143,12 +1143,12 @@ listProto.indexOfName = function (name) {
|
|
|
1143
1143
|
|
|
1144
1144
|
|
|
1145
1145
|
listProto.indexOfRawIndex = function (rawIndex) {
|
|
1146
|
-
if (!this._indices) {
|
|
1147
|
-
return rawIndex;
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1150
1146
|
if (rawIndex >= this._rawCount || rawIndex < 0) {
|
|
1151
1147
|
return -1;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
if (!this._indices) {
|
|
1151
|
+
return rawIndex;
|
|
1152
1152
|
} // Indices are ascending
|
|
1153
1153
|
|
|
1154
1154
|
|
|
@@ -1182,7 +1182,8 @@ listProto.indexOfRawIndex = function (rawIndex) {
|
|
|
1182
1182
|
* @param {string} dim
|
|
1183
1183
|
* @param {number} value
|
|
1184
1184
|
* @param {number} [maxDistance=Infinity]
|
|
1185
|
-
* @return {Array.<number>}
|
|
1185
|
+
* @return {Array.<number>} If and only if multiple indices has
|
|
1186
|
+
* the same value, they are put to the result.
|
|
1186
1187
|
*/
|
|
1187
1188
|
|
|
1188
1189
|
|
|
@@ -1199,29 +1200,34 @@ listProto.indicesOfNearest = function (dim, value, maxDistance) {
|
|
|
1199
1200
|
maxDistance = Infinity;
|
|
1200
1201
|
}
|
|
1201
1202
|
|
|
1202
|
-
var minDist =
|
|
1203
|
+
var minDist = Infinity;
|
|
1203
1204
|
var minDiff = -1;
|
|
1205
|
+
var nearestIndicesLen = 0; // Check the test case of `test/ut/spec/data/List.js`.
|
|
1204
1206
|
|
|
1205
1207
|
for (var i = 0, len = this.count(); i < len; i++) {
|
|
1206
|
-
var diff = value - this.get(dim, i
|
|
1207
|
-
/*, stack */
|
|
1208
|
-
);
|
|
1208
|
+
var diff = value - this.get(dim, i);
|
|
1209
1209
|
var dist = Math.abs(diff);
|
|
1210
1210
|
|
|
1211
|
-
if (
|
|
1212
|
-
//
|
|
1213
|
-
//
|
|
1214
|
-
//
|
|
1215
|
-
|
|
1211
|
+
if (dist <= maxDistance) {
|
|
1212
|
+
// When the `value` is at the middle of `this.get(dim, i)` and `this.get(dim, i+1)`,
|
|
1213
|
+
// we'd better not push both of them to `nearestIndices`, otherwise it is easy to
|
|
1214
|
+
// get more than one item in `nearestIndices` (more specifically, in `tooltip`).
|
|
1215
|
+
// So we chose the one that `diff >= 0` in this csae.
|
|
1216
|
+
// But if `this.get(dim, i)` and `this.get(dim, j)` get the same value, both of them
|
|
1217
|
+
// should be push to `nearestIndices`.
|
|
1218
|
+
if (dist < minDist || dist === minDist && diff >= 0 && minDiff < 0) {
|
|
1216
1219
|
minDist = dist;
|
|
1217
1220
|
minDiff = diff;
|
|
1218
|
-
|
|
1221
|
+
nearestIndicesLen = 0;
|
|
1219
1222
|
}
|
|
1220
1223
|
|
|
1221
|
-
|
|
1224
|
+
if (diff === minDiff) {
|
|
1225
|
+
nearestIndices[nearestIndicesLen++] = i;
|
|
1226
|
+
}
|
|
1222
1227
|
}
|
|
1223
1228
|
}
|
|
1224
1229
|
|
|
1230
|
+
nearestIndices.length = nearestIndicesLen;
|
|
1225
1231
|
return nearestIndices;
|
|
1226
1232
|
};
|
|
1227
1233
|
/**
|
package/lib/data/Tree.js
CHANGED
|
@@ -507,7 +507,7 @@ Tree.prototype = {
|
|
|
507
507
|
* @return module:echarts/data/Tree
|
|
508
508
|
*/
|
|
509
509
|
|
|
510
|
-
Tree.createTree = function (dataRoot, hostModel, treeOptions) {
|
|
510
|
+
Tree.createTree = function (dataRoot, hostModel, treeOptions, beforeLink) {
|
|
511
511
|
var tree = new Tree(hostModel, treeOptions.levels, treeOptions.leaves);
|
|
512
512
|
var listData = [];
|
|
513
513
|
var dimMax = 1;
|
|
@@ -544,6 +544,7 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions) {
|
|
|
544
544
|
structAttr: 'tree'
|
|
545
545
|
});
|
|
546
546
|
tree.update();
|
|
547
|
+
beforeLink && beforeLink(list);
|
|
547
548
|
return tree;
|
|
548
549
|
};
|
|
549
550
|
/**
|