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
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
var zrUtil = require('zrender/lib/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/lib/core/env');
|
|
@@ -17,6 +18,10 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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/lib/coord/Axis.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var numberUtil = require('../util/number');
|
|
4
4
|
var linearMap = numberUtil.linearMap;
|
|
5
5
|
var zrUtil = require('zrender/lib/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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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/lib/coord/axisDefault.js
CHANGED
|
@@ -65,6 +65,8 @@
|
|
|
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 @@
|
|
|
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
|
module.exports = {
|
|
149
152
|
categoryAxis: categoryAxis,
|
package/lib/coord/axisHelper.js
CHANGED
|
@@ -35,11 +35,36 @@
|
|
|
35
35
|
if (!zrUtil.isArray(boundaryGap)) {
|
|
36
36
|
boundaryGap = [boundaryGap || 0, boundaryGap || 0];
|
|
37
37
|
}
|
|
38
|
+
if (typeof boundaryGap[0] === 'boolean') {
|
|
39
|
+
if (__DEV__) {
|
|
40
|
+
console.warn('Boolean type for boundaryGap is only '
|
|
41
|
+
+ 'allowed for ordinal axis. Please use string in '
|
|
42
|
+
+ 'percentage instead, e.g., "20%". Currently, '
|
|
43
|
+
+ 'boundaryGap is set to be 0.');
|
|
44
|
+
}
|
|
45
|
+
boundaryGap = [0, 0];
|
|
46
|
+
}
|
|
38
47
|
boundaryGap[0] = numberUtil.parsePercent(boundaryGap[0], 1);
|
|
39
48
|
boundaryGap[1] = numberUtil.parsePercent(boundaryGap[1], 1);
|
|
40
|
-
span = originalExtent[1] - originalExtent[0]
|
|
49
|
+
span = (originalExtent[1] - originalExtent[0])
|
|
50
|
+
|| Math.abs(originalExtent[0]);
|
|
41
51
|
}
|
|
42
52
|
|
|
53
|
+
// Notice: When min/max is not set (that is, when there are null/undefined,
|
|
54
|
+
// which is the most common case), these cases should be ensured:
|
|
55
|
+
// (1) For 'ordinal', show all axis.data.
|
|
56
|
+
// (2) For others:
|
|
57
|
+
// + `boundaryGap` is applied (if min/max set, boundaryGap is
|
|
58
|
+
// disabled).
|
|
59
|
+
// + If `needCrossZero`, min/max should be zero, otherwise, min/max should
|
|
60
|
+
// be the result that originalExtent enlarged by boundaryGap.
|
|
61
|
+
// (3) If no data, it should be ensured that `scale.setBlank` is set.
|
|
62
|
+
|
|
63
|
+
// FIXME
|
|
64
|
+
// (1) When min/max is 'dataMin' or 'dataMax', should boundaryGap be able to used?
|
|
65
|
+
// (2) When `needCrossZero` and all data is positive/negative, should it be ensured
|
|
66
|
+
// that the results processed by boundaryGap are positive/negative?
|
|
67
|
+
|
|
43
68
|
if (min == null) {
|
|
44
69
|
min = scaleType === 'ordinal'
|
|
45
70
|
? (axisDataLen ? 0 : NaN)
|
|
@@ -89,31 +114,12 @@
|
|
|
89
114
|
}
|
|
90
115
|
|
|
91
116
|
scale.setExtent(extent[0], extent[1]);
|
|
92
|
-
scale.niceExtent(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
// minInterval is 1, calculated interval is 0.2, so increase it to be 1. In this way we can get
|
|
99
|
-
// an integer axis.
|
|
100
|
-
var minInterval = model.get('minInterval');
|
|
101
|
-
if (isFinite(minInterval) && !fixMin && !fixMax && scale.type === 'interval') {
|
|
102
|
-
var interval = scale.getInterval();
|
|
103
|
-
var intervalScale = Math.max(Math.abs(interval), minInterval) / interval;
|
|
104
|
-
// while (interval < minInterval) {
|
|
105
|
-
// var quantity = numberUtil.quantity(interval);
|
|
106
|
-
// interval = quantity * 10;
|
|
107
|
-
// scaleQuantity *= 10;
|
|
108
|
-
// }
|
|
109
|
-
extent = scale.getExtent();
|
|
110
|
-
var origin = (extent[1] + extent[0]) / 2;
|
|
111
|
-
scale.setExtent(
|
|
112
|
-
intervalScale * (extent[0] - origin) + origin,
|
|
113
|
-
intervalScale * (extent[1] - origin) + origin
|
|
114
|
-
);
|
|
115
|
-
scale.niceExtent(splitNumber);
|
|
116
|
-
}
|
|
117
|
+
scale.niceExtent({
|
|
118
|
+
splitNumber: splitNumber,
|
|
119
|
+
fixMin: fixMin,
|
|
120
|
+
fixMax: fixMax,
|
|
121
|
+
minInterval: scale.type === 'interval' ? model.get('minInterval') : null
|
|
122
|
+
});
|
|
117
123
|
|
|
118
124
|
// If some one specified the min, max. And the default calculated interval
|
|
119
125
|
// is not good enough. He can specify the interval. It is often appeared
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
return [{name: 'time', type: 'time'}];
|
|
35
35
|
},
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
getRangeInfo: function () {
|
|
38
38
|
return this._rangeInfo;
|
|
39
39
|
},
|
|
40
40
|
|
|
@@ -160,18 +160,20 @@
|
|
|
160
160
|
* Convert a time data(time, value) item to (x, y) point.
|
|
161
161
|
*
|
|
162
162
|
* @override
|
|
163
|
-
* @param {Array} data
|
|
164
|
-
* @param {boolean}
|
|
165
|
-
* @return {Array}
|
|
163
|
+
* @param {Array|number} data data
|
|
164
|
+
* @param {boolean} [clamp=true] out of range
|
|
165
|
+
* @return {Array} point
|
|
166
166
|
*/
|
|
167
|
-
dataToPoint: function (data,
|
|
167
|
+
dataToPoint: function (data, clamp) {
|
|
168
|
+
zrUtil.isArray(data) && (data = data[0]);
|
|
169
|
+
clamp == null && (clamp = true);
|
|
168
170
|
|
|
169
|
-
var dayInfo = this.getDateInfo(data
|
|
171
|
+
var dayInfo = this.getDateInfo(data);
|
|
170
172
|
var range = this._rangeInfo;
|
|
171
173
|
var date = dayInfo.formatedDate;
|
|
172
174
|
|
|
173
175
|
// if not in range return [NaN, NaN]
|
|
174
|
-
if (
|
|
176
|
+
if (clamp && !(dayInfo.time >= range.start.time && dayInfo.time <= range.end.time)) {
|
|
175
177
|
return [NaN, NaN];
|
|
176
178
|
}
|
|
177
179
|
|
|
@@ -211,12 +213,11 @@
|
|
|
211
213
|
* Convert a time date item to (x, y) four point.
|
|
212
214
|
*
|
|
213
215
|
* @param {Array} data date[0] is date
|
|
214
|
-
* @param {boolean}
|
|
216
|
+
* @param {boolean} [clamp=true] out of range
|
|
215
217
|
* @return {Object} point
|
|
216
218
|
*/
|
|
217
|
-
dataToRect: function (data,
|
|
218
|
-
|
|
219
|
-
var point = this.dataToPoint(data, noClip);
|
|
219
|
+
dataToRect: function (data, clamp) {
|
|
220
|
+
var point = this.dataToPoint(data, clamp);
|
|
220
221
|
|
|
221
222
|
return {
|
|
222
223
|
contentShape: {
|
|
@@ -270,16 +271,12 @@
|
|
|
270
271
|
},
|
|
271
272
|
|
|
272
273
|
/**
|
|
273
|
-
* @
|
|
274
|
-
* @implements
|
|
275
|
-
* see {module:echarts/CoodinateSystem}
|
|
274
|
+
* @inheritDoc
|
|
276
275
|
*/
|
|
277
276
|
convertToPixel: zrUtil.curry(doConvert, 'dataToPoint'),
|
|
278
277
|
|
|
279
278
|
/**
|
|
280
|
-
* @
|
|
281
|
-
* @implements
|
|
282
|
-
* see {module:echarts/CoodinateSystem}
|
|
279
|
+
* @inheritDoc
|
|
283
280
|
*/
|
|
284
281
|
convertFromPixel: zrUtil.curry(doConvert, 'pointToData'),
|
|
285
282
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
var zrUtil = require('zrender/lib/core/util');
|
|
4
|
+
|
|
5
|
+
function prepareCustom(coordSys) {
|
|
6
|
+
var rect = coordSys.getRect();
|
|
7
|
+
var rangeInfo = coordSys.getRangeInfo();
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
coordSys: {
|
|
11
|
+
type: 'calendar',
|
|
12
|
+
x: rect.x,
|
|
13
|
+
y: rect.y,
|
|
14
|
+
width: rect.width,
|
|
15
|
+
height: rect.height,
|
|
16
|
+
cellWidth: coordSys.getCellWidth(),
|
|
17
|
+
cellHeight: coordSys.getCellHeight(),
|
|
18
|
+
rangeInfo: {
|
|
19
|
+
start: rangeInfo.start,
|
|
20
|
+
end: rangeInfo.end,
|
|
21
|
+
weeks: rangeInfo.weeks,
|
|
22
|
+
dayCount: rangeInfo.allDay
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
api: {
|
|
26
|
+
coord: zrUtil.bind(coordSys.dataToPoint, coordSys)
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = prepareCustom;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
var zrUtil = require('zrender/lib/core/util');
|
|
4
4
|
var Axis = require('../Axis');
|
|
5
|
-
var axisLabelInterval = require('./axisLabelInterval');
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Extend axis 2d
|
|
@@ -81,17 +80,6 @@
|
|
|
81
80
|
this.grid.getOtherAxis();
|
|
82
81
|
},
|
|
83
82
|
|
|
84
|
-
/**
|
|
85
|
-
* @return {number}
|
|
86
|
-
*/
|
|
87
|
-
getLabelInterval: function () {
|
|
88
|
-
var labelInterval = this._labelInterval;
|
|
89
|
-
if (!labelInterval) {
|
|
90
|
-
labelInterval = this._labelInterval = axisLabelInterval(this);
|
|
91
|
-
}
|
|
92
|
-
return labelInterval;
|
|
93
|
-
},
|
|
94
|
-
|
|
95
83
|
/**
|
|
96
84
|
* If label is ignored.
|
|
97
85
|
* Automatically used when axis is category and label can not be all shown
|
|
@@ -100,7 +100,9 @@ var factory = exports;
|
|
|
100
100
|
for (var idx in axes) {
|
|
101
101
|
if (axes.hasOwnProperty(idx)) {
|
|
102
102
|
var axis = axes[idx];
|
|
103
|
-
if (axis && (
|
|
103
|
+
if (axis && (
|
|
104
|
+
axis.type === 'category' || axis.type === 'time' || !ifAxisCrossZero(axis)
|
|
105
|
+
)) {
|
|
104
106
|
return true;
|
|
105
107
|
}
|
|
106
108
|
}
|
|
@@ -555,7 +557,8 @@ var factory = exports;
|
|
|
555
557
|
ecModel.eachComponent('grid', function (gridModel, idx) {
|
|
556
558
|
var grid = new Grid(gridModel, ecModel, api);
|
|
557
559
|
grid.name = 'grid_' + idx;
|
|
558
|
-
|
|
560
|
+
// Postpone `resize` to `update`.
|
|
561
|
+
// grid.resize(gridModel, api);
|
|
559
562
|
|
|
560
563
|
gridModel.coordinateSystem = grid;
|
|
561
564
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
var zrUtil = require('zrender/lib/core/util');
|
|
4
|
+
|
|
5
|
+
function dataToCoordSize(dataSize, dataItem) {
|
|
6
|
+
// dataItem is necessary in log axis.
|
|
7
|
+
dataItem = dataItem || [0, 0];
|
|
8
|
+
return zrUtil.map(['x', 'y'], function (dim, dimIdx) {
|
|
9
|
+
var axis = this.getAxis(dim);
|
|
10
|
+
var val = dataItem[dimIdx];
|
|
11
|
+
var halfSize = dataSize[dimIdx] / 2;
|
|
12
|
+
return axis.type === 'category'
|
|
13
|
+
? axis.getBandWidth()
|
|
14
|
+
: Math.abs(axis.dataToCoord(val - halfSize) - axis.dataToCoord(val + halfSize));
|
|
15
|
+
}, this);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function prepareCustom(coordSys) {
|
|
19
|
+
var rect = coordSys.grid.getRect();
|
|
20
|
+
return {
|
|
21
|
+
coordSys: {
|
|
22
|
+
// The name exposed to user is always 'cartesian2d' but not 'grid'.
|
|
23
|
+
type: 'cartesian2d',
|
|
24
|
+
x: rect.x,
|
|
25
|
+
y: rect.y,
|
|
26
|
+
width: rect.width,
|
|
27
|
+
height: rect.height
|
|
28
|
+
},
|
|
29
|
+
api: {
|
|
30
|
+
coord: zrUtil.bind(coordSys.dataToPoint, coordSys),
|
|
31
|
+
size: zrUtil.bind(dataToCoordSize, coordSys)
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
module.exports = prepareCustom;
|
package/lib/coord/geo/Geo.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
this.map = map;
|
|
38
38
|
|
|
39
|
-
this._nameCoordMap =
|
|
39
|
+
this._nameCoordMap = zrUtil.createHashMap();
|
|
40
40
|
|
|
41
41
|
this.loadGeoJson(geoJson, specialAreas, nameMap);
|
|
42
42
|
}
|
|
@@ -85,14 +85,14 @@
|
|
|
85
85
|
specialAreas = specialAreas || {};
|
|
86
86
|
nameMap = nameMap || {};
|
|
87
87
|
var regions = this.regions;
|
|
88
|
-
var regionsMap =
|
|
88
|
+
var regionsMap = zrUtil.createHashMap();
|
|
89
89
|
for (var i = 0; i < regions.length; i++) {
|
|
90
90
|
var regionName = regions[i].name;
|
|
91
91
|
// Try use the alias in nameMap
|
|
92
|
-
regionName = nameMap[regionName]
|
|
92
|
+
regionName = nameMap.hasOwnProperty(regionName) ? nameMap[regionName] : regionName;
|
|
93
93
|
regions[i].name = regionName;
|
|
94
94
|
|
|
95
|
-
regionsMap
|
|
95
|
+
regionsMap.set(regionName, regions[i]);
|
|
96
96
|
// Add geoJson
|
|
97
97
|
this.addGeoCoord(regionName, regions[i].center);
|
|
98
98
|
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
* @return {module:echarts/coord/geo/Region}
|
|
145
145
|
*/
|
|
146
146
|
getRegion: function (name) {
|
|
147
|
-
return this._regionsMap
|
|
147
|
+
return this._regionsMap.get(name);
|
|
148
148
|
},
|
|
149
149
|
|
|
150
150
|
getRegionByCoord: function (coord) {
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
* @param {Array.<number>} geoCoord
|
|
163
163
|
*/
|
|
164
164
|
addGeoCoord: function (name, geoCoord) {
|
|
165
|
-
this._nameCoordMap
|
|
165
|
+
this._nameCoordMap.set(name, geoCoord);
|
|
166
166
|
},
|
|
167
167
|
|
|
168
168
|
/**
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
* @return {Array.<number>}
|
|
172
172
|
*/
|
|
173
173
|
getGeoCoord: function (name) {
|
|
174
|
-
return this._nameCoordMap
|
|
174
|
+
return this._nameCoordMap.get(name);
|
|
175
175
|
},
|
|
176
176
|
|
|
177
177
|
// Overwrite
|
|
@@ -208,7 +208,6 @@
|
|
|
208
208
|
}, this);
|
|
209
209
|
},
|
|
210
210
|
|
|
211
|
-
// Overwrite
|
|
212
211
|
/**
|
|
213
212
|
* @param {string|Array.<number>} data
|
|
214
213
|
* @return {Array.<number>}
|
|
@@ -224,16 +223,12 @@
|
|
|
224
223
|
},
|
|
225
224
|
|
|
226
225
|
/**
|
|
227
|
-
* @
|
|
228
|
-
* @implements
|
|
229
|
-
* see {module:echarts/CoodinateSystem}
|
|
226
|
+
* @inheritDoc
|
|
230
227
|
*/
|
|
231
228
|
convertToPixel: zrUtil.curry(doConvert, 'dataToPoint'),
|
|
232
229
|
|
|
233
230
|
/**
|
|
234
|
-
* @
|
|
235
|
-
* @implements
|
|
236
|
-
* see {module:echarts/CoodinateSystem}
|
|
231
|
+
* @inheritDoc
|
|
237
232
|
*/
|
|
238
233
|
convertFromPixel: zrUtil.curry(doConvert, 'pointToData')
|
|
239
234
|
|