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
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// TODO minAngle
|
|
2
|
-
|
|
3
1
|
|
|
4
2
|
|
|
5
3
|
var numberUtil = require('../../util/number');
|
|
@@ -36,9 +34,14 @@
|
|
|
36
34
|
|
|
37
35
|
var minAngle = seriesModel.get('minAngle') * RADIAN;
|
|
38
36
|
|
|
37
|
+
var validDataCount = 0;
|
|
38
|
+
data.each('value', function (value) {
|
|
39
|
+
!isNaN(value) && validDataCount++;
|
|
40
|
+
});
|
|
41
|
+
|
|
39
42
|
var sum = data.getSum('value');
|
|
40
43
|
// Sum may be 0
|
|
41
|
-
var unitRadian = Math.PI / (sum ||
|
|
44
|
+
var unitRadian = Math.PI / (sum || validDataCount) * 2;
|
|
42
45
|
|
|
43
46
|
var clockwise = seriesModel.get('clockwise');
|
|
44
47
|
|
|
@@ -54,8 +57,8 @@
|
|
|
54
57
|
var valueSumLargerThanMinAngle = 0;
|
|
55
58
|
|
|
56
59
|
var currentAngle = startAngle;
|
|
57
|
-
|
|
58
60
|
var dir = clockwise ? 1 : -1;
|
|
61
|
+
|
|
59
62
|
data.each('value', function (value, idx) {
|
|
60
63
|
var angle;
|
|
61
64
|
if (isNaN(value)) {
|
|
@@ -80,7 +83,7 @@
|
|
|
80
83
|
? unitRadian : (value * unitRadian);
|
|
81
84
|
}
|
|
82
85
|
else {
|
|
83
|
-
angle = PI2 /
|
|
86
|
+
angle = PI2 / validDataCount;
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
if (angle < minAngle) {
|
|
@@ -110,27 +113,32 @@
|
|
|
110
113
|
|
|
111
114
|
// Some sector is constrained by minAngle
|
|
112
115
|
// Rest sectors needs recalculate angle
|
|
113
|
-
if (restAngle < PI2) {
|
|
116
|
+
if (restAngle < PI2 && validDataCount) {
|
|
114
117
|
// Average the angle if rest angle is not enough after all angles is
|
|
115
118
|
// Constrained by minAngle
|
|
116
119
|
if (restAngle <= 1e-3) {
|
|
117
|
-
var angle = PI2 /
|
|
118
|
-
data.each(function (idx) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
var angle = PI2 / validDataCount;
|
|
121
|
+
data.each('value', function (value, idx) {
|
|
122
|
+
if (!isNaN(value)) {
|
|
123
|
+
var layout = data.getItemLayout(idx);
|
|
124
|
+
layout.angle = angle;
|
|
125
|
+
layout.startAngle = startAngle + dir * idx * angle;
|
|
126
|
+
layout.endAngle = startAngle + dir * (idx + 1) * angle;
|
|
127
|
+
}
|
|
122
128
|
});
|
|
123
129
|
}
|
|
124
130
|
else {
|
|
125
131
|
unitRadian = restAngle / valueSumLargerThanMinAngle;
|
|
126
132
|
currentAngle = startAngle;
|
|
127
133
|
data.each('value', function (value, idx) {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
if (!isNaN(value)) {
|
|
135
|
+
var layout = data.getItemLayout(idx);
|
|
136
|
+
var angle = layout.angle === minAngle
|
|
137
|
+
? minAngle : value * unitRadian;
|
|
138
|
+
layout.startAngle = currentAngle;
|
|
139
|
+
layout.endAngle = currentAngle + dir * angle;
|
|
140
|
+
currentAngle += dir * angle;
|
|
141
|
+
}
|
|
134
142
|
});
|
|
135
143
|
}
|
|
136
144
|
}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
getInitialData: function (option, ecModel) {
|
|
29
29
|
var data = option.data || [];
|
|
30
30
|
var dimensions = completeDimensions(
|
|
31
|
-
[], data, {extraPrefix: 'indicator_'}
|
|
31
|
+
[], data, {extraPrefix: 'indicator_', extraFromZero: true}
|
|
32
32
|
);
|
|
33
33
|
var list = new List(dimensions, this);
|
|
34
34
|
list.initData(data);
|
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
|
|
9
9
|
type: 'series.scatter',
|
|
10
10
|
|
|
11
|
-
dependencies: ['grid', 'polar', 'geo', 'singleAxis'],
|
|
11
|
+
dependencies: ['grid', 'polar', 'geo', 'singleAxis', 'calendar'],
|
|
12
12
|
|
|
13
13
|
getInitialData: function (option, ecModel) {
|
|
14
|
-
|
|
15
|
-
return list;
|
|
14
|
+
return createListFromArray(option.data, this, ecModel);
|
|
16
15
|
},
|
|
17
16
|
|
|
18
17
|
brushSelector: 'point',
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* @readOnly
|
|
26
|
-
* @type {
|
|
26
|
+
* @type {module:zrender/core/util#HashMap}
|
|
27
27
|
*/
|
|
28
28
|
nameMap: null,
|
|
29
29
|
|
|
@@ -150,17 +150,18 @@
|
|
|
150
150
|
|
|
151
151
|
var data = this.fixData(filterData || []);
|
|
152
152
|
var nameList = [];
|
|
153
|
-
var nameMap = this.nameMap =
|
|
153
|
+
var nameMap = this.nameMap = zrUtil.createHashMap();
|
|
154
154
|
var count = 0;
|
|
155
155
|
|
|
156
156
|
for (var i = 0; i < data.length; ++i) {
|
|
157
157
|
nameList.push(data[i][DATA_NAME_INDEX]);
|
|
158
|
-
if (!nameMap
|
|
159
|
-
nameMap
|
|
158
|
+
if (!nameMap.get(data[i][DATA_NAME_INDEX])) {
|
|
159
|
+
nameMap.set(data[i][DATA_NAME_INDEX], count);
|
|
160
|
+
count++;
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
completeDimensions(dimensions, data);
|
|
164
|
+
dimensions = completeDimensions(dimensions, data);
|
|
164
165
|
|
|
165
166
|
var list = new List(dimensions, this);
|
|
166
167
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
data.each(function (index) {
|
|
14
14
|
var name = data.getName(index);
|
|
15
|
-
var color = colorList[(seriesModel.nameMap
|
|
15
|
+
var color = colorList[(seriesModel.nameMap.get(name) - 1) % colorList.length];
|
|
16
16
|
rawData.setItemVisual(index, 'color', color);
|
|
17
17
|
});
|
|
18
18
|
});
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
var idIndexMap = this._idIndexMap;
|
|
238
238
|
|
|
239
239
|
if (!idIndexMap) {
|
|
240
|
-
idIndexMap = this._idIndexMap =
|
|
240
|
+
idIndexMap = this._idIndexMap = zrUtil.createHashMap();
|
|
241
241
|
/**
|
|
242
242
|
* @private
|
|
243
243
|
* @type {number}
|
|
@@ -245,9 +245,9 @@
|
|
|
245
245
|
this._idIndexMapCount = 0;
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
-
var index = idIndexMap
|
|
248
|
+
var index = idIndexMap.get(id);
|
|
249
249
|
if (index == null) {
|
|
250
|
-
idIndexMap
|
|
250
|
+
idIndexMap.set(id, index = this._idIndexMapCount++);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
return index;
|
|
@@ -301,8 +301,13 @@
|
|
|
301
301
|
function sort(viewChildren, orderBy) {
|
|
302
302
|
if (orderBy) {
|
|
303
303
|
viewChildren.sort(function (a, b) {
|
|
304
|
-
|
|
304
|
+
var diff = orderBy === 'asc'
|
|
305
305
|
? a.getValue() - b.getValue() : b.getValue() - a.getValue();
|
|
306
|
+
return diff === 0
|
|
307
|
+
? (orderBy === 'asc'
|
|
308
|
+
? a.dataIndex - b.dataIndex : b.dataIndex - a.dataIndex
|
|
309
|
+
)
|
|
310
|
+
: diff;
|
|
306
311
|
});
|
|
307
312
|
}
|
|
308
313
|
return viewChildren;
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
var remRadian = numberUtil.remRadian;
|
|
9
9
|
var isRadianAroundZero = numberUtil.isRadianAroundZero;
|
|
10
10
|
var vec2 = require('zrender/lib/core/vector');
|
|
11
|
+
var matrix = require('zrender/lib/core/matrix');
|
|
11
12
|
var v2ApplyTransform = vec2.applyTransform;
|
|
12
13
|
var retrieve = zrUtil.retrieve;
|
|
13
14
|
|
|
@@ -59,6 +60,7 @@
|
|
|
59
60
|
* @param {number} [opt.labelInterval] Default label interval when label
|
|
60
61
|
* interval from model is null or 'auto'.
|
|
61
62
|
* @param {number} [opt.strokeContainThreshold] Default label interval when label
|
|
63
|
+
* @param {number} [opt.nameTruncateMaxWidth]
|
|
62
64
|
*/
|
|
63
65
|
var AxisBuilder = function (axisModel, opt) {
|
|
64
66
|
|
|
@@ -334,33 +336,7 @@
|
|
|
334
336
|
|
|
335
337
|
}, this);
|
|
336
338
|
|
|
337
|
-
|
|
338
|
-
var firstRect = current && current.getBoundingRect().clone();
|
|
339
|
-
var nextRect = next && next.getBoundingRect().clone();
|
|
340
|
-
if (firstRect && nextRect) {
|
|
341
|
-
firstRect.applyTransform(current.getLocalTransform());
|
|
342
|
-
nextRect.applyTransform(next.getLocalTransform());
|
|
343
|
-
return firstRect.intersect(nextRect);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// If min or max are user set, we need to check
|
|
348
|
-
// If the tick on min(max) are overlap on their neighbour tick
|
|
349
|
-
// If they are overlapped, we need to hide the min(max) tick label
|
|
350
|
-
if (axisModel.getMin() != null) {
|
|
351
|
-
var firstLabel = textEls[0];
|
|
352
|
-
var nextLabel = textEls[1];
|
|
353
|
-
if (isTwoLabelOverlapped(firstLabel, nextLabel)) {
|
|
354
|
-
firstLabel.ignore = true;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
if (axisModel.getMax() != null) {
|
|
358
|
-
var lastLabel = textEls[textEls.length - 1];
|
|
359
|
-
var prevLabel = textEls[textEls.length - 2];
|
|
360
|
-
if (isTwoLabelOverlapped(prevLabel, lastLabel)) {
|
|
361
|
-
lastLabel.ignore = true;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
339
|
+
fixMinMaxLabelShow(axisModel, textEls);
|
|
364
340
|
},
|
|
365
341
|
|
|
366
342
|
/**
|
|
@@ -426,7 +402,9 @@
|
|
|
426
402
|
|
|
427
403
|
var truncateOpt = axisModel.get('nameTruncate', true) || {};
|
|
428
404
|
var ellipsis = truncateOpt.ellipsis;
|
|
429
|
-
var maxWidth = retrieve(
|
|
405
|
+
var maxWidth = retrieve(
|
|
406
|
+
opt.nameTruncateMaxWidth, truncateOpt.maxWidth, axisNameAvailableWidth
|
|
407
|
+
);
|
|
430
408
|
var truncatedText = (ellipsis != null && maxWidth != null)
|
|
431
409
|
? formatUtil.truncateText(
|
|
432
410
|
name, maxWidth, textFont, ellipsis,
|
|
@@ -536,9 +514,6 @@
|
|
|
536
514
|
};
|
|
537
515
|
};
|
|
538
516
|
|
|
539
|
-
/**
|
|
540
|
-
* @inner
|
|
541
|
-
*/
|
|
542
517
|
function endTextLayout(opt, textPosition, textRotate, extent) {
|
|
543
518
|
var rotationDiff = remRadian(textRotate - opt.rotation);
|
|
544
519
|
var textAlign;
|
|
@@ -572,9 +547,6 @@
|
|
|
572
547
|
};
|
|
573
548
|
}
|
|
574
549
|
|
|
575
|
-
/**
|
|
576
|
-
* @inner
|
|
577
|
-
*/
|
|
578
550
|
function isSilent(axisModel) {
|
|
579
551
|
var tooltipOpt = axisModel.get('tooltip');
|
|
580
552
|
return axisModel.get('silent')
|
|
@@ -584,6 +556,53 @@
|
|
|
584
556
|
);
|
|
585
557
|
}
|
|
586
558
|
|
|
559
|
+
function fixMinMaxLabelShow(axisModel, textEls) {
|
|
560
|
+
// If min or max are user set, we need to check
|
|
561
|
+
// If the tick on min(max) are overlap on their neighbour tick
|
|
562
|
+
// If they are overlapped, we need to hide the min(max) tick label
|
|
563
|
+
var showMinLabel = axisModel.get('axisLabel.showMinLabel');
|
|
564
|
+
var showMaxLabel = axisModel.get('axisLabel.showMaxLabel');
|
|
565
|
+
var firstLabel = textEls[0];
|
|
566
|
+
var nextLabel = textEls[1];
|
|
567
|
+
var lastLabel = textEls[textEls.length - 1];
|
|
568
|
+
var prevLabel = textEls[textEls.length - 2];
|
|
569
|
+
|
|
570
|
+
if (showMinLabel === false) {
|
|
571
|
+
firstLabel.ignore = true;
|
|
572
|
+
}
|
|
573
|
+
else if (axisModel.getMin() != null && isTwoLabelOverlapped(firstLabel, nextLabel)) {
|
|
574
|
+
showMinLabel ? (nextLabel.ignore = true) : (firstLabel.ignore = true);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (showMaxLabel === false) {
|
|
578
|
+
lastLabel.ignore = true;
|
|
579
|
+
}
|
|
580
|
+
else if (axisModel.getMax() != null && isTwoLabelOverlapped(prevLabel, lastLabel)) {
|
|
581
|
+
showMaxLabel ? (prevLabel.ignore = true) : (lastLabel.ignore = true);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function isTwoLabelOverlapped(current, next, labelLayout) {
|
|
586
|
+
// current and next has the same rotation.
|
|
587
|
+
var firstRect = current && current.getBoundingRect().clone();
|
|
588
|
+
var nextRect = next && next.getBoundingRect().clone();
|
|
589
|
+
|
|
590
|
+
if (!firstRect || !nextRect) {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// When checking intersect of two rotated labels, we use mRotationBack
|
|
595
|
+
// to avoid that boundingRect is enlarge when using `boundingRect.applyTransform`.
|
|
596
|
+
var mRotationBack = matrix.identity([]);
|
|
597
|
+
matrix.rotate(mRotationBack, mRotationBack, -current.rotation);
|
|
598
|
+
|
|
599
|
+
firstRect.applyTransform(matrix.mul([], mRotationBack, current.getLocalTransform()));
|
|
600
|
+
nextRect.applyTransform(matrix.mul([], mRotationBack, next.getLocalTransform()));
|
|
601
|
+
|
|
602
|
+
return firstRect.intersect(nextRect);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
|
|
587
606
|
/**
|
|
588
607
|
* @static
|
|
589
608
|
*/
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var zrUtil = require('zrender/lib/core/util');
|
|
4
4
|
var AxisBuilder = require('./AxisBuilder');
|
|
5
5
|
var BrushController = require('../helper/BrushController');
|
|
6
|
+
var brushHelper = require('../helper/brushHelper');
|
|
6
7
|
var graphic = require('../../util/graphic');
|
|
7
8
|
|
|
8
9
|
var elementList = ['axisLine', 'axisLabel', 'axisTick', 'axisName'];
|
|
@@ -45,9 +46,8 @@
|
|
|
45
46
|
return;
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
).coordinateSystem;
|
|
49
|
+
var coordSysModel = getCoordSysModel(axisModel, ecModel);
|
|
50
|
+
var coordSys = coordSysModel.coordinateSystem;
|
|
51
51
|
|
|
52
52
|
var areaSelectStyle = axisModel.getAreaSelectStyle();
|
|
53
53
|
var areaWidth = areaSelectStyle.width;
|
|
@@ -55,22 +55,8 @@
|
|
|
55
55
|
var dim = axisModel.axis.dim;
|
|
56
56
|
var axisLayout = coordSys.getAxisLayout(dim);
|
|
57
57
|
|
|
58
|
-
// Fetch from axisModel by default.
|
|
59
|
-
var axisLabelShow;
|
|
60
|
-
var axisIndex = zrUtil.indexOf(coordSys.dimensions, dim);
|
|
61
|
-
|
|
62
|
-
var axisExpandWindow = axisLayout.axisExpandWindow;
|
|
63
|
-
if (axisExpandWindow
|
|
64
|
-
&& (axisIndex <= axisExpandWindow[0] || axisIndex >= axisExpandWindow[1])
|
|
65
|
-
) {
|
|
66
|
-
axisLabelShow = false;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
58
|
var builderOpt = zrUtil.extend(
|
|
70
|
-
{
|
|
71
|
-
axisLabelShow: axisLabelShow,
|
|
72
|
-
strokeContainThreshold: areaWidth
|
|
73
|
-
},
|
|
59
|
+
{strokeContainThreshold: areaWidth},
|
|
74
60
|
axisLayout
|
|
75
61
|
);
|
|
76
62
|
|
|
@@ -80,26 +66,27 @@
|
|
|
80
66
|
|
|
81
67
|
this._axisGroup.add(axisBuilder.getGroup());
|
|
82
68
|
|
|
83
|
-
this._refreshBrushController(
|
|
69
|
+
this._refreshBrushController(
|
|
70
|
+
builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api
|
|
71
|
+
);
|
|
84
72
|
|
|
85
|
-
|
|
73
|
+
var animationModel = (payload && payload.animation === false) ? null : axisModel;
|
|
74
|
+
graphic.groupTransition(oldAxisGroup, this._axisGroup, animationModel);
|
|
86
75
|
},
|
|
87
76
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
range: [
|
|
96
|
-
axis.dataToCoord(interval[0], true),
|
|
97
|
-
axis.dataToCoord(interval[1], true)
|
|
98
|
-
]
|
|
99
|
-
};
|
|
100
|
-
});
|
|
77
|
+
/**
|
|
78
|
+
* @override
|
|
79
|
+
*/
|
|
80
|
+
updateVisual: function (axisModel, ecModel, api, payload) {
|
|
81
|
+
this._brushController && this._brushController
|
|
82
|
+
.updateCovers(getCoverInfoList(axisModel));
|
|
83
|
+
},
|
|
101
84
|
|
|
102
|
-
|
|
85
|
+
_refreshBrushController: function (
|
|
86
|
+
builderOpt, areaSelectStyle, axisModel, coordSysModel, areaWidth, api
|
|
87
|
+
) {
|
|
88
|
+
// After filtering, axis may change, select area needs to be update.
|
|
89
|
+
var extent = axisModel.axis.getExtent();
|
|
103
90
|
var extentLen = extent[1] - extent[0];
|
|
104
91
|
var extra = Math.min(30, Math.abs(extentLen) * 0.1); // Arbitrary value.
|
|
105
92
|
|
|
@@ -122,21 +109,22 @@
|
|
|
122
109
|
})
|
|
123
110
|
.setPanels([{
|
|
124
111
|
panelId: 'pl',
|
|
125
|
-
|
|
112
|
+
clipPath: brushHelper.makeRectPanelClipPath(rect),
|
|
113
|
+
isTargetByCursor: brushHelper.makeRectIsTargetByCursor(rect, api, coordSysModel),
|
|
114
|
+
getLinearBrushOtherExtent: brushHelper.makeLinearBrushOtherExtent(rect, 0)
|
|
126
115
|
}])
|
|
127
116
|
.enableBrush({
|
|
128
117
|
brushType: 'lineX',
|
|
129
118
|
brushStyle: areaSelectStyle,
|
|
130
119
|
removeOnClick: true
|
|
131
120
|
})
|
|
132
|
-
.updateCovers(
|
|
121
|
+
.updateCovers(getCoverInfoList(axisModel));
|
|
133
122
|
},
|
|
134
123
|
|
|
135
124
|
_onBrush: function (coverInfoList, opt) {
|
|
136
125
|
// Do not cache these object, because the mey be changed.
|
|
137
126
|
var axisModel = this.axisModel;
|
|
138
127
|
var axis = axisModel.axis;
|
|
139
|
-
|
|
140
128
|
var intervals = zrUtil.map(coverInfoList, function (coverInfo) {
|
|
141
129
|
return [
|
|
142
130
|
axis.coordToData(coverInfo.range[0], true),
|
|
@@ -172,4 +160,24 @@
|
|
|
172
160
|
)[0] === axisModel;
|
|
173
161
|
}
|
|
174
162
|
|
|
163
|
+
function getCoverInfoList(axisModel) {
|
|
164
|
+
var axis = axisModel.axis;
|
|
165
|
+
return zrUtil.map(axisModel.activeIntervals, function (interval) {
|
|
166
|
+
return {
|
|
167
|
+
brushType: 'lineX',
|
|
168
|
+
panelId: 'pl',
|
|
169
|
+
range: [
|
|
170
|
+
axis.dataToCoord(interval[0], true),
|
|
171
|
+
axis.dataToCoord(interval[1], true)
|
|
172
|
+
]
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function getCoordSysModel(axisModel, ecModel) {
|
|
178
|
+
return ecModel.getComponent(
|
|
179
|
+
'parallel', axisModel.get('parallelIndex')
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
175
183
|
module.exports = AxisView;
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
|
|
77
77
|
handle: {
|
|
78
78
|
show: false,
|
|
79
|
-
icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.
|
|
79
|
+
icon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7v-1.2h6.6z M13.3,22H6.7v-1.2h6.6z M13.3,19.6H6.7v-1.2h6.6z', // jshint ignore:line
|
|
80
80
|
size: 45,
|
|
81
81
|
// handle margin is from symbol center to axis, which is stable when circular move.
|
|
82
82
|
margin: 50,
|
|
@@ -194,22 +194,26 @@
|
|
|
194
194
|
*/
|
|
195
195
|
createPointerEl: function (group, elOption, axisModel, axisPointerModel) {
|
|
196
196
|
var pointerOption = elOption.pointer;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
if (pointerOption) {
|
|
198
|
+
var pointerEl = get(group).pointerEl = new graphic[pointerOption.type](
|
|
199
|
+
clone(elOption.pointer)
|
|
200
|
+
);
|
|
201
|
+
group.add(pointerEl);
|
|
202
|
+
}
|
|
201
203
|
},
|
|
202
204
|
|
|
203
205
|
/**
|
|
204
206
|
* @protected
|
|
205
207
|
*/
|
|
206
208
|
createLabelEl: function (group, elOption, axisModel, axisPointerModel) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
209
|
+
if (elOption.label) {
|
|
210
|
+
var labelEl = get(group).labelEl = new graphic.Rect(
|
|
211
|
+
clone(elOption.label)
|
|
212
|
+
);
|
|
210
213
|
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
group.add(labelEl);
|
|
215
|
+
updateLabelShowHide(labelEl, axisPointerModel);
|
|
216
|
+
}
|
|
213
217
|
},
|
|
214
218
|
|
|
215
219
|
/**
|
|
@@ -354,16 +358,17 @@
|
|
|
354
358
|
}
|
|
355
359
|
|
|
356
360
|
var payloadInfo = this._payloadInfo;
|
|
357
|
-
var
|
|
361
|
+
var axisModel = this._axisModel;
|
|
362
|
+
this._api.dispatchAction({
|
|
358
363
|
type: 'updateAxisPointer',
|
|
359
364
|
x: payloadInfo.cursorPoint[0],
|
|
360
365
|
y: payloadInfo.cursorPoint[1],
|
|
361
366
|
tooltipOption: payloadInfo.tooltipOption,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
+
axesInfo: [{
|
|
368
|
+
axisDim: axisModel.axis.dim,
|
|
369
|
+
axisIndex: axisModel.componentIndex
|
|
370
|
+
}]
|
|
371
|
+
});
|
|
367
372
|
},
|
|
368
373
|
|
|
369
374
|
/**
|
|
@@ -19,12 +19,15 @@
|
|
|
19
19
|
var otherExtent = getCartesian(grid, axis).getOtherAxis(axis).getGlobalExtent();
|
|
20
20
|
var pixelValue = axis.toGlobalCoord(axis.dataToCoord(value, true));
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
if (axisPointerType && axisPointerType !== 'none') {
|
|
23
|
+
var elStyle = viewHelper.buildElStyle(axisPointerModel);
|
|
24
|
+
var pointerOption = pointerShapeBuilder[axisPointerType](
|
|
25
|
+
axis, pixelValue, otherExtent, elStyle
|
|
26
|
+
);
|
|
27
|
+
pointerOption.style = elStyle;
|
|
28
|
+
elOption.graphicKey = pointerOption.type;
|
|
29
|
+
elOption.pointer = pointerOption;
|
|
30
|
+
}
|
|
28
31
|
|
|
29
32
|
var layoutInfo = cartesianAxisHelper.layout(grid.model, axisModel);
|
|
30
33
|
viewHelper.buildCartesianSingleLabelElOption(
|
|
@@ -28,14 +28,16 @@
|
|
|
28
28
|
var coordValue;
|
|
29
29
|
coordValue = axis['dataTo' + formatUtil.capitalFirst(axis.dim)](value);
|
|
30
30
|
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
var axisPointerType = axisPointerModel.get('type');
|
|
32
|
+
if (axisPointerType && axisPointerType !== 'none') {
|
|
33
|
+
var elStyle = viewHelper.buildElStyle(axisPointerModel);
|
|
34
|
+
var pointerOption = pointerShapeBuilder[axisPointerType](
|
|
35
|
+
axis, polar, coordValue, otherExtent, elStyle
|
|
36
|
+
);
|
|
37
|
+
pointerOption.style = elStyle;
|
|
38
|
+
elOption.graphicKey = pointerOption.type;
|
|
39
|
+
elOption.pointer = pointerOption;
|
|
40
|
+
}
|
|
39
41
|
|
|
40
42
|
var labelMargin = axisPointerModel.get('label.margin');
|
|
41
43
|
var labelPos = getLabelPosition(value, axisModel, axisPointerModel, polar, labelMargin);
|
|
@@ -20,14 +20,18 @@
|
|
|
20
20
|
var coordSys = axis.coordinateSystem;
|
|
21
21
|
var otherExtent = getGlobalExtent(coordSys, 1 - getPointDimIndex(axis));
|
|
22
22
|
var pixelValue = coordSys.dataToPoint(value)[0];
|
|
23
|
-
var elStyle = viewHelper.buildElStyle(axisPointerModel);
|
|
24
|
-
var pointerOption = pointerShapeBuilder[axisPointerModel.get('type')](
|
|
25
|
-
axis, pixelValue, otherExtent, elStyle
|
|
26
|
-
);
|
|
27
|
-
pointerOption.style = elStyle;
|
|
28
23
|
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
var axisPointerType = axisPointerModel.get('type');
|
|
25
|
+
if (axisPointerType && axisPointerType !== 'none') {
|
|
26
|
+
var elStyle = viewHelper.buildElStyle(axisPointerModel);
|
|
27
|
+
var pointerOption = pointerShapeBuilder[axisPointerType](
|
|
28
|
+
axis, pixelValue, otherExtent, elStyle
|
|
29
|
+
);
|
|
30
|
+
pointerOption.style = elStyle;
|
|
31
|
+
|
|
32
|
+
elOption.graphicKey = pointerOption.type;
|
|
33
|
+
elOption.pointer = pointerOption;
|
|
34
|
+
}
|
|
31
35
|
|
|
32
36
|
var layoutInfo = singleAxisHelper.layout(axisModel);
|
|
33
37
|
viewHelper.buildCartesianSingleLabelElOption(
|