echarts 3.5.4 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -18
- package/dist/echarts.common.js +10072 -9330
- package/dist/echarts.common.min.js +13 -13
- package/dist/echarts.js +13084 -11412
- package/dist/echarts.min.js +22 -21
- package/dist/echarts.simple.js +9454 -8889
- package/dist/echarts.simple.min.js +9 -10
- package/index.js +1 -0
- package/lib/chart/bar/BarView.js +141 -49
- package/lib/chart/bar/BaseBarSeries.js +2 -6
- package/lib/chart/bar.js +1 -0
- package/lib/chart/boxplot/BoxplotSeries.js +1 -1
- package/lib/chart/boxplot/boxplotLayout.js +23 -7
- package/lib/chart/candlestick/CandlestickSeries.js +1 -21
- package/lib/chart/candlestick/candlestickLayout.js +23 -7
- package/lib/chart/custom.js +442 -0
- package/lib/chart/graph/categoryVisual.js +3 -2
- package/lib/chart/heatmap/HeatmapView.js +75 -73
- package/lib/chart/helper/Symbol.js +8 -31
- package/lib/chart/helper/createListFromArray.js +15 -10
- package/lib/chart/helper/labelHelper.js +48 -0
- package/lib/chart/helper/whiskerBoxCommon.js +25 -44
- package/lib/chart/map/mapDataStatistic.js +9 -8
- package/lib/chart/pie/pieLayout.js +25 -17
- package/lib/chart/radar/RadarSeries.js +1 -1
- package/lib/chart/scatter/ScatterSeries.js +2 -3
- package/lib/chart/themeRiver/ThemeRiverSeries.js +6 -5
- package/lib/chart/themeRiver/themeRiverVisual.js +1 -1
- package/lib/chart/treemap/TreemapSeries.js +3 -3
- package/lib/component/axisPointer/BaseAxisPointer.js +7 -6
- package/lib/component/axisPointer/axisTrigger.js +62 -51
- package/lib/component/axisPointer.js +1 -2
- package/lib/component/calendar/CalendarView.js +5 -5
- package/lib/component/dataZoom/AxisProxy.js +76 -13
- package/lib/component/dataZoom/DataZoomModel.js +21 -5
- package/lib/component/dataZoom/InsideZoomModel.js +4 -1
- package/lib/component/dataZoom/InsideZoomView.js +16 -26
- package/lib/component/dataZoom/SliderZoomView.js +63 -26
- package/lib/component/dataZoom/roams.js +8 -3
- package/lib/component/graphic.js +13 -12
- package/lib/component/helper/BrushTargetManager.js +5 -5
- package/lib/component/helper/MapDraw.js +3 -3
- package/lib/component/helper/RoamController.js +43 -20
- package/lib/component/helper/brushHelper.js +2 -13
- package/lib/component/helper/selectableMixin.js +7 -7
- package/lib/component/helper/sliderMove.js +65 -36
- package/lib/component/legend/LegendView.js +6 -6
- package/lib/component/legend/legendAction.js +1 -1
- package/lib/component/marker/MarkAreaView.js +3 -6
- package/lib/component/marker/MarkLineView.js +3 -5
- package/lib/component/marker/MarkPointView.js +3 -5
- package/lib/component/marker/MarkerView.js +10 -12
- package/lib/component/polar.js +5 -0
- package/lib/component/timeline/SliderTimelineView.js +1 -1
- package/lib/component/toolbox/feature/DataZoom.js +14 -1
- package/lib/component/tooltip/TooltipView.js +3 -3
- package/lib/component/visualMap/ContinuousView.js +6 -4
- package/lib/coord/Axis.js +34 -2
- package/lib/coord/axisDefault.js +2 -1
- package/lib/coord/axisHelper.js +6 -25
- package/lib/coord/axisModelCommonMixin.js +1 -1
- package/lib/coord/calendar/Calendar.js +14 -17
- package/lib/coord/calendar/prepareCustom.js +31 -0
- package/lib/coord/cartesian/Axis2D.js +0 -12
- package/lib/coord/cartesian/Cartesian2D.js +1 -0
- package/lib/coord/cartesian/Grid.js +5 -2
- package/lib/coord/cartesian/prepareCustom.js +36 -0
- package/lib/coord/geo/Geo.js +9 -14
- package/lib/coord/geo/GeoModel.js +5 -5
- package/lib/coord/geo/geoCreator.js +3 -3
- package/lib/coord/geo/prepareCustom.js +36 -0
- package/lib/coord/parallel/Parallel.js +12 -11
- package/lib/coord/polar/Polar.js +2 -1
- package/lib/coord/polar/prepareCustom.js +53 -0
- package/lib/coord/single/Single.js +9 -8
- package/lib/coord/single/SingleAxis.js +0 -27
- package/lib/coord/single/prepareCustom.js +33 -0
- package/lib/data/DataDiffer.js +2 -1
- package/lib/data/Graph.js +11 -7
- package/lib/data/List.js +58 -19
- package/lib/data/helper/completeDimensions.js +184 -23
- package/lib/echarts.js +38 -33
- package/lib/helper.js +1 -8
- package/lib/layout/barGrid.js +87 -18
- package/lib/layout/barPolar.js +286 -0
- package/lib/layout/points.js +22 -16
- package/lib/model/Global.js +34 -31
- package/lib/model/Series.js +41 -29
- package/lib/model/mixin/colorPalette.js +2 -1
- package/lib/model/mixin/textStyle.js +7 -13
- package/lib/scale/Interval.js +21 -14
- package/lib/scale/Log.js +5 -7
- package/lib/scale/Time.js +13 -7
- package/lib/scale/helper.js +5 -1
- package/lib/util/format.js +12 -0
- package/lib/util/graphic.js +53 -1
- package/lib/util/model.js +63 -7
- package/map/js/world.js +1 -1
- package/map/json/world.json +1 -1
- package/package.json +3 -3
- package/src/chart/bar/BarView.js +141 -49
- package/src/chart/bar/BaseBarSeries.js +2 -6
- package/src/chart/bar.js +1 -0
- package/src/chart/boxplot/BoxplotSeries.js +1 -1
- package/src/chart/boxplot/boxplotLayout.js +23 -7
- package/src/chart/candlestick/CandlestickSeries.js +1 -21
- package/src/chart/candlestick/candlestickLayout.js +23 -7
- package/src/chart/custom.js +442 -0
- package/src/chart/graph/categoryVisual.js +3 -2
- package/src/chart/heatmap/HeatmapView.js +75 -73
- package/src/chart/helper/Symbol.js +8 -31
- package/src/chart/helper/createListFromArray.js +15 -10
- package/src/chart/helper/labelHelper.js +49 -0
- package/src/chart/helper/whiskerBoxCommon.js +25 -44
- package/src/chart/map/mapDataStatistic.js +9 -8
- package/src/chart/pie/pieLayout.js +25 -17
- package/src/chart/radar/RadarSeries.js +1 -1
- package/src/chart/scatter/ScatterSeries.js +2 -3
- package/src/chart/themeRiver/ThemeRiverSeries.js +6 -5
- package/src/chart/themeRiver/themeRiverVisual.js +1 -1
- package/src/chart/treemap/TreemapSeries.js +3 -3
- package/src/component/axisPointer/BaseAxisPointer.js +7 -6
- package/src/component/axisPointer/axisTrigger.js +62 -51
- package/src/component/axisPointer.js +1 -2
- package/src/component/calendar/CalendarView.js +5 -5
- package/src/component/dataZoom/AxisProxy.js +76 -13
- package/src/component/dataZoom/DataZoomModel.js +21 -5
- package/src/component/dataZoom/InsideZoomModel.js +4 -1
- package/src/component/dataZoom/InsideZoomView.js +16 -26
- package/src/component/dataZoom/SliderZoomView.js +63 -26
- package/src/component/dataZoom/roams.js +8 -3
- package/src/component/graphic.js +13 -12
- package/src/component/helper/BrushTargetManager.js +5 -5
- package/src/component/helper/MapDraw.js +3 -3
- package/src/component/helper/RoamController.js +43 -20
- package/src/component/helper/brushHelper.js +2 -13
- package/src/component/helper/selectableMixin.js +7 -7
- package/src/component/helper/sliderMove.js +65 -36
- package/src/component/legend/LegendView.js +6 -6
- package/src/component/legend/legendAction.js +1 -1
- package/src/component/marker/MarkAreaView.js +3 -6
- package/src/component/marker/MarkLineView.js +3 -5
- package/src/component/marker/MarkPointView.js +3 -5
- package/src/component/marker/MarkerView.js +10 -12
- package/src/component/polar.js +5 -0
- package/src/component/timeline/SliderTimelineView.js +1 -1
- package/src/component/toolbox/feature/DataZoom.js +14 -1
- package/src/component/tooltip/TooltipView.js +3 -3
- package/src/component/visualMap/ContinuousView.js +6 -4
- package/src/coord/Axis.js +34 -2
- package/src/coord/axisDefault.js +2 -1
- package/src/coord/axisHelper.js +6 -25
- package/src/coord/axisModelCommonMixin.js +1 -1
- package/src/coord/calendar/Calendar.js +14 -17
- package/src/coord/calendar/prepareCustom.js +32 -0
- package/src/coord/cartesian/Axis2D.js +0 -12
- package/src/coord/cartesian/Cartesian2D.js +1 -0
- package/src/coord/cartesian/Grid.js +5 -2
- package/src/coord/cartesian/prepareCustom.js +37 -0
- package/src/coord/geo/Geo.js +9 -14
- package/src/coord/geo/GeoModel.js +5 -5
- package/src/coord/geo/geoCreator.js +3 -3
- package/src/coord/geo/prepareCustom.js +37 -0
- package/src/coord/parallel/Parallel.js +12 -11
- package/src/coord/polar/Polar.js +2 -1
- package/src/coord/polar/prepareCustom.js +54 -0
- package/src/coord/single/Single.js +9 -8
- package/src/coord/single/SingleAxis.js +0 -27
- package/src/coord/single/prepareCustom.js +34 -0
- package/src/data/DataDiffer.js +2 -1
- package/src/data/Graph.js +11 -7
- package/src/data/List.js +58 -19
- package/src/data/helper/completeDimensions.js +184 -23
- package/src/echarts.js +38 -33
- package/src/helper.js +1 -8
- package/src/layout/barGrid.js +87 -18
- package/src/layout/barPolar.js +287 -0
- package/src/layout/points.js +22 -16
- package/src/model/Global.js +34 -31
- package/src/model/Series.js +41 -29
- package/src/model/mixin/colorPalette.js +2 -1
- package/src/model/mixin/textStyle.js +7 -13
- package/src/scale/Interval.js +21 -14
- package/src/scale/Log.js +5 -7
- package/src/scale/Time.js +13 -7
- package/src/scale/helper.js +5 -1
- package/src/util/format.js +12 -0
- package/src/util/graphic.js +53 -1
- package/src/util/model.js +63 -7
- package/src/coord/cartesian/axisLabelInterval.js +0 -26
|
@@ -17,20 +17,26 @@
|
|
|
17
17
|
* @param {string} [currTrigger] 'click' | 'mousemove' | 'leave'
|
|
18
18
|
* @param {Array.<number>} [point] x and y, which are mandatory, specify a point to
|
|
19
19
|
* tigger axisPointer and tooltip.
|
|
20
|
-
* @param {Object} [finder] {
|
|
20
|
+
* @param {Object} [finder] {
|
|
21
|
+
* seriesIndex, dataIndex,
|
|
22
|
+
* axesInfo: [{
|
|
23
|
+
* axisDim: 'x'|'y'|'angle'|..., axisIndex: ..., value: ...
|
|
24
|
+
* }, ...]
|
|
25
|
+
* }
|
|
21
26
|
* These properties, which are optional, restrict target axes.
|
|
22
27
|
* @param {Function} dispatchAction
|
|
23
28
|
* @param {module:echarts/ExtensionAPI} api
|
|
24
29
|
* @param {Object} [tooltipOption]
|
|
25
|
-
* @param {string} [highDownKey]
|
|
26
30
|
* @return {Object} content of event obj for echarts.connect.
|
|
27
31
|
*/
|
|
28
32
|
function axisTrigger(
|
|
29
33
|
coordSysAxesInfo, currTrigger, point, finder, dispatchAction,
|
|
30
|
-
ecModel, api, tooltipOption
|
|
34
|
+
ecModel, api, tooltipOption
|
|
31
35
|
) {
|
|
32
36
|
finder = finder || {};
|
|
33
|
-
if (
|
|
37
|
+
if (illegalPoint(point)) {
|
|
38
|
+
// Used in the default behavior of `connection`: use the sample seriesIndex
|
|
39
|
+
// and dataIndex. And also used in the tooltipView trigger.
|
|
34
40
|
point = findPointFromSeries({
|
|
35
41
|
seriesIndex: finder.seriesIndex,
|
|
36
42
|
// Do not use dataIndexInside from other ec instance.
|
|
@@ -38,6 +44,13 @@
|
|
|
38
44
|
dataIndex: finder.dataIndex
|
|
39
45
|
}, ecModel).point;
|
|
40
46
|
}
|
|
47
|
+
var isIllegalPoint = illegalPoint(point);
|
|
48
|
+
|
|
49
|
+
// Axis and value can be specified when calling dispatchAction({type: 'updateAxisPointer'}).
|
|
50
|
+
// Notice: In this case, it is difficult to get the `point` (which is necessary to show
|
|
51
|
+
// tooltip, so if point is not given, we just use the point found by sample seriesIndex
|
|
52
|
+
// and dataIndex.
|
|
53
|
+
var inputAxesInfo = finder.axesInfo;
|
|
41
54
|
|
|
42
55
|
var axesInfo = coordSysAxesInfo.axesInfo;
|
|
43
56
|
var shouldHide = currTrigger === 'leave' || illegalPoint(point);
|
|
@@ -45,21 +58,26 @@
|
|
|
45
58
|
|
|
46
59
|
var showValueMap = {};
|
|
47
60
|
var dataByCoordSys = {list: [], map: {}};
|
|
48
|
-
var highlightBatch = [];
|
|
49
61
|
var updaters = {
|
|
50
62
|
showPointer: curry(showPointer, showValueMap),
|
|
51
|
-
showTooltip: curry(showTooltip, dataByCoordSys)
|
|
52
|
-
highlight: curry(highlight, highlightBatch)
|
|
63
|
+
showTooltip: curry(showTooltip, dataByCoordSys)
|
|
53
64
|
};
|
|
54
65
|
|
|
55
66
|
// Process for triggered axes.
|
|
56
67
|
each(coordSysAxesInfo.coordSysMap, function (coordSys, coordSysKey) {
|
|
57
|
-
|
|
68
|
+
// If a point given, it must be contained by the coordinate system.
|
|
69
|
+
var coordSysContainsPoint = isIllegalPoint || coordSys.containPoint(point);
|
|
58
70
|
|
|
59
71
|
each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) {
|
|
60
72
|
var axis = axisInfo.axis;
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
var inputAxisInfo = findInputAxisInfo(inputAxesInfo, axisInfo);
|
|
74
|
+
// If no inputAxesInfo, no axis is restricted.
|
|
75
|
+
if (!shouldHide && coordSysContainsPoint && (!inputAxesInfo || inputAxisInfo)) {
|
|
76
|
+
var val = inputAxisInfo && inputAxisInfo.value;
|
|
77
|
+
if (val == null && !isIllegalPoint) {
|
|
78
|
+
val = axis.pointToData(point);
|
|
79
|
+
}
|
|
80
|
+
val != null && processOnAxis(axisInfo, val, updaters, false, outputFinder);
|
|
63
81
|
}
|
|
64
82
|
});
|
|
65
83
|
});
|
|
@@ -88,9 +106,9 @@
|
|
|
88
106
|
processOnAxis(axesInfo[tarKey], val, updaters, true, outputFinder);
|
|
89
107
|
});
|
|
90
108
|
|
|
91
|
-
updateModelActually(showValueMap, axesInfo);
|
|
109
|
+
updateModelActually(showValueMap, axesInfo, outputFinder);
|
|
92
110
|
dispatchTooltipActually(dataByCoordSys, point, tooltipOption, dispatchAction);
|
|
93
|
-
dispatchHighDownActually(
|
|
111
|
+
dispatchHighDownActually(axesInfo, dispatchAction, api);
|
|
94
112
|
|
|
95
113
|
return outputFinder;
|
|
96
114
|
}
|
|
@@ -126,8 +144,7 @@
|
|
|
126
144
|
}
|
|
127
145
|
}
|
|
128
146
|
|
|
129
|
-
updaters.
|
|
130
|
-
updaters.showPointer(axisInfo, newValue, payloadBatch);
|
|
147
|
+
updaters.showPointer(axisInfo, newValue, payloadBatch, outputFinder);
|
|
131
148
|
// Tooltip should always be snapToValue, otherwise there will be
|
|
132
149
|
// incorrect "axis value ~ series value" mapping displayed in tooltip.
|
|
133
150
|
updaters.showTooltip(axisInfo, payloadInfo, snapToValue);
|
|
@@ -243,11 +260,8 @@
|
|
|
243
260
|
});
|
|
244
261
|
}
|
|
245
262
|
|
|
246
|
-
function
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
function updateModelActually(showValueMap, axesInfo) {
|
|
263
|
+
function updateModelActually(showValueMap, axesInfo, outputFinder) {
|
|
264
|
+
var outputAxesInfo = outputFinder.axesInfo = [];
|
|
251
265
|
// Basic logic: If no 'show' required, 'hide' this axisPointer.
|
|
252
266
|
each(axesInfo, function (axisInfo, key) {
|
|
253
267
|
var option = axisInfo.axisPointerModel.option;
|
|
@@ -256,7 +270,7 @@
|
|
|
256
270
|
if (valItem) {
|
|
257
271
|
!axisInfo.useHandle && (option.status = 'show');
|
|
258
272
|
option.value = valItem.value;
|
|
259
|
-
// For label formatter param.
|
|
273
|
+
// For label formatter param and highlight.
|
|
260
274
|
option.seriesDataIndices = (valItem.payloadBatch || []).slice();
|
|
261
275
|
}
|
|
262
276
|
// When always show (e.g., handle used), remain
|
|
@@ -266,6 +280,13 @@
|
|
|
266
280
|
// click legend to toggle axis blank.
|
|
267
281
|
!axisInfo.useHandle && (option.status = 'hide');
|
|
268
282
|
}
|
|
283
|
+
|
|
284
|
+
// If status is 'hide', should be no info in payload.
|
|
285
|
+
option.status === 'show' && outputAxesInfo.push({
|
|
286
|
+
axisDim: axisInfo.axis.dim,
|
|
287
|
+
axisIndex: axisInfo.axis.model.componentIndex,
|
|
288
|
+
value: option.value
|
|
289
|
+
});
|
|
269
290
|
});
|
|
270
291
|
}
|
|
271
292
|
|
|
@@ -295,28 +316,24 @@
|
|
|
295
316
|
});
|
|
296
317
|
}
|
|
297
318
|
|
|
298
|
-
function dispatchHighDownActually(
|
|
299
|
-
// Basic logic: If nothing highlighted, should downplay all highlighted items.
|
|
300
|
-
// This case will occur when mouse leave coordSys.
|
|
301
|
-
|
|
319
|
+
function dispatchHighDownActually(axesInfo, dispatchAction, api) {
|
|
302
320
|
// FIXME
|
|
303
|
-
//
|
|
304
|
-
// (
|
|
305
|
-
|
|
306
|
-
// It will not be fixed until someone requires this scenario.
|
|
307
|
-
|
|
308
|
-
// Consider items area hightlighted by 'handle', and globalListener may
|
|
309
|
-
// downplay all items (including just highlighted ones) when mousemove.
|
|
310
|
-
// So we use a highDownKey to separate them as a temporary solution.
|
|
321
|
+
// highlight status modification shoule be a stage of main process?
|
|
322
|
+
// (Consider confilct (e.g., legend and axisPointer) and setOption)
|
|
323
|
+
|
|
311
324
|
var zr = api.getZr();
|
|
312
|
-
highDownKey = '
|
|
325
|
+
var highDownKey = 'axisPointerLastHighlights';
|
|
313
326
|
var lastHighlights = get(zr)[highDownKey] || {};
|
|
314
327
|
var newHighlights = get(zr)[highDownKey] = {};
|
|
315
328
|
|
|
329
|
+
// Update highlight/downplay status according to axisPointer model.
|
|
316
330
|
// Build hash map and remove duplicate incidentally.
|
|
317
|
-
|
|
318
|
-
var
|
|
319
|
-
|
|
331
|
+
each(axesInfo, function (axisInfo, key) {
|
|
332
|
+
var option = axisInfo.axisPointerModel.option;
|
|
333
|
+
option.status === 'show' && each(option.seriesDataIndices, function (batchItem) {
|
|
334
|
+
var key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex;
|
|
335
|
+
newHighlights[key] = batchItem;
|
|
336
|
+
});
|
|
320
337
|
});
|
|
321
338
|
|
|
322
339
|
// Diff.
|
|
@@ -337,21 +354,15 @@
|
|
|
337
354
|
});
|
|
338
355
|
}
|
|
339
356
|
|
|
340
|
-
function
|
|
341
|
-
var
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
!isTarget && each(
|
|
348
|
-
[['AxisId', 'id'], ['AxisIndex', 'componentIndex'], ['AxisName', 'name']],
|
|
349
|
-
function (prop) {
|
|
350
|
-
var vals = modelUtil.normalizeToArray(finder[axis.dim + prop[0]]);
|
|
351
|
-
isTarget |= zrUtil.indexOf(vals, axis.model[prop[1]]) >= 0;
|
|
357
|
+
function findInputAxisInfo(inputAxesInfo, axisInfo) {
|
|
358
|
+
for (var i = 0; i < (inputAxesInfo || []).length; i++) {
|
|
359
|
+
var inputAxisInfo = inputAxesInfo[i];
|
|
360
|
+
if (axisInfo.axis.dim === inputAxisInfo.axisDim
|
|
361
|
+
&& axisInfo.axis.model.componentIndex === inputAxisInfo.axisIndex
|
|
362
|
+
) {
|
|
363
|
+
return inputAxisInfo;
|
|
352
364
|
}
|
|
353
|
-
|
|
354
|
-
return !isTarget;
|
|
365
|
+
}
|
|
355
366
|
}
|
|
356
367
|
|
|
357
368
|
function makeMapperParam(axisInfo) {
|
|
@@ -365,7 +376,7 @@
|
|
|
365
376
|
}
|
|
366
377
|
|
|
367
378
|
function illegalPoint(point) {
|
|
368
|
-
return point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]);
|
|
379
|
+
return !point || point[0] == null || isNaN(point[0]) || point[1] == null || isNaN(point[1]);
|
|
369
380
|
}
|
|
370
381
|
|
|
371
382
|
module.exports = axisTrigger;
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
var coordSys = calendarModel.coordinateSystem;
|
|
64
64
|
|
|
65
65
|
// range info
|
|
66
|
-
var rangeData = coordSys.
|
|
66
|
+
var rangeData = coordSys.getRangeInfo();
|
|
67
67
|
var orient = coordSys.getOrient();
|
|
68
68
|
|
|
69
69
|
this._renderDayRect(calendarModel, rangeData, group);
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
i = coordSys.getNextNDay(i, 1).time
|
|
91
91
|
) {
|
|
92
92
|
|
|
93
|
-
var point = coordSys.dataToRect([i],
|
|
93
|
+
var point = coordSys.dataToRect([i], false).tl;
|
|
94
94
|
|
|
95
95
|
// every rect
|
|
96
96
|
var rect = new graphic.Rect({
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
function addPoints(date) {
|
|
146
146
|
|
|
147
147
|
self._firstDayOfMonth.push(coordSys.getDateInfo(date));
|
|
148
|
-
self._firstDayPoints.push(coordSys.dataToRect([date],
|
|
148
|
+
self._firstDayPoints.push(coordSys.dataToRect([date], false).tl);
|
|
149
149
|
|
|
150
150
|
var points = self._getLinePointsOfOneWeek(calendarModel, date, orient);
|
|
151
151
|
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
for (var i = 0; i < 7; i++) {
|
|
202
202
|
|
|
203
203
|
var tmpD = coordSys.getNextNDay(date.time, i);
|
|
204
|
-
var point = coordSys.dataToRect([tmpD.time],
|
|
204
|
+
var point = coordSys.dataToRect([tmpD.time], false);
|
|
205
205
|
|
|
206
206
|
points[2 * tmpD.day] = point.tl;
|
|
207
207
|
points[2 * tmpD.day + 1] = point[orient === 'horizontal' ? 'bl' : 'tr'];
|
|
@@ -479,7 +479,7 @@
|
|
|
479
479
|
for (var i = 0; i < 7; i++) {
|
|
480
480
|
|
|
481
481
|
var tmpD = coordSys.getNextNDay(start, i);
|
|
482
|
-
var point = coordSys.dataToRect([tmpD.time],
|
|
482
|
+
var point = coordSys.dataToRect([tmpD.time], false).center;
|
|
483
483
|
var day = i;
|
|
484
484
|
day = Math.abs((i + firstDayOfWeek) % 7);
|
|
485
485
|
var weekText = new graphic.Text({
|
|
@@ -49,6 +49,13 @@
|
|
|
49
49
|
*/
|
|
50
50
|
this._dataExtent;
|
|
51
51
|
|
|
52
|
+
/**
|
|
53
|
+
* {minSpan, maxSpan, minValueSpan, maxValueSpan}
|
|
54
|
+
* @private
|
|
55
|
+
* @type {Object}
|
|
56
|
+
*/
|
|
57
|
+
this._minMaxSpan;
|
|
58
|
+
|
|
52
59
|
/**
|
|
53
60
|
* @readOnly
|
|
54
61
|
* @type {module: echarts/model/Global}
|
|
@@ -147,6 +154,10 @@
|
|
|
147
154
|
return foundOtherAxisModel;
|
|
148
155
|
},
|
|
149
156
|
|
|
157
|
+
getMinMaxSpan: function () {
|
|
158
|
+
return zrUtil.clone(this._minMaxSpan);
|
|
159
|
+
},
|
|
160
|
+
|
|
150
161
|
/**
|
|
151
162
|
* Only calculate by given range and this._dataExtent, do not change anything.
|
|
152
163
|
*
|
|
@@ -241,6 +252,8 @@
|
|
|
241
252
|
this._valueWindow = dataWindow.valueWindow;
|
|
242
253
|
this._percentWindow = dataWindow.percentWindow;
|
|
243
254
|
|
|
255
|
+
setMinMaxSpan(this);
|
|
256
|
+
|
|
244
257
|
// Update axis setting then.
|
|
245
258
|
setAxisModel(this);
|
|
246
259
|
},
|
|
@@ -270,6 +283,10 @@
|
|
|
270
283
|
var filterMode = dataZoomModel.get('filterMode');
|
|
271
284
|
var valueWindow = this._valueWindow;
|
|
272
285
|
|
|
286
|
+
if (filterMode === 'none') {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
|
|
273
290
|
// FIXME
|
|
274
291
|
// Toolbox may has dataZoom injected. And if there are stacked bar chart
|
|
275
292
|
// with NaN data, NaN will be filtered and stack will be wrong.
|
|
@@ -289,19 +306,43 @@
|
|
|
289
306
|
// Process series data
|
|
290
307
|
each(seriesModels, function (seriesModel) {
|
|
291
308
|
var seriesData = seriesModel.getData();
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
)
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
309
|
+
var dataDims = seriesModel.coordDimToDataDim(axisDim);
|
|
310
|
+
|
|
311
|
+
if (filterMode === 'weakFilter') {
|
|
312
|
+
seriesData && seriesData.filterSelf(function (dataIndex) {
|
|
313
|
+
var leftOut;
|
|
314
|
+
var rightOut;
|
|
315
|
+
var hasValue;
|
|
316
|
+
for (var i = 0; i < dataDims.length; i++) {
|
|
317
|
+
var value = seriesData.get(dataDims[i], dataIndex);
|
|
318
|
+
var thisHasValue = !isNaN(value);
|
|
319
|
+
var thisLeftOut = value < valueWindow[0];
|
|
320
|
+
var thisRightOut = value > valueWindow[1];
|
|
321
|
+
if (thisHasValue && !thisLeftOut && !thisRightOut) {
|
|
322
|
+
return true;
|
|
323
|
+
}
|
|
324
|
+
thisHasValue && (hasValue = true);
|
|
325
|
+
thisLeftOut && (leftOut = true);
|
|
326
|
+
thisRightOut && (rightOut = true);
|
|
327
|
+
}
|
|
328
|
+
// If both left out and right out, do not filter.
|
|
329
|
+
return hasValue && leftOut && rightOut;
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
seriesData && each(dataDims, function (dim) {
|
|
334
|
+
if (filterMode === 'empty') {
|
|
335
|
+
seriesModel.setData(
|
|
336
|
+
seriesData.map(dim, function (value) {
|
|
337
|
+
return !isInWindow(value) ? NaN : value;
|
|
338
|
+
})
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
seriesData.filterSelf(dim, isInWindow);
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
}
|
|
305
346
|
});
|
|
306
347
|
|
|
307
348
|
function isInWindow(value) {
|
|
@@ -400,5 +441,27 @@
|
|
|
400
441
|
);
|
|
401
442
|
}
|
|
402
443
|
|
|
444
|
+
function setMinMaxSpan(axisProxy) {
|
|
445
|
+
var minMaxSpan = axisProxy._minMaxSpan = {};
|
|
446
|
+
var dataZoomModel = axisProxy._dataZoomModel;
|
|
447
|
+
|
|
448
|
+
each(['min', 'max'], function (minMax) {
|
|
449
|
+
minMaxSpan[minMax + 'Span'] = dataZoomModel.get(minMax + 'Span');
|
|
450
|
+
|
|
451
|
+
// minValueSpan and maxValueSpan has higher priority than minSpan and maxSpan
|
|
452
|
+
var valueSpan = dataZoomModel.get(minMax + 'ValueSpan');
|
|
453
|
+
if (valueSpan != null) {
|
|
454
|
+
minMaxSpan[minMax + 'ValueSpan'] = valueSpan;
|
|
455
|
+
|
|
456
|
+
valueSpan = axisProxy.getAxisModel().axis.scale.parse(valueSpan);
|
|
457
|
+
if (valueSpan != null) {
|
|
458
|
+
minMaxSpan[minMax + 'Span'] = numberUtil.linearMap(
|
|
459
|
+
valueSpan, axisProxy._dataExtent, [0, 100], true
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
403
466
|
module.exports = AxisProxy;
|
|
404
467
|
|
|
@@ -30,12 +30,18 @@
|
|
|
30
30
|
xAxisIndex: null, // Default the first horizontal category axis.
|
|
31
31
|
yAxisIndex: null, // Default the first vertical category axis.
|
|
32
32
|
|
|
33
|
-
filterMode: 'filter', // Possible values: 'filter' or 'empty'.
|
|
34
|
-
// 'filter': data items which are out of window will be removed.
|
|
35
|
-
//
|
|
33
|
+
filterMode: 'filter', // Possible values: 'filter' or 'empty' or 'weakFilter'.
|
|
34
|
+
// 'filter': data items which are out of window will be removed. This option is
|
|
35
|
+
// applicable when filtering outliers. For each data item, it will be
|
|
36
|
+
// filtered if one of the relevant dimensions is out of the window.
|
|
37
|
+
// 'weakFilter': data items which are out of window will be removed. This option
|
|
38
|
+
// is applicable when filtering outliers. For each data item, it will be
|
|
39
|
+
// filtered only if all of the relevant dimensions are out of the same
|
|
40
|
+
// side of the window.
|
|
36
41
|
// 'empty': data items which are out of window will be set to empty.
|
|
37
42
|
// This option is applicable when user should not neglect
|
|
38
43
|
// that there are some data items out of window.
|
|
44
|
+
// 'none': Do not filter.
|
|
39
45
|
// Taking line chart as an example, line will be broken in
|
|
40
46
|
// the filtered points when filterModel is set to 'empty', but
|
|
41
47
|
// be connected when set to 'filter'.
|
|
@@ -47,7 +53,11 @@
|
|
|
47
53
|
start: 0, // Start percent. 0 ~ 100
|
|
48
54
|
end: 100, // End percent. 0 ~ 100
|
|
49
55
|
startValue: null, // Start value. If startValue specified, start is ignored.
|
|
50
|
-
endValue: null
|
|
56
|
+
endValue: null, // End value. If endValue specified, end is ignored.
|
|
57
|
+
minSpan: null, // 0 ~ 100
|
|
58
|
+
maxSpan: null, // 0 ~ 100
|
|
59
|
+
minValueSpan: null, // The range of dataZoom can not be smaller than that.
|
|
60
|
+
maxValueSpan: null // The range of dataZoom can not be larger than that.
|
|
51
61
|
},
|
|
52
62
|
|
|
53
63
|
/**
|
|
@@ -469,9 +479,15 @@
|
|
|
469
479
|
|
|
470
480
|
/**
|
|
471
481
|
* @public
|
|
482
|
+
* @param {module:echarts/model/Model} [axisModel] If axisModel given, find axisProxy
|
|
483
|
+
* corresponding to the axisModel
|
|
472
484
|
* @return {module:echarts/component/dataZoom/AxisProxy}
|
|
473
485
|
*/
|
|
474
|
-
findRepresentativeAxisProxy: function () {
|
|
486
|
+
findRepresentativeAxisProxy: function (axisModel) {
|
|
487
|
+
if (axisModel) {
|
|
488
|
+
return axisModel.__dzAxisProxy;
|
|
489
|
+
}
|
|
490
|
+
|
|
475
491
|
// Find the first hosted axisProxy
|
|
476
492
|
var axisProxies = this._axisProxies;
|
|
477
493
|
for (var key in axisProxies) {
|
|
@@ -12,6 +12,9 @@
|
|
|
12
12
|
*/
|
|
13
13
|
defaultOption: {
|
|
14
14
|
disabled: false, // Whether disable this inside zoom.
|
|
15
|
-
zoomLock: false
|
|
15
|
+
zoomLock: false, // Whether disable zoom but only pan.
|
|
16
|
+
zoomOnMouseWheel: true, // Can be: true / false / 'shift' / 'ctrl' / 'alt'.
|
|
17
|
+
moveOnMouseMove: true, // Can be: true / false / 'shift' / 'ctrl' / 'alt'.
|
|
18
|
+
preventDefaultMouseMove: true
|
|
16
19
|
}
|
|
17
20
|
});
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
|
|
46
46
|
zrUtil.each(coordInfoList, function (coordInfo) {
|
|
47
47
|
var coordModel = coordInfo.model;
|
|
48
|
+
var dataZoomOption = dataZoomModel.option;
|
|
48
49
|
|
|
49
50
|
roams.register(
|
|
50
51
|
api,
|
|
@@ -57,7 +58,14 @@
|
|
|
57
58
|
dataZoomId: dataZoomModel.id,
|
|
58
59
|
throttleRate: dataZoomModel.get('throttle', true),
|
|
59
60
|
panGetRange: bind(this._onPan, this, coordInfo, coordSysName),
|
|
60
|
-
zoomGetRange: bind(this._onZoom, this, coordInfo, coordSysName)
|
|
61
|
+
zoomGetRange: bind(this._onZoom, this, coordInfo, coordSysName),
|
|
62
|
+
zoomLock: dataZoomOption.zoomLock,
|
|
63
|
+
disabled: dataZoomOption.disabled,
|
|
64
|
+
roamControllerOpt: {
|
|
65
|
+
zoomOnMouseWheel: dataZoomOption.zoomOnMouseWheel,
|
|
66
|
+
moveOnMouseMove: dataZoomOption.moveOnMouseMove,
|
|
67
|
+
preventDefaultMouseMove: dataZoomOption.preventDefaultMouseMove
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
);
|
|
63
71
|
}, this);
|
|
@@ -78,10 +86,6 @@
|
|
|
78
86
|
* @private
|
|
79
87
|
*/
|
|
80
88
|
_onPan: function (coordInfo, coordSysName, controller, dx, dy, oldX, oldY, newX, newY) {
|
|
81
|
-
if (this.dataZoomModel.option.disabled) {
|
|
82
|
-
return this._range;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
89
|
var range = this._range.slice();
|
|
86
90
|
|
|
87
91
|
// Calculate transform by the first axis.
|
|
@@ -98,7 +102,7 @@
|
|
|
98
102
|
* (range[1] - range[0])
|
|
99
103
|
* directionInfo.pixel / directionInfo.pixelLength;
|
|
100
104
|
|
|
101
|
-
sliderMove(percentDelta, range, [0, 100], '
|
|
105
|
+
sliderMove(percentDelta, range, [0, 100], 'all');
|
|
102
106
|
|
|
103
107
|
return (this._range = range);
|
|
104
108
|
},
|
|
@@ -107,12 +111,6 @@
|
|
|
107
111
|
* @private
|
|
108
112
|
*/
|
|
109
113
|
_onZoom: function (coordInfo, coordSysName, controller, scale, mouseX, mouseY) {
|
|
110
|
-
var option = this.dataZoomModel.option;
|
|
111
|
-
|
|
112
|
-
if (option.disabled || option.zoomLock) {
|
|
113
|
-
return this._range;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
114
|
var range = this._range.slice();
|
|
117
115
|
|
|
118
116
|
// Calculate transform by the first axis.
|
|
@@ -131,7 +129,12 @@
|
|
|
131
129
|
scale = Math.max(1 / scale, 0);
|
|
132
130
|
range[0] = (range[0] - percentPoint) * scale + percentPoint;
|
|
133
131
|
range[1] = (range[1] - percentPoint) * scale + percentPoint;
|
|
134
|
-
|
|
132
|
+
|
|
133
|
+
// Restrict range.
|
|
134
|
+
var minMaxSpan = this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();
|
|
135
|
+
sliderMove(0, range, [0, 100], 0, minMaxSpan.minSpan, minMaxSpan.maxSpan);
|
|
136
|
+
|
|
137
|
+
return (this._range = range);
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
});
|
|
@@ -214,17 +217,4 @@
|
|
|
214
217
|
}
|
|
215
218
|
};
|
|
216
219
|
|
|
217
|
-
function fixRange(range) {
|
|
218
|
-
// Clamp, using !(<= or >=) to handle NaN.
|
|
219
|
-
// jshint ignore:start
|
|
220
|
-
var bound = [0, 100];
|
|
221
|
-
!(range[0] <= bound[1]) && (range[0] = bound[1]);
|
|
222
|
-
!(range[1] <= bound[1]) && (range[1] = bound[1]);
|
|
223
|
-
!(range[0] >= bound[0]) && (range[0] = bound[0]);
|
|
224
|
-
!(range[1] >= bound[0]) && (range[1] = bound[0]);
|
|
225
|
-
// jshint ignore:end
|
|
226
|
-
|
|
227
|
-
return range;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
220
|
module.exports = InsideZoomView;
|