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
|
@@ -200,7 +200,7 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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
|
define(function (require) {
|
|
2
2
|
|
|
3
|
+
var zrUtil = require('zrender/core/util');
|
|
4
|
+
|
|
3
5
|
return require('../../echarts').extendComponentView({
|
|
4
6
|
|
|
5
7
|
type: 'marker',
|
|
@@ -8,18 +10,16 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function(require) {
|
|
|
6
6
|
|
|
7
7
|
var echarts = require('../echarts');
|
|
8
8
|
var zrUtil = require('zrender/core/util');
|
|
9
|
+
var throttle = require('../util/throttle');
|
|
9
10
|
|
|
10
11
|
var CLICK_THRESHOLD = 5; // > 4
|
|
11
12
|
|
|
@@ -14,43 +15,107 @@ define(function(require) {
|
|
|
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/src/component/polar.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
define(function(require) {
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var zrUtil = require('zrender/core/util');
|
|
5
|
+
|
|
4
6
|
require('../coord/polar/polarCreator');
|
|
5
7
|
require('./angleAxis');
|
|
6
8
|
require('./radiusAxis');
|
|
@@ -8,6 +10,9 @@ define(function(require) {
|
|
|
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 @@ define(function(require) {
|
|
|
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 @@ define(function(require) {
|
|
|
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 @@ define(function(require) {
|
|
|
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 @@ define(function(require) {
|
|
|
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 @@ define(function(require) {
|
|
|
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 @@ define(function(require) {
|
|
|
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)
|
|
@@ -4,6 +4,7 @@ define(function (require) {
|
|
|
4
4
|
var zrUtil = require('zrender/core/util');
|
|
5
5
|
var formatUtil = require('../../util/format');
|
|
6
6
|
var numberUtil = require('../../util/number');
|
|
7
|
+
var graphic = require('../../util/graphic');
|
|
7
8
|
var findPointFromSeries = require('../axisPointer/findPointFromSeries');
|
|
8
9
|
var layoutUtil = require('../../util/layout');
|
|
9
10
|
var env = require('zrender/core/env');
|
|
@@ -17,6 +18,10 @@ define(function (require) {
|
|
|
17
18
|
var parsePercent = numberUtil.parsePercent;
|
|
18
19
|
|
|
19
20
|
|
|
21
|
+
var proxyRect = new graphic.Rect({
|
|
22
|
+
shape: {x: -1, y: -1, width: 2, height: 2}
|
|
23
|
+
});
|
|
24
|
+
|
|
20
25
|
require('../../echarts').extendComponentView({
|
|
21
26
|
|
|
22
27
|
type: 'tooltip',
|
|
@@ -56,10 +61,11 @@ define(function (require) {
|
|
|
56
61
|
this._api = api;
|
|
57
62
|
|
|
58
63
|
/**
|
|
64
|
+
* Should be cleaned when render.
|
|
59
65
|
* @private
|
|
60
66
|
* @type {Array.<Array.<Object>>}
|
|
61
67
|
*/
|
|
62
|
-
this._lastDataByCoordSys;
|
|
68
|
+
this._lastDataByCoordSys = null;
|
|
63
69
|
|
|
64
70
|
/**
|
|
65
71
|
* @private
|
|
@@ -150,11 +156,22 @@ define(function (require) {
|
|
|
150
156
|
// Reset ticket
|
|
151
157
|
this._ticket = '';
|
|
152
158
|
|
|
153
|
-
|
|
159
|
+
// When triggered from axisPointer.
|
|
154
160
|
var dataByCoordSys = payload.dataByCoordSys;
|
|
155
161
|
|
|
156
|
-
|
|
157
|
-
|
|
162
|
+
if (payload.tooltip && payload.x != null && payload.y != null) {
|
|
163
|
+
var el = proxyRect;
|
|
164
|
+
el.position = [payload.x, payload.y];
|
|
165
|
+
el.update();
|
|
166
|
+
el.tooltip = payload.tooltip;
|
|
167
|
+
// Manually show tooltip while view is not using zrender elements.
|
|
168
|
+
this._tryShow({
|
|
169
|
+
offsetX: payload.x,
|
|
170
|
+
offsetY: payload.y,
|
|
171
|
+
target: el
|
|
172
|
+
}, dispatchAction);
|
|
173
|
+
}
|
|
174
|
+
else if (dataByCoordSys) {
|
|
158
175
|
this._tryShow({
|
|
159
176
|
offsetX: payload.x,
|
|
160
177
|
offsetY: payload.y,
|
|
@@ -164,7 +181,12 @@ define(function (require) {
|
|
|
164
181
|
tooltipOption: payload.tooltipOption
|
|
165
182
|
}, dispatchAction);
|
|
166
183
|
}
|
|
167
|
-
else if (seriesIndex != null) {
|
|
184
|
+
else if (payload.seriesIndex != null) {
|
|
185
|
+
|
|
186
|
+
if (this._manuallyAxisShowTip(tooltipModel, ecModel, api, payload)) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
168
190
|
var pointInfo = findPointFromSeries(payload, ecModel);
|
|
169
191
|
var cx = pointInfo.point[0];
|
|
170
192
|
var cy = pointInfo.point[1];
|
|
@@ -179,11 +201,19 @@ define(function (require) {
|
|
|
179
201
|
}
|
|
180
202
|
}
|
|
181
203
|
else if (payload.x != null && payload.y != null) {
|
|
204
|
+
// FIXME
|
|
205
|
+
// should wrap dispatchAction like `axisPointer/globalListener` ?
|
|
206
|
+
api.dispatchAction({
|
|
207
|
+
type: 'updateAxisPointer',
|
|
208
|
+
x: payload.x,
|
|
209
|
+
y: payload.y
|
|
210
|
+
});
|
|
211
|
+
|
|
182
212
|
this._tryShow({
|
|
183
213
|
offsetX: payload.x,
|
|
184
214
|
offsetY: payload.y,
|
|
185
215
|
position: payload.position,
|
|
186
|
-
target: api.getZr().
|
|
216
|
+
target: api.getZr().findHover(payload.x, payload.y).target,
|
|
187
217
|
event: {}
|
|
188
218
|
}, dispatchAction);
|
|
189
219
|
}
|
|
@@ -203,6 +233,44 @@ define(function (require) {
|
|
|
203
233
|
}
|
|
204
234
|
},
|
|
205
235
|
|
|
236
|
+
// Be compatible with previous design, that is, when tooltip.type is 'axis' and
|
|
237
|
+
// dispatchAction 'showTip' with seriesIndex and dataIndex will trigger axis pointer
|
|
238
|
+
// and tooltip.
|
|
239
|
+
_manuallyAxisShowTip: function (tooltipModel, ecModel, api, payload) {
|
|
240
|
+
var seriesIndex = payload.seriesIndex;
|
|
241
|
+
var dataIndex = payload.dataIndex;
|
|
242
|
+
var coordSysAxesInfo = ecModel.getComponent('axisPointer').coordSysAxesInfo;
|
|
243
|
+
|
|
244
|
+
if (seriesIndex == null || dataIndex == null || coordSysAxesInfo == null) {
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
var seriesModel = ecModel.getSeriesByIndex(seriesIndex);
|
|
249
|
+
if (!seriesModel) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
var data = seriesModel.getData();
|
|
254
|
+
var tooltipModel = buildTooltipModel([
|
|
255
|
+
data.getItemModel(dataIndex),
|
|
256
|
+
seriesModel,
|
|
257
|
+
(seriesModel.coordinateSystem || {}).model,
|
|
258
|
+
tooltipModel
|
|
259
|
+
]);
|
|
260
|
+
|
|
261
|
+
if (tooltipModel.get('trigger') !== 'axis') {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
api.dispatchAction({
|
|
266
|
+
type: 'updateAxisPointer',
|
|
267
|
+
seriesIndex: seriesIndex,
|
|
268
|
+
dataIndex: dataIndex
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
return true;
|
|
272
|
+
},
|
|
273
|
+
|
|
206
274
|
_tryShow: function (e, dispatchAction) {
|
|
207
275
|
var el = e.target;
|
|
208
276
|
var tooltipModel = this._tooltipModel;
|
|
@@ -518,7 +586,7 @@ define(function (require) {
|
|
|
518
586
|
}
|
|
519
587
|
else {
|
|
520
588
|
var pos = refixTooltipPosition(
|
|
521
|
-
x, y, content.el, viewWidth, viewHeight, align ?
|
|
589
|
+
x, y, content.el, viewWidth, viewHeight, align ? null : 20, vAlign ? null : 20
|
|
522
590
|
);
|
|
523
591
|
x = pos[0];
|
|
524
592
|
y = pos[1];
|
|
@@ -545,13 +613,13 @@ define(function (require) {
|
|
|
545
613
|
var contentNotChanged = !!lastCoordSys
|
|
546
614
|
&& lastCoordSys.length === dataByCoordSys.length;
|
|
547
615
|
|
|
548
|
-
each(lastCoordSys, function (lastItemCoordSys, indexCoordSys) {
|
|
616
|
+
contentNotChanged && each(lastCoordSys, function (lastItemCoordSys, indexCoordSys) {
|
|
549
617
|
var lastDataByAxis = lastItemCoordSys.dataByAxis || {};
|
|
550
618
|
var thisItemCoordSys = dataByCoordSys[indexCoordSys] || {};
|
|
551
619
|
var thisDataByAxis = thisItemCoordSys.dataByAxis || [];
|
|
552
620
|
contentNotChanged &= lastDataByAxis.length === thisDataByAxis.length;
|
|
553
621
|
|
|
554
|
-
each(lastDataByAxis, function (lastItem, indexAxis) {
|
|
622
|
+
contentNotChanged && each(lastDataByAxis, function (lastItem, indexAxis) {
|
|
555
623
|
var thisItem = thisDataByAxis[indexAxis] || {};
|
|
556
624
|
var lastIndices = lastItem.seriesDataIndices || [];
|
|
557
625
|
var newIndices = thisItem.seriesDataIndices || [];
|
|
@@ -562,7 +630,7 @@ define(function (require) {
|
|
|
562
630
|
&& lastItem.axisId === thisItem.axisId
|
|
563
631
|
&& lastIndices.length === newIndices.length;
|
|
564
632
|
|
|
565
|
-
each(lastIndices, function (lastIdxItem, j) {
|
|
633
|
+
contentNotChanged && each(lastIndices, function (lastIdxItem, j) {
|
|
566
634
|
var newIdxItem = newIndices[j];
|
|
567
635
|
contentNotChanged &=
|
|
568
636
|
lastIdxItem.seriesIndex === newIdxItem.seriesIndex
|
|
@@ -633,17 +701,21 @@ define(function (require) {
|
|
|
633
701
|
var width = el.clientWidth;
|
|
634
702
|
var height = el.clientHeight;
|
|
635
703
|
|
|
636
|
-
if (
|
|
637
|
-
x
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
y -= height + gapV;
|
|
704
|
+
if (gapH != null) {
|
|
705
|
+
if (x + width + gapH > viewWidth) {
|
|
706
|
+
x -= width + gapH;
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
x += gapH;
|
|
710
|
+
}
|
|
644
711
|
}
|
|
645
|
-
|
|
646
|
-
y
|
|
712
|
+
if (gapV != null) {
|
|
713
|
+
if (y + height + gapV > viewHeight) {
|
|
714
|
+
y -= height + gapV;
|
|
715
|
+
}
|
|
716
|
+
else {
|
|
717
|
+
y += gapV;
|
|
718
|
+
}
|
|
647
719
|
}
|
|
648
720
|
return [x, y];
|
|
649
721
|
}
|
|
@@ -355,16 +355,18 @@ define(function(require) {
|
|
|
355
355
|
delta = delta || 0;
|
|
356
356
|
var visualMapModel = this.visualMapModel;
|
|
357
357
|
var handleEnds = this._handleEnds;
|
|
358
|
+
var sizeExtent = [0, visualMapModel.itemSize[1]];
|
|
358
359
|
|
|
359
360
|
sliderMove(
|
|
360
361
|
delta,
|
|
361
362
|
handleEnds,
|
|
362
|
-
|
|
363
|
-
handleIndex
|
|
364
|
-
|
|
363
|
+
sizeExtent,
|
|
364
|
+
handleIndex,
|
|
365
|
+
// cross is forbiden
|
|
366
|
+
0
|
|
365
367
|
);
|
|
368
|
+
|
|
366
369
|
var dataExtent = visualMapModel.getExtent();
|
|
367
|
-
var sizeExtent = [0, visualMapModel.itemSize[1]];
|
|
368
370
|
// Update data interval.
|
|
369
371
|
this._dataInterval = [
|
|
370
372
|
linearMap(handleEnds[0], sizeExtent, dataExtent, true),
|
package/src/coord/Axis.js
CHANGED
|
@@ -3,6 +3,7 @@ define(function (require) {
|
|
|
3
3
|
var numberUtil = require('../util/number');
|
|
4
4
|
var linearMap = numberUtil.linearMap;
|
|
5
5
|
var zrUtil = require('zrender/core/util');
|
|
6
|
+
var axisHelper = require('./axisHelper');
|
|
6
7
|
|
|
7
8
|
function fixExtentWithBands(extent, nTick) {
|
|
8
9
|
var size = extent[1] - extent[0];
|
|
@@ -47,6 +48,12 @@ define(function (require) {
|
|
|
47
48
|
* @type {boolean}
|
|
48
49
|
*/
|
|
49
50
|
this.onBand = false;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @private
|
|
54
|
+
* @type {number}
|
|
55
|
+
*/
|
|
56
|
+
this._labelInterval;
|
|
50
57
|
};
|
|
51
58
|
|
|
52
59
|
Axis.prototype = {
|
|
@@ -79,8 +86,7 @@ define(function (require) {
|
|
|
79
86
|
* @return {Array.<number>}
|
|
80
87
|
*/
|
|
81
88
|
getExtent: function () {
|
|
82
|
-
|
|
83
|
-
return ret;
|
|
89
|
+
return this._extent.slice();
|
|
84
90
|
},
|
|
85
91
|
|
|
86
92
|
/**
|
|
@@ -224,6 +230,32 @@ define(function (require) {
|
|
|
224
230
|
var size = Math.abs(axisExtent[1] - axisExtent[0]);
|
|
225
231
|
|
|
226
232
|
return Math.abs(size) / len;
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get interval of the axis label.
|
|
237
|
+
* @return {number}
|
|
238
|
+
*/
|
|
239
|
+
getLabelInterval: function () {
|
|
240
|
+
var labelInterval = this._labelInterval;
|
|
241
|
+
if (!labelInterval) {
|
|
242
|
+
var axisModel = this.model;
|
|
243
|
+
var labelModel = axisModel.getModel('axisLabel');
|
|
244
|
+
var interval = labelModel.get('interval');
|
|
245
|
+
if (!(this.type === 'category' && interval === 'auto')) {
|
|
246
|
+
labelInterval = interval === 'auto' ? 0 : interval;
|
|
247
|
+
}
|
|
248
|
+
else if (this.isHorizontal){
|
|
249
|
+
labelInterval = axisHelper.getAxisLabelInterval(
|
|
250
|
+
zrUtil.map(this.scale.getTicks(), this.dataToCoord, this),
|
|
251
|
+
axisModel.getFormattedLabels(),
|
|
252
|
+
labelModel.getModel('textStyle').getFont(),
|
|
253
|
+
this.isHorizontal()
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
this._labelInterval = labelInterval;
|
|
257
|
+
}
|
|
258
|
+
return labelInterval;
|
|
227
259
|
}
|
|
228
260
|
|
|
229
261
|
};
|
package/src/coord/axisDefault.js
CHANGED
|
@@ -65,6 +65,8 @@ define(function (require) {
|
|
|
65
65
|
// 控制文本标签是否在grid里
|
|
66
66
|
inside: false,
|
|
67
67
|
rotate: 0,
|
|
68
|
+
showMinLabel: null, // true | false | null (auto)
|
|
69
|
+
showMaxLabel: null, // true | false | null (auto)
|
|
68
70
|
margin: 8,
|
|
69
71
|
// formatter: null,
|
|
70
72
|
// 其余属性默认使用全局文本样式,详见TEXTSTYLE
|
|
@@ -140,10 +142,11 @@ define(function (require) {
|
|
|
140
142
|
min: 'dataMin',
|
|
141
143
|
max: 'dataMax'
|
|
142
144
|
}, valueAxis);
|
|
145
|
+
|
|
143
146
|
var logAxis = zrUtil.defaults({
|
|
147
|
+
scale: true,
|
|
144
148
|
logBase: 10
|
|
145
149
|
}, valueAxis);
|
|
146
|
-
logAxis.scale = true;
|
|
147
150
|
|
|
148
151
|
return {
|
|
149
152
|
categoryAxis: categoryAxis,
|