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,42 +4,202 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var zrUtil = require('zrender/lib/core/util');
|
|
7
|
+
var modelUtil = require('../../util/model');
|
|
8
|
+
var each = zrUtil.each;
|
|
9
|
+
var isString = zrUtil.isString;
|
|
10
|
+
var defaults = zrUtil.defaults;
|
|
11
|
+
var normalizeToArray = modelUtil.normalizeToArray;
|
|
12
|
+
|
|
13
|
+
var OTHER_DIMS = {tooltip: 1, label: 1, itemName: 1};
|
|
7
14
|
|
|
8
15
|
/**
|
|
9
|
-
* Complete the dimensions array
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @param
|
|
15
|
-
*
|
|
16
|
-
*
|
|
16
|
+
* Complete the dimensions array, by user defined `dimension` and `encode`,
|
|
17
|
+
* and guessing from the data structure.
|
|
18
|
+
* If no 'value' dimension specified, the first no-named dimension will be
|
|
19
|
+
* named as 'value'.
|
|
20
|
+
*
|
|
21
|
+
* @param {Array.<string>} sysDims Necessary dimensions, like ['x', 'y'], which
|
|
22
|
+
* provides not only dim template, but also default order.
|
|
23
|
+
* `name` of each item provides default coord name.
|
|
24
|
+
* [{dimsDef: []}, ...] can be specified to give names.
|
|
25
|
+
* @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]].
|
|
26
|
+
* @param {Object} [opt]
|
|
27
|
+
* @param {Array.<Object|string>} [opt.dimsDef] option.series.dimensions User defined dimensions
|
|
28
|
+
* For example: ['asdf', {name, type}, ...].
|
|
29
|
+
* @param {Object} [opt.encodeDef] option.series.encode {x: 2, y: [3, 1], tooltip: [1, 2], label: 3}
|
|
30
|
+
* @param {string} [opt.extraPrefix] Prefix of name when filling the left dimensions.
|
|
31
|
+
* @param {string} [opt.extraFromZero] If specified, extra dim names will be:
|
|
32
|
+
* extraPrefix + 0, extraPrefix + extraBaseIndex + 1 ...
|
|
33
|
+
* If not specified, extra dim names will be:
|
|
34
|
+
* extraPrefix, extraPrefix + 0, extraPrefix + 1 ...
|
|
35
|
+
* @param {number} [opt.dimCount] If not specified, guess by the first data item.
|
|
36
|
+
* @return {Array.<Object>} [{
|
|
37
|
+
* name: string mandatory,
|
|
38
|
+
* coordDim: string mandatory,
|
|
39
|
+
* coordDimIndex: number mandatory,
|
|
40
|
+
* type: string optional,
|
|
41
|
+
* tooltipName: string optional,
|
|
42
|
+
* otherDims: {
|
|
43
|
+
* tooltip: number optional,
|
|
44
|
+
* label: number optional
|
|
45
|
+
* },
|
|
46
|
+
* isExtraCoord: boolean true or undefined.
|
|
47
|
+
* other props ...
|
|
48
|
+
* }]
|
|
17
49
|
*/
|
|
18
|
-
function completeDimensions(
|
|
19
|
-
|
|
20
|
-
return dimensions;
|
|
21
|
-
}
|
|
22
|
-
|
|
50
|
+
function completeDimensions(sysDims, data, opt) {
|
|
51
|
+
data = data || [];
|
|
23
52
|
opt = opt || {};
|
|
53
|
+
sysDims = (sysDims || []).slice();
|
|
54
|
+
var dimsDef = (opt.dimsDef || []).slice();
|
|
55
|
+
var encodeDef = zrUtil.createHashMap(opt.encodeDef);
|
|
56
|
+
var dataDimNameMap = zrUtil.createHashMap();
|
|
57
|
+
var coordDimNameMap = zrUtil.createHashMap();
|
|
58
|
+
// var valueCandidate;
|
|
59
|
+
var result = [];
|
|
24
60
|
|
|
25
61
|
var dimCount = opt.dimCount;
|
|
26
62
|
if (dimCount == null) {
|
|
27
63
|
var value0 = retrieveValue(data[0]);
|
|
28
|
-
dimCount =
|
|
64
|
+
dimCount = Math.max(
|
|
65
|
+
zrUtil.isArray(value0) && value0.length || 1,
|
|
66
|
+
sysDims.length,
|
|
67
|
+
dimsDef.length
|
|
68
|
+
);
|
|
69
|
+
each(sysDims, function (sysDimItem) {
|
|
70
|
+
var sysDimItemDimsDef = sysDimItem.dimsDef;
|
|
71
|
+
sysDimItemDimsDef && (dimCount = Math.max(dimCount, sysDimItemDimsDef.length));
|
|
72
|
+
});
|
|
29
73
|
}
|
|
30
74
|
|
|
31
|
-
|
|
32
|
-
var extraPrefix = opt.extraPrefix || 'extra';
|
|
75
|
+
// Apply user defined dims (`name` and `type`) and init result.
|
|
33
76
|
for (var i = 0; i < dimCount; i++) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
77
|
+
var dimDefItem = isString(dimsDef[i]) ? {name: dimsDef[i]} : (dimsDef[i] || {});
|
|
78
|
+
var userDimName = dimDefItem.name;
|
|
79
|
+
var resultItem = result[i] = {otherDims: {}};
|
|
80
|
+
// Name will be applied later for avoiding duplication.
|
|
81
|
+
if (userDimName != null && dataDimNameMap.get(userDimName) == null) {
|
|
82
|
+
// Only if `series.dimensions` is defined in option, tooltipName
|
|
83
|
+
// will be set, and dimension will be diplayed vertically in
|
|
84
|
+
// tooltip by default.
|
|
85
|
+
resultItem.name = resultItem.tooltipName = userDimName;
|
|
86
|
+
dataDimNameMap.set(userDimName, i);
|
|
87
|
+
}
|
|
88
|
+
dimDefItem.type != null && (resultItem.type = dimDefItem.type);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Set `coordDim` and `coordDimIndex` by `encodeDef` and normalize `encodeDef`.
|
|
92
|
+
encodeDef.each(function (dataDims, coordDim) {
|
|
93
|
+
dataDims = encodeDef.set(coordDim, normalizeToArray(dataDims).slice());
|
|
94
|
+
each(dataDims, function (resultDimIdx, coordDimIndex) {
|
|
95
|
+
// The input resultDimIdx can be dim name or index.
|
|
96
|
+
isString(resultDimIdx) && (resultDimIdx = dataDimNameMap.get(resultDimIdx));
|
|
97
|
+
if (resultDimIdx != null && resultDimIdx < dimCount) {
|
|
98
|
+
dataDims[coordDimIndex] = resultDimIdx;
|
|
99
|
+
applyDim(result[resultDimIdx], coordDim, coordDimIndex);
|
|
100
|
+
// coordDim === 'value' && valueCandidate == null && (valueCandidate = resultDimIdx);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Apply templetes and default order from `sysDims`.
|
|
106
|
+
var availDimIdx = 0;
|
|
107
|
+
each(sysDims, function (sysDimItem, sysDimIndex) {
|
|
108
|
+
var coordDim;
|
|
109
|
+
var sysDimItem;
|
|
110
|
+
var sysDimItemDimsDef;
|
|
111
|
+
var sysDimItemOtherDims;
|
|
112
|
+
if (isString(sysDimItem)) {
|
|
113
|
+
coordDim = sysDimItem;
|
|
114
|
+
sysDimItem = {};
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
coordDim = sysDimItem.name;
|
|
118
|
+
sysDimItem = zrUtil.clone(sysDimItem);
|
|
119
|
+
// `coordDimIndex` should not be set directly.
|
|
120
|
+
sysDimItemDimsDef = sysDimItem.dimsDef;
|
|
121
|
+
sysDimItemOtherDims = sysDimItem.otherDims;
|
|
122
|
+
sysDimItem.name = sysDimItem.coordDim = sysDimItem.coordDimIndex
|
|
123
|
+
= sysDimItem.dimsDef = sysDimItem.otherDims = null;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var dataDims = normalizeToArray(encodeDef.get(coordDim));
|
|
127
|
+
// dimensions provides default dim sequences.
|
|
128
|
+
if (!dataDims.length) {
|
|
129
|
+
for (var i = 0; i < (sysDimItemDimsDef && sysDimItemDimsDef.length || 1); i++) {
|
|
130
|
+
while (availDimIdx < result.length && result[availDimIdx].coordDim != null) {
|
|
131
|
+
availDimIdx++;
|
|
132
|
+
}
|
|
133
|
+
availDimIdx < result.length && dataDims.push(availDimIdx++);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
// Apply templates.
|
|
137
|
+
each(dataDims, function (resultDimIdx, coordDimIndex) {
|
|
138
|
+
var resultItem = result[resultDimIdx];
|
|
139
|
+
applyDim(defaults(resultItem, sysDimItem), coordDim, coordDimIndex);
|
|
140
|
+
// coordDim === 'value' && valueCandidate == null && (valueCandidate = resultDimIdx);
|
|
141
|
+
if (resultItem.name == null && sysDimItemDimsDef) {
|
|
142
|
+
resultItem.name = resultItem.tooltipName = sysDimItemDimsDef[coordDimIndex];
|
|
143
|
+
}
|
|
144
|
+
sysDimItemOtherDims && defaults(resultItem.otherDims, sysDimItemOtherDims);
|
|
145
|
+
});
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Make sure the first extra dim is 'value'.
|
|
149
|
+
var extra = opt.extraPrefix || 'value';
|
|
150
|
+
|
|
151
|
+
// Set dim `name` and other `coordDim` and other props.
|
|
152
|
+
for (var resultDimIdx = 0; resultDimIdx < dimCount; resultDimIdx++) {
|
|
153
|
+
var resultItem = result[resultDimIdx] = result[resultDimIdx] || {};
|
|
154
|
+
var coordDim = resultItem.coordDim;
|
|
155
|
+
|
|
156
|
+
coordDim == null && (
|
|
157
|
+
resultItem.coordDim = genName(extra, coordDimNameMap, opt.extraFromZero),
|
|
158
|
+
resultItem.coordDimIndex = 0,
|
|
159
|
+
resultItem.isExtraCoord = true
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
resultItem.name == null && (resultItem.name = genName(
|
|
163
|
+
// Ensure At least one value dim.
|
|
164
|
+
// (dataDimNameMap.get('value') == null
|
|
165
|
+
// && (valueCandidate == null || valueCandidate === resultDimIdx)
|
|
166
|
+
// // Try to set as 'value' only if coordDim is not set as 'extra'.
|
|
167
|
+
// && coordDim == null
|
|
168
|
+
// )
|
|
169
|
+
// ? 'value'
|
|
170
|
+
// :
|
|
171
|
+
resultItem.coordDim,
|
|
172
|
+
dataDimNameMap
|
|
173
|
+
));
|
|
174
|
+
|
|
175
|
+
resultItem.type == null && guessOrdinal(data, resultDimIdx)
|
|
176
|
+
&& (resultItem.type = 'ordinal');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return result;
|
|
180
|
+
|
|
181
|
+
function applyDim(resultItem, coordDim, coordDimIndex) {
|
|
182
|
+
if (OTHER_DIMS[coordDim]) {
|
|
183
|
+
resultItem.otherDims[coordDim] = coordDimIndex;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
resultItem.coordDim = coordDim;
|
|
187
|
+
resultItem.coordDimIndex = coordDimIndex;
|
|
188
|
+
coordDimNameMap.set(coordDim, true);
|
|
39
189
|
}
|
|
40
190
|
}
|
|
41
191
|
|
|
42
|
-
|
|
192
|
+
function genName(name, map, fromZero) {
|
|
193
|
+
if (fromZero || map.get(name) != null) {
|
|
194
|
+
var i = 0;
|
|
195
|
+
while (map.get(name + i) != null) {
|
|
196
|
+
i++;
|
|
197
|
+
}
|
|
198
|
+
name += i;
|
|
199
|
+
}
|
|
200
|
+
map.set(name, true);
|
|
201
|
+
return name;
|
|
202
|
+
}
|
|
43
203
|
}
|
|
44
204
|
|
|
45
205
|
// The rule should not be complex, otherwise user might not
|
|
@@ -53,10 +213,11 @@
|
|
|
53
213
|
}
|
|
54
214
|
|
|
55
215
|
var value = value[dimIndex];
|
|
216
|
+
// Consider usage convenience, '1', '2' will be treated as "number".
|
|
56
217
|
if (value != null && isFinite(value)) {
|
|
57
218
|
return false;
|
|
58
219
|
}
|
|
59
|
-
else if (
|
|
220
|
+
else if (isString(value) && value !== '-') {
|
|
60
221
|
return true;
|
|
61
222
|
}
|
|
62
223
|
}
|
package/lib/echarts.js
CHANGED
|
@@ -176,7 +176,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
176
176
|
* @type {module:echarts/ExtensionAPI}
|
|
177
177
|
* @private
|
|
178
178
|
*/
|
|
179
|
-
this._api =
|
|
179
|
+
this._api = createExtensionAPI(this);
|
|
180
180
|
|
|
181
181
|
Eventful.call(this);
|
|
182
182
|
|
|
@@ -276,14 +276,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
276
276
|
ecModel.init(null, null, theme, optionManager);
|
|
277
277
|
}
|
|
278
278
|
|
|
279
|
-
|
|
280
|
-
// ugly
|
|
281
|
-
this.__lastOnlyGraphic = !!(option && option.graphic);
|
|
282
|
-
zrUtil.each(option, function (o, mainType) {
|
|
283
|
-
mainType !== 'graphic' && (this.__lastOnlyGraphic = false);
|
|
284
|
-
}, this);
|
|
285
|
-
|
|
286
|
-
this._model.setOption(option, optionPreprocessorFuncs, this.__lastOnlyGraphic);
|
|
279
|
+
this._model.setOption(option, optionPreprocessorFuncs);
|
|
287
280
|
|
|
288
281
|
if (lazyUpdate) {
|
|
289
282
|
this[OPTION_UPDATED] = {silent: silent};
|
|
@@ -809,21 +802,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
809
802
|
|
|
810
803
|
prepareView.call(this, 'chart', ecModel);
|
|
811
804
|
|
|
812
|
-
|
|
813
|
-
// ugly
|
|
814
|
-
if (this.__lastOnlyGraphic) {
|
|
815
|
-
each(this._componentsViews, function (componentView) {
|
|
816
|
-
var componentModel = componentView.__model;
|
|
817
|
-
if (componentModel && componentModel.mainType === 'graphic') {
|
|
818
|
-
componentView.render(componentModel, ecModel, this._api, payload);
|
|
819
|
-
updateZ(componentModel, componentView);
|
|
820
|
-
}
|
|
821
|
-
}, this);
|
|
822
|
-
this.__lastOnlyGraphic = false;
|
|
823
|
-
}
|
|
824
|
-
else {
|
|
825
|
-
updateMethods.update.call(this, payload);
|
|
826
|
-
}
|
|
805
|
+
updateMethods.update.call(this, payload);
|
|
827
806
|
}
|
|
828
807
|
};
|
|
829
808
|
|
|
@@ -1140,7 +1119,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1140
1119
|
}
|
|
1141
1120
|
|
|
1142
1121
|
// Consider: id same and type changed.
|
|
1143
|
-
var viewId = model.id + '_' + model.type;
|
|
1122
|
+
var viewId = '_ec_' + model.id + '_' + model.type;
|
|
1144
1123
|
var view = viewMap[viewId];
|
|
1145
1124
|
if (!view) {
|
|
1146
1125
|
var classType = parseClassType(model.type);
|
|
@@ -1160,10 +1139,13 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1160
1139
|
}
|
|
1161
1140
|
}
|
|
1162
1141
|
|
|
1163
|
-
model.__viewId = viewId;
|
|
1142
|
+
model.__viewId = view.__id = viewId;
|
|
1164
1143
|
view.__alive = true;
|
|
1165
|
-
view.__id = viewId;
|
|
1166
1144
|
view.__model = model;
|
|
1145
|
+
view.group.__ecComponentInfo = {
|
|
1146
|
+
mainType: model.mainType,
|
|
1147
|
+
index: model.componentIndex
|
|
1148
|
+
};
|
|
1167
1149
|
}, this);
|
|
1168
1150
|
|
|
1169
1151
|
for (var i = 0; i < viewList.length;) {
|
|
@@ -1173,6 +1155,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1173
1155
|
view.dispose(ecModel, this._api);
|
|
1174
1156
|
viewList.splice(i, 1);
|
|
1175
1157
|
delete viewMap[view.__id];
|
|
1158
|
+
view.__id = view.group.__ecComponentInfo = null;
|
|
1176
1159
|
}
|
|
1177
1160
|
else {
|
|
1178
1161
|
i++;
|
|
@@ -1202,7 +1185,8 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1202
1185
|
var data = series.getData();
|
|
1203
1186
|
if (stack && data.type === 'list') {
|
|
1204
1187
|
var previousStack = stackedDataMap[stack];
|
|
1205
|
-
|
|
1188
|
+
// Avoid conflict with Object.prototype
|
|
1189
|
+
if (stackedDataMap.hasOwnProperty(stack) && previousStack) {
|
|
1206
1190
|
data.stackedOn = previousStack;
|
|
1207
1191
|
}
|
|
1208
1192
|
stackedDataMap[stack] = data;
|
|
@@ -1344,6 +1328,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1344
1328
|
echartsProto.clear = function () {
|
|
1345
1329
|
this.setOption({ series: [] }, true);
|
|
1346
1330
|
};
|
|
1331
|
+
|
|
1347
1332
|
/**
|
|
1348
1333
|
* Dispose instance
|
|
1349
1334
|
*/
|
|
@@ -1390,6 +1375,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1390
1375
|
});
|
|
1391
1376
|
}
|
|
1392
1377
|
}
|
|
1378
|
+
|
|
1393
1379
|
/**
|
|
1394
1380
|
* Update chart progressive and blend.
|
|
1395
1381
|
* @param {module:echarts/model/Series|module:echarts/model/Component} model
|
|
@@ -1432,6 +1418,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1432
1418
|
}
|
|
1433
1419
|
});
|
|
1434
1420
|
}
|
|
1421
|
+
|
|
1435
1422
|
/**
|
|
1436
1423
|
* @param {module:echarts/model/Series|module:echarts/model/Component} model
|
|
1437
1424
|
* @param {module:echarts/view/Component|module:echarts/view/Chart} view
|
|
@@ -1447,6 +1434,26 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1447
1434
|
}
|
|
1448
1435
|
});
|
|
1449
1436
|
}
|
|
1437
|
+
|
|
1438
|
+
function createExtensionAPI(ecInstance) {
|
|
1439
|
+
var coordSysMgr = ecInstance._coordSysMgr;
|
|
1440
|
+
return zrUtil.extend(new ExtensionAPI(ecInstance), {
|
|
1441
|
+
// Inject methods
|
|
1442
|
+
getCoordinateSystems: zrUtil.bind(
|
|
1443
|
+
coordSysMgr.getCoordinateSystems, coordSysMgr
|
|
1444
|
+
),
|
|
1445
|
+
getComponentByElement: function (el) {
|
|
1446
|
+
while (el) {
|
|
1447
|
+
var modelInfo = el.__ecComponentInfo;
|
|
1448
|
+
if (modelInfo != null) {
|
|
1449
|
+
return ecInstance._model.getComponent(modelInfo.mainType, modelInfo.index);
|
|
1450
|
+
}
|
|
1451
|
+
el = el.parent;
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1450
1457
|
/**
|
|
1451
1458
|
* @type {Object} key: actionType.
|
|
1452
1459
|
* @inner
|
|
@@ -1501,6 +1508,7 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1501
1508
|
var idBase = new Date() - 0;
|
|
1502
1509
|
var groupIdBase = new Date() - 0;
|
|
1503
1510
|
var DOM_ATTRIBUTE_KEY = '_echarts_instance_';
|
|
1511
|
+
|
|
1504
1512
|
/**
|
|
1505
1513
|
* @alias module:echarts
|
|
1506
1514
|
*/
|
|
@@ -1508,9 +1516,9 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1508
1516
|
/**
|
|
1509
1517
|
* @type {number}
|
|
1510
1518
|
*/
|
|
1511
|
-
version: '3.
|
|
1519
|
+
version: '3.6.0',
|
|
1512
1520
|
dependencies: {
|
|
1513
|
-
zrender: '3.
|
|
1521
|
+
zrender: '3.5.0'
|
|
1514
1522
|
}
|
|
1515
1523
|
};
|
|
1516
1524
|
|
|
@@ -1577,9 +1585,21 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1577
1585
|
+ echarts.dependencies.zrender + '+'
|
|
1578
1586
|
);
|
|
1579
1587
|
}
|
|
1588
|
+
|
|
1580
1589
|
if (!dom) {
|
|
1581
1590
|
throw new Error('Initialize failed: invalid dom.');
|
|
1582
1591
|
}
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
var existInstance = echarts.getInstanceByDom(dom);
|
|
1595
|
+
if (existInstance) {
|
|
1596
|
+
if (__DEV__) {
|
|
1597
|
+
console.warn('There is a chart instance already initialized on the dom.');
|
|
1598
|
+
}
|
|
1599
|
+
return existInstance;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
if (__DEV__) {
|
|
1583
1603
|
if (zrUtil.isDom(dom)
|
|
1584
1604
|
&& dom.nodeName.toUpperCase() !== 'CANVAS'
|
|
1585
1605
|
&& (
|
|
@@ -1595,8 +1615,12 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1595
1615
|
chart.id = 'ec_' + idBase++;
|
|
1596
1616
|
instances[chart.id] = chart;
|
|
1597
1617
|
|
|
1598
|
-
dom.setAttribute
|
|
1618
|
+
if (dom.setAttribute) {
|
|
1599
1619
|
dom.setAttribute(DOM_ATTRIBUTE_KEY, chart.id);
|
|
1620
|
+
}
|
|
1621
|
+
else {
|
|
1622
|
+
dom[DOM_ATTRIBUTE_KEY] = chart.id;
|
|
1623
|
+
}
|
|
1600
1624
|
|
|
1601
1625
|
enableConnect(chart);
|
|
1602
1626
|
|
|
@@ -1644,12 +1668,13 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1644
1668
|
* @param {module:echarts~ECharts|HTMLDomElement|string} chart
|
|
1645
1669
|
*/
|
|
1646
1670
|
echarts.dispose = function (chart) {
|
|
1647
|
-
if (
|
|
1648
|
-
chart = echarts.getInstanceByDom(chart);
|
|
1649
|
-
}
|
|
1650
|
-
else if (typeof chart === 'string') {
|
|
1671
|
+
if (typeof chart === 'string') {
|
|
1651
1672
|
chart = instances[chart];
|
|
1652
1673
|
}
|
|
1674
|
+
else if (!(chart instanceof ECharts)){
|
|
1675
|
+
// Try to treat as dom
|
|
1676
|
+
chart = echarts.getInstanceByDom(chart);
|
|
1677
|
+
}
|
|
1653
1678
|
if ((chart instanceof ECharts) && !chart.isDisposed()) {
|
|
1654
1679
|
chart.dispose();
|
|
1655
1680
|
}
|
|
@@ -1660,9 +1685,16 @@ if (typeof __DEV__ === 'undefined') {
|
|
|
1660
1685
|
* @return {echarts~ECharts}
|
|
1661
1686
|
*/
|
|
1662
1687
|
echarts.getInstanceByDom = function (dom) {
|
|
1663
|
-
var key
|
|
1688
|
+
var key;
|
|
1689
|
+
if (dom.getAttribute) {
|
|
1690
|
+
key = dom.getAttribute(DOM_ATTRIBUTE_KEY);
|
|
1691
|
+
}
|
|
1692
|
+
else {
|
|
1693
|
+
key = dom[DOM_ATTRIBUTE_KEY];
|
|
1694
|
+
}
|
|
1664
1695
|
return instances[key];
|
|
1665
1696
|
};
|
|
1697
|
+
|
|
1666
1698
|
/**
|
|
1667
1699
|
* @param {string} key
|
|
1668
1700
|
* @return {echarts~ECharts}
|
package/lib/helper.js
CHANGED
|
@@ -19,14 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* @param {Array.<string>} dimensions Necessary dimensions, like ['x', 'y']
|
|
24
|
-
* @param {Array} data Data list. [[1, 2, 3], [2, 3, 4]]
|
|
25
|
-
* @param {Object} [opt]
|
|
26
|
-
* @param {Array.<string>} [opt.defaultNames] Default names to fill not necessary dimensions, like ['value']
|
|
27
|
-
* @param {string} [opt.extraPrefix] Prefix of name when filling the left dimensions.
|
|
28
|
-
* @param {number} [opt.dimCount] If not specified, guess by the first data item.
|
|
29
|
-
* @return {Array.<string>}
|
|
22
|
+
* @see {module:echarts/data/helper/completeDimensions}
|
|
30
23
|
*/
|
|
31
24
|
completeDimensions: require('./data/helper/completeDimensions'),
|
|
32
25
|
|
package/lib/layout/barGrid.js
CHANGED
|
@@ -5,29 +5,96 @@
|
|
|
5
5
|
var numberUtil = require('../util/number');
|
|
6
6
|
var parsePercent = numberUtil.parsePercent;
|
|
7
7
|
|
|
8
|
+
var STACK_PREFIX = '__ec_stack_';
|
|
9
|
+
|
|
8
10
|
function getSeriesStackId(seriesModel) {
|
|
9
|
-
return seriesModel.get('stack') ||
|
|
11
|
+
return seriesModel.get('stack') || STACK_PREFIX + seriesModel.seriesIndex;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
function getAxisKey(axis) {
|
|
13
15
|
return axis.dim + axis.index;
|
|
14
16
|
}
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @param {Object} opt
|
|
20
|
+
* @param {module:echarts/coord/Axis} opt.axis Only support category axis currently.
|
|
21
|
+
* @param {number} opt.count Positive interger.
|
|
22
|
+
* @param {number} [opt.barWidth]
|
|
23
|
+
* @param {number} [opt.barMaxWidth]
|
|
24
|
+
* @param {number} [opt.barGap]
|
|
25
|
+
* @param {number} [opt.barCategoryGap]
|
|
26
|
+
* @return {Object} {width, offset, offsetCenter} If axis.type is not 'category', return undefined.
|
|
27
|
+
*/
|
|
28
|
+
function getLayoutOnAxis(opt, api) {
|
|
29
|
+
var params = [];
|
|
30
|
+
var baseAxis = opt.axis;
|
|
31
|
+
var axisKey = 'axis0';
|
|
32
|
+
|
|
33
|
+
if (baseAxis.type !== 'category') {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
var bandWidth = baseAxis.getBandWidth();
|
|
37
|
+
|
|
38
|
+
for (var i = 0; i < opt.count || 0; i++) {
|
|
39
|
+
params.push(zrUtil.defaults({
|
|
40
|
+
bandWidth: bandWidth,
|
|
41
|
+
axisKey: axisKey,
|
|
42
|
+
stackId: STACK_PREFIX + i
|
|
43
|
+
}, opt));
|
|
44
|
+
}
|
|
45
|
+
var widthAndOffsets = doCalBarWidthAndOffset(params, api);
|
|
46
|
+
|
|
47
|
+
var result = [];
|
|
48
|
+
for (var i = 0; i < opt.count; i++) {
|
|
49
|
+
var item = widthAndOffsets[axisKey][STACK_PREFIX + i];
|
|
50
|
+
item.offsetCenter = item.offset + item.width / 2;
|
|
51
|
+
result.push(item);
|
|
52
|
+
}
|
|
19
53
|
|
|
20
|
-
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function calBarWidthAndOffset(barSeries, api) {
|
|
58
|
+
var seriesInfoList = zrUtil.map(barSeries, function (seriesModel) {
|
|
21
59
|
var data = seriesModel.getData();
|
|
22
60
|
var cartesian = seriesModel.coordinateSystem;
|
|
23
|
-
|
|
24
61
|
var baseAxis = cartesian.getBaseAxis();
|
|
25
62
|
var axisExtent = baseAxis.getExtent();
|
|
26
63
|
var bandWidth = baseAxis.type === 'category'
|
|
27
64
|
? baseAxis.getBandWidth()
|
|
28
65
|
: (Math.abs(axisExtent[1] - axisExtent[0]) / data.count());
|
|
29
66
|
|
|
30
|
-
var
|
|
67
|
+
var barWidth = parsePercent(
|
|
68
|
+
seriesModel.get('barWidth'), bandWidth
|
|
69
|
+
);
|
|
70
|
+
var barMaxWidth = parsePercent(
|
|
71
|
+
seriesModel.get('barMaxWidth'), bandWidth
|
|
72
|
+
);
|
|
73
|
+
var barGap = seriesModel.get('barGap');
|
|
74
|
+
var barCategoryGap = seriesModel.get('barCategoryGap');
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
bandWidth: bandWidth,
|
|
78
|
+
barWidth: barWidth,
|
|
79
|
+
barMaxWidth: barMaxWidth,
|
|
80
|
+
barGap: barGap,
|
|
81
|
+
barCategoryGap: barCategoryGap,
|
|
82
|
+
axisKey: getAxisKey(baseAxis),
|
|
83
|
+
stackId: getSeriesStackId(seriesModel)
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
return doCalBarWidthAndOffset(seriesInfoList, api);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function doCalBarWidthAndOffset(seriesInfoList, api) {
|
|
91
|
+
// Columns info on each category axis. Key is cartesian name
|
|
92
|
+
var columnsMap = {};
|
|
93
|
+
|
|
94
|
+
zrUtil.each(seriesInfoList, function (seriesInfo, idx) {
|
|
95
|
+
var axisKey = seriesInfo.axisKey;
|
|
96
|
+
var bandWidth = seriesInfo.bandWidth;
|
|
97
|
+
var columnsOnAxis = columnsMap[axisKey] || {
|
|
31
98
|
bandWidth: bandWidth,
|
|
32
99
|
remainedWidth: bandWidth,
|
|
33
100
|
autoWidthCount: 0,
|
|
@@ -36,9 +103,9 @@
|
|
|
36
103
|
stacks: {}
|
|
37
104
|
};
|
|
38
105
|
var stacks = columnsOnAxis.stacks;
|
|
39
|
-
columnsMap[
|
|
106
|
+
columnsMap[axisKey] = columnsOnAxis;
|
|
40
107
|
|
|
41
|
-
var stackId =
|
|
108
|
+
var stackId = seriesInfo.stackId;
|
|
42
109
|
|
|
43
110
|
if (!stacks[stackId]) {
|
|
44
111
|
columnsOnAxis.autoWidthCount++;
|
|
@@ -48,29 +115,24 @@
|
|
|
48
115
|
maxWidth: 0
|
|
49
116
|
};
|
|
50
117
|
|
|
51
|
-
var barWidth = parsePercent(
|
|
52
|
-
seriesModel.get('barWidth'), bandWidth
|
|
53
|
-
);
|
|
54
|
-
var barMaxWidth = parsePercent(
|
|
55
|
-
seriesModel.get('barMaxWidth'), bandWidth
|
|
56
|
-
);
|
|
57
|
-
var barGap = seriesModel.get('barGap');
|
|
58
|
-
var barCategoryGap = seriesModel.get('barCategoryGap');
|
|
59
|
-
|
|
60
118
|
// Caution: In a single coordinate system, these barGrid attributes
|
|
61
119
|
// will be shared by series. Consider that they have default values,
|
|
62
120
|
// only the attributes set on the last series will work.
|
|
63
121
|
// Do not change this fact unless there will be a break change.
|
|
64
122
|
|
|
65
123
|
// TODO
|
|
124
|
+
var barWidth = seriesInfo.barWidth;
|
|
66
125
|
if (barWidth && !stacks[stackId].width) {
|
|
67
126
|
barWidth = Math.min(columnsOnAxis.remainedWidth, barWidth);
|
|
68
127
|
stacks[stackId].width = barWidth;
|
|
69
128
|
columnsOnAxis.remainedWidth -= barWidth;
|
|
70
129
|
}
|
|
71
130
|
|
|
131
|
+
var barMaxWidth = seriesInfo.barMaxWidth;
|
|
72
132
|
barMaxWidth && (stacks[stackId].maxWidth = barMaxWidth);
|
|
133
|
+
var barGap = seriesInfo.barGap;
|
|
73
134
|
(barGap != null) && (columnsOnAxis.gap = barGap);
|
|
135
|
+
var barCategoryGap = seriesInfo.barCategoryGap;
|
|
74
136
|
(barCategoryGap != null) && (columnsOnAxis.categoryGap = barCategoryGap);
|
|
75
137
|
});
|
|
76
138
|
|
|
@@ -94,8 +156,11 @@
|
|
|
94
156
|
// Find if any auto calculated bar exceeded maxBarWidth
|
|
95
157
|
zrUtil.each(stacks, function (column, stack) {
|
|
96
158
|
var maxWidth = column.maxWidth;
|
|
97
|
-
if (
|
|
159
|
+
if (maxWidth && maxWidth < autoWidth) {
|
|
98
160
|
maxWidth = Math.min(maxWidth, remainedWidth);
|
|
161
|
+
if (column.width) {
|
|
162
|
+
maxWidth = Math.min(maxWidth, column.width);
|
|
163
|
+
}
|
|
99
164
|
remainedWidth -= maxWidth;
|
|
100
165
|
column.width = maxWidth;
|
|
101
166
|
autoWidthCount--;
|
|
@@ -157,6 +222,11 @@
|
|
|
157
222
|
|
|
158
223
|
ecModel.eachSeriesByType(seriesType, function (seriesModel) {
|
|
159
224
|
|
|
225
|
+
// Check series coordinate, do layout for cartesian2d only
|
|
226
|
+
if (seriesModel.coordinateSystem.type !== 'cartesian2d') {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
|
|
160
230
|
var data = seriesModel.getData();
|
|
161
231
|
var cartesian = seriesModel.coordinateSystem;
|
|
162
232
|
var baseAxis = cartesian.getBaseAxis();
|
|
@@ -243,4 +313,6 @@
|
|
|
243
313
|
}, this);
|
|
244
314
|
}
|
|
245
315
|
|
|
316
|
+
barLayoutGrid.getLayoutOnAxis = getLayoutOnAxis;
|
|
317
|
+
|
|
246
318
|
module.exports = barLayoutGrid;
|