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
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
* or more contributor license agreements. See the NOTICE file
|
|
4
|
+
* distributed with this work for additional information
|
|
5
|
+
* regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
* to you under the Apache License, Version 2.0 (the
|
|
7
|
+
* "License"); you may not use this file except in compliance
|
|
8
|
+
* with the License. You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import * as zrUtil from 'zrender/src/core/util';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @class
|
|
24
|
+
* @param {Object|DataDimensionInfo} [opt] All of the fields will be shallow copied.
|
|
25
|
+
*/
|
|
26
|
+
function DataDimensionInfo(opt) {
|
|
27
|
+
if (opt != null) {
|
|
28
|
+
zrUtil.extend(this, opt);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Dimension name.
|
|
33
|
+
* Mandatory.
|
|
34
|
+
* @type {string}
|
|
35
|
+
*/
|
|
36
|
+
// this.name;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The origin name in dimsDef, see source helper.
|
|
40
|
+
* If displayName given, the tooltip will displayed vertically.
|
|
41
|
+
* Optional.
|
|
42
|
+
* @type {string}
|
|
43
|
+
*/
|
|
44
|
+
// this.displayName;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Which coordSys dimension this dimension mapped to.
|
|
48
|
+
* A `coordDim` can be a "coordSysDim" that the coordSys required
|
|
49
|
+
* (for example, an item in `coordSysDims` of `model/referHelper#CoordSysInfo`),
|
|
50
|
+
* or an generated "extra coord name" if does not mapped to any "coordSysDim"
|
|
51
|
+
* (That is determined by whether `isExtraCoord` is `true`).
|
|
52
|
+
* Mandatory.
|
|
53
|
+
* @type {string}
|
|
54
|
+
*/
|
|
55
|
+
// this.coordDim;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The index of this dimension in `series.encode[coordDim]`.
|
|
59
|
+
* Mandatory.
|
|
60
|
+
* @type {number}
|
|
61
|
+
*/
|
|
62
|
+
// this.coordDimIndex;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Dimension type. The enumerable values are the key of
|
|
66
|
+
* `dataCtors` of `data/List`.
|
|
67
|
+
* Optional.
|
|
68
|
+
* @type {string}
|
|
69
|
+
*/
|
|
70
|
+
// this.type;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* This index of this dimension info in `data/List#_dimensionInfos`.
|
|
74
|
+
* Mandatory after added to `data/List`.
|
|
75
|
+
* @type {number}
|
|
76
|
+
*/
|
|
77
|
+
// this.index;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The format of `otherDims` is:
|
|
81
|
+
* ```js
|
|
82
|
+
* {
|
|
83
|
+
* tooltip: number optional,
|
|
84
|
+
* label: number optional,
|
|
85
|
+
* itemName: number optional,
|
|
86
|
+
* seriesName: number optional,
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* A `series.encode` can specified these fields:
|
|
91
|
+
* ```js
|
|
92
|
+
* encode: {
|
|
93
|
+
* // "3, 1, 5" is the index of data dimension.
|
|
94
|
+
* tooltip: [3, 1, 5],
|
|
95
|
+
* label: [0, 3],
|
|
96
|
+
* ...
|
|
97
|
+
* }
|
|
98
|
+
* ```
|
|
99
|
+
* `otherDims` is the parse result of the `series.encode` above, like:
|
|
100
|
+
* ```js
|
|
101
|
+
* // Suppose the index of this data dimension is `3`.
|
|
102
|
+
* this.otherDims = {
|
|
103
|
+
* // `3` is at the index `0` of the `encode.tooltip`
|
|
104
|
+
* tooltip: 0,
|
|
105
|
+
* // `3` is at the index `1` of the `encode.tooltip`
|
|
106
|
+
* label: 1
|
|
107
|
+
* };
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* This prop should never be `null`/`undefined` after initialized.
|
|
111
|
+
* @type {Object}
|
|
112
|
+
*/
|
|
113
|
+
this.otherDims = {};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Be `true` if this dimension is not mapped to any "coordSysDim" that the
|
|
117
|
+
* "coordSys" required.
|
|
118
|
+
* Mandatory.
|
|
119
|
+
* @type {boolean}
|
|
120
|
+
*/
|
|
121
|
+
// this.isExtraCoord;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @type {module:data/OrdinalMeta}
|
|
125
|
+
*/
|
|
126
|
+
// this.ordinalMeta;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Whether to create inverted indices.
|
|
130
|
+
* @type {boolean}
|
|
131
|
+
*/
|
|
132
|
+
// this.createInvertedIndices;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export default DataDimensionInfo;
|
package/src/data/Graph.js
CHANGED
package/src/data/List.js
CHANGED
|
@@ -31,6 +31,7 @@ import DataDiffer from './DataDiffer';
|
|
|
31
31
|
import Source from './Source';
|
|
32
32
|
import {defaultDimValueGetters, DefaultDataProvider} from './helper/dataProvider';
|
|
33
33
|
import {summarizeDimensions} from './helper/dimensionHelper';
|
|
34
|
+
import DataDimensionInfo from './DataDimensionInfo';
|
|
34
35
|
|
|
35
36
|
var isObject = zrUtil.isObject;
|
|
36
37
|
|
|
@@ -102,13 +103,9 @@ function transferProperties(target, source) {
|
|
|
102
103
|
* @constructor
|
|
103
104
|
* @alias module:echarts/data/List
|
|
104
105
|
*
|
|
105
|
-
* @param {Array.<string|Object>} dimensions
|
|
106
|
+
* @param {Array.<string|Object|module:data/DataDimensionInfo>} dimensions
|
|
106
107
|
* For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].
|
|
107
108
|
* Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
|
|
108
|
-
* Spetial fields: {
|
|
109
|
-
* ordinalMeta: <module:echarts/data/OrdinalMeta>
|
|
110
|
-
* createInvertedIndices: <boolean>
|
|
111
|
-
* }
|
|
112
109
|
* @param {module:echarts/model/Model} hostModel
|
|
113
110
|
*/
|
|
114
111
|
var List = function (dimensions, hostModel) {
|
|
@@ -124,7 +121,10 @@ var List = function (dimensions, hostModel) {
|
|
|
124
121
|
var dimensionInfo = dimensions[i];
|
|
125
122
|
|
|
126
123
|
if (zrUtil.isString(dimensionInfo)) {
|
|
127
|
-
dimensionInfo = {name: dimensionInfo};
|
|
124
|
+
dimensionInfo = new DataDimensionInfo({name: dimensionInfo});
|
|
125
|
+
}
|
|
126
|
+
else if (!(dimensionInfo instanceof DataDimensionInfo)) {
|
|
127
|
+
dimensionInfo = new DataDimensionInfo(dimensionInfo);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
var dimensionName = dimensionInfo.name;
|
|
@@ -406,7 +406,7 @@ listProto.mapDimension = function (coordDim, idx) {
|
|
|
406
406
|
* Initialize from data
|
|
407
407
|
* @param {Array.<Object|number|Array>} data source or data or data provider.
|
|
408
408
|
* @param {Array.<string>} [nameLIst] The name of a datum is used on data diff and
|
|
409
|
-
*
|
|
409
|
+
* default label/tooltip.
|
|
410
410
|
* A name can be specified in encode.itemName,
|
|
411
411
|
* or dataItem.name (only for series option data),
|
|
412
412
|
* or provided in nameList from outside.
|
|
@@ -1144,7 +1144,8 @@ listProto.indexOfRawIndex = function (rawIndex) {
|
|
|
1144
1144
|
* @param {string} dim
|
|
1145
1145
|
* @param {number} value
|
|
1146
1146
|
* @param {number} [maxDistance=Infinity]
|
|
1147
|
-
* @return {Array.<number>}
|
|
1147
|
+
* @return {Array.<number>} If and only if multiple indices has
|
|
1148
|
+
* the same value, they are put to the result.
|
|
1148
1149
|
*/
|
|
1149
1150
|
listProto.indicesOfNearest = function (dim, value, maxDistance) {
|
|
1150
1151
|
var storage = this._storage;
|
|
@@ -1159,23 +1160,35 @@ listProto.indicesOfNearest = function (dim, value, maxDistance) {
|
|
|
1159
1160
|
maxDistance = Infinity;
|
|
1160
1161
|
}
|
|
1161
1162
|
|
|
1162
|
-
var minDist =
|
|
1163
|
+
var minDist = Infinity;
|
|
1163
1164
|
var minDiff = -1;
|
|
1165
|
+
var nearestIndicesLen = 0;
|
|
1166
|
+
|
|
1167
|
+
// Check the test case of `test/ut/spec/data/List.js`.
|
|
1164
1168
|
for (var i = 0, len = this.count(); i < len; i++) {
|
|
1165
|
-
var diff = value - this.get(dim, i
|
|
1169
|
+
var diff = value - this.get(dim, i);
|
|
1166
1170
|
var dist = Math.abs(diff);
|
|
1167
|
-
if (
|
|
1168
|
-
//
|
|
1169
|
-
//
|
|
1170
|
-
//
|
|
1171
|
-
|
|
1171
|
+
if (dist <= maxDistance) {
|
|
1172
|
+
// When the `value` is at the middle of `this.get(dim, i)` and `this.get(dim, i+1)`,
|
|
1173
|
+
// we'd better not push both of them to `nearestIndices`, otherwise it is easy to
|
|
1174
|
+
// get more than one item in `nearestIndices` (more specifically, in `tooltip`).
|
|
1175
|
+
// So we chose the one that `diff >= 0` in this csae.
|
|
1176
|
+
// But if `this.get(dim, i)` and `this.get(dim, j)` get the same value, both of them
|
|
1177
|
+
// should be push to `nearestIndices`.
|
|
1178
|
+
if (dist < minDist
|
|
1179
|
+
|| (dist === minDist && diff >= 0 && minDiff < 0)
|
|
1180
|
+
) {
|
|
1172
1181
|
minDist = dist;
|
|
1173
1182
|
minDiff = diff;
|
|
1174
|
-
|
|
1183
|
+
nearestIndicesLen = 0;
|
|
1184
|
+
}
|
|
1185
|
+
if (diff === minDiff) {
|
|
1186
|
+
nearestIndices[nearestIndicesLen++] = i;
|
|
1175
1187
|
}
|
|
1176
|
-
nearestIndices.push(i);
|
|
1177
1188
|
}
|
|
1178
1189
|
}
|
|
1190
|
+
nearestIndices.length = nearestIndicesLen;
|
|
1191
|
+
|
|
1179
1192
|
return nearestIndices;
|
|
1180
1193
|
};
|
|
1181
1194
|
|
package/src/data/Tree.js
CHANGED
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import * as zrUtil from 'zrender/src/core/util';
|
|
27
|
-
import Model from '../model/Model';
|
|
28
27
|
import linkList from './helper/linkList';
|
|
29
28
|
import List from './List';
|
|
30
29
|
import createDimensions from './helper/createDimensions';
|
|
@@ -247,26 +246,7 @@ TreeNode.prototype = {
|
|
|
247
246
|
}
|
|
248
247
|
var hostTree = this.hostTree;
|
|
249
248
|
var itemModel = hostTree.data.getItemModel(this.dataIndex);
|
|
250
|
-
|
|
251
|
-
var leavesModel;
|
|
252
|
-
if (!levelModel && (this.children.length === 0 || (this.children.length !== 0 && this.isExpand === false))) {
|
|
253
|
-
leavesModel = this.getLeavesModel();
|
|
254
|
-
}
|
|
255
|
-
return itemModel.getModel(path, (levelModel || leavesModel || hostTree.hostModel).getModel(path));
|
|
256
|
-
},
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* @return {module:echarts/model/Model}
|
|
260
|
-
*/
|
|
261
|
-
getLevelModel: function () {
|
|
262
|
-
return (this.hostTree.levelModels || [])[this.depth];
|
|
263
|
-
},
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* @return {module:echarts/model/Model}
|
|
267
|
-
*/
|
|
268
|
-
getLeavesModel: function () {
|
|
269
|
-
return this.hostTree.leavesModel;
|
|
249
|
+
return itemModel.getModel(path);
|
|
270
250
|
},
|
|
271
251
|
|
|
272
252
|
/**
|
|
@@ -338,10 +318,8 @@ TreeNode.prototype = {
|
|
|
338
318
|
* @constructor
|
|
339
319
|
* @alias module:echarts/data/Tree
|
|
340
320
|
* @param {module:echarts/model/Model} hostModel
|
|
341
|
-
* @param {Array.<Object>} levelOptions
|
|
342
|
-
* @param {Object} leavesOption
|
|
343
321
|
*/
|
|
344
|
-
function Tree(hostModel
|
|
322
|
+
function Tree(hostModel) {
|
|
345
323
|
/**
|
|
346
324
|
* @type {module:echarts/data/Tree~TreeNode}
|
|
347
325
|
* @readOnly
|
|
@@ -368,16 +346,6 @@ function Tree(hostModel, levelOptions, leavesOption) {
|
|
|
368
346
|
*/
|
|
369
347
|
this.hostModel = hostModel;
|
|
370
348
|
|
|
371
|
-
/**
|
|
372
|
-
* @private
|
|
373
|
-
* @readOnly
|
|
374
|
-
* @type {Array.<module:echarts/model/Model}
|
|
375
|
-
*/
|
|
376
|
-
this.levelModels = zrUtil.map(levelOptions || [], function (levelDefine) {
|
|
377
|
-
return new Model(levelDefine, hostModel, hostModel.ecModel);
|
|
378
|
-
});
|
|
379
|
-
|
|
380
|
-
this.leavesModel = new Model(leavesOption || {}, hostModel, hostModel.ecModel);
|
|
381
349
|
}
|
|
382
350
|
|
|
383
351
|
Tree.prototype = {
|
|
@@ -467,14 +435,11 @@ Tree.prototype = {
|
|
|
467
435
|
* @static
|
|
468
436
|
* @param {Object} dataRoot Root node.
|
|
469
437
|
* @param {module:echarts/model/Model} hostModel
|
|
470
|
-
* @param {Object} treeOptions
|
|
471
|
-
* @param {Array.<Object>} treeOptions.levels
|
|
472
|
-
* @param {Array.<Object>} treeOptions.leaves
|
|
473
438
|
* @return module:echarts/data/Tree
|
|
474
439
|
*/
|
|
475
|
-
Tree.createTree = function (dataRoot, hostModel,
|
|
440
|
+
Tree.createTree = function (dataRoot, hostModel, beforeLink) {
|
|
476
441
|
|
|
477
|
-
var tree = new Tree(hostModel
|
|
442
|
+
var tree = new Tree(hostModel);
|
|
478
443
|
var listData = [];
|
|
479
444
|
var dimMax = 1;
|
|
480
445
|
|
|
@@ -511,6 +476,8 @@ Tree.createTree = function (dataRoot, hostModel, treeOptions) {
|
|
|
511
476
|
var list = new List(dimensionsInfo, hostModel);
|
|
512
477
|
list.initData(listData);
|
|
513
478
|
|
|
479
|
+
beforeLink && beforeLink(list);
|
|
480
|
+
|
|
514
481
|
linkList({
|
|
515
482
|
mainData: list,
|
|
516
483
|
struct: tree,
|
|
@@ -24,15 +24,20 @@
|
|
|
24
24
|
|
|
25
25
|
import {createHashMap, each, isString, defaults, extend, isObject, clone} from 'zrender/src/core/util';
|
|
26
26
|
import {normalizeToArray} from '../../util/model';
|
|
27
|
-
import {guessOrdinal} from './sourceHelper';
|
|
27
|
+
import {guessOrdinal, BE_ORDINAL} from './sourceHelper';
|
|
28
28
|
import Source from '../Source';
|
|
29
29
|
import {OTHER_DIMENSIONS} from './dimensionHelper';
|
|
30
|
+
import DataDimensionInfo from '../DataDimensionInfo';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* @see {module:echarts/test/ut/spec/data/completeDimensions}
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
35
|
+
* This method builds the relationship between:
|
|
36
|
+
* + "what the coord sys or series requires (see `sysDims`)",
|
|
37
|
+
* + "what the user defines (in `encode` and `dimensions`, see `opt.dimsDef` and `opt.encodeDef`)"
|
|
38
|
+
* + "what the data source provids (see `source`)".
|
|
39
|
+
*
|
|
40
|
+
* Some guess strategy will be adapted if user does not define something.
|
|
36
41
|
* If no 'value' dimension specified, the first no-named dimension will be
|
|
37
42
|
* named as 'value'.
|
|
38
43
|
*
|
|
@@ -48,32 +53,20 @@ import {OTHER_DIMENSIONS} from './dimensionHelper';
|
|
|
48
53
|
* @param {Array.<Object|string>} [opt.dimsDef] option.series.dimensions User defined dimensions
|
|
49
54
|
* For example: ['asdf', {name, type}, ...].
|
|
50
55
|
* @param {Object|HashMap} [opt.encodeDef] option.series.encode {x: 2, y: [3, 1], tooltip: [1, 2], label: 3}
|
|
56
|
+
* @param {Function} [opt.encodeDefaulter] Called if no `opt.encodeDef` exists.
|
|
57
|
+
* If not specified, auto find the next available data dim.
|
|
58
|
+
* param source {module:data/Source}
|
|
59
|
+
* param dimCount {number}
|
|
60
|
+
* return {Object} encode Never be `null/undefined`.
|
|
51
61
|
* @param {string} [opt.generateCoord] Generate coord dim with the given name.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
62
|
+
* If not specified, extra dim names will be:
|
|
63
|
+
* 'value', 'value0', 'value1', ...
|
|
54
64
|
* @param {number} [opt.generateCoordCount] By default, the generated dim name is `generateCoord`.
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
65
|
+
* If `generateCoordCount` specified, the generated dim names will be:
|
|
66
|
+
* `generateCoord` + 0, `generateCoord` + 1, ...
|
|
67
|
+
* can be Infinity, indicate that use all of the remain columns.
|
|
58
68
|
* @param {number} [opt.dimCount] If not specified, guess by the first data item.
|
|
59
|
-
* @
|
|
60
|
-
* @return {Array.<Object>} [{
|
|
61
|
-
* name: string mandatory,
|
|
62
|
-
* displayName: string, the origin name in dimsDef, see source helper.
|
|
63
|
-
* If displayName given, the tooltip will displayed vertically.
|
|
64
|
-
* coordDim: string mandatory,
|
|
65
|
-
* coordDimIndex: number mandatory,
|
|
66
|
-
* type: string optional,
|
|
67
|
-
* otherDims: { never null/undefined
|
|
68
|
-
* tooltip: number optional,
|
|
69
|
-
* label: number optional,
|
|
70
|
-
* itemName: number optional,
|
|
71
|
-
* seriesName: number optional,
|
|
72
|
-
* },
|
|
73
|
-
* isExtraCoord: boolean true if coord is generated
|
|
74
|
-
* (not specified in encode and not series specified)
|
|
75
|
-
* other props ...
|
|
76
|
-
* }]
|
|
69
|
+
* @return {Array.<module:data/DataDimensionInfo>}
|
|
77
70
|
*/
|
|
78
71
|
function completeDimensions(sysDims, source, opt) {
|
|
79
72
|
if (!Source.isInstance(source)) {
|
|
@@ -83,7 +76,6 @@ function completeDimensions(sysDims, source, opt) {
|
|
|
83
76
|
opt = opt || {};
|
|
84
77
|
sysDims = (sysDims || []).slice();
|
|
85
78
|
var dimsDef = (opt.dimsDef || []).slice();
|
|
86
|
-
var encodeDef = createHashMap(opt.encodeDef);
|
|
87
79
|
var dataDimNameMap = createHashMap();
|
|
88
80
|
var coordDimNameMap = createHashMap();
|
|
89
81
|
// var valueCandidate;
|
|
@@ -97,7 +89,7 @@ function completeDimensions(sysDims, source, opt) {
|
|
|
97
89
|
{}, isObject(dimsDef[i]) ? dimsDef[i] : {name: dimsDef[i]}
|
|
98
90
|
);
|
|
99
91
|
var userDimName = dimDefItem.name;
|
|
100
|
-
var resultItem = result[i] =
|
|
92
|
+
var resultItem = result[i] = new DataDimensionInfo();
|
|
101
93
|
// Name will be applied later for avoiding duplication.
|
|
102
94
|
if (userDimName != null && dataDimNameMap.get(userDimName) == null) {
|
|
103
95
|
// Only if `series.dimensions` is defined in option
|
|
@@ -110,6 +102,12 @@ function completeDimensions(sysDims, source, opt) {
|
|
|
110
102
|
dimDefItem.displayName != null && (resultItem.displayName = dimDefItem.displayName);
|
|
111
103
|
}
|
|
112
104
|
|
|
105
|
+
var encodeDef = opt.encodeDef;
|
|
106
|
+
if (!encodeDef && opt.encodeDefaulter) {
|
|
107
|
+
encodeDef = opt.encodeDefaulter(source, dimCount);
|
|
108
|
+
}
|
|
109
|
+
encodeDef = createHashMap(encodeDef);
|
|
110
|
+
|
|
113
111
|
// Set `coordDim` and `coordDimIndex` by `encodeDef` and normalize `encodeDef`.
|
|
114
112
|
encodeDef.each(function (dataDims, coordDim) {
|
|
115
113
|
dataDims = normalizeToArray(dataDims).slice();
|
|
@@ -211,7 +209,7 @@ function completeDimensions(sysDims, source, opt) {
|
|
|
211
209
|
|
|
212
210
|
// Set dim `name` and other `coordDim` and other props.
|
|
213
211
|
for (var resultDimIdx = 0; resultDimIdx < dimCount; resultDimIdx++) {
|
|
214
|
-
var resultItem = result[resultDimIdx] = result[resultDimIdx] ||
|
|
212
|
+
var resultItem = result[resultDimIdx] = result[resultDimIdx] || new DataDimensionInfo();
|
|
215
213
|
var coordDim = resultItem.coordDim;
|
|
216
214
|
|
|
217
215
|
if (coordDim == null) {
|
|
@@ -230,7 +228,28 @@ function completeDimensions(sysDims, source, opt) {
|
|
|
230
228
|
dataDimNameMap
|
|
231
229
|
));
|
|
232
230
|
|
|
233
|
-
if (resultItem.type == null
|
|
231
|
+
if (resultItem.type == null
|
|
232
|
+
&& (
|
|
233
|
+
guessOrdinal(source, resultDimIdx, resultItem.name) === BE_ORDINAL.Must
|
|
234
|
+
// Consider the case:
|
|
235
|
+
// {
|
|
236
|
+
// dataset: {source: [
|
|
237
|
+
// ['2001', 123],
|
|
238
|
+
// ['2002', 456],
|
|
239
|
+
// ...
|
|
240
|
+
// ['The others', 987],
|
|
241
|
+
// ]},
|
|
242
|
+
// series: {type: 'pie'}
|
|
243
|
+
// }
|
|
244
|
+
// The first colum should better be treated as a "ordinal" although it
|
|
245
|
+
// might not able to be detected as an "ordinal" by `guessOrdinal`.
|
|
246
|
+
|| (resultItem.isExtraCoord
|
|
247
|
+
&& (resultItem.otherDims.itemName != null
|
|
248
|
+
|| resultItem.otherDims.seriesName != null
|
|
249
|
+
)
|
|
250
|
+
)
|
|
251
|
+
)
|
|
252
|
+
) {
|
|
234
253
|
resultItem.type = 'ordinal';
|
|
235
254
|
}
|
|
236
255
|
}
|
|
@@ -32,6 +32,7 @@ import completeDimensions from './completeDimensions';
|
|
|
32
32
|
* @param {string} [opt.generateCoordCount]
|
|
33
33
|
* @param {Array.<string|Object>} [opt.dimensionsDefine=source.dimensionsDefine] Overwrite source define.
|
|
34
34
|
* @param {Object|HashMap} [opt.encodeDefine=source.encodeDefine] Overwrite source define.
|
|
35
|
+
* @param {Function} [opt.encodeDefaulter] Make default encode if user not specified.
|
|
35
36
|
* @return {Array.<Object>} dimensionsInfo
|
|
36
37
|
*/
|
|
37
38
|
export default function (source, opt) {
|
|
@@ -40,6 +41,7 @@ export default function (source, opt) {
|
|
|
40
41
|
dimsDef: opt.dimensionsDefine || source.dimensionsDefine,
|
|
41
42
|
encodeDef: opt.encodeDefine || source.encodeDefine,
|
|
42
43
|
dimCount: opt.dimensionsCount,
|
|
44
|
+
encodeDefaulter: opt.encodeDefaulter,
|
|
43
45
|
generateCoord: opt.generateCoord,
|
|
44
46
|
generateCoordCount: opt.generateCoordCount
|
|
45
47
|
});
|