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
package/src/coord/axisHelper.js
CHANGED
|
@@ -35,11 +35,36 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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
|
|
@@ -35,7 +35,7 @@ define(function (require) {
|
|
|
35
35
|
return [{name: 'time', type: 'time'}];
|
|
36
36
|
},
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
getRangeInfo: function () {
|
|
39
39
|
return this._rangeInfo;
|
|
40
40
|
},
|
|
41
41
|
|
|
@@ -161,18 +161,20 @@ define(function (require) {
|
|
|
161
161
|
* Convert a time data(time, value) item to (x, y) point.
|
|
162
162
|
*
|
|
163
163
|
* @override
|
|
164
|
-
* @param {Array} data
|
|
165
|
-
* @param {boolean}
|
|
166
|
-
* @return {Array}
|
|
164
|
+
* @param {Array|number} data data
|
|
165
|
+
* @param {boolean} [clamp=true] out of range
|
|
166
|
+
* @return {Array} point
|
|
167
167
|
*/
|
|
168
|
-
dataToPoint: function (data,
|
|
168
|
+
dataToPoint: function (data, clamp) {
|
|
169
|
+
zrUtil.isArray(data) && (data = data[0]);
|
|
170
|
+
clamp == null && (clamp = true);
|
|
169
171
|
|
|
170
|
-
var dayInfo = this.getDateInfo(data
|
|
172
|
+
var dayInfo = this.getDateInfo(data);
|
|
171
173
|
var range = this._rangeInfo;
|
|
172
174
|
var date = dayInfo.formatedDate;
|
|
173
175
|
|
|
174
176
|
// if not in range return [NaN, NaN]
|
|
175
|
-
if (
|
|
177
|
+
if (clamp && !(dayInfo.time >= range.start.time && dayInfo.time <= range.end.time)) {
|
|
176
178
|
return [NaN, NaN];
|
|
177
179
|
}
|
|
178
180
|
|
|
@@ -212,12 +214,11 @@ define(function (require) {
|
|
|
212
214
|
* Convert a time date item to (x, y) four point.
|
|
213
215
|
*
|
|
214
216
|
* @param {Array} data date[0] is date
|
|
215
|
-
* @param {boolean}
|
|
217
|
+
* @param {boolean} [clamp=true] out of range
|
|
216
218
|
* @return {Object} point
|
|
217
219
|
*/
|
|
218
|
-
dataToRect: function (data,
|
|
219
|
-
|
|
220
|
-
var point = this.dataToPoint(data, noClip);
|
|
220
|
+
dataToRect: function (data, clamp) {
|
|
221
|
+
var point = this.dataToPoint(data, clamp);
|
|
221
222
|
|
|
222
223
|
return {
|
|
223
224
|
contentShape: {
|
|
@@ -271,16 +272,12 @@ define(function (require) {
|
|
|
271
272
|
},
|
|
272
273
|
|
|
273
274
|
/**
|
|
274
|
-
* @
|
|
275
|
-
* @implements
|
|
276
|
-
* see {module:echarts/CoodinateSystem}
|
|
275
|
+
* @inheritDoc
|
|
277
276
|
*/
|
|
278
277
|
convertToPixel: zrUtil.curry(doConvert, 'dataToPoint'),
|
|
279
278
|
|
|
280
279
|
/**
|
|
281
|
-
* @
|
|
282
|
-
* @implements
|
|
283
|
-
* see {module:echarts/CoodinateSystem}
|
|
280
|
+
* @inheritDoc
|
|
284
281
|
*/
|
|
285
282
|
convertFromPixel: zrUtil.curry(doConvert, 'pointToData'),
|
|
286
283
|
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
define(function(require) {
|
|
2
|
+
|
|
3
|
+
var zrUtil = require('zrender/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
|
+
return prepareCustom;
|
|
32
|
+
});
|
|
@@ -2,7 +2,6 @@ define(function (require) {
|
|
|
2
2
|
|
|
3
3
|
var zrUtil = require('zrender/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 @@ define(function (require) {
|
|
|
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 @@ define(function(require, factory) {
|
|
|
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 @@ define(function(require, factory) {
|
|
|
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,37 @@
|
|
|
1
|
+
define(function(require) {
|
|
2
|
+
|
|
3
|
+
var zrUtil = require('zrender/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
|
+
return prepareCustom;
|
|
37
|
+
});
|
package/src/coord/geo/Geo.js
CHANGED
|
@@ -36,7 +36,7 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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 @@ define(function (require) {
|
|
|
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
|
|
|
@@ -36,12 +36,12 @@ define(function (require) {
|
|
|
36
36
|
|
|
37
37
|
option.regions = geoCreator.getFilledRegions(option.regions, option.map);
|
|
38
38
|
|
|
39
|
-
this._optionModelMap = zrUtil.reduce(option.regions || [], function (
|
|
39
|
+
this._optionModelMap = zrUtil.reduce(option.regions || [], function (optionModelMap, regionOpt) {
|
|
40
40
|
if (regionOpt.name) {
|
|
41
|
-
|
|
41
|
+
optionModelMap.set(regionOpt.name, new Model(regionOpt, self));
|
|
42
42
|
}
|
|
43
|
-
return
|
|
44
|
-
},
|
|
43
|
+
return optionModelMap;
|
|
44
|
+
}, zrUtil.createHashMap());
|
|
45
45
|
|
|
46
46
|
this.updateSelectedMap(option.regions);
|
|
47
47
|
},
|
|
@@ -129,7 +129,7 @@ define(function (require) {
|
|
|
129
129
|
* @return {module:echarts/model/Model}
|
|
130
130
|
*/
|
|
131
131
|
getRegionModel: function (name) {
|
|
132
|
-
return this._optionModelMap
|
|
132
|
+
return this._optionModelMap.get(name) || new Model(null, this, this.ecModel);
|
|
133
133
|
},
|
|
134
134
|
|
|
135
135
|
/**
|
|
@@ -260,15 +260,15 @@ define(function (require) {
|
|
|
260
260
|
return originRegionArr;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
-
var dataNameMap =
|
|
263
|
+
var dataNameMap = zrUtil.createHashMap();
|
|
264
264
|
var features = geoJson.features;
|
|
265
265
|
for (var i = 0; i < regionsArr.length; i++) {
|
|
266
|
-
dataNameMap
|
|
266
|
+
dataNameMap.set(regionsArr[i].name, regionsArr[i]);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
269
|
for (var i = 0; i < features.length; i++) {
|
|
270
270
|
var name = features[i].properties.name;
|
|
271
|
-
if (!dataNameMap
|
|
271
|
+
if (!dataNameMap.get(name)) {
|
|
272
272
|
regionsArr.push({
|
|
273
273
|
name: name
|
|
274
274
|
});
|
|
@@ -12,6 +12,11 @@ define(function (require) {
|
|
|
12
12
|
if (!json.UTF8Encoding) {
|
|
13
13
|
return json;
|
|
14
14
|
}
|
|
15
|
+
var encodeScale = json.UTF8Scale;
|
|
16
|
+
if (encodeScale == null) {
|
|
17
|
+
encodeScale = 1024;
|
|
18
|
+
}
|
|
19
|
+
|
|
15
20
|
var features = json.features;
|
|
16
21
|
|
|
17
22
|
for (var f = 0; f < features.length; f++) {
|
|
@@ -26,7 +31,8 @@ define(function (require) {
|
|
|
26
31
|
if (geometry.type === 'Polygon') {
|
|
27
32
|
coordinates[c] = decodePolygon(
|
|
28
33
|
coordinate,
|
|
29
|
-
encodeOffsets[c]
|
|
34
|
+
encodeOffsets[c],
|
|
35
|
+
encodeScale
|
|
30
36
|
);
|
|
31
37
|
}
|
|
32
38
|
else if (geometry.type === 'MultiPolygon') {
|
|
@@ -34,7 +40,8 @@ define(function (require) {
|
|
|
34
40
|
var polygon = coordinate[c2];
|
|
35
41
|
coordinate[c2] = decodePolygon(
|
|
36
42
|
polygon,
|
|
37
|
-
encodeOffsets[c][c2]
|
|
43
|
+
encodeOffsets[c][c2],
|
|
44
|
+
encodeScale
|
|
38
45
|
);
|
|
39
46
|
}
|
|
40
47
|
}
|
|
@@ -45,7 +52,7 @@ define(function (require) {
|
|
|
45
52
|
return json;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
|
-
function decodePolygon(coordinate, encodeOffsets) {
|
|
55
|
+
function decodePolygon(coordinate, encodeOffsets, encodeScale) {
|
|
49
56
|
var result = [];
|
|
50
57
|
var prevX = encodeOffsets[0];
|
|
51
58
|
var prevY = encodeOffsets[1];
|
|
@@ -63,7 +70,7 @@ define(function (require) {
|
|
|
63
70
|
prevX = x;
|
|
64
71
|
prevY = y;
|
|
65
72
|
// Dequantize
|
|
66
|
-
result.push([x /
|
|
73
|
+
result.push([x / encodeScale, y / encodeScale]);
|
|
67
74
|
}
|
|
68
75
|
|
|
69
76
|
return result;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
define(function(require) {
|
|
2
|
+
|
|
3
|
+
var zrUtil = require('zrender/core/util');
|
|
4
|
+
|
|
5
|
+
function dataToCoordSize(dataSize, dataItem) {
|
|
6
|
+
dataItem = dataItem || [0, 0];
|
|
7
|
+
return zrUtil.map([0, 1], function (dimIdx) {
|
|
8
|
+
var val = dataItem[dimIdx];
|
|
9
|
+
var halfSize = dataSize[dimIdx] / 2;
|
|
10
|
+
var p1 = [];
|
|
11
|
+
var p2 = [];
|
|
12
|
+
p1[dimIdx] = val - halfSize;
|
|
13
|
+
p2[dimIdx] = val + halfSize;
|
|
14
|
+
p1[1 - dimIdx] = p2[1 - dimIdx] = dataItem[1 - dimIdx];
|
|
15
|
+
return Math.abs(this.dataToPoint(p1)[dimIdx] - this.dataToPoint(p2)[dimIdx]);
|
|
16
|
+
}, this);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function prepareCustom(coordSys) {
|
|
20
|
+
var rect = coordSys.getBoundingRect();
|
|
21
|
+
return {
|
|
22
|
+
coordSys: {
|
|
23
|
+
type: 'geo',
|
|
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
|
+
return prepareCustom;
|
|
37
|
+
});
|