echarts 4.5.0 → 4.9.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/.DS_Store +0 -0
- package/.gitattributes +3 -0
- package/.github/pull_request_template.md +66 -0
- package/.github/workflows/nodejs.yml +15 -3
- package/.huskyrc +5 -0
- package/CONTRIBUTING.md +16 -160
- package/NOTICE +1 -1
- package/README.md +3 -3
- package/asset/.DS_Store +0 -0
- package/build/.DS_Store +0 -0
- package/dist/echarts-en.common.js +3072 -1261
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +4339 -1685
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +2496 -1011
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +3046 -1261
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +4313 -1685
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +2470 -1011
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/bmap.js +33 -11
- package/dist/extension/bmap.js.map +1 -1
- package/dist/extension/bmap.min.js +1 -1
- package/dist/extension/dataTool.js.map +1 -1
- package/extension/.DS_Store +0 -0
- package/extension/bmap/BMapCoordSys.js +14 -4
- package/extension/bmap/BMapModel.js +4 -0
- package/extension/bmap/BMapView.js +18 -10
- package/extension-src/bmap/BMapCoordSys.js +14 -4
- package/extension-src/bmap/BMapModel.js +6 -1
- package/extension-src/bmap/BMapView.js +16 -9
- package/lib/chart/bar/BarSeries.js +14 -1
- package/lib/chart/bar/BarView.js +196 -18
- package/lib/chart/bar/BaseBarSeries.js +3 -1
- package/lib/chart/bar/PictorialBarSeries.js +1 -1
- package/lib/chart/candlestick/candlestickVisual.js +1 -1
- package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
- package/lib/chart/funnel/FunnelSeries.js +14 -5
- package/lib/chart/funnel/funnelLayout.js +162 -46
- package/lib/chart/gauge/GaugeSeries.js +0 -2
- package/lib/chart/graph/GraphSeries.js +23 -7
- package/lib/chart/graph/GraphView.js +30 -12
- package/lib/chart/graph/circularLayoutHelper.js +8 -2
- package/lib/chart/graph/forceLayout.js +6 -1
- package/lib/chart/graph/simpleLayout.js +1 -1
- package/lib/chart/graph/simpleLayoutHelper.js +10 -4
- package/lib/chart/heatmap/HeatmapView.js +4 -4
- package/lib/chart/helper/EffectLine.js +23 -1
- package/lib/chart/helper/EffectSymbol.js +2 -1
- package/lib/chart/helper/Line.js +129 -42
- package/lib/chart/helper/LineDraw.js +5 -1
- package/lib/chart/helper/Symbol.js +2 -3
- package/lib/chart/helper/createClipPathFromCoordSys.js +4 -1
- package/lib/chart/helper/createListFromArray.js +14 -8
- package/lib/chart/helper/createRenderPlanner.js +6 -3
- package/lib/chart/helper/multipleGraphEdgeHelper.js +258 -0
- package/lib/chart/helper/whiskerBoxCommon.js +22 -16
- package/lib/chart/line/LineSeries.js +3 -1
- package/lib/chart/line/LineView.js +41 -2
- package/lib/chart/lines/LinesSeries.js +0 -2
- package/lib/chart/map/MapSeries.js +14 -5
- package/lib/chart/pie/PieSeries.js +27 -6
- package/lib/chart/pie/PieView.js +22 -15
- package/lib/chart/pie/labelLayout.js +102 -19
- package/lib/chart/pie/pieLayout.js +19 -7
- package/lib/chart/radar/RadarSeries.js +27 -6
- package/lib/chart/radar/RadarView.js +3 -1
- package/lib/chart/sankey/SankeySeries.js +13 -1
- package/lib/chart/sankey/SankeyView.js +70 -32
- package/lib/chart/sankey/sankeyLayout.js +22 -3
- package/lib/chart/scatter/ScatterSeries.js +3 -1
- package/lib/chart/sunburst/SunburstPiece.js +5 -1
- package/lib/chart/sunburst/SunburstSeries.js +29 -12
- package/lib/chart/sunburst/SunburstView.js +5 -1
- package/lib/chart/themeRiver/ThemeRiverSeries.js +24 -33
- package/lib/chart/tree/TreeSeries.js +20 -3
- package/lib/chart/tree/TreeView.js +149 -23
- package/lib/chart/treemap/TreemapSeries.js +25 -4
- package/lib/chart/treemap/TreemapView.js +80 -38
- package/lib/chart/treemap/treemapLayout.js +1 -1
- package/lib/chart/treemap/treemapVisual.js +9 -15
- package/lib/component/axis/AngleAxisView.js +64 -7
- package/lib/component/axis/AxisBuilder.js +62 -24
- package/lib/component/axis/CartesianAxisView.js +52 -85
- package/lib/component/axis/RadiusAxisView.js +36 -4
- package/lib/component/axis/SingleAxisView.js +21 -6
- package/lib/component/axis/axisSplitHelper.js +132 -0
- package/lib/component/axisPointer/axisTrigger.js +1 -1
- package/lib/component/brush/BrushView.js +11 -1
- package/lib/component/brush/visualEncoding.js +13 -2
- package/lib/component/dataZoom/SliderZoomView.js +4 -10
- package/lib/component/helper/BrushController.js +33 -43
- package/lib/component/helper/MapDraw.js +30 -4
- package/lib/component/legend/LegendModel.js +3 -3
- package/lib/component/legend/LegendView.js +17 -13
- package/lib/component/legend/ScrollableLegendView.js +18 -18
- package/lib/component/marker/MarkAreaView.js +53 -15
- package/lib/component/marker/MarkLineModel.js +2 -1
- package/lib/component/marker/MarkLineView.js +3 -0
- package/lib/component/marker/MarkPointView.js +8 -1
- package/lib/component/marker/MarkerModel.js +3 -2
- package/lib/component/marker/markerHelper.js +7 -4
- package/lib/component/timeline/SliderTimelineView.js +7 -1
- package/lib/component/title.js +6 -2
- package/lib/component/toolbox/ToolboxView.js +5 -1
- package/lib/component/toolbox/feature/DataView.js +23 -8
- package/lib/component/toolbox/feature/DataZoom.js +6 -6
- package/lib/component/toolbox/feature/MagicType.js +20 -14
- package/lib/component/toolbox/feature/SaveAsImage.js +4 -2
- package/lib/component/tooltip/TooltipContent.js +101 -30
- package/lib/component/tooltip/TooltipRichContent.js +56 -8
- package/lib/component/tooltip/TooltipView.js +11 -12
- package/lib/component/visualMap/PiecewiseModel.js +3 -6
- package/lib/component/visualMap/VisualMapModel.js +1 -1
- package/lib/coord/Axis.js +30 -2
- package/lib/coord/View.js +9 -0
- package/lib/coord/axisDefault.js +22 -3
- package/lib/coord/axisHelper.js +24 -18
- package/lib/coord/calendar/Calendar.js +8 -4
- package/lib/coord/geo/GeoModel.js +2 -1
- package/lib/coord/geo/geoJSONLoader.js +3 -2
- package/lib/coord/geo/geoSourceManager.js +3 -2
- package/lib/coord/geo/parseGeoJson.js +3 -2
- package/lib/coord/radar/Radar.js +5 -5
- package/lib/data/DataDimensionInfo.js +157 -0
- package/lib/data/Graph.js +1 -6
- package/lib/data/List.js +26 -20
- package/lib/data/Tree.js +5 -42
- package/lib/data/helper/completeDimensions.js +43 -32
- package/lib/data/helper/createDimensions.js +2 -0
- package/lib/data/helper/sourceHelper.js +214 -114
- package/lib/echarts.js +57 -34
- package/lib/langEN.js +26 -0
- package/lib/layout/barGrid.js +19 -13
- package/lib/layout/barPolar.js +1 -6
- package/lib/loading/default.js +43 -27
- package/lib/model/Series.js +4 -4
- package/lib/model/referHelper.js +40 -12
- package/lib/processor/dataSample.js +1 -1
- package/lib/scale/Interval.js +87 -2
- package/lib/scale/Log.js +9 -2
- package/lib/scale/helper.js +1 -43
- package/lib/stream/Scheduler.js +10 -2
- package/lib/theme/dark.js +3 -0
- package/lib/util/format.js +19 -2
- package/lib/util/graphic.js +14 -12
- package/lib/visual/LegendVisualProvider.js +75 -0
- package/lib/visual/VisualMapping.js +1 -1
- package/lib/visual/dataColor.js +2 -12
- package/lib/visual/seriesColor.js +15 -7
- package/lib/visual/symbol.js +12 -2
- package/map/.DS_Store +0 -0
- package/map/js/.DS_Store +0 -0
- package/map/js/china.js +1 -1
- package/map/js/province/.DS_Store +0 -0
- package/map/js/province/chongqing.js +1 -1
- package/map/js/province/gansu.js +2 -2
- package/map/js/province/tianjin.js +1 -28
- package/map/json/.DS_Store +0 -0
- package/map/json/china.json +1 -1
- package/map/json/province/chongqing.json +1 -1
- package/map/json/province/tianjin.json +1 -1
- package/package.json +12 -6
- package/src/.DS_Store +0 -0
- package/src/chart/.DS_Store +0 -0
- package/src/chart/bar/BarSeries.js +15 -1
- package/src/chart/bar/BarView.js +198 -17
- package/src/chart/bar/BaseBarSeries.js +1 -1
- package/src/chart/bar/PictorialBarSeries.js +2 -2
- package/src/chart/candlestick/candlestickVisual.js +1 -1
- package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
- package/src/chart/funnel/FunnelSeries.js +11 -4
- package/src/chart/funnel/funnelLayout.js +179 -53
- package/src/chart/gauge/GaugeSeries.js +0 -1
- package/src/chart/graph/GraphSeries.js +19 -7
- package/src/chart/graph/GraphView.js +28 -10
- package/src/chart/graph/circularLayoutHelper.js +8 -2
- package/src/chart/graph/forceLayout.js +7 -1
- package/src/chart/graph/simpleLayout.js +1 -1
- package/src/chart/graph/simpleLayoutHelper.js +12 -5
- package/src/chart/heatmap/HeatmapView.js +4 -4
- package/src/chart/helper/EffectLine.js +23 -1
- package/src/chart/helper/EffectSymbol.js +2 -1
- package/src/chart/helper/Line.js +122 -37
- package/src/chart/helper/LineDraw.js +5 -1
- package/src/chart/helper/Symbol.js +4 -4
- package/src/chart/helper/createClipPathFromCoordSys.js +4 -0
- package/src/chart/helper/createGraphFromNodeEdge.js +2 -1
- package/src/chart/helper/createListFromArray.js +13 -8
- package/src/chart/helper/createRenderPlanner.js +5 -2
- package/src/chart/helper/multipleGraphEdgeHelper.js +229 -0
- package/src/chart/helper/whiskerBoxCommon.js +21 -16
- package/src/chart/line/LineSeries.js +1 -1
- package/src/chart/line/LineView.js +45 -1
- package/src/chart/lines/LinesSeries.js +1 -3
- package/src/chart/map/MapSeries.js +11 -5
- package/src/chart/pie/PieSeries.js +26 -5
- package/src/chart/pie/PieView.js +20 -15
- package/src/chart/pie/labelLayout.js +114 -22
- package/src/chart/pie/pieLayout.js +20 -7
- package/src/chart/radar/RadarSeries.js +31 -6
- package/src/chart/radar/RadarView.js +4 -2
- package/src/chart/sankey/SankeySeries.js +12 -1
- package/src/chart/sankey/SankeyView.js +75 -30
- package/src/chart/sankey/sankeyLayout.js +25 -5
- package/src/chart/scatter/ScatterSeries.js +1 -1
- package/src/chart/sunburst/SunburstPiece.js +7 -1
- package/src/chart/sunburst/SunburstSeries.js +28 -15
- package/src/chart/sunburst/SunburstView.js +2 -1
- package/src/chart/themeRiver/ThemeRiverSeries.js +25 -30
- package/src/chart/tree/TreeSeries.js +19 -6
- package/src/chart/tree/TreeView.js +156 -23
- package/src/chart/treemap/TreemapSeries.js +23 -5
- package/src/chart/treemap/TreemapView.js +77 -41
- package/src/chart/treemap/treemapLayout.js +2 -2
- package/src/chart/treemap/treemapVisual.js +8 -25
- package/src/component/axis/AngleAxisView.js +75 -7
- package/src/component/axis/AxisBuilder.js +77 -32
- package/src/component/axis/CartesianAxisView.js +47 -83
- package/src/component/axis/RadiusAxisView.js +37 -4
- package/src/component/axis/SingleAxisView.js +21 -4
- package/src/component/axis/axisSplitHelper.js +114 -0
- package/src/component/axisPointer/axisTrigger.js +1 -1
- package/src/component/brush/BrushView.js +8 -1
- package/src/component/brush/visualEncoding.js +6 -3
- package/src/component/dataZoom/SliderZoomView.js +4 -9
- package/src/component/helper/BrushController.js +40 -47
- package/src/component/helper/MapDraw.js +27 -4
- package/src/component/legend/LegendModel.js +3 -3
- package/src/component/legend/LegendView.js +18 -12
- package/src/component/legend/ScrollableLegendView.js +18 -16
- package/src/component/marker/MarkAreaView.js +53 -15
- package/src/component/marker/MarkLineModel.js +2 -1
- package/src/component/marker/MarkLineView.js +3 -1
- package/src/component/marker/MarkPointView.js +7 -1
- package/src/component/marker/MarkerModel.js +3 -2
- package/src/component/marker/markerHelper.js +8 -5
- package/src/component/timeline/SliderTimelineView.js +9 -6
- package/src/component/title.js +4 -3
- package/src/component/toolbox/.DS_Store +0 -0
- package/src/component/toolbox/ToolboxView.js +5 -0
- package/src/component/toolbox/feature/DataView.js +20 -8
- package/src/component/toolbox/feature/DataZoom.js +6 -6
- package/src/component/toolbox/feature/MagicType.js +19 -13
- package/src/component/toolbox/feature/SaveAsImage.js +4 -2
- package/src/component/tooltip/TooltipContent.js +94 -28
- package/src/component/tooltip/TooltipRichContent.js +52 -9
- package/src/component/tooltip/TooltipView.js +14 -12
- package/src/component/visualMap/PiecewiseModel.js +5 -9
- package/src/component/visualMap/VisualMapModel.js +1 -1
- package/src/coord/Axis.js +29 -2
- package/src/coord/View.js +10 -1
- package/src/coord/axisDefault.js +26 -2
- package/src/coord/axisHelper.js +30 -21
- package/src/coord/calendar/Calendar.js +12 -5
- package/src/coord/geo/GeoModel.js +3 -6
- package/src/coord/geo/geoJSONLoader.js +3 -2
- package/src/coord/geo/geoSourceManager.js +3 -2
- package/src/coord/geo/parseGeoJson.js +3 -2
- package/src/coord/radar/Radar.js +6 -8
- package/src/data/DataDimensionInfo.js +135 -0
- package/src/data/Graph.js +0 -5
- package/src/data/List.js +30 -17
- package/src/data/Tree.js +6 -39
- package/src/data/helper/completeDimensions.js +49 -30
- package/src/data/helper/createDimensions.js +2 -0
- package/src/data/helper/sourceHelper.js +216 -124
- package/src/echarts.js +60 -36
- package/src/langEN.js +26 -0
- package/src/layout/barGrid.js +22 -10
- package/src/layout/barPolar.js +4 -6
- package/src/loading/default.js +46 -34
- package/src/model/.DS_Store +0 -0
- package/src/model/Series.js +4 -4
- package/src/model/referHelper.js +34 -11
- package/src/preprocessor/.DS_Store +0 -0
- package/src/processor/dataSample.js +1 -1
- package/src/scale/Interval.js +84 -4
- package/src/scale/Log.js +9 -2
- package/src/scale/helper.js +1 -39
- package/src/stream/Scheduler.js +9 -1
- package/src/theme/dark.js +3 -0
- package/src/util/.DS_Store +0 -0
- package/src/util/format.js +17 -1
- package/src/util/graphic.js +13 -11
- package/src/visual/LegendVisualProvider.js +55 -0
- package/src/visual/VisualMapping.js +1 -1
- package/src/visual/dataColor.js +0 -13
- package/src/visual/seriesColor.js +13 -7
- package/src/visual/symbol.js +11 -2
- package/theme/.DS_Store +0 -0
- package/theme/azul.js +163 -0
- package/theme/bee-inspired.js +178 -0
- package/theme/blue.js +178 -0
- package/theme/caravan.js +178 -0
- package/theme/carp.js +163 -0
- package/theme/cool.js +180 -0
- package/theme/dark-blue.js +168 -0
- package/theme/dark-bold.js +168 -0
- package/theme/dark-digerati.js +168 -0
- package/theme/dark-fresh-cut.js +168 -0
- package/theme/dark-mushroom.js +168 -0
- package/theme/dark.js +69 -62
- package/theme/eduardo.js +178 -0
- package/theme/forest.js +163 -0
- package/theme/fresh-cut.js +163 -0
- package/theme/fruit.js +178 -0
- package/theme/gray.js +220 -0
- package/theme/green.js +222 -0
- package/theme/helianthus.js +263 -0
- package/theme/infographic.js +72 -57
- package/theme/inspired.js +163 -0
- package/theme/jazz.js +163 -0
- package/theme/london.js +163 -0
- package/theme/macarons.js +80 -57
- package/theme/macarons2.js +251 -0
- package/theme/mint.js +155 -0
- package/theme/red-velvet.js +163 -0
- package/theme/red.js +225 -0
- package/theme/roma.js +55 -22
- package/theme/royal.js +163 -0
- package/theme/sakura.js +140 -0
- package/theme/shine.js +52 -45
- package/theme/tech-blue.js +180 -0
- package/theme/vintage.js +37 -23
package/lib/coord/axisDefault.js
CHANGED
|
@@ -48,7 +48,7 @@ var defaultOption = {
|
|
|
48
48
|
name: '',
|
|
49
49
|
// 'start' | 'middle' | 'end'
|
|
50
50
|
nameLocation: 'end',
|
|
51
|
-
// By degree. By
|
|
51
|
+
// By degree. By default auto rotate by nameLocation.
|
|
52
52
|
nameRotate: null,
|
|
53
53
|
nameTruncate: {
|
|
54
54
|
maxWidth: null,
|
|
@@ -170,13 +170,32 @@ axisDefault.valueAxis = zrUtil.merge({
|
|
|
170
170
|
// + `true`: the extent do not consider value 0.
|
|
171
171
|
// scale: false,
|
|
172
172
|
// AxisTick and axisLabel and splitLine are caculated based on splitNumber.
|
|
173
|
-
splitNumber: 5
|
|
173
|
+
splitNumber: 5,
|
|
174
|
+
// Interval specifies the span of the ticks is mandatorily.
|
|
174
175
|
// interval: null
|
|
175
176
|
// Specify min interval when auto calculate tick interval.
|
|
176
177
|
// minInterval: null
|
|
177
178
|
// Specify max interval when auto calculate tick interval.
|
|
178
179
|
// maxInterval: null
|
|
179
|
-
|
|
180
|
+
minorTick: {
|
|
181
|
+
// Minor tick, not available for cateogry axis.
|
|
182
|
+
show: false,
|
|
183
|
+
// Split number of minor ticks. The value should be in range of (0, 100)
|
|
184
|
+
splitNumber: 5,
|
|
185
|
+
// Lenght of minor tick
|
|
186
|
+
length: 3,
|
|
187
|
+
// Same inside with axisTick
|
|
188
|
+
// Line style
|
|
189
|
+
lineStyle: {// Default to be same with axisTick
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
minorSplitLine: {
|
|
193
|
+
show: false,
|
|
194
|
+
lineStyle: {
|
|
195
|
+
color: '#eee',
|
|
196
|
+
width: 1
|
|
197
|
+
}
|
|
198
|
+
}
|
|
180
199
|
}, defaultOption);
|
|
181
200
|
axisDefault.timeAxis = zrUtil.defaults({
|
|
182
201
|
scale: true,
|
package/lib/coord/axisHelper.js
CHANGED
|
@@ -71,8 +71,6 @@ function getScaleExtent(scale, model) {
|
|
|
71
71
|
var scaleType = scale.type;
|
|
72
72
|
var min = model.getMin();
|
|
73
73
|
var max = model.getMax();
|
|
74
|
-
var fixMin = min != null;
|
|
75
|
-
var fixMax = max != null;
|
|
76
74
|
var originalExtent = scale.getExtent();
|
|
77
75
|
var axisDataLen;
|
|
78
76
|
var boundaryGap;
|
|
@@ -109,14 +107,6 @@ function getScaleExtent(scale, model) {
|
|
|
109
107
|
// that the results processed by boundaryGap are positive/negative?
|
|
110
108
|
|
|
111
109
|
|
|
112
|
-
if (min == null) {
|
|
113
|
-
min = scaleType === 'ordinal' ? axisDataLen ? 0 : NaN : originalExtent[0] - boundaryGap[0] * span;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
if (max == null) {
|
|
117
|
-
max = scaleType === 'ordinal' ? axisDataLen ? axisDataLen - 1 : NaN : originalExtent[1] + boundaryGap[1] * span;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
110
|
if (min === 'dataMin') {
|
|
121
111
|
min = originalExtent[0];
|
|
122
112
|
} else if (typeof min === 'function') {
|
|
@@ -135,6 +125,17 @@ function getScaleExtent(scale, model) {
|
|
|
135
125
|
});
|
|
136
126
|
}
|
|
137
127
|
|
|
128
|
+
var fixMin = min != null;
|
|
129
|
+
var fixMax = max != null;
|
|
130
|
+
|
|
131
|
+
if (min == null) {
|
|
132
|
+
min = scaleType === 'ordinal' ? axisDataLen ? 0 : NaN : originalExtent[0] - boundaryGap[0] * span;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (max == null) {
|
|
136
|
+
max = scaleType === 'ordinal' ? axisDataLen ? axisDataLen - 1 : NaN : originalExtent[1] + boundaryGap[1] * span;
|
|
137
|
+
}
|
|
138
|
+
|
|
138
139
|
(min == null || !isFinite(min)) && (min = NaN);
|
|
139
140
|
(max == null || !isFinite(max)) && (max = NaN);
|
|
140
141
|
scale.setBlank(zrUtil.eqNaN(min) || zrUtil.eqNaN(max) || scaleType === 'ordinal' && !scale.getOrdinalMeta().categories.length); // Evaluate if axis needs cross zero
|
|
@@ -181,7 +182,13 @@ function getScaleExtent(scale, model) {
|
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
return
|
|
185
|
+
return {
|
|
186
|
+
extent: [min, max],
|
|
187
|
+
// "fix" means "fixed", the value should not be
|
|
188
|
+
// changed in the subsequent steps.
|
|
189
|
+
fixMin: fixMin,
|
|
190
|
+
fixMax: fixMax
|
|
191
|
+
};
|
|
185
192
|
}
|
|
186
193
|
|
|
187
194
|
function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
|
|
@@ -222,9 +229,8 @@ function adjustScaleForOverflow(min, max, model, barWidthAndOffset) {
|
|
|
222
229
|
}
|
|
223
230
|
|
|
224
231
|
function niceScaleExtent(scale, model) {
|
|
225
|
-
var
|
|
226
|
-
var
|
|
227
|
-
var fixMax = model.getMax() != null;
|
|
232
|
+
var extentInfo = getScaleExtent(scale, model);
|
|
233
|
+
var extent = extentInfo.extent;
|
|
228
234
|
var splitNumber = model.get('splitNumber');
|
|
229
235
|
|
|
230
236
|
if (scale.type === 'log') {
|
|
@@ -235,8 +241,8 @@ function niceScaleExtent(scale, model) {
|
|
|
235
241
|
scale.setExtent(extent[0], extent[1]);
|
|
236
242
|
scale.niceExtent({
|
|
237
243
|
splitNumber: splitNumber,
|
|
238
|
-
fixMin: fixMin,
|
|
239
|
-
fixMax: fixMax,
|
|
244
|
+
fixMin: extentInfo.fixMin,
|
|
245
|
+
fixMax: extentInfo.fixMax,
|
|
240
246
|
minInterval: scaleType === 'interval' || scaleType === 'time' ? model.get('minInterval') : null,
|
|
241
247
|
maxInterval: scaleType === 'interval' || scaleType === 'time' ? model.get('maxInterval') : null
|
|
242
248
|
}); // If some one specified the min, max. And the default calculated interval
|
|
@@ -391,8 +397,8 @@ function rotateTextRect(textRect, rotate) {
|
|
|
391
397
|
var boundingBox = textRect.plain();
|
|
392
398
|
var beforeWidth = boundingBox.width;
|
|
393
399
|
var beforeHeight = boundingBox.height;
|
|
394
|
-
var afterWidth = beforeWidth * Math.cos(rotateRadians) + beforeHeight * Math.sin(rotateRadians);
|
|
395
|
-
var afterHeight = beforeWidth * Math.sin(rotateRadians) + beforeHeight * Math.cos(rotateRadians);
|
|
400
|
+
var afterWidth = beforeWidth * Math.abs(Math.cos(rotateRadians)) + Math.abs(beforeHeight * Math.sin(rotateRadians));
|
|
401
|
+
var afterHeight = beforeWidth * Math.abs(Math.sin(rotateRadians)) + Math.abs(beforeHeight * Math.cos(rotateRadians));
|
|
396
402
|
var rotatedRect = new BoundingRect(boundingBox.x, boundingBox.y, afterWidth, afterHeight);
|
|
397
403
|
return rotatedRect;
|
|
398
404
|
}
|
|
@@ -336,7 +336,9 @@ Calendar.prototype = {
|
|
|
336
336
|
range.reverse();
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY) - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1; // Consider
|
|
339
|
+
var allDay = Math.floor(range[1].time / PROXIMATE_ONE_DAY) - Math.floor(range[0].time / PROXIMATE_ONE_DAY) + 1; // Consider case1 (#11677 #10430):
|
|
340
|
+
// Set the system timezone as "UK", set the range to `['2016-07-01', '2016-12-31']`
|
|
341
|
+
// Consider case2:
|
|
340
342
|
// Firstly set system timezone as "Time Zone: America/Toronto",
|
|
341
343
|
// ```
|
|
342
344
|
// var first = new Date(1478412000000 - 3600 * 1000 * 2.5);
|
|
@@ -350,12 +352,14 @@ Calendar.prototype = {
|
|
|
350
352
|
var endDateNum = range[1].date.getDate();
|
|
351
353
|
date.setDate(startDateNum + allDay - 1); // The bias can not over a month, so just compare date.
|
|
352
354
|
|
|
353
|
-
|
|
355
|
+
var dateNum = date.getDate();
|
|
356
|
+
|
|
357
|
+
if (dateNum !== endDateNum) {
|
|
354
358
|
var sign = date.getTime() - range[1].time > 0 ? 1 : -1;
|
|
355
359
|
|
|
356
|
-
while (date.getDate() !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
|
|
360
|
+
while ((dateNum = date.getDate()) !== endDateNum && (date.getTime() - range[1].time) * sign > 0) {
|
|
357
361
|
allDay -= sign;
|
|
358
|
-
date.setDate(
|
|
362
|
+
date.setDate(dateNum - sign);
|
|
359
363
|
}
|
|
360
364
|
}
|
|
361
365
|
|
|
@@ -143,8 +143,9 @@ var GeoModel = ComponentModel.extend({
|
|
|
143
143
|
* @return {string}
|
|
144
144
|
*/
|
|
145
145
|
getFormattedLabel: function (name, status) {
|
|
146
|
+
status = status || 'normal';
|
|
146
147
|
var regionModel = this.getRegionModel(name);
|
|
147
|
-
var formatter = regionModel.get(
|
|
148
|
+
var formatter = regionModel.get((status === 'normal' ? '' : status + '.') + 'label.formatter');
|
|
148
149
|
var params = {
|
|
149
150
|
name: name
|
|
150
151
|
};
|
|
@@ -60,9 +60,10 @@ var _default = {
|
|
|
60
60
|
/**
|
|
61
61
|
* @param {string} mapName
|
|
62
62
|
* @param {Object} mapRecord {specialAreas, geoJSON}
|
|
63
|
+
* @param {string} nameProperty
|
|
63
64
|
* @return {Object} {regions, boundingRect}
|
|
64
65
|
*/
|
|
65
|
-
load: function (mapName, mapRecord) {
|
|
66
|
+
load: function (mapName, mapRecord, nameProperty) {
|
|
66
67
|
var parsed = inner(mapRecord).parsed;
|
|
67
68
|
|
|
68
69
|
if (parsed) {
|
|
@@ -74,7 +75,7 @@ var _default = {
|
|
|
74
75
|
var regions; // https://jsperf.com/try-catch-performance-overhead
|
|
75
76
|
|
|
76
77
|
try {
|
|
77
|
-
regions = geoJSON ? parseGeoJson(geoJSON) : [];
|
|
78
|
+
regions = geoJSON ? parseGeoJson(geoJSON, nameProperty) : [];
|
|
78
79
|
} catch (e) {
|
|
79
80
|
throw new Error('Invalid geoJson format\n' + e.message);
|
|
80
81
|
}
|
|
@@ -61,16 +61,17 @@ var _default = {
|
|
|
61
61
|
/**
|
|
62
62
|
* @param {string} mapName
|
|
63
63
|
* @param {Object} nameMap
|
|
64
|
+
* @param {string} nameProperty
|
|
64
65
|
* @return {Object} source {regions, regionsMap, nameCoordMap, boundingRect}
|
|
65
66
|
*/
|
|
66
|
-
load: function (mapName, nameMap) {
|
|
67
|
+
load: function (mapName, nameMap, nameProperty) {
|
|
67
68
|
var regions = [];
|
|
68
69
|
var regionsMap = createHashMap();
|
|
69
70
|
var nameCoordMap = createHashMap();
|
|
70
71
|
var boundingRect;
|
|
71
72
|
var mapRecords = retrieveMap(mapName);
|
|
72
73
|
each(mapRecords, function (record) {
|
|
73
|
-
var singleSource = loaders[record.type].load(mapName, record);
|
|
74
|
+
var singleSource = loaders[record.type].load(mapName, record, nameProperty);
|
|
74
75
|
each(singleSource.regions, function (region) {
|
|
75
76
|
var regionName = region.name; // Try use the alias in geoNameMap
|
|
76
77
|
|
|
@@ -108,11 +108,12 @@ function decodePolygon(coordinate, encodeOffsets, encodeScale) {
|
|
|
108
108
|
/**
|
|
109
109
|
* @alias module:echarts/coord/geo/parseGeoJson
|
|
110
110
|
* @param {Object} geoJson
|
|
111
|
+
* @param {string} nameProperty
|
|
111
112
|
* @return {module:zrender/container/Group}
|
|
112
113
|
*/
|
|
113
114
|
|
|
114
115
|
|
|
115
|
-
function _default(geoJson) {
|
|
116
|
+
function _default(geoJson, nameProperty) {
|
|
116
117
|
decode(geoJson);
|
|
117
118
|
return zrUtil.map(zrUtil.filter(geoJson.features, function (featureObj) {
|
|
118
119
|
// Output of mapshaper may have geometry null
|
|
@@ -145,7 +146,7 @@ function _default(geoJson) {
|
|
|
145
146
|
});
|
|
146
147
|
}
|
|
147
148
|
|
|
148
|
-
var region = new Region(properties
|
|
149
|
+
var region = new Region(properties[nameProperty || 'name'], geometries, properties.cp);
|
|
149
150
|
region.properties = properties;
|
|
150
151
|
return region;
|
|
151
152
|
});
|
package/lib/coord/radar/Radar.js
CHANGED
|
@@ -210,7 +210,7 @@ Radar.prototype.update = function (ecModel, api) {
|
|
|
210
210
|
|
|
211
211
|
|
|
212
212
|
zrUtil.each(indicatorAxes, function (indicatorAxis, idx) {
|
|
213
|
-
var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model);
|
|
213
|
+
var rawExtent = getScaleExtent(indicatorAxis.scale, indicatorAxis.model).extent;
|
|
214
214
|
niceScaleExtent(indicatorAxis.scale, indicatorAxis.model);
|
|
215
215
|
var axisModel = indicatorAxis.model;
|
|
216
216
|
var scale = indicatorAxis.scale;
|
|
@@ -247,12 +247,12 @@ Radar.prototype.update = function (ecModel, api) {
|
|
|
247
247
|
|
|
248
248
|
if (nicedSplitNumber > splitNumber) {
|
|
249
249
|
interval = increaseInterval(interval);
|
|
250
|
-
} //
|
|
250
|
+
} // TODO
|
|
251
251
|
|
|
252
252
|
|
|
253
|
-
var
|
|
254
|
-
var
|
|
255
|
-
scale.setExtent(
|
|
253
|
+
var max = Math.ceil(rawExtent[1] / interval) * interval;
|
|
254
|
+
var min = numberUtil.round(max - interval * splitNumber);
|
|
255
|
+
scale.setExtent(min, max);
|
|
256
256
|
scale.setInterval(interval);
|
|
257
257
|
}
|
|
258
258
|
});
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
|
|
2
|
+
/*
|
|
3
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
4
|
+
* or more contributor license agreements. See the NOTICE file
|
|
5
|
+
* distributed with this work for additional information
|
|
6
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
7
|
+
* to you under the Apache License, Version 2.0 (the
|
|
8
|
+
* "License"); you may not use this file except in compliance
|
|
9
|
+
* with the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing,
|
|
14
|
+
* software distributed under the License is distributed on an
|
|
15
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
16
|
+
* KIND, either express or implied. See the License for the
|
|
17
|
+
* specific language governing permissions and limitations
|
|
18
|
+
* under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
var zrUtil = require("zrender/lib/core/util");
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
25
|
+
* or more contributor license agreements. See the NOTICE file
|
|
26
|
+
* distributed with this work for additional information
|
|
27
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
28
|
+
* to you under the Apache License, Version 2.0 (the
|
|
29
|
+
* "License"); you may not use this file except in compliance
|
|
30
|
+
* with the License. You may obtain a copy of the License at
|
|
31
|
+
*
|
|
32
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
33
|
+
*
|
|
34
|
+
* Unless required by applicable law or agreed to in writing,
|
|
35
|
+
* software distributed under the License is distributed on an
|
|
36
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
37
|
+
* KIND, either express or implied. See the License for the
|
|
38
|
+
* specific language governing permissions and limitations
|
|
39
|
+
* under the License.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @class
|
|
44
|
+
* @param {Object|DataDimensionInfo} [opt] All of the fields will be shallow copied.
|
|
45
|
+
*/
|
|
46
|
+
function DataDimensionInfo(opt) {
|
|
47
|
+
if (opt != null) {
|
|
48
|
+
zrUtil.extend(this, opt);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Dimension name.
|
|
52
|
+
* Mandatory.
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
// this.name;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The origin name in dimsDef, see source helper.
|
|
59
|
+
* If displayName given, the tooltip will displayed vertically.
|
|
60
|
+
* Optional.
|
|
61
|
+
* @type {string}
|
|
62
|
+
*/
|
|
63
|
+
// this.displayName;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Which coordSys dimension this dimension mapped to.
|
|
67
|
+
* A `coordDim` can be a "coordSysDim" that the coordSys required
|
|
68
|
+
* (for example, an item in `coordSysDims` of `model/referHelper#CoordSysInfo`),
|
|
69
|
+
* or an generated "extra coord name" if does not mapped to any "coordSysDim"
|
|
70
|
+
* (That is determined by whether `isExtraCoord` is `true`).
|
|
71
|
+
* Mandatory.
|
|
72
|
+
* @type {string}
|
|
73
|
+
*/
|
|
74
|
+
// this.coordDim;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The index of this dimension in `series.encode[coordDim]`.
|
|
78
|
+
* Mandatory.
|
|
79
|
+
* @type {number}
|
|
80
|
+
*/
|
|
81
|
+
// this.coordDimIndex;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Dimension type. The enumerable values are the key of
|
|
85
|
+
* `dataCtors` of `data/List`.
|
|
86
|
+
* Optional.
|
|
87
|
+
* @type {string}
|
|
88
|
+
*/
|
|
89
|
+
// this.type;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* This index of this dimension info in `data/List#_dimensionInfos`.
|
|
93
|
+
* Mandatory after added to `data/List`.
|
|
94
|
+
* @type {number}
|
|
95
|
+
*/
|
|
96
|
+
// this.index;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The format of `otherDims` is:
|
|
100
|
+
* ```js
|
|
101
|
+
* {
|
|
102
|
+
* tooltip: number optional,
|
|
103
|
+
* label: number optional,
|
|
104
|
+
* itemName: number optional,
|
|
105
|
+
* seriesName: number optional,
|
|
106
|
+
* }
|
|
107
|
+
* ```
|
|
108
|
+
*
|
|
109
|
+
* A `series.encode` can specified these fields:
|
|
110
|
+
* ```js
|
|
111
|
+
* encode: {
|
|
112
|
+
* // "3, 1, 5" is the index of data dimension.
|
|
113
|
+
* tooltip: [3, 1, 5],
|
|
114
|
+
* label: [0, 3],
|
|
115
|
+
* ...
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
* `otherDims` is the parse result of the `series.encode` above, like:
|
|
119
|
+
* ```js
|
|
120
|
+
* // Suppose the index of this data dimension is `3`.
|
|
121
|
+
* this.otherDims = {
|
|
122
|
+
* // `3` is at the index `0` of the `encode.tooltip`
|
|
123
|
+
* tooltip: 0,
|
|
124
|
+
* // `3` is at the index `1` of the `encode.tooltip`
|
|
125
|
+
* label: 1
|
|
126
|
+
* };
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
* This prop should never be `null`/`undefined` after initialized.
|
|
130
|
+
* @type {Object}
|
|
131
|
+
*/
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
this.otherDims = {};
|
|
135
|
+
/**
|
|
136
|
+
* Be `true` if this dimension is not mapped to any "coordSysDim" that the
|
|
137
|
+
* "coordSys" required.
|
|
138
|
+
* Mandatory.
|
|
139
|
+
* @type {boolean}
|
|
140
|
+
*/
|
|
141
|
+
// this.isExtraCoord;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @type {module:data/OrdinalMeta}
|
|
145
|
+
*/
|
|
146
|
+
// this.ordinalMeta;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Whether to create inverted indices.
|
|
150
|
+
* @type {boolean}
|
|
151
|
+
*/
|
|
152
|
+
// this.createInvertedIndices;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
;
|
|
156
|
+
var _default = DataDimensionInfo;
|
|
157
|
+
module.exports = _default;
|
package/lib/data/Graph.js
CHANGED
|
@@ -191,12 +191,7 @@ graphProto.addEdge = function (n1, n2, dataIndex) {
|
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
var key = n1.id + '-' + n2.id;
|
|
195
|
-
|
|
196
|
-
if (edgesMap[key]) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
194
|
+
var key = n1.id + '-' + n2.id;
|
|
200
195
|
var edge = new Edge(n1, n2, dataIndex);
|
|
201
196
|
edge.hostGraph = this;
|
|
202
197
|
|
package/lib/data/List.js
CHANGED
|
@@ -39,6 +39,8 @@ var _dimensionHelper = require("./helper/dimensionHelper");
|
|
|
39
39
|
|
|
40
40
|
var summarizeDimensions = _dimensionHelper.summarizeDimensions;
|
|
41
41
|
|
|
42
|
+
var DataDimensionInfo = require("./DataDimensionInfo");
|
|
43
|
+
|
|
42
44
|
/*
|
|
43
45
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
44
46
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -114,13 +116,9 @@ function transferProperties(target, source) {
|
|
|
114
116
|
* @constructor
|
|
115
117
|
* @alias module:echarts/data/List
|
|
116
118
|
*
|
|
117
|
-
* @param {Array.<string|Object>} dimensions
|
|
119
|
+
* @param {Array.<string|Object|module:data/DataDimensionInfo>} dimensions
|
|
118
120
|
* For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].
|
|
119
121
|
* Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
|
|
120
|
-
* Spetial fields: {
|
|
121
|
-
* ordinalMeta: <module:echarts/data/OrdinalMeta>
|
|
122
|
-
* createInvertedIndices: <boolean>
|
|
123
|
-
* }
|
|
124
122
|
* @param {module:echarts/model/Model} hostModel
|
|
125
123
|
*/
|
|
126
124
|
|
|
@@ -136,9 +134,11 @@ var List = function (dimensions, hostModel) {
|
|
|
136
134
|
var dimensionInfo = dimensions[i];
|
|
137
135
|
|
|
138
136
|
if (zrUtil.isString(dimensionInfo)) {
|
|
139
|
-
dimensionInfo = {
|
|
137
|
+
dimensionInfo = new DataDimensionInfo({
|
|
140
138
|
name: dimensionInfo
|
|
141
|
-
};
|
|
139
|
+
});
|
|
140
|
+
} else if (!(dimensionInfo instanceof DataDimensionInfo)) {
|
|
141
|
+
dimensionInfo = new DataDimensionInfo(dimensionInfo);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
var dimensionName = dimensionInfo.name;
|
|
@@ -419,7 +419,7 @@ listProto.mapDimension = function (coordDim, idx) {
|
|
|
419
419
|
* Initialize from data
|
|
420
420
|
* @param {Array.<Object|number|Array>} data source or data or data provider.
|
|
421
421
|
* @param {Array.<string>} [nameLIst] The name of a datum is used on data diff and
|
|
422
|
-
*
|
|
422
|
+
* default label/tooltip.
|
|
423
423
|
* A name can be specified in encode.itemName,
|
|
424
424
|
* or dataItem.name (only for series option data),
|
|
425
425
|
* or provided in nameList from outside.
|
|
@@ -1182,7 +1182,8 @@ listProto.indexOfRawIndex = function (rawIndex) {
|
|
|
1182
1182
|
* @param {string} dim
|
|
1183
1183
|
* @param {number} value
|
|
1184
1184
|
* @param {number} [maxDistance=Infinity]
|
|
1185
|
-
* @return {Array.<number>}
|
|
1185
|
+
* @return {Array.<number>} If and only if multiple indices has
|
|
1186
|
+
* the same value, they are put to the result.
|
|
1186
1187
|
*/
|
|
1187
1188
|
|
|
1188
1189
|
|
|
@@ -1199,29 +1200,34 @@ listProto.indicesOfNearest = function (dim, value, maxDistance) {
|
|
|
1199
1200
|
maxDistance = Infinity;
|
|
1200
1201
|
}
|
|
1201
1202
|
|
|
1202
|
-
var minDist =
|
|
1203
|
+
var minDist = Infinity;
|
|
1203
1204
|
var minDiff = -1;
|
|
1205
|
+
var nearestIndicesLen = 0; // Check the test case of `test/ut/spec/data/List.js`.
|
|
1204
1206
|
|
|
1205
1207
|
for (var i = 0, len = this.count(); i < len; i++) {
|
|
1206
|
-
var diff = value - this.get(dim, i
|
|
1207
|
-
/*, stack */
|
|
1208
|
-
);
|
|
1208
|
+
var diff = value - this.get(dim, i);
|
|
1209
1209
|
var dist = Math.abs(diff);
|
|
1210
1210
|
|
|
1211
|
-
if (
|
|
1212
|
-
//
|
|
1213
|
-
//
|
|
1214
|
-
//
|
|
1215
|
-
|
|
1211
|
+
if (dist <= maxDistance) {
|
|
1212
|
+
// When the `value` is at the middle of `this.get(dim, i)` and `this.get(dim, i+1)`,
|
|
1213
|
+
// we'd better not push both of them to `nearestIndices`, otherwise it is easy to
|
|
1214
|
+
// get more than one item in `nearestIndices` (more specifically, in `tooltip`).
|
|
1215
|
+
// So we chose the one that `diff >= 0` in this csae.
|
|
1216
|
+
// But if `this.get(dim, i)` and `this.get(dim, j)` get the same value, both of them
|
|
1217
|
+
// should be push to `nearestIndices`.
|
|
1218
|
+
if (dist < minDist || dist === minDist && diff >= 0 && minDiff < 0) {
|
|
1216
1219
|
minDist = dist;
|
|
1217
1220
|
minDiff = diff;
|
|
1218
|
-
|
|
1221
|
+
nearestIndicesLen = 0;
|
|
1219
1222
|
}
|
|
1220
1223
|
|
|
1221
|
-
|
|
1224
|
+
if (diff === minDiff) {
|
|
1225
|
+
nearestIndices[nearestIndicesLen++] = i;
|
|
1226
|
+
}
|
|
1222
1227
|
}
|
|
1223
1228
|
}
|
|
1224
1229
|
|
|
1230
|
+
nearestIndices.length = nearestIndicesLen;
|
|
1225
1231
|
return nearestIndices;
|
|
1226
1232
|
};
|
|
1227
1233
|
/**
|
package/lib/data/Tree.js
CHANGED
|
@@ -20,8 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
var zrUtil = require("zrender/lib/core/util");
|
|
22
22
|
|
|
23
|
-
var Model = require("../model/Model");
|
|
24
|
-
|
|
25
23
|
var linkList = require("./helper/linkList");
|
|
26
24
|
|
|
27
25
|
var List = require("./List");
|
|
@@ -281,28 +279,7 @@ TreeNode.prototype = {
|
|
|
281
279
|
|
|
282
280
|
var hostTree = this.hostTree;
|
|
283
281
|
var itemModel = hostTree.data.getItemModel(this.dataIndex);
|
|
284
|
-
|
|
285
|
-
var leavesModel;
|
|
286
|
-
|
|
287
|
-
if (!levelModel && (this.children.length === 0 || this.children.length !== 0 && this.isExpand === false)) {
|
|
288
|
-
leavesModel = this.getLeavesModel();
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* @return {module:echarts/model/Model}
|
|
296
|
-
*/
|
|
297
|
-
getLevelModel: function () {
|
|
298
|
-
return (this.hostTree.levelModels || [])[this.depth];
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* @return {module:echarts/model/Model}
|
|
303
|
-
*/
|
|
304
|
-
getLeavesModel: function () {
|
|
305
|
-
return this.hostTree.leavesModel;
|
|
282
|
+
return itemModel.getModel(path);
|
|
306
283
|
},
|
|
307
284
|
|
|
308
285
|
/**
|
|
@@ -375,11 +352,9 @@ TreeNode.prototype = {
|
|
|
375
352
|
* @constructor
|
|
376
353
|
* @alias module:echarts/data/Tree
|
|
377
354
|
* @param {module:echarts/model/Model} hostModel
|
|
378
|
-
* @param {Array.<Object>} levelOptions
|
|
379
|
-
* @param {Object} leavesOption
|
|
380
355
|
*/
|
|
381
356
|
|
|
382
|
-
function Tree(hostModel
|
|
357
|
+
function Tree(hostModel) {
|
|
383
358
|
/**
|
|
384
359
|
* @type {module:echarts/data/Tree~TreeNode}
|
|
385
360
|
* @readOnly
|
|
@@ -405,16 +380,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
|
|
|
405
380
|
*/
|
|
406
381
|
|
|
407
382
|
this.hostModel = hostModel;
|
|
408
|
-
/**
|
|
409
|
-
* @private
|
|
410
|
-
* @readOnly
|
|
411
|
-
* @type {Array.<module:echarts/model/Model}
|
|
412
|
-
*/
|
|
413
|
-
|
|
414
|
-
this.levelModels = zrUtil.map(levelOptions || [], function (levelDefine) {
|
|
415
|
-
return new Model(levelDefine, hostModel, hostModel.ecModel);
|
|
416
|
-
});
|
|
417
|
-
this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
|
|
418
383
|
}
|
|
419
384
|
|
|
420
385
|
Tree.prototype = {
|
|
@@ -501,14 +466,11 @@ Tree.prototype = {
|
|
|
501
466
|
* @static
|
|
502
467
|
* @param {Object} dataRoot Root node.
|
|
503
468
|
* @param {module:echarts/model/Model} hostModel
|
|
504
|
-
* @param {Object} treeOptions
|
|
505
|
-
* @param {Array.<Object>} treeOptions.levels
|
|
506
|
-
* @param {Array.<Object>} treeOptions.leaves
|
|
507
469
|
* @return module:echarts/data/Tree
|
|
508
470
|
*/
|
|
509
471
|
|
|
510
|
-
Tree.createTree = function (dataRoot, hostModel,
|
|
511
|
-
var tree = new Tree(hostModel
|
|
472
|
+
Tree.createTree = function (dataRoot, hostModel, beforeLink) {
|
|
473
|
+
var tree = new Tree(hostModel);
|
|
512
474
|
var listData = [];
|
|
513
475
|
var dimMax = 1;
|
|
514
476
|
buildHierarchy(dataRoot);
|
|
@@ -538,6 +500,7 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions) {
|
|
|
538
500
|
});
|
|
539
501
|
var list = new List(dimensionsInfo, hostModel);
|
|
540
502
|
list.initData(listData);
|
|
503
|
+
beforeLink && beforeLink(list);
|
|
541
504
|
linkList({
|
|
542
505
|
mainData: list,
|
|
543
506
|
struct: tree,
|