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
|
@@ -21,6 +21,7 @@ import SeriesModel from '../../model/Series';
|
|
|
21
21
|
import createListSimply from '../helper/createListSimply';
|
|
22
22
|
import * as zrUtil from 'zrender/src/core/util';
|
|
23
23
|
import {encodeHTML} from '../../util/format';
|
|
24
|
+
import LegendVisualProvider from '../../visual/LegendVisualProvider';
|
|
24
25
|
|
|
25
26
|
var RadarSeries = SeriesModel.extend({
|
|
26
27
|
|
|
@@ -35,9 +36,10 @@ var RadarSeries = SeriesModel.extend({
|
|
|
35
36
|
|
|
36
37
|
// Enable legend selection for each data item
|
|
37
38
|
// Use a function instead of direct access because data reference may changed
|
|
38
|
-
this.
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
this.legendVisualProvider = new LegendVisualProvider(
|
|
40
|
+
zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this)
|
|
41
|
+
);
|
|
42
|
+
|
|
41
43
|
},
|
|
42
44
|
|
|
43
45
|
getInitialData: function (option, ecModel) {
|
|
@@ -47,16 +49,39 @@ var RadarSeries = SeriesModel.extend({
|
|
|
47
49
|
});
|
|
48
50
|
},
|
|
49
51
|
|
|
50
|
-
formatTooltip: function (dataIndex) {
|
|
52
|
+
formatTooltip: function (dataIndex, multipleSeries, dataType, renderMode) {
|
|
51
53
|
var data = this.getData();
|
|
52
54
|
var coordSys = this.coordinateSystem;
|
|
53
55
|
var indicatorAxes = coordSys.getIndicatorAxes();
|
|
54
56
|
var name = this.getData().getName(dataIndex);
|
|
55
|
-
|
|
57
|
+
var newLine = renderMode === 'html' ? '<br/>' : '\n';
|
|
58
|
+
return encodeHTML(name === '' ? this.name : name) + newLine
|
|
56
59
|
+ zrUtil.map(indicatorAxes, function (axis, idx) {
|
|
57
60
|
var val = data.get(data.mapDimension(axis.dim), dataIndex);
|
|
58
61
|
return encodeHTML(axis.name + ' : ' + val);
|
|
59
|
-
}).join(
|
|
62
|
+
}).join(newLine);
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* @implement
|
|
67
|
+
*/
|
|
68
|
+
getTooltipPosition: function (dataIndex) {
|
|
69
|
+
if (dataIndex != null) {
|
|
70
|
+
var data = this.getData();
|
|
71
|
+
var coordSys = this.coordinateSystem;
|
|
72
|
+
var values = data.getValues(
|
|
73
|
+
zrUtil.map(coordSys.dimensions, function (dim) {
|
|
74
|
+
return data.mapDimension(dim);
|
|
75
|
+
}), dataIndex, true
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
for (var i = 0, len = values.length; i < len; i++) {
|
|
79
|
+
if (!isNaN(values[i])) {
|
|
80
|
+
var indicatorAxes = coordSys.getIndicatorAxes();
|
|
81
|
+
return coordSys.coordToPoint(indicatorAxes[i].dataToCoord(values[i]), i);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
60
85
|
},
|
|
61
86
|
|
|
62
87
|
defaultOption: {
|
|
@@ -52,12 +52,14 @@ export default echarts.extendChartView({
|
|
|
52
52
|
var symbolPath = symbolUtil.createSymbol(
|
|
53
53
|
symbolType, -1, -1, 2, 2, color
|
|
54
54
|
);
|
|
55
|
+
var symbolRotate = data.getItemVisual(idx, 'symbolRotate') || 0;
|
|
55
56
|
symbolPath.attr({
|
|
56
57
|
style: {
|
|
57
58
|
strokeNoScale: true
|
|
58
59
|
},
|
|
59
60
|
z2: 100,
|
|
60
|
-
scale: [symbolSize[0] / 2, symbolSize[1] / 2]
|
|
61
|
+
scale: [symbolSize[0] / 2, symbolSize[1] / 2],
|
|
62
|
+
rotation: symbolRotate * Math.PI / 180 || 0
|
|
61
63
|
});
|
|
62
64
|
return symbolPath;
|
|
63
65
|
}
|
|
@@ -226,4 +228,4 @@ export default echarts.extendChartView({
|
|
|
226
228
|
},
|
|
227
229
|
|
|
228
230
|
dispose: function () {}
|
|
229
|
-
});
|
|
231
|
+
});
|
|
@@ -138,6 +138,17 @@ var SankeySeries = SeriesModel.extend({
|
|
|
138
138
|
}
|
|
139
139
|
},
|
|
140
140
|
|
|
141
|
+
// Override Series.getDataParams()
|
|
142
|
+
getDataParams: function (dataIndex, dataType) {
|
|
143
|
+
var params = SankeySeries.superCall(this, 'getDataParams', dataIndex, dataType);
|
|
144
|
+
if (params.value == null && dataType === 'node') {
|
|
145
|
+
var node = this.getGraph().getNodeByIndex(dataIndex);
|
|
146
|
+
var nodeValue = node.getLayout().value;
|
|
147
|
+
params.value = nodeValue;
|
|
148
|
+
}
|
|
149
|
+
return params;
|
|
150
|
+
},
|
|
151
|
+
|
|
141
152
|
defaultOption: {
|
|
142
153
|
zlevel: 0,
|
|
143
154
|
z: 2,
|
|
@@ -198,7 +209,7 @@ var SankeySeries = SeriesModel.extend({
|
|
|
198
209
|
show: true
|
|
199
210
|
},
|
|
200
211
|
lineStyle: {
|
|
201
|
-
opacity: 0.
|
|
212
|
+
opacity: 0.5
|
|
202
213
|
}
|
|
203
214
|
},
|
|
204
215
|
|
|
@@ -22,7 +22,9 @@ import * as echarts from '../../echarts';
|
|
|
22
22
|
import * as zrUtil from 'zrender/src/core/util';
|
|
23
23
|
|
|
24
24
|
var nodeOpacityPath = ['itemStyle', 'opacity'];
|
|
25
|
+
var hoverNodeOpacityPath = ['emphasis', 'itemStyle', 'opacity'];
|
|
25
26
|
var lineOpacityPath = ['lineStyle', 'opacity'];
|
|
27
|
+
var hoverLineOpacityPath = ['emphasis', 'lineStyle', 'opacity'];
|
|
26
28
|
|
|
27
29
|
function getItemOpacity(item, opacityPath) {
|
|
28
30
|
return item.getVisual('opacity') || item.getModel().get(opacityPath);
|
|
@@ -30,8 +32,8 @@ function getItemOpacity(item, opacityPath) {
|
|
|
30
32
|
|
|
31
33
|
function fadeOutItem(item, opacityPath, opacityRatio) {
|
|
32
34
|
var el = item.getGraphicEl();
|
|
33
|
-
|
|
34
35
|
var opacity = getItemOpacity(item, opacityPath);
|
|
36
|
+
|
|
35
37
|
if (opacityRatio != null) {
|
|
36
38
|
opacity == null && (opacity = 1);
|
|
37
39
|
opacity *= opacityRatio;
|
|
@@ -49,12 +51,14 @@ function fadeInItem(item, opacityPath) {
|
|
|
49
51
|
var opacity = getItemOpacity(item, opacityPath);
|
|
50
52
|
var el = item.getGraphicEl();
|
|
51
53
|
|
|
52
|
-
el.highlight && el.highlight();
|
|
53
54
|
el.traverse(function (child) {
|
|
54
55
|
if (child.type !== 'group') {
|
|
55
56
|
child.setStyle('opacity', opacity);
|
|
56
57
|
}
|
|
57
58
|
});
|
|
59
|
+
|
|
60
|
+
// Support emphasis here.
|
|
61
|
+
el.highlight && el.highlight();
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
var SankeyShape = graphic.extendShape({
|
|
@@ -92,6 +96,14 @@ var SankeyShape = graphic.extendShape({
|
|
|
92
96
|
);
|
|
93
97
|
}
|
|
94
98
|
ctx.closePath();
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
highlight: function () {
|
|
102
|
+
this.trigger('emphasis');
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
downplay: function () {
|
|
106
|
+
this.trigger('normal');
|
|
95
107
|
}
|
|
96
108
|
});
|
|
97
109
|
|
|
@@ -274,9 +286,21 @@ export default echarts.extendChartView({
|
|
|
274
286
|
el.cursor = 'move';
|
|
275
287
|
}
|
|
276
288
|
|
|
289
|
+
el.highlight = function () {
|
|
290
|
+
this.trigger('emphasis');
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
el.downplay = function () {
|
|
294
|
+
this.trigger('normal');
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
el.focusNodeAdjHandler && el.off('mouseover', el.focusNodeAdjHandler);
|
|
298
|
+
el.unfocusNodeAdjHandler && el.off('mouseout', el.unfocusNodeAdjHandler);
|
|
299
|
+
|
|
277
300
|
if (itemModel.get('focusNodeAdjacency')) {
|
|
278
|
-
el.
|
|
301
|
+
el.on('mouseover', el.focusNodeAdjHandler = function () {
|
|
279
302
|
if (!sankeyView._focusAdjacencyDisabled) {
|
|
303
|
+
sankeyView._clearTimer();
|
|
280
304
|
api.dispatchAction({
|
|
281
305
|
type: 'focusNodeAdjacency',
|
|
282
306
|
seriesId: seriesModel.id,
|
|
@@ -284,12 +308,10 @@ export default echarts.extendChartView({
|
|
|
284
308
|
});
|
|
285
309
|
}
|
|
286
310
|
});
|
|
287
|
-
|
|
311
|
+
|
|
312
|
+
el.on('mouseout', el.unfocusNodeAdjHandler = function () {
|
|
288
313
|
if (!sankeyView._focusAdjacencyDisabled) {
|
|
289
|
-
|
|
290
|
-
type: 'unfocusNodeAdjacency',
|
|
291
|
-
seriesId: seriesModel.id
|
|
292
|
-
});
|
|
314
|
+
sankeyView._dispatchUnfocus(api);
|
|
293
315
|
}
|
|
294
316
|
});
|
|
295
317
|
}
|
|
@@ -297,9 +319,14 @@ export default echarts.extendChartView({
|
|
|
297
319
|
|
|
298
320
|
edgeData.eachItemGraphicEl(function (el, dataIndex) {
|
|
299
321
|
var edgeModel = edgeData.getItemModel(dataIndex);
|
|
322
|
+
|
|
323
|
+
el.focusNodeAdjHandler && el.off('mouseover', el.focusNodeAdjHandler);
|
|
324
|
+
el.unfocusNodeAdjHandler && el.off('mouseout', el.unfocusNodeAdjHandler);
|
|
325
|
+
|
|
300
326
|
if (edgeModel.get('focusNodeAdjacency')) {
|
|
301
|
-
el.
|
|
327
|
+
el.on('mouseover', el.focusNodeAdjHandler = function () {
|
|
302
328
|
if (!sankeyView._focusAdjacencyDisabled) {
|
|
329
|
+
sankeyView._clearTimer();
|
|
303
330
|
api.dispatchAction({
|
|
304
331
|
type: 'focusNodeAdjacency',
|
|
305
332
|
seriesId: seriesModel.id,
|
|
@@ -307,12 +334,10 @@ export default echarts.extendChartView({
|
|
|
307
334
|
});
|
|
308
335
|
}
|
|
309
336
|
});
|
|
310
|
-
|
|
337
|
+
|
|
338
|
+
el.on('mouseout', el.unfocusNodeAdjHandler = function () {
|
|
311
339
|
if (!sankeyView._focusAdjacencyDisabled) {
|
|
312
|
-
|
|
313
|
-
type: 'unfocusNodeAdjacency',
|
|
314
|
-
seriesId: seriesModel.id
|
|
315
|
-
});
|
|
340
|
+
sankeyView._dispatchUnfocus(api);
|
|
316
341
|
}
|
|
317
342
|
});
|
|
318
343
|
}
|
|
@@ -327,10 +352,31 @@ export default echarts.extendChartView({
|
|
|
327
352
|
this._data = seriesModel.getData();
|
|
328
353
|
},
|
|
329
354
|
|
|
330
|
-
dispose: function () {
|
|
355
|
+
dispose: function () {
|
|
356
|
+
this._clearTimer();
|
|
357
|
+
},
|
|
358
|
+
|
|
359
|
+
_dispatchUnfocus: function (api) {
|
|
360
|
+
var self = this;
|
|
361
|
+
this._clearTimer();
|
|
362
|
+
this._unfocusDelayTimer = setTimeout(function () {
|
|
363
|
+
self._unfocusDelayTimer = null;
|
|
364
|
+
api.dispatchAction({
|
|
365
|
+
type: 'unfocusNodeAdjacency',
|
|
366
|
+
seriesId: self._model.id
|
|
367
|
+
});
|
|
368
|
+
}, 500);
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
_clearTimer: function () {
|
|
372
|
+
if (this._unfocusDelayTimer) {
|
|
373
|
+
clearTimeout(this._unfocusDelayTimer);
|
|
374
|
+
this._unfocusDelayTimer = null;
|
|
375
|
+
}
|
|
376
|
+
},
|
|
331
377
|
|
|
332
378
|
focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
333
|
-
var data =
|
|
379
|
+
var data = seriesModel.getData();
|
|
334
380
|
var graph = data.graph;
|
|
335
381
|
var dataIndex = payload.dataIndex;
|
|
336
382
|
var itemModel = data.getItemModel(dataIndex);
|
|
@@ -350,15 +396,15 @@ export default echarts.extendChartView({
|
|
|
350
396
|
});
|
|
351
397
|
|
|
352
398
|
if (node) {
|
|
353
|
-
fadeInItem(node,
|
|
399
|
+
fadeInItem(node, hoverNodeOpacityPath);
|
|
354
400
|
var focusNodeAdj = itemModel.get('focusNodeAdjacency');
|
|
355
401
|
if (focusNodeAdj === 'outEdges') {
|
|
356
402
|
zrUtil.each(node.outEdges, function (edge) {
|
|
357
403
|
if (edge.dataIndex < 0) {
|
|
358
404
|
return;
|
|
359
405
|
}
|
|
360
|
-
fadeInItem(edge,
|
|
361
|
-
fadeInItem(edge.node2,
|
|
406
|
+
fadeInItem(edge, hoverLineOpacityPath);
|
|
407
|
+
fadeInItem(edge.node2, hoverNodeOpacityPath);
|
|
362
408
|
});
|
|
363
409
|
}
|
|
364
410
|
else if (focusNodeAdj === 'inEdges') {
|
|
@@ -366,8 +412,8 @@ export default echarts.extendChartView({
|
|
|
366
412
|
if (edge.dataIndex < 0) {
|
|
367
413
|
return;
|
|
368
414
|
}
|
|
369
|
-
fadeInItem(edge,
|
|
370
|
-
fadeInItem(edge.node1,
|
|
415
|
+
fadeInItem(edge, hoverLineOpacityPath);
|
|
416
|
+
fadeInItem(edge.node1, hoverNodeOpacityPath);
|
|
371
417
|
});
|
|
372
418
|
}
|
|
373
419
|
else if (focusNodeAdj === 'allEdges') {
|
|
@@ -375,21 +421,21 @@ export default echarts.extendChartView({
|
|
|
375
421
|
if (edge.dataIndex < 0) {
|
|
376
422
|
return;
|
|
377
423
|
}
|
|
378
|
-
fadeInItem(edge,
|
|
379
|
-
fadeInItem(edge.node1,
|
|
380
|
-
fadeInItem(edge.node2,
|
|
424
|
+
fadeInItem(edge, hoverLineOpacityPath);
|
|
425
|
+
(edge.node1 !== node) && fadeInItem(edge.node1, hoverNodeOpacityPath);
|
|
426
|
+
(edge.node2 !== node) && fadeInItem(edge.node2, hoverNodeOpacityPath);
|
|
381
427
|
});
|
|
382
428
|
}
|
|
383
429
|
}
|
|
384
430
|
if (edge) {
|
|
385
|
-
fadeInItem(edge,
|
|
386
|
-
fadeInItem(edge.node1,
|
|
387
|
-
fadeInItem(edge.node2,
|
|
431
|
+
fadeInItem(edge, hoverLineOpacityPath);
|
|
432
|
+
fadeInItem(edge.node1, hoverNodeOpacityPath);
|
|
433
|
+
fadeInItem(edge.node2, hoverNodeOpacityPath);
|
|
388
434
|
}
|
|
389
435
|
},
|
|
390
436
|
|
|
391
437
|
unfocusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
392
|
-
var graph =
|
|
438
|
+
var graph = seriesModel.getGraph();
|
|
393
439
|
|
|
394
440
|
graph.eachNode(function (node) {
|
|
395
441
|
fadeOutItem(node, nodeOpacityPath);
|
|
@@ -412,8 +458,7 @@ function createGridClipShape(rect, seriesModel, cb) {
|
|
|
412
458
|
});
|
|
413
459
|
graphic.initProps(rectEl, {
|
|
414
460
|
shape: {
|
|
415
|
-
width: rect.width + 20
|
|
416
|
-
height: rect.height + 20
|
|
461
|
+
width: rect.width + 20
|
|
417
462
|
}
|
|
418
463
|
}, seriesModel, cb);
|
|
419
464
|
|
|
@@ -87,7 +87,8 @@ function computeNodeValues(nodes) {
|
|
|
87
87
|
zrUtil.each(nodes, function (node) {
|
|
88
88
|
var value1 = sum(node.outEdges, getEdgeValue);
|
|
89
89
|
var value2 = sum(node.inEdges, getEdgeValue);
|
|
90
|
-
var
|
|
90
|
+
var nodeRawValue = node.getValue() || 0;
|
|
91
|
+
var value = Math.max(value1, value2, nodeRawValue);
|
|
91
92
|
node.setLayout({value: value}, true);
|
|
92
93
|
});
|
|
93
94
|
}
|
|
@@ -399,7 +400,13 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
|
|
|
399
400
|
zrUtil.each(nodes, function (node) {
|
|
400
401
|
if (node.outEdges.length) {
|
|
401
402
|
var y = sum(node.outEdges, weightedTarget, orient)
|
|
402
|
-
|
|
403
|
+
/ sum(node.outEdges, getEdgeValue, orient);
|
|
404
|
+
|
|
405
|
+
if (isNaN(y)) {
|
|
406
|
+
var len = node.outEdges.length;
|
|
407
|
+
y = len ? sum(node.outEdges, centerTarget, orient) / len : 0;
|
|
408
|
+
}
|
|
409
|
+
|
|
403
410
|
if (orient === 'vertical') {
|
|
404
411
|
var nodeX = node.getLayout().x + (y - center(node, orient)) * alpha;
|
|
405
412
|
node.setLayout({x: nodeX}, true);
|
|
@@ -416,10 +423,16 @@ function relaxRightToLeft(nodesByBreadth, alpha, orient) {
|
|
|
416
423
|
function weightedTarget(edge, orient) {
|
|
417
424
|
return center(edge.node2, orient) * edge.getValue();
|
|
418
425
|
}
|
|
426
|
+
function centerTarget(edge, orient) {
|
|
427
|
+
return center(edge.node2, orient);
|
|
428
|
+
}
|
|
419
429
|
|
|
420
430
|
function weightedSource(edge, orient) {
|
|
421
431
|
return center(edge.node1, orient) * edge.getValue();
|
|
422
432
|
}
|
|
433
|
+
function centerSource(edge, orient) {
|
|
434
|
+
return center(edge.node1, orient);
|
|
435
|
+
}
|
|
423
436
|
|
|
424
437
|
function center(node, orient) {
|
|
425
438
|
return orient === 'vertical'
|
|
@@ -431,12 +444,12 @@ function getEdgeValue(edge) {
|
|
|
431
444
|
return edge.getValue();
|
|
432
445
|
}
|
|
433
446
|
|
|
434
|
-
function sum(array,
|
|
447
|
+
function sum(array, cb, orient) {
|
|
435
448
|
var sum = 0;
|
|
436
449
|
var len = array.length;
|
|
437
450
|
var i = -1;
|
|
438
451
|
while (++i < len) {
|
|
439
|
-
var value = +
|
|
452
|
+
var value = +cb.call(array, array[i], orient);
|
|
440
453
|
if (!isNaN(value)) {
|
|
441
454
|
sum += value;
|
|
442
455
|
}
|
|
@@ -455,8 +468,15 @@ function relaxLeftToRight(nodesByBreadth, alpha, orient) {
|
|
|
455
468
|
zrUtil.each(nodesByBreadth, function (nodes) {
|
|
456
469
|
zrUtil.each(nodes, function (node) {
|
|
457
470
|
if (node.inEdges.length) {
|
|
471
|
+
|
|
458
472
|
var y = sum(node.inEdges, weightedSource, orient)
|
|
459
|
-
|
|
473
|
+
/ sum(node.inEdges, getEdgeValue, orient);
|
|
474
|
+
|
|
475
|
+
if (isNaN(y)) {
|
|
476
|
+
var len = node.inEdges.length;
|
|
477
|
+
y = len ? sum(node.inEdges, centerSource, orient) / len : 0;
|
|
478
|
+
}
|
|
479
|
+
|
|
460
480
|
if (orient === 'vertical') {
|
|
461
481
|
var nodeX = node.getLayout().x + (y - center(node, orient)) * alpha;
|
|
462
482
|
node.setLayout({x: nodeX}, true);
|
|
@@ -27,7 +27,7 @@ export default SeriesModel.extend({
|
|
|
27
27
|
dependencies: ['grid', 'polar', 'geo', 'singleAxis', 'calendar'],
|
|
28
28
|
|
|
29
29
|
getInitialData: function (option, ecModel) {
|
|
30
|
-
return createListFromArray(this.getSource(), this);
|
|
30
|
+
return createListFromArray(this.getSource(), this, {useEncodeDefaulter: true});
|
|
31
31
|
},
|
|
32
32
|
|
|
33
33
|
brushSelector: 'point',
|
|
@@ -158,6 +158,8 @@ SunburstPieceProto.updateData = function (
|
|
|
158
158
|
|
|
159
159
|
this._seriesModel = seriesModel || this._seriesModel;
|
|
160
160
|
this._ecModel = ecModel || this._ecModel;
|
|
161
|
+
|
|
162
|
+
graphic.setHoverStyle(this);
|
|
161
163
|
};
|
|
162
164
|
|
|
163
165
|
SunburstPieceProto.onEmphasis = function (highlightPolicy) {
|
|
@@ -201,9 +203,13 @@ SunburstPieceProto._updateLabel = function (seriesModel, visualColor, state) {
|
|
|
201
203
|
: itemModel.getModel(state + '.label');
|
|
202
204
|
var labelHoverModel = itemModel.getModel('emphasis.label');
|
|
203
205
|
|
|
206
|
+
var labelFormatter = labelModel.get('formatter');
|
|
207
|
+
// Use normal formatter if no state formatter is defined
|
|
208
|
+
var labelState = labelFormatter ? state : 'normal';
|
|
209
|
+
|
|
204
210
|
var text = zrUtil.retrieve(
|
|
205
211
|
seriesModel.getFormattedLabel(
|
|
206
|
-
this.node.dataIndex,
|
|
212
|
+
this.node.dataIndex, labelState, null, null, 'label'
|
|
207
213
|
),
|
|
208
214
|
this.node.name
|
|
209
215
|
);
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import * as zrUtil from 'zrender/src/core/util';
|
|
21
21
|
import SeriesModel from '../../model/Series';
|
|
22
22
|
import Tree from '../../data/Tree';
|
|
23
|
+
import Model from '../../model/Model';
|
|
23
24
|
import {wrapTreePathInfo} from '../helper/treeHelper';
|
|
24
25
|
|
|
25
26
|
export default SeriesModel.extend({
|
|
@@ -37,18 +38,25 @@ export default SeriesModel.extend({
|
|
|
37
38
|
|
|
38
39
|
completeTreeValue(root);
|
|
39
40
|
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
var treeOption = {};
|
|
45
|
-
|
|
46
|
-
treeOption.levels = levels;
|
|
41
|
+
var levelModels = zrUtil.map(option.levels || [], function (levelDefine) {
|
|
42
|
+
return new Model(levelDefine, this, ecModel);
|
|
43
|
+
}, this);
|
|
47
44
|
|
|
48
45
|
// Make sure always a new tree is created when setOption,
|
|
49
46
|
// in TreemapView, we check whether oldTree === newTree
|
|
50
47
|
// to choose mappings approach among old shapes and new shapes.
|
|
51
|
-
|
|
48
|
+
var tree = Tree.createTree(root, this, beforeLink);
|
|
49
|
+
|
|
50
|
+
function beforeLink(nodeData) {
|
|
51
|
+
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
52
|
+
var node = tree.getNodeByDataIndex(idx);
|
|
53
|
+
var levelModel = levelModels[node.depth];
|
|
54
|
+
levelModel && (model.parentModel = levelModel);
|
|
55
|
+
return model;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return tree.data;
|
|
52
60
|
},
|
|
53
61
|
|
|
54
62
|
optionUpdated: function () {
|
|
@@ -105,8 +113,7 @@ export default SeriesModel.extend({
|
|
|
105
113
|
align: 'center',
|
|
106
114
|
position: 'inside',
|
|
107
115
|
distance: 5,
|
|
108
|
-
silent: true
|
|
109
|
-
emphasis: {}
|
|
116
|
+
silent: true
|
|
110
117
|
},
|
|
111
118
|
itemStyle: {
|
|
112
119
|
borderWidth: 1,
|
|
@@ -116,13 +123,19 @@ export default SeriesModel.extend({
|
|
|
116
123
|
shadowColor: 'rgba(0, 0, 0, 0.2)',
|
|
117
124
|
shadowOffsetX: 0,
|
|
118
125
|
shadowOffsetY: 0,
|
|
119
|
-
opacity: 1
|
|
120
|
-
|
|
121
|
-
|
|
126
|
+
opacity: 1
|
|
127
|
+
},
|
|
128
|
+
highlight: {
|
|
129
|
+
itemStyle: {
|
|
122
130
|
opacity: 1
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
downplay: {
|
|
134
|
+
itemStyle: {
|
|
135
|
+
opacity: 0.5
|
|
123
136
|
},
|
|
124
|
-
|
|
125
|
-
opacity: 0.
|
|
137
|
+
label: {
|
|
138
|
+
opacity: 0.6
|
|
126
139
|
}
|
|
127
140
|
},
|
|
128
141
|
|
|
@@ -21,6 +21,7 @@ import * as zrUtil from 'zrender/src/core/util';
|
|
|
21
21
|
import ChartView from '../../view/Chart';
|
|
22
22
|
import SunburstPiece from './SunburstPiece';
|
|
23
23
|
import DataDiffer from '../../data/DataDiffer';
|
|
24
|
+
import {windowOpen} from '../../util/format';
|
|
24
25
|
|
|
25
26
|
var ROOT_TO_NODE_ACTION = 'sunburstRootToNode';
|
|
26
27
|
|
|
@@ -206,7 +207,7 @@ var SunburstView = ChartView.extend({
|
|
|
206
207
|
if (link) {
|
|
207
208
|
var linkTarget = itemModel.get('target', true)
|
|
208
209
|
|| '_blank';
|
|
209
|
-
|
|
210
|
+
windowOpen(link, linkTarget);
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
targetFound = true;
|
|
@@ -24,6 +24,7 @@ import List from '../../data/List';
|
|
|
24
24
|
import * as zrUtil from 'zrender/src/core/util';
|
|
25
25
|
import {groupData} from '../../util/model';
|
|
26
26
|
import {encodeHTML} from '../../util/format';
|
|
27
|
+
import LegendVisualProvider from '../../visual/LegendVisualProvider';
|
|
27
28
|
|
|
28
29
|
var DATA_NAME_INDEX = 2;
|
|
29
30
|
|
|
@@ -49,9 +50,9 @@ var ThemeRiverSeries = SeriesModel.extend({
|
|
|
49
50
|
// Put this function here is for the sake of consistency of code style.
|
|
50
51
|
// Enable legend selection for each data item
|
|
51
52
|
// Use a function instead of direct access because data reference may changed
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
this.legendVisualProvider = new LegendVisualProvider(
|
|
54
|
+
zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this)
|
|
55
|
+
);
|
|
55
56
|
},
|
|
56
57
|
|
|
57
58
|
/**
|
|
@@ -62,52 +63,46 @@ var ThemeRiverSeries = SeriesModel.extend({
|
|
|
62
63
|
*/
|
|
63
64
|
fixData: function (data) {
|
|
64
65
|
var rawDataLength = data.length;
|
|
66
|
+
/**
|
|
67
|
+
* Make sure every layer data get the same keys.
|
|
68
|
+
* The value index tells which layer has visited.
|
|
69
|
+
* {
|
|
70
|
+
* 2014/01/01: -1
|
|
71
|
+
* }
|
|
72
|
+
*/
|
|
73
|
+
var timeValueKeys = {};
|
|
65
74
|
|
|
66
75
|
// grouped data by name
|
|
67
76
|
var groupResult = groupData(data, function (item) {
|
|
77
|
+
if (!timeValueKeys.hasOwnProperty(item[0])) {
|
|
78
|
+
timeValueKeys[item[0]] = -1;
|
|
79
|
+
}
|
|
68
80
|
return item[2];
|
|
69
81
|
});
|
|
70
82
|
var layData = [];
|
|
71
83
|
groupResult.buckets.each(function (items, key) {
|
|
72
84
|
layData.push({name: key, dataList: items});
|
|
73
85
|
});
|
|
74
|
-
|
|
75
86
|
var layerNum = layData.length;
|
|
76
|
-
var largestLayer = -1;
|
|
77
|
-
var index = -1;
|
|
78
|
-
for (var i = 0; i < layerNum; ++i) {
|
|
79
|
-
var len = layData[i].dataList.length;
|
|
80
|
-
if (len > largestLayer) {
|
|
81
|
-
largestLayer = len;
|
|
82
|
-
index = i;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
87
|
|
|
86
88
|
for (var k = 0; k < layerNum; ++k) {
|
|
87
|
-
if (k === index) {
|
|
88
|
-
continue;
|
|
89
|
-
}
|
|
90
89
|
var name = layData[k].name;
|
|
91
|
-
for (var j = 0; j <
|
|
92
|
-
var timeValue = layData[
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (keyIndex === -1) {
|
|
90
|
+
for (var j = 0; j < layData[k].dataList.length; ++j) {
|
|
91
|
+
var timeValue = layData[k].dataList[j][0];
|
|
92
|
+
timeValueKeys[timeValue] = k;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
for (var timeValue in timeValueKeys) {
|
|
96
|
+
if (timeValueKeys.hasOwnProperty(timeValue) && timeValueKeys[timeValue] !== k) {
|
|
97
|
+
timeValueKeys[timeValue] = k;
|
|
103
98
|
data[rawDataLength] = [];
|
|
104
99
|
data[rawDataLength][0] = timeValue;
|
|
105
100
|
data[rawDataLength][1] = 0;
|
|
106
101
|
data[rawDataLength][2] = name;
|
|
107
102
|
rawDataLength++;
|
|
108
|
-
|
|
109
103
|
}
|
|
110
104
|
}
|
|
105
|
+
|
|
111
106
|
}
|
|
112
107
|
return data;
|
|
113
108
|
},
|
|
@@ -292,4 +287,4 @@ var ThemeRiverSeries = SeriesModel.extend({
|
|
|
292
287
|
}
|
|
293
288
|
});
|
|
294
289
|
|
|
295
|
-
export default ThemeRiverSeries;
|
|
290
|
+
export default ThemeRiverSeries;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import SeriesModel from '../../model/Series';
|
|
21
21
|
import Tree from '../../data/Tree';
|
|
22
22
|
import {encodeHTML} from '../../util/format';
|
|
23
|
+
import Model from '../../model/Model';
|
|
23
24
|
|
|
24
25
|
export default SeriesModel.extend({
|
|
25
26
|
|
|
@@ -42,12 +43,19 @@ export default SeriesModel.extend({
|
|
|
42
43
|
var root = {name: option.name, children: option.data};
|
|
43
44
|
|
|
44
45
|
var leaves = option.leaves || {};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
var leavesModel = new Model(leaves, this, this.ecModel);
|
|
47
|
+
|
|
48
|
+
var tree = Tree.createTree(root, this, beforeLink);
|
|
49
|
+
|
|
50
|
+
function beforeLink(nodeData) {
|
|
51
|
+
nodeData.wrapMethod('getItemModel', function (model, idx) {
|
|
52
|
+
var node = tree.getNodeByDataIndex(idx);
|
|
53
|
+
if (!node.children.length || !node.isExpand) {
|
|
54
|
+
model.parentModel = leavesModel;
|
|
55
|
+
}
|
|
56
|
+
return model;
|
|
57
|
+
});
|
|
58
|
+
}
|
|
51
59
|
|
|
52
60
|
var treeDepth = 0;
|
|
53
61
|
|
|
@@ -128,6 +136,11 @@ export default SeriesModel.extend({
|
|
|
128
136
|
// the layout of the tree, two value can be selected, 'orthogonal' or 'radial'
|
|
129
137
|
layout: 'orthogonal',
|
|
130
138
|
|
|
139
|
+
// value can be 'polyline'
|
|
140
|
+
edgeShape: 'curve',
|
|
141
|
+
|
|
142
|
+
edgeForkPosition: '50%',
|
|
143
|
+
|
|
131
144
|
// true | false | 'move' | 'scale', see module:component/helper/RoamController.
|
|
132
145
|
roam: false,
|
|
133
146
|
|