echarts 3.5.1 → 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/README.md +10 -0
- package/dist/echarts.common.js +11010 -9830
- package/dist/echarts.common.min.js +13 -13
- package/dist/echarts.js +13291 -10852
- package/dist/echarts.min.js +22 -21
- package/dist/echarts.simple.js +9904 -8990
- package/dist/echarts.simple.min.js +9 -10
- package/index.js +1 -0
- package/lib/ExtensionAPI.js +2 -4
- 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 +3 -22
- package/lib/chart/candlestick/candlestickLayout.js +23 -7
- package/lib/chart/custom.js +442 -0
- package/lib/chart/funnel/funnelLayout.js +10 -3
- package/lib/chart/gauge/GaugeView.js +1 -1
- package/lib/chart/graph/GraphView.js +15 -9
- package/lib/chart/graph/categoryVisual.js +3 -2
- package/lib/chart/heatmap/HeatmapLayer.js +1 -1
- 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/parallel/ParallelSeries.js +2 -0
- package/lib/chart/parallel/ParallelView.js +13 -12
- package/lib/chart/parallel/parallelVisual.js +9 -1
- package/lib/chart/pie/pieLayout.js +25 -17
- package/lib/chart/radar/RadarSeries.js +1 -1
- package/lib/chart/sankey/sankeyLayout.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/chart/treemap/TreemapView.js +1 -1
- package/lib/chart/treemap/treemapLayout.js +6 -1
- package/lib/component/axis/AxisBuilder.js +53 -34
- package/lib/component/axis/ParallelAxisView.js +45 -37
- package/lib/component/axisPointer/AxisPointerModel.js +1 -1
- package/lib/component/axisPointer/BaseAxisPointer.js +20 -15
- package/lib/component/axisPointer/CartesianAxisPointer.js +9 -6
- package/lib/component/axisPointer/PolarAxisPointer.js +10 -8
- package/lib/component/axisPointer/SingleAxisPointer.js +11 -7
- package/lib/component/axisPointer/axisTrigger.js +87 -72
- package/lib/component/axisPointer/viewHelper.js +6 -3
- package/lib/component/axisPointer.js +2 -2
- package/lib/component/brush/BrushModel.js +6 -4
- package/lib/component/brush/BrushView.js +1 -1
- package/lib/component/brush/visualEncoding.js +6 -4
- 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 +17 -27
- package/lib/component/dataZoom/SliderZoomView.js +63 -26
- package/lib/component/dataZoom/roams.js +9 -4
- package/lib/component/graphic.js +13 -12
- package/lib/component/helper/BrushController.js +75 -114
- package/lib/component/helper/BrushTargetManager.js +16 -8
- package/lib/component/helper/MapDraw.js +25 -11
- package/lib/component/helper/RoamController.js +111 -139
- package/lib/component/helper/brushHelper.js +25 -213
- package/lib/component/helper/cursorHelper.js +21 -0
- package/lib/component/helper/roamHelper.js +54 -0
- package/lib/component/helper/selectableMixin.js +7 -7
- package/lib/component/helper/sliderMove.js +66 -37
- 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/marker/markerHelper.js +1 -1
- package/lib/component/parallel.js +94 -29
- package/lib/component/polar.js +5 -0
- package/lib/component/timeline/SliderTimelineView.js +1 -1
- package/lib/component/toolbox/feature/Brush.js +7 -0
- package/lib/component/toolbox/feature/DataZoom.js +17 -4
- package/lib/component/tooltip/TooltipView.js +92 -20
- package/lib/component/visualMap/ContinuousView.js +6 -4
- package/lib/coord/Axis.js +34 -2
- package/lib/coord/axisDefault.js +4 -1
- package/lib/coord/axisHelper.js +32 -26
- 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/parseGeoJson.js +11 -4
- package/lib/coord/geo/prepareCustom.js +36 -0
- package/lib/coord/parallel/Parallel.js +225 -101
- package/lib/coord/parallel/ParallelModel.js +7 -1
- 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 +59 -20
- package/lib/data/helper/completeDimensions.js +184 -23
- package/lib/echarts.js +68 -36
- package/lib/helper.js +1 -8
- package/lib/layout/barGrid.js +91 -19
- 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/globalDefault.js +4 -1
- package/lib/model/mixin/colorPalette.js +2 -1
- package/lib/model/mixin/textStyle.js +7 -13
- package/lib/scale/Interval.js +46 -76
- package/lib/scale/Log.js +5 -7
- package/lib/scale/Scale.js +10 -1
- package/lib/scale/Time.js +34 -12
- package/lib/scale/helper.js +93 -0
- package/lib/util/format.js +20 -9
- package/lib/util/graphic.js +70 -8
- package/lib/util/layout.js +7 -3
- package/lib/util/model.js +63 -7
- package/lib/util/number.js +59 -19
- package/lib/util/throttle.js +14 -3
- package/map/js/world.js +1 -1
- package/map/json/world.json +1 -1
- package/package.json +3 -3
- package/src/ExtensionAPI.js +2 -4
- 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 +3 -22
- package/src/chart/candlestick/candlestickLayout.js +23 -7
- package/src/chart/custom.js +442 -0
- package/src/chart/funnel/funnelLayout.js +10 -4
- package/src/chart/gauge/GaugeView.js +1 -1
- package/src/chart/graph/GraphView.js +15 -9
- package/src/chart/graph/categoryVisual.js +3 -2
- package/src/chart/heatmap/HeatmapLayer.js +1 -1
- 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/parallel/ParallelSeries.js +2 -0
- package/src/chart/parallel/ParallelView.js +13 -12
- package/src/chart/parallel/parallelVisual.js +9 -1
- package/src/chart/pie/pieLayout.js +25 -17
- package/src/chart/radar/RadarSeries.js +1 -1
- package/src/chart/sankey/sankeyLayout.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/chart/treemap/TreemapView.js +1 -1
- package/src/chart/treemap/treemapLayout.js +6 -1
- package/src/component/axis/AxisBuilder.js +53 -34
- package/src/component/axis/ParallelAxisView.js +45 -37
- package/src/component/axisPointer/AxisPointerModel.js +1 -1
- package/src/component/axisPointer/BaseAxisPointer.js +20 -15
- package/src/component/axisPointer/CartesianAxisPointer.js +9 -6
- package/src/component/axisPointer/PolarAxisPointer.js +10 -8
- package/src/component/axisPointer/SingleAxisPointer.js +11 -7
- package/src/component/axisPointer/axisTrigger.js +87 -72
- package/src/component/axisPointer/viewHelper.js +6 -3
- package/src/component/axisPointer.js +2 -2
- package/src/component/brush/BrushModel.js +6 -4
- package/src/component/brush/BrushView.js +1 -1
- package/src/component/brush/visualEncoding.js +6 -4
- 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 +17 -27
- package/src/component/dataZoom/SliderZoomView.js +63 -26
- package/src/component/dataZoom/roams.js +9 -4
- package/src/component/graphic.js +13 -12
- package/src/component/helper/BrushController.js +75 -114
- package/src/component/helper/BrushTargetManager.js +16 -8
- package/src/component/helper/MapDraw.js +25 -11
- package/src/component/helper/RoamController.js +111 -139
- package/src/component/helper/brushHelper.js +41 -0
- package/src/component/helper/cursorHelper.js +22 -0
- package/src/component/helper/roamHelper.js +55 -0
- package/src/component/helper/selectableMixin.js +7 -7
- package/src/component/helper/sliderMove.js +66 -37
- 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/marker/markerHelper.js +1 -1
- package/src/component/parallel.js +94 -29
- package/src/component/polar.js +5 -0
- package/src/component/timeline/SliderTimelineView.js +1 -1
- package/src/component/toolbox/feature/Brush.js +7 -0
- package/src/component/toolbox/feature/DataZoom.js +17 -4
- package/src/component/tooltip/TooltipView.js +92 -20
- package/src/component/visualMap/ContinuousView.js +6 -4
- package/src/coord/Axis.js +34 -2
- package/src/coord/axisDefault.js +4 -1
- package/src/coord/axisHelper.js +32 -26
- 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/parseGeoJson.js +11 -4
- package/src/coord/geo/prepareCustom.js +37 -0
- package/src/coord/parallel/Parallel.js +225 -101
- package/src/coord/parallel/ParallelModel.js +7 -1
- 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 +59 -20
- package/src/data/helper/completeDimensions.js +184 -23
- package/src/echarts.js +68 -36
- package/src/helper.js +1 -8
- package/src/layout/barGrid.js +91 -19
- 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/globalDefault.js +4 -1
- package/src/model/mixin/colorPalette.js +2 -1
- package/src/model/mixin/textStyle.js +7 -13
- package/src/scale/Interval.js +46 -76
- package/src/scale/Log.js +5 -7
- package/src/scale/Scale.js +10 -1
- package/src/scale/Time.js +34 -12
- package/src/scale/helper.js +94 -0
- package/src/util/format.js +20 -9
- package/src/util/graphic.js +70 -8
- package/src/util/layout.js +7 -3
- package/src/util/model.js +63 -7
- package/src/util/number.js +59 -19
- package/src/util/throttle.js +14 -3
- package/src/coord/cartesian/axisLabelInterval.js +0 -26
- package/theme/default.js +0 -23
- package/theme/halloween.js +0 -528
|
@@ -2,52 +2,81 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Calculate slider move result.
|
|
5
|
+
* Usage:
|
|
6
|
+
* (1) If both handle0 and handle1 are needed to be moved, set minSpan the same as
|
|
7
|
+
* maxSpan and the same as `Math.abs(handleEnd[1] - handleEnds[0])`.
|
|
8
|
+
* (2) If handle0 is forbidden to cross handle1, set minSpan as `0`.
|
|
5
9
|
*
|
|
6
10
|
* @param {number} delta Move length.
|
|
7
|
-
* @param {Array.<number>} handleEnds handleEnds[0]
|
|
8
|
-
*
|
|
11
|
+
* @param {Array.<number>} handleEnds handleEnds[0] can be bigger then handleEnds[1].
|
|
12
|
+
* handleEnds will be modified in this method.
|
|
9
13
|
* @param {Array.<number>} extent handleEnds is restricted by extent.
|
|
10
|
-
*
|
|
11
|
-
* @param {string}
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* extent[0] should less or equals than extent[1].
|
|
15
|
+
* @param {number|string} handleIndex Can be 'all', means that both move the two handleEnds,
|
|
16
|
+
* where the input minSpan and maxSpan will not work.
|
|
17
|
+
* @param {number} [minSpan] The range of dataZoom can not be smaller than that.
|
|
18
|
+
* If not set, handle0 and cross handle1. If set as a non-negative
|
|
19
|
+
* number (including `0`), handles will push each other when reaching
|
|
20
|
+
* the minSpan.
|
|
21
|
+
* @param {number} [maxSpan] The range of dataZoom can not be larger than that.
|
|
22
|
+
* @return {Array.<number>} The input handleEnds.
|
|
17
23
|
*/
|
|
18
|
-
module.exports = function (delta, handleEnds, extent,
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
module.exports = function (delta, handleEnds, extent, handleIndex, minSpan, maxSpan) {
|
|
25
|
+
// Normalize firstly.
|
|
26
|
+
handleEnds[0] = restrict(handleEnds[0], extent);
|
|
27
|
+
handleEnds[1] = restrict(handleEnds[1], extent);
|
|
28
|
+
|
|
29
|
+
delta = delta || 0;
|
|
30
|
+
|
|
31
|
+
var extentSpan = extent[1] - extent[0];
|
|
32
|
+
|
|
33
|
+
// Notice maxSpan and minSpan can be null/undefined.
|
|
34
|
+
if (minSpan != null) {
|
|
35
|
+
minSpan = restrict(minSpan, [0, extentSpan]);
|
|
21
36
|
}
|
|
37
|
+
if (maxSpan != null) {
|
|
38
|
+
maxSpan = Math.max(maxSpan, minSpan != null ? minSpan : 0);
|
|
39
|
+
}
|
|
40
|
+
if (handleIndex === 'all') {
|
|
41
|
+
minSpan = maxSpan = Math.abs(handleEnds[1] - handleEnds[0]);
|
|
42
|
+
handleIndex = 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var originalDistSign = getSpanSign(handleEnds, handleIndex);
|
|
22
46
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
47
|
+
handleEnds[handleIndex] += delta;
|
|
48
|
+
|
|
49
|
+
// Restrict in extent.
|
|
50
|
+
var extentMinSpan = minSpan || 0;
|
|
51
|
+
var realExtent = extent.slice();
|
|
52
|
+
originalDistSign.sign < 0 ? (realExtent[0] += extentMinSpan) : (realExtent[1] -= extentMinSpan);
|
|
53
|
+
handleEnds[handleIndex] = restrict(handleEnds[handleIndex], realExtent);
|
|
54
|
+
|
|
55
|
+
// Expand span.
|
|
56
|
+
var currDistSign = getSpanSign(handleEnds, handleIndex);
|
|
57
|
+
if (minSpan != null && (
|
|
58
|
+
currDistSign.sign !== originalDistSign.sign || currDistSign.span < minSpan
|
|
59
|
+
)) {
|
|
60
|
+
// If minSpan exists, 'cross' is forbinden.
|
|
61
|
+
handleEnds[1 - handleIndex] = handleEnds[handleIndex] + originalDistSign.sign * minSpan;
|
|
27
62
|
}
|
|
28
|
-
else {
|
|
29
|
-
delta = getRealDelta(delta, handleEnds[handleIndex], extent);
|
|
30
|
-
handleEnds[handleIndex] += delta;
|
|
31
63
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
64
|
+
// Shrink span.
|
|
65
|
+
var currDistSign = getSpanSign(handleEnds, handleIndex);
|
|
66
|
+
if (maxSpan != null && currDistSign.span > maxSpan) {
|
|
67
|
+
handleEnds[1 - handleIndex] = handleEnds[handleIndex] + currDistSign.sign * maxSpan;
|
|
35
68
|
}
|
|
36
69
|
|
|
37
70
|
return handleEnds;
|
|
38
|
-
|
|
39
|
-
function getRealDelta(delta, handleEnds, extent) {
|
|
40
|
-
var handleMinMax = !handleEnds.length
|
|
41
|
-
? [handleEnds, handleEnds]
|
|
42
|
-
: handleEnds.slice();
|
|
43
|
-
handleEnds[0] > handleEnds[1] && handleMinMax.reverse();
|
|
44
|
-
|
|
45
|
-
if (delta < 0 && handleMinMax[0] + delta < extent[0]) {
|
|
46
|
-
delta = extent[0] - handleMinMax[0];
|
|
47
|
-
}
|
|
48
|
-
if (delta > 0 && handleMinMax[1] + delta > extent[1]) {
|
|
49
|
-
delta = extent[1] - handleMinMax[1];
|
|
50
|
-
}
|
|
51
|
-
return delta;
|
|
52
|
-
}
|
|
53
71
|
};
|
|
72
|
+
|
|
73
|
+
function getSpanSign(handleEnds, handleIndex) {
|
|
74
|
+
var dist = handleEnds[handleIndex] - handleEnds[1 - handleIndex];
|
|
75
|
+
// If `handleEnds[0] === handleEnds[1]`, always believe that handleEnd[0]
|
|
76
|
+
// is at left of handleEnds[1] for non-cross case.
|
|
77
|
+
return {span: Math.abs(dist), sign: dist > 0 ? -1 : dist < 0 ? 1 : handleIndex ? -1 : 1};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function restrict(value, extend) {
|
|
81
|
+
return Math.min(extend[1], Math.max(extend[0], value));
|
|
82
|
+
}
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
? 'right' : 'left';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
var legendDrawedMap =
|
|
66
|
+
var legendDrawedMap = zrUtil.createHashMap();
|
|
67
67
|
|
|
68
68
|
zrUtil.each(legendModel.getData(), function (itemModel) {
|
|
69
69
|
var name = itemModel.get('name');
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
|
|
79
79
|
var seriesModel = ecModel.getSeriesByName(name)[0];
|
|
80
80
|
|
|
81
|
-
if (legendDrawedMap
|
|
81
|
+
if (legendDrawedMap.get(name)) {
|
|
82
82
|
// Have been drawed
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
@@ -109,13 +109,13 @@
|
|
|
109
109
|
.on('mouseover', curry(dispatchHighlightAction, seriesModel, null, api))
|
|
110
110
|
.on('mouseout', curry(dispatchDownplayAction, seriesModel, null, api));
|
|
111
111
|
|
|
112
|
-
legendDrawedMap
|
|
112
|
+
legendDrawedMap.set(name, true);
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
115
|
// Data legend of pie, funnel
|
|
116
116
|
ecModel.eachRawSeries(function (seriesModel) {
|
|
117
117
|
// In case multiple series has same data name
|
|
118
|
-
if (legendDrawedMap
|
|
118
|
+
if (legendDrawedMap.get(name)) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
121
|
if (seriesModel.legendDataProvider) {
|
|
@@ -141,13 +141,13 @@
|
|
|
141
141
|
.on('mouseover', curry(dispatchHighlightAction, seriesModel, name, api))
|
|
142
142
|
.on('mouseout', curry(dispatchDownplayAction, seriesModel, name, api));
|
|
143
143
|
|
|
144
|
-
legendDrawedMap
|
|
144
|
+
legendDrawedMap.set(name, true);
|
|
145
145
|
}
|
|
146
146
|
}, this);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
if (__DEV__) {
|
|
150
|
-
if (!legendDrawedMap
|
|
150
|
+
if (!legendDrawedMap.get(name)) {
|
|
151
151
|
console.warn(name + ' series not exists. Legend data should be same with series name or data name.');
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -155,12 +155,9 @@
|
|
|
155
155
|
var seriesData = seriesModel.getData();
|
|
156
156
|
|
|
157
157
|
var areaGroupMap = this.markerGroupMap;
|
|
158
|
-
var polygonGroup = areaGroupMap
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
group: new graphic.Group()
|
|
162
|
-
};
|
|
163
|
-
}
|
|
158
|
+
var polygonGroup = areaGroupMap.get(seriesName)
|
|
159
|
+
|| areaGroupMap.set(seriesName, {group: new graphic.Group()});
|
|
160
|
+
|
|
164
161
|
this.group.add(polygonGroup.group);
|
|
165
162
|
polygonGroup.__keep = true;
|
|
166
163
|
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
]);
|
|
201
201
|
});
|
|
202
202
|
|
|
203
|
-
this.markerGroupMap
|
|
203
|
+
this.markerGroupMap.get(seriesModel.name).updateLayout();
|
|
204
204
|
|
|
205
205
|
}
|
|
206
206
|
}, this);
|
|
@@ -212,10 +212,8 @@
|
|
|
212
212
|
var seriesData = seriesModel.getData();
|
|
213
213
|
|
|
214
214
|
var lineDrawMap = this.markerGroupMap;
|
|
215
|
-
var lineDraw = lineDrawMap
|
|
216
|
-
|
|
217
|
-
lineDraw = lineDrawMap[seriesName] = new LineDraw();
|
|
218
|
-
}
|
|
215
|
+
var lineDraw = lineDrawMap.get(seriesName)
|
|
216
|
+
|| lineDrawMap.set(seriesName, new LineDraw());
|
|
219
217
|
this.group.add(lineDraw.group);
|
|
220
218
|
|
|
221
219
|
var mlData = createList(coordSys, seriesModel, mlModel);
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
var mpModel = seriesModel.markPointModel;
|
|
54
54
|
if (mpModel) {
|
|
55
55
|
updateMarkerLayout(mpModel.getData(), seriesModel, api);
|
|
56
|
-
this.markerGroupMap
|
|
56
|
+
this.markerGroupMap.get(seriesModel.name).updateLayout(mpModel);
|
|
57
57
|
}
|
|
58
58
|
}, this);
|
|
59
59
|
},
|
|
@@ -64,10 +64,8 @@
|
|
|
64
64
|
var seriesData = seriesModel.getData();
|
|
65
65
|
|
|
66
66
|
var symbolDrawMap = this.markerGroupMap;
|
|
67
|
-
var symbolDraw = symbolDrawMap
|
|
68
|
-
|
|
69
|
-
symbolDraw = symbolDrawMap[seriesName] = new SymbolDraw();
|
|
70
|
-
}
|
|
67
|
+
var symbolDraw = symbolDrawMap.get(seriesName)
|
|
68
|
+
|| symbolDrawMap.set(seriesName, new SymbolDraw());
|
|
71
69
|
|
|
72
70
|
var mpData = createList(coordSys, seriesModel, mpModel);
|
|
73
71
|
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
var zrUtil = require('zrender/lib/core/util');
|
|
4
|
+
|
|
3
5
|
module.exports = require('../../echarts').extendComponentView({
|
|
4
6
|
|
|
5
7
|
type: 'marker',
|
|
@@ -8,18 +10,16 @@
|
|
|
8
10
|
/**
|
|
9
11
|
* Markline grouped by series
|
|
10
12
|
* @private
|
|
11
|
-
* @type {
|
|
13
|
+
* @type {module:zrender/core/util.HashMap}
|
|
12
14
|
*/
|
|
13
|
-
this.markerGroupMap =
|
|
15
|
+
this.markerGroupMap = zrUtil.createHashMap();
|
|
14
16
|
},
|
|
15
17
|
|
|
16
18
|
render: function (markerModel, ecModel, api) {
|
|
17
19
|
var markerGroupMap = this.markerGroupMap;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
}
|
|
20
|
+
markerGroupMap.each(function (item) {
|
|
21
|
+
item.__keep = false;
|
|
22
|
+
});
|
|
23
23
|
|
|
24
24
|
var markerModelKey = this.type + 'Model';
|
|
25
25
|
ecModel.eachSeries(function (seriesModel) {
|
|
@@ -27,11 +27,9 @@
|
|
|
27
27
|
markerModel && this.renderSeries(seriesModel, markerModel, ecModel, api);
|
|
28
28
|
}, this);
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
}
|
|
30
|
+
markerGroupMap.each(function (item) {
|
|
31
|
+
!item.__keep && this.group.remove(item.group);
|
|
32
|
+
}, this);
|
|
35
33
|
},
|
|
36
34
|
|
|
37
35
|
renderSeries: function () {}
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
var coordArr = [];
|
|
34
34
|
var value = numCalculate(data, targetDataDim, mlType);
|
|
35
35
|
|
|
36
|
-
var dataIndex = data.
|
|
36
|
+
var dataIndex = data.indicesOfNearest(targetDataDim, value, true)[0];
|
|
37
37
|
coordArr[otherCoordIndex] = data.get(otherDataDim, dataIndex, true);
|
|
38
38
|
coordArr[targetCoordIndex] = data.get(targetDataDim, dataIndex, true);
|
|
39
39
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
var echarts = require('../echarts');
|
|
8
8
|
var zrUtil = require('zrender/lib/core/util');
|
|
9
|
+
var throttle = require('../util/throttle');
|
|
9
10
|
|
|
10
11
|
var CLICK_THRESHOLD = 5; // > 4
|
|
11
12
|
|
|
@@ -14,43 +15,107 @@
|
|
|
14
15
|
type: 'parallel',
|
|
15
16
|
|
|
16
17
|
render: function (parallelModel, ecModel, api) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (!this.__onMouseDown) {
|
|
20
|
-
// FIXME
|
|
21
|
-
// click: mousemove check. otherwise confilct with drag brush.
|
|
22
|
-
var mousedownPoint;
|
|
23
|
-
zr.on('mousedown', this.__onMouseDown = function (e) {
|
|
24
|
-
mousedownPoint = [e.offsetX, e.offsetY];
|
|
25
|
-
});
|
|
26
|
-
zr.on('mouseup', this.__onMouseUp = function (e) {
|
|
27
|
-
var point = [e.offsetX, e.offsetY];
|
|
28
|
-
var dist = Math.pow(mousedownPoint[0] - point[0], 2)
|
|
29
|
-
+ Math.pow(mousedownPoint[1] - point[1], 2);
|
|
30
|
-
|
|
31
|
-
if (!parallelModel.get('axisExpandable') || dist > CLICK_THRESHOLD) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
18
|
+
this._model = parallelModel;
|
|
19
|
+
this._api = api;
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
type: 'parallelAxisExpand',
|
|
41
|
-
axisExpandCenter: axisIndex
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
});
|
|
21
|
+
if (!this._handlers) {
|
|
22
|
+
this._handlers = {};
|
|
23
|
+
zrUtil.each(handlers, function (handler, eventName) {
|
|
24
|
+
api.getZr().on(eventName, this._handlers[eventName] = zrUtil.bind(handler, this));
|
|
25
|
+
}, this);
|
|
45
26
|
}
|
|
27
|
+
|
|
28
|
+
throttle.createOrUpdate(
|
|
29
|
+
this,
|
|
30
|
+
'_throttledDispatchExpand',
|
|
31
|
+
parallelModel.get('axisExpandRate'),
|
|
32
|
+
'fixRate'
|
|
33
|
+
);
|
|
46
34
|
},
|
|
47
35
|
|
|
48
36
|
dispose: function (ecModel, api) {
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
zrUtil.each(this._handlers, function (handler, eventName) {
|
|
38
|
+
api.getZr().off(eventName, handler);
|
|
39
|
+
});
|
|
40
|
+
this._handlers = null;
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @param {Object} [opt] If null, cancle the last action triggering for debounce.
|
|
45
|
+
*/
|
|
46
|
+
_throttledDispatchExpand: function (opt) {
|
|
47
|
+
this._dispatchExpand(opt);
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
_dispatchExpand: function (opt) {
|
|
51
|
+
opt && this._api.dispatchAction(
|
|
52
|
+
zrUtil.extend({type: 'parallelAxisExpand'}, opt)
|
|
53
|
+
);
|
|
51
54
|
}
|
|
55
|
+
|
|
52
56
|
});
|
|
53
57
|
|
|
58
|
+
var handlers = {
|
|
59
|
+
|
|
60
|
+
mousedown: function (e) {
|
|
61
|
+
if (checkTrigger(this, 'click')) {
|
|
62
|
+
this._mouseDownPoint = [e.offsetX, e.offsetY];
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
mouseup: function (e) {
|
|
67
|
+
var mouseDownPoint = this._mouseDownPoint;
|
|
68
|
+
|
|
69
|
+
if (checkTrigger(this, 'click') && mouseDownPoint) {
|
|
70
|
+
var point = [e.offsetX, e.offsetY];
|
|
71
|
+
var dist = Math.pow(mouseDownPoint[0] - point[0], 2)
|
|
72
|
+
+ Math.pow(mouseDownPoint[1] - point[1], 2);
|
|
73
|
+
|
|
74
|
+
if (dist > CLICK_THRESHOLD) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var result = this._model.coordinateSystem.getSlidedAxisExpandWindow(
|
|
79
|
+
[e.offsetX, e.offsetY]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
result.behavior !== 'none' && this._dispatchExpand({
|
|
83
|
+
axisExpandWindow: result.axisExpandWindow
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
this._mouseDownPoint = null;
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
mousemove: function (e) {
|
|
91
|
+
// Should do nothing when brushing.
|
|
92
|
+
if (this._mouseDownPoint || !checkTrigger(this, 'mousemove')) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
var model = this._model;
|
|
96
|
+
var result = model.coordinateSystem.getSlidedAxisExpandWindow(
|
|
97
|
+
[e.offsetX, e.offsetY]
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
var behavior = result.behavior;
|
|
101
|
+
behavior === 'jump' && this._throttledDispatchExpand.debounceNextCall(model.get('axisExpandDebounce'));
|
|
102
|
+
this._throttledDispatchExpand(
|
|
103
|
+
behavior === 'none'
|
|
104
|
+
? null // Cancle the last trigger, in case that mouse slide out of the area quickly.
|
|
105
|
+
: {
|
|
106
|
+
axisExpandWindow: result.axisExpandWindow,
|
|
107
|
+
// Jumping uses animation, and sliding suppresses animation.
|
|
108
|
+
animation: behavior === 'jump' ? null : false
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
function checkTrigger(view, triggerOn) {
|
|
115
|
+
var model = view._model;
|
|
116
|
+
return model.get('axisExpandable') && model.get('axisExpandTriggerOn') === triggerOn;
|
|
117
|
+
}
|
|
118
|
+
|
|
54
119
|
echarts.registerPreprocessor(
|
|
55
120
|
require('../coord/parallel/parallelPreprocessor')
|
|
56
121
|
);
|
package/lib/component/polar.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var zrUtil = require('zrender/lib/core/util');
|
|
5
|
+
|
|
4
6
|
require('../coord/polar/polarCreator');
|
|
5
7
|
require('./angleAxis');
|
|
6
8
|
require('./radiusAxis');
|
|
@@ -8,6 +10,9 @@
|
|
|
8
10
|
|
|
9
11
|
require('./axisPointer/PolarAxisPointer');
|
|
10
12
|
|
|
13
|
+
// For reducing size of echarts.min, barLayoutPolar is required by polar.
|
|
14
|
+
require('../echarts').registerLayout(zrUtil.curry(require('../layout/barPolar'), 'bar'));
|
|
15
|
+
|
|
11
16
|
// Polar view
|
|
12
17
|
require('../echarts').extendComponentView({
|
|
13
18
|
type: 'polar'
|
|
@@ -92,8 +92,15 @@
|
|
|
92
92
|
var brushMode = this._brushMode;
|
|
93
93
|
|
|
94
94
|
if (type === 'clear') {
|
|
95
|
+
// Trigger parallel action firstly
|
|
96
|
+
api.dispatchAction({
|
|
97
|
+
type: 'axisAreaSelect',
|
|
98
|
+
intervals: []
|
|
99
|
+
});
|
|
100
|
+
|
|
95
101
|
api.dispatchAction({
|
|
96
102
|
type: 'brush',
|
|
103
|
+
command: 'clear',
|
|
97
104
|
// Clear all areas of all brush components.
|
|
98
105
|
areas: []
|
|
99
106
|
});
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
var BrushController = require('../../helper/BrushController');
|
|
6
6
|
var BrushTargetManager = require('../../helper/BrushTargetManager');
|
|
7
7
|
var history = require('../../dataZoom/history');
|
|
8
|
+
var sliderMove = require('../../helper/sliderMove');
|
|
8
9
|
|
|
9
10
|
var each = zrUtil.each;
|
|
10
11
|
|
|
@@ -51,7 +52,7 @@
|
|
|
51
52
|
this.ecModel = ecModel;
|
|
52
53
|
this.api = api;
|
|
53
54
|
|
|
54
|
-
updateZoomBtnStatus(featureModel, ecModel, this, payload);
|
|
55
|
+
updateZoomBtnStatus(featureModel, ecModel, this, payload, api);
|
|
55
56
|
updateBackBtnStatus(featureModel, ecModel);
|
|
56
57
|
};
|
|
57
58
|
|
|
@@ -122,7 +123,19 @@
|
|
|
122
123
|
this._dispatchZoomAction(snapshot);
|
|
123
124
|
|
|
124
125
|
function setBatch(dimName, coordSys, minMax) {
|
|
125
|
-
var
|
|
126
|
+
var axis = coordSys.getAxis(dimName);
|
|
127
|
+
var axisModel = axis.model;
|
|
128
|
+
var dataZoomModel = findDataZoom(dimName, axisModel, ecModel);
|
|
129
|
+
|
|
130
|
+
// Restrict range.
|
|
131
|
+
var minMaxSpan = dataZoomModel.findRepresentativeAxisProxy(axisModel).getMinMaxSpan();
|
|
132
|
+
if (minMaxSpan.minValueSpan != null || minMaxSpan.maxValueSpan != null) {
|
|
133
|
+
minMax = sliderMove(
|
|
134
|
+
0, minMax.slice(), axis.scale.getExtent(), 0,
|
|
135
|
+
minMaxSpan.minValueSpan, minMaxSpan.maxValueSpan
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
126
139
|
dataZoomModel && (snapshot[dataZoomModel.id] = {
|
|
127
140
|
dataZoomId: dataZoomModel.id,
|
|
128
141
|
startValue: minMax[0],
|
|
@@ -176,7 +189,7 @@
|
|
|
176
189
|
);
|
|
177
190
|
}
|
|
178
191
|
|
|
179
|
-
function updateZoomBtnStatus(featureModel, ecModel, view, payload) {
|
|
192
|
+
function updateZoomBtnStatus(featureModel, ecModel, view, payload, api) {
|
|
180
193
|
var zoomActive = view._isZoomActive;
|
|
181
194
|
|
|
182
195
|
if (payload && payload.type === 'takeGlobalCursor') {
|
|
@@ -193,7 +206,7 @@
|
|
|
193
206
|
);
|
|
194
207
|
|
|
195
208
|
view._brushController
|
|
196
|
-
.setPanels(brushTargetManager.makePanelOpts(function (targetInfo) {
|
|
209
|
+
.setPanels(brushTargetManager.makePanelOpts(api, function (targetInfo) {
|
|
197
210
|
return (targetInfo.xAxisDeclared && !targetInfo.yAxisDeclared)
|
|
198
211
|
? 'lineX'
|
|
199
212
|
: (!targetInfo.xAxisDeclared && targetInfo.yAxisDeclared)
|