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,114 @@
|
|
|
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
|
+
import * as graphic from '../../util/graphic';
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export function rectCoordAxisBuildSplitArea(axisView, axisGroup, axisModel, gridModel) {
|
|
25
|
+
var axis = axisModel.axis;
|
|
26
|
+
|
|
27
|
+
if (axis.scale.isBlank()) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var splitAreaModel = axisModel.getModel('splitArea');
|
|
32
|
+
var areaStyleModel = splitAreaModel.getModel('areaStyle');
|
|
33
|
+
var areaColors = areaStyleModel.get('color');
|
|
34
|
+
|
|
35
|
+
var gridRect = gridModel.coordinateSystem.getRect();
|
|
36
|
+
|
|
37
|
+
var ticksCoords = axis.getTicksCoords({
|
|
38
|
+
tickModel: splitAreaModel,
|
|
39
|
+
clamp: true
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!ticksCoords.length) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// For Making appropriate splitArea animation, the color and anid
|
|
47
|
+
// should be corresponding to previous one if possible.
|
|
48
|
+
var areaColorsLen = areaColors.length;
|
|
49
|
+
var lastSplitAreaColors = axisView.__splitAreaColors;
|
|
50
|
+
var newSplitAreaColors = zrUtil.createHashMap();
|
|
51
|
+
var colorIndex = 0;
|
|
52
|
+
if (lastSplitAreaColors) {
|
|
53
|
+
for (var i = 0; i < ticksCoords.length; i++) {
|
|
54
|
+
var cIndex = lastSplitAreaColors.get(ticksCoords[i].tickValue);
|
|
55
|
+
if (cIndex != null) {
|
|
56
|
+
colorIndex = (cIndex + (areaColorsLen - 1) * i) % areaColorsLen;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var prev = axis.toGlobalCoord(ticksCoords[0].coord);
|
|
63
|
+
|
|
64
|
+
var areaStyle = areaStyleModel.getAreaStyle();
|
|
65
|
+
areaColors = zrUtil.isArray(areaColors) ? areaColors : [areaColors];
|
|
66
|
+
|
|
67
|
+
for (var i = 1; i < ticksCoords.length; i++) {
|
|
68
|
+
var tickCoord = axis.toGlobalCoord(ticksCoords[i].coord);
|
|
69
|
+
|
|
70
|
+
var x;
|
|
71
|
+
var y;
|
|
72
|
+
var width;
|
|
73
|
+
var height;
|
|
74
|
+
if (axis.isHorizontal()) {
|
|
75
|
+
x = prev;
|
|
76
|
+
y = gridRect.y;
|
|
77
|
+
width = tickCoord - x;
|
|
78
|
+
height = gridRect.height;
|
|
79
|
+
prev = x + width;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
x = gridRect.x;
|
|
83
|
+
y = prev;
|
|
84
|
+
width = gridRect.width;
|
|
85
|
+
height = tickCoord - y;
|
|
86
|
+
prev = y + height;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
var tickValue = ticksCoords[i - 1].tickValue;
|
|
90
|
+
tickValue != null && newSplitAreaColors.set(tickValue, colorIndex);
|
|
91
|
+
|
|
92
|
+
axisGroup.add(new graphic.Rect({
|
|
93
|
+
anid: tickValue != null ? 'area_' + tickValue : null,
|
|
94
|
+
shape: {
|
|
95
|
+
x: x,
|
|
96
|
+
y: y,
|
|
97
|
+
width: width,
|
|
98
|
+
height: height
|
|
99
|
+
},
|
|
100
|
+
style: zrUtil.defaults({
|
|
101
|
+
fill: areaColors[colorIndex]
|
|
102
|
+
}, areaStyle),
|
|
103
|
+
silent: true
|
|
104
|
+
}));
|
|
105
|
+
|
|
106
|
+
colorIndex = (colorIndex + 1) % areaColorsLen;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
axisView.__splitAreaColors = newSplitAreaColors;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function rectCoordAxisHandleRemove(axisView) {
|
|
113
|
+
axisView.__splitAreaColors = null;
|
|
114
|
+
}
|
|
@@ -163,7 +163,7 @@ function processOnAxis(axisInfo, newValue, updaters, dontSnap, outputFinder) {
|
|
|
163
163
|
var snapToValue = payloadInfo.snapToValue;
|
|
164
164
|
|
|
165
165
|
// Fill content of event obj for echarts.connect.
|
|
166
|
-
// By
|
|
166
|
+
// By default use the first involved series data as a sample to connect.
|
|
167
167
|
if (payloadBatch[0] && outputFinder.seriesIndex == null) {
|
|
168
168
|
zrUtil.extend(outputFinder, payloadBatch[0]);
|
|
169
169
|
}
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import * as echarts from '../../echarts';
|
|
21
21
|
import * as zrUtil from 'zrender/src/core/util';
|
|
22
22
|
import BrushController from '../helper/BrushController';
|
|
23
|
+
import {layoutCovers} from './visualEncoding';
|
|
23
24
|
|
|
24
25
|
export default echarts.extendComponentView({
|
|
25
26
|
|
|
@@ -65,7 +66,13 @@ export default echarts.extendComponentView({
|
|
|
65
66
|
/**
|
|
66
67
|
* @override
|
|
67
68
|
*/
|
|
68
|
-
updateTransform:
|
|
69
|
+
updateTransform: function (brushModel, ecModel) {
|
|
70
|
+
// PENDING: `updateTransform` is a little tricky, whose layout need
|
|
71
|
+
// to be calculate mandatorily and other stages will not be performed.
|
|
72
|
+
// Take care the correctness of the logic. See #11754 .
|
|
73
|
+
layoutCovers(ecModel);
|
|
74
|
+
return updateController.apply(this, arguments);
|
|
75
|
+
},
|
|
69
76
|
|
|
70
77
|
/**
|
|
71
78
|
* @override
|
|
@@ -35,16 +35,19 @@ var PRIORITY_BRUSH = echarts.PRIORITY.VISUAL.BRUSH;
|
|
|
35
35
|
*/
|
|
36
36
|
echarts.registerLayout(PRIORITY_BRUSH, function (ecModel, api, payload) {
|
|
37
37
|
ecModel.eachComponent({mainType: 'brush'}, function (brushModel) {
|
|
38
|
-
|
|
39
38
|
payload && payload.type === 'takeGlobalCursor' && brushModel.setBrushOption(
|
|
40
39
|
payload.key === 'brush' ? payload.brushOption : {brushType: false}
|
|
41
40
|
);
|
|
41
|
+
});
|
|
42
|
+
layoutCovers(ecModel);
|
|
43
|
+
});
|
|
42
44
|
|
|
45
|
+
export function layoutCovers(ecModel) {
|
|
46
|
+
ecModel.eachComponent({mainType: 'brush'}, function (brushModel) {
|
|
43
47
|
var brushTargetManager = brushModel.brushTargetManager = new BrushTargetManager(brushModel.option, ecModel);
|
|
44
|
-
|
|
45
48
|
brushTargetManager.setInputRanges(brushModel.areas, ecModel);
|
|
46
49
|
});
|
|
47
|
-
}
|
|
50
|
+
}
|
|
48
51
|
|
|
49
52
|
/**
|
|
50
53
|
* Register the visual encoding if this modules required.
|
|
@@ -450,10 +450,6 @@ var SliderZoomView = DataZoomView.extend({
|
|
|
450
450
|
draggable: true,
|
|
451
451
|
cursor: getCursor(this._orient),
|
|
452
452
|
drift: bind(this._onDragMove, this, 'all'),
|
|
453
|
-
onmousemove: function (e) {
|
|
454
|
-
// Fot mobile devicem, prevent screen slider on the button.
|
|
455
|
-
eventTool.stop(e.event);
|
|
456
|
-
},
|
|
457
453
|
ondragstart: bind(this._showDataInfo, this, true),
|
|
458
454
|
ondragend: bind(this._onDragEnd, this),
|
|
459
455
|
onmouseover: bind(this._showDataInfo, this, true),
|
|
@@ -489,10 +485,6 @@ var SliderZoomView = DataZoomView.extend({
|
|
|
489
485
|
cursor: getCursor(this._orient),
|
|
490
486
|
draggable: true,
|
|
491
487
|
drift: bind(this._onDragMove, this, handleIndex),
|
|
492
|
-
onmousemove: function (e) {
|
|
493
|
-
// Fot mobile devicem, prevent screen slider on the button.
|
|
494
|
-
eventTool.stop(e.event);
|
|
495
|
-
},
|
|
496
488
|
ondragend: bind(this._onDragEnd, this),
|
|
497
489
|
onmouseover: bind(this._showDataInfo, this, true),
|
|
498
490
|
onmouseout: bind(this._showDataInfo, this, false)
|
|
@@ -714,9 +706,12 @@ var SliderZoomView = DataZoomView.extend({
|
|
|
714
706
|
handleLabels[1].attr('invisible', !showOrHide);
|
|
715
707
|
},
|
|
716
708
|
|
|
717
|
-
_onDragMove: function (handleIndex, dx, dy) {
|
|
709
|
+
_onDragMove: function (handleIndex, dx, dy, event) {
|
|
718
710
|
this._dragging = true;
|
|
719
711
|
|
|
712
|
+
// For mobile device, prevent screen slider on the button.
|
|
713
|
+
eventTool.stop(event.event);
|
|
714
|
+
|
|
720
715
|
// Transform dx, dy to bar coordination.
|
|
721
716
|
var barTransform = this._displayables.barGroup.getLocalTransform();
|
|
722
717
|
var vertex = graphic.applyTransform([dx, dy], barTransform, true);
|
|
@@ -136,12 +136,6 @@ function BrushController(zr) {
|
|
|
136
136
|
*/
|
|
137
137
|
this._dragging;
|
|
138
138
|
|
|
139
|
-
/**
|
|
140
|
-
* @private
|
|
141
|
-
* @type {Object}
|
|
142
|
-
*/
|
|
143
|
-
this._lastMouseMovePoint = {};
|
|
144
|
-
|
|
145
139
|
/**
|
|
146
140
|
* @private
|
|
147
141
|
* @type {Array}
|
|
@@ -186,7 +180,8 @@ function BrushController(zr) {
|
|
|
186
180
|
* @type {Object}
|
|
187
181
|
*/
|
|
188
182
|
this._handlers = {};
|
|
189
|
-
|
|
183
|
+
|
|
184
|
+
each(pointerHandlers, function (handler, eventName) {
|
|
190
185
|
this._handlers[eventName] = zrUtil.bind(handler, this);
|
|
191
186
|
}, this);
|
|
192
187
|
}
|
|
@@ -382,9 +377,7 @@ function doEnableBrush(controller, brushOption) {
|
|
|
382
377
|
interactionMutex.take(zr, MUTEX_RESOURCE_KEY, controller._uid);
|
|
383
378
|
}
|
|
384
379
|
|
|
385
|
-
|
|
386
|
-
zr.on(eventName, handler);
|
|
387
|
-
});
|
|
380
|
+
mountHandlers(zr, controller._handlers);
|
|
388
381
|
|
|
389
382
|
controller._brushType = brushOption.brushType;
|
|
390
383
|
controller._brushOption = zrUtil.merge(zrUtil.clone(DEFAULT_BRUSH_OPT), brushOption, true);
|
|
@@ -395,13 +388,23 @@ function doDisableBrush(controller) {
|
|
|
395
388
|
|
|
396
389
|
interactionMutex.release(zr, MUTEX_RESOURCE_KEY, controller._uid);
|
|
397
390
|
|
|
398
|
-
|
|
399
|
-
zr.off(eventName, handler);
|
|
400
|
-
});
|
|
391
|
+
unmountHandlers(zr, controller._handlers);
|
|
401
392
|
|
|
402
393
|
controller._brushType = controller._brushOption = null;
|
|
403
394
|
}
|
|
404
395
|
|
|
396
|
+
function mountHandlers(zr, handlers) {
|
|
397
|
+
each(handlers, function (handler, eventName) {
|
|
398
|
+
zr.on(eventName, handler);
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
function unmountHandlers(zr, handlers) {
|
|
403
|
+
each(handlers, function (handler, eventName) {
|
|
404
|
+
zr.off(eventName, handler);
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
|
|
405
408
|
function createCover(controller, brushOption) {
|
|
406
409
|
var cover = coverRenderers[brushOption.brushType].createCover(controller, brushOption);
|
|
407
410
|
cover.__brushOption = brushOption;
|
|
@@ -715,8 +718,14 @@ function pointsToRect(points) {
|
|
|
715
718
|
}
|
|
716
719
|
|
|
717
720
|
function resetCursor(controller, e, localCursorPoint) {
|
|
718
|
-
|
|
719
|
-
|
|
721
|
+
if (
|
|
722
|
+
// Check active
|
|
723
|
+
!controller._brushType
|
|
724
|
+
// resetCursor should be always called when mouse is in zr area,
|
|
725
|
+
// but not called when mouse is out of zr area to avoid bad influence
|
|
726
|
+
// if `mousemove`, `mouseup` are triggered from `document` event.
|
|
727
|
+
|| isOutsideZrArea(controller, e)
|
|
728
|
+
) {
|
|
720
729
|
return;
|
|
721
730
|
}
|
|
722
731
|
|
|
@@ -820,7 +829,7 @@ function determineBrushType(brushType, panel) {
|
|
|
820
829
|
return brushType;
|
|
821
830
|
}
|
|
822
831
|
|
|
823
|
-
var
|
|
832
|
+
var pointerHandlers = {
|
|
824
833
|
|
|
825
834
|
mousedown: function (e) {
|
|
826
835
|
if (this._dragging) {
|
|
@@ -845,56 +854,34 @@ var mouseHandlers = {
|
|
|
845
854
|
},
|
|
846
855
|
|
|
847
856
|
mousemove: function (e) {
|
|
848
|
-
var
|
|
849
|
-
|
|
850
|
-
lastPoint.y = e.offsetY;
|
|
857
|
+
var x = e.offsetX;
|
|
858
|
+
var y = e.offsetY;
|
|
851
859
|
|
|
852
|
-
var localCursorPoint = this.group.transformCoordToLocal(
|
|
860
|
+
var localCursorPoint = this.group.transformCoordToLocal(x, y);
|
|
853
861
|
|
|
854
862
|
resetCursor(this, e, localCursorPoint);
|
|
855
863
|
|
|
856
864
|
if (this._dragging) {
|
|
857
|
-
|
|
858
865
|
preventDefault(e);
|
|
859
|
-
|
|
860
866
|
var eventParams = updateCoverByMouse(this, e, localCursorPoint, false);
|
|
861
|
-
|
|
862
867
|
eventParams && trigger(this, eventParams);
|
|
863
868
|
}
|
|
864
869
|
},
|
|
865
870
|
|
|
866
871
|
mouseup: function (e) {
|
|
867
872
|
handleDragEnd(this, e);
|
|
868
|
-
},
|
|
869
|
-
|
|
870
|
-
globalout: function (e) {
|
|
871
|
-
handleDragEnd(this, e, true);
|
|
872
873
|
}
|
|
873
874
|
};
|
|
874
875
|
|
|
875
|
-
function handleDragEnd(controller, e, isGlobalOut) {
|
|
876
|
-
if (controller._dragging) {
|
|
877
876
|
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
877
|
+
function handleDragEnd(controller, e) {
|
|
878
|
+
if (controller._dragging) {
|
|
879
|
+
preventDefault(e);
|
|
881
880
|
|
|
882
|
-
var
|
|
883
|
-
var
|
|
884
|
-
var lastPoint = controller._lastMouseMovePoint;
|
|
885
|
-
if (isGlobalOut) {
|
|
886
|
-
pointerX = lastPoint.x;
|
|
887
|
-
pointerY = lastPoint.y;
|
|
888
|
-
}
|
|
881
|
+
var x = e.offsetX;
|
|
882
|
+
var y = e.offsetY;
|
|
889
883
|
|
|
890
|
-
var localCursorPoint = controller.group.transformCoordToLocal(
|
|
891
|
-
// FIXME
|
|
892
|
-
// Here `e` is used only in `onIrrelevantElement` finally. And it's OK
|
|
893
|
-
// that pass the `e` of `globalout` to `onIrrelevantElement`. But it is
|
|
894
|
-
// not a good design of these interfaces. However, we do not refactor
|
|
895
|
-
// these code now because the implementation of `onIrrelevantElement`
|
|
896
|
-
// need to be discussed and probably be changed in future, becuase it
|
|
897
|
-
// slows down the performance of zrender in some cases.
|
|
884
|
+
var localCursorPoint = controller.group.transformCoordToLocal(x, y);
|
|
898
885
|
var eventParams = updateCoverByMouse(controller, e, localCursorPoint, true);
|
|
899
886
|
|
|
900
887
|
controller._dragging = false;
|
|
@@ -906,6 +893,12 @@ function handleDragEnd(controller, e, isGlobalOut) {
|
|
|
906
893
|
}
|
|
907
894
|
}
|
|
908
895
|
|
|
896
|
+
function isOutsideZrArea(controller, x, y) {
|
|
897
|
+
var zr = controller._zr;
|
|
898
|
+
return x < 0 || x > zr.getWidth() || y < 0 || y > zr.getHeight();
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
|
|
909
902
|
/**
|
|
910
903
|
* key: brushType
|
|
911
904
|
* @type {Object}
|
|
@@ -24,6 +24,7 @@ import {onIrrelevantElement} from '../../component/helper/cursorHelper';
|
|
|
24
24
|
import * as graphic from '../../util/graphic';
|
|
25
25
|
import geoSourceManager from '../../coord/geo/geoSourceManager';
|
|
26
26
|
import {getUID} from '../../util/component';
|
|
27
|
+
import Transformable from 'zrender/src/mixin/Transformable';
|
|
27
28
|
|
|
28
29
|
function getFixedItemStyle(model) {
|
|
29
30
|
var itemStyle = model.getItemStyle();
|
|
@@ -181,13 +182,29 @@ MapDraw.prototype = {
|
|
|
181
182
|
var regionsGroup = this._regionsGroup;
|
|
182
183
|
var group = this.group;
|
|
183
184
|
|
|
184
|
-
|
|
185
|
-
|
|
185
|
+
var transformInfo = geo.getTransformInfo();
|
|
186
|
+
// No animation when first draw or in action
|
|
187
|
+
var isFirstDraw = !regionsGroup.childAt(0) || payload;
|
|
188
|
+
var targetScale;
|
|
189
|
+
if (isFirstDraw) {
|
|
190
|
+
group.transform = transformInfo.roamTransform;
|
|
186
191
|
group.decomposeTransform();
|
|
192
|
+
group.dirty();
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
var target = new Transformable();
|
|
196
|
+
target.transform = transformInfo.roamTransform;
|
|
197
|
+
target.decomposeTransform();
|
|
198
|
+
var props = {
|
|
199
|
+
scale: target.scale,
|
|
200
|
+
position: target.position
|
|
201
|
+
};
|
|
202
|
+
targetScale = target.scale;
|
|
203
|
+
graphic.updateProps(group, props, mapOrGeoModel);
|
|
187
204
|
}
|
|
188
205
|
|
|
189
|
-
var scale =
|
|
190
|
-
var position =
|
|
206
|
+
var scale = transformInfo.rawScale;
|
|
207
|
+
var position = transformInfo.rawPosition;
|
|
191
208
|
|
|
192
209
|
regionsGroup.removeAll();
|
|
193
210
|
|
|
@@ -326,6 +343,12 @@ MapDraw.prototype = {
|
|
|
326
343
|
}
|
|
327
344
|
);
|
|
328
345
|
|
|
346
|
+
if (!isFirstDraw) {
|
|
347
|
+
// Text animation
|
|
348
|
+
var textScale = [1 / targetScale[0], 1 / targetScale[1]];
|
|
349
|
+
graphic.updateProps(textEl, { scale: textScale }, mapOrGeoModel);
|
|
350
|
+
}
|
|
351
|
+
|
|
329
352
|
regionGroup.add(textEl);
|
|
330
353
|
}
|
|
331
354
|
|
|
@@ -111,9 +111,9 @@ var LegendModel = echarts.extendComponentModel({
|
|
|
111
111
|
availableNames.push(seriesName);
|
|
112
112
|
var isPotential;
|
|
113
113
|
|
|
114
|
-
if (seriesModel.
|
|
115
|
-
var
|
|
116
|
-
var names =
|
|
114
|
+
if (seriesModel.legendVisualProvider) {
|
|
115
|
+
var provider = seriesModel.legendVisualProvider;
|
|
116
|
+
var names = provider.getAllNames();
|
|
117
117
|
|
|
118
118
|
if (!ecModel.isSeriesFiltered(seriesModel)) {
|
|
119
119
|
availableNames = availableNames.concat(names);
|
|
@@ -175,7 +175,7 @@ export default echarts.extendComponentView({
|
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
//
|
|
178
|
+
// Legend to control series.
|
|
179
179
|
if (seriesModel) {
|
|
180
180
|
var data = seriesModel.getData();
|
|
181
181
|
var color = data.getVisual('color');
|
|
@@ -204,29 +204,31 @@ export default echarts.extendComponentView({
|
|
|
204
204
|
selectMode
|
|
205
205
|
);
|
|
206
206
|
|
|
207
|
-
itemGroup.on('click', curry(dispatchSelectAction, name, api))
|
|
207
|
+
itemGroup.on('click', curry(dispatchSelectAction, name, null, api, excludeSeriesId))
|
|
208
208
|
.on('mouseover', curry(dispatchHighlightAction, seriesModel.name, null, api, excludeSeriesId))
|
|
209
209
|
.on('mouseout', curry(dispatchDownplayAction, seriesModel.name, null, api, excludeSeriesId));
|
|
210
210
|
|
|
211
211
|
legendDrawnMap.set(name, true);
|
|
212
212
|
}
|
|
213
213
|
else {
|
|
214
|
-
//
|
|
214
|
+
// Legend to control data. In pie and funnel.
|
|
215
215
|
ecModel.eachRawSeries(function (seriesModel) {
|
|
216
|
+
|
|
216
217
|
// In case multiple series has same data name
|
|
217
218
|
if (legendDrawnMap.get(name)) {
|
|
218
219
|
return;
|
|
219
220
|
}
|
|
220
221
|
|
|
221
|
-
if (seriesModel.
|
|
222
|
-
var
|
|
223
|
-
|
|
224
|
-
if (idx < 0) {
|
|
222
|
+
if (seriesModel.legendVisualProvider) {
|
|
223
|
+
var provider = seriesModel.legendVisualProvider;
|
|
224
|
+
if (!provider.containName(name)) {
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
var
|
|
229
|
-
|
|
228
|
+
var idx = provider.indexOfName(name);
|
|
229
|
+
|
|
230
|
+
var color = provider.getItemVisual(idx, 'color');
|
|
231
|
+
var borderColor = provider.getItemVisual(idx, 'borderColor');
|
|
230
232
|
|
|
231
233
|
var legendSymbolType = 'roundRect';
|
|
232
234
|
|
|
@@ -238,7 +240,7 @@ export default echarts.extendComponentView({
|
|
|
238
240
|
);
|
|
239
241
|
|
|
240
242
|
// FIXME: consider different series has items with the same name.
|
|
241
|
-
itemGroup.on('click', curry(dispatchSelectAction, name, api))
|
|
243
|
+
itemGroup.on('click', curry(dispatchSelectAction, null, name, api, excludeSeriesId))
|
|
242
244
|
// Should not specify the series name, consider legend controls
|
|
243
245
|
// more than one pie series.
|
|
244
246
|
.on('mouseover', curry(dispatchHighlightAction, null, name, api, excludeSeriesId))
|
|
@@ -518,11 +520,15 @@ function setSymbolStyle(symbol, symbolType, legendModelItemStyle, borderColor, i
|
|
|
518
520
|
return symbol.setStyle(itemStyle);
|
|
519
521
|
}
|
|
520
522
|
|
|
521
|
-
function dispatchSelectAction(
|
|
523
|
+
function dispatchSelectAction(seriesName, dataName, api, excludeSeriesId) {
|
|
524
|
+
// downplay before unselect
|
|
525
|
+
dispatchDownplayAction(seriesName, dataName, api, excludeSeriesId);
|
|
522
526
|
api.dispatchAction({
|
|
523
527
|
type: 'legendToggleSelect',
|
|
524
|
-
name:
|
|
528
|
+
name: seriesName != null ? seriesName : dataName
|
|
525
529
|
});
|
|
530
|
+
// highlight after select
|
|
531
|
+
dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId);
|
|
526
532
|
}
|
|
527
533
|
|
|
528
534
|
function dispatchHighlightAction(seriesName, dataName, api, excludeSeriesId) {
|
|
@@ -459,26 +459,28 @@ var ScrollableLegendView = LegendView.extend({
|
|
|
459
459
|
},
|
|
460
460
|
|
|
461
461
|
_findTargetItemIndex: function (targetDataIndex) {
|
|
462
|
+
if (!this._showController) {
|
|
463
|
+
return 0;
|
|
464
|
+
}
|
|
465
|
+
|
|
462
466
|
var index;
|
|
463
467
|
var contentGroup = this.getContentGroup();
|
|
464
468
|
var defaultIndex;
|
|
465
469
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
});
|
|
481
|
-
}
|
|
470
|
+
contentGroup.eachChild(function (child, idx) {
|
|
471
|
+
var legendDataIdx = child.__legendDataIndex;
|
|
472
|
+
// FIXME
|
|
473
|
+
// If the given targetDataIndex (from model) is illegal,
|
|
474
|
+
// we use defaultIndex. But the index on the legend model and
|
|
475
|
+
// action payload is still illegal. That case will not be
|
|
476
|
+
// changed until some scenario requires.
|
|
477
|
+
if (defaultIndex == null && legendDataIdx != null) {
|
|
478
|
+
defaultIndex = idx;
|
|
479
|
+
}
|
|
480
|
+
if (legendDataIdx === targetDataIndex) {
|
|
481
|
+
index = idx;
|
|
482
|
+
}
|
|
483
|
+
});
|
|
482
484
|
|
|
483
485
|
return index != null ? index : defaultIndex;
|
|
484
486
|
}
|
|
@@ -208,9 +208,29 @@ MarkerView.extend({
|
|
|
208
208
|
// Update visual and layout of line
|
|
209
209
|
areaData.each(function (idx) {
|
|
210
210
|
// Layout
|
|
211
|
-
|
|
211
|
+
var points = zrUtil.map(dimPermutations, function (dim) {
|
|
212
212
|
return getSingleMarkerEndPoint(areaData, idx, dim, seriesModel, api);
|
|
213
|
-
})
|
|
213
|
+
});
|
|
214
|
+
// If none of the area is inside coordSys, allClipped is set to be true
|
|
215
|
+
// in layout so that label will not be displayed. See #12591
|
|
216
|
+
var allClipped = true;
|
|
217
|
+
zrUtil.each(dimPermutations, function (dim) {
|
|
218
|
+
if (!allClipped) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
var xValue = areaData.get(dim[0], idx);
|
|
222
|
+
var yValue = areaData.get(dim[1], idx);
|
|
223
|
+
// If is infinity, the axis should be considered not clipped
|
|
224
|
+
if ((isInifinity(xValue) || coordSys.getAxis('x').containData(xValue))
|
|
225
|
+
&& (isInifinity(yValue) || coordSys.getAxis('y').containData(yValue))
|
|
226
|
+
) {
|
|
227
|
+
allClipped = false;
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
areaData.setItemLayout(idx, {
|
|
231
|
+
points: points,
|
|
232
|
+
allClipped: allClipped
|
|
233
|
+
});
|
|
214
234
|
|
|
215
235
|
// Visual
|
|
216
236
|
areaData.setItemVisual(idx, {
|
|
@@ -221,23 +241,41 @@ MarkerView.extend({
|
|
|
221
241
|
|
|
222
242
|
areaData.diff(polygonGroup.__data)
|
|
223
243
|
.add(function (idx) {
|
|
224
|
-
var
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
244
|
+
var layout = areaData.getItemLayout(idx);
|
|
245
|
+
if (!layout.allClipped) {
|
|
246
|
+
var polygon = new graphic.Polygon({
|
|
247
|
+
shape: {
|
|
248
|
+
points: layout.points
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
areaData.setItemGraphicEl(idx, polygon);
|
|
252
|
+
polygonGroup.group.add(polygon);
|
|
253
|
+
}
|
|
231
254
|
})
|
|
232
255
|
.update(function (newIdx, oldIdx) {
|
|
233
256
|
var polygon = polygonGroup.__data.getItemGraphicEl(oldIdx);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
257
|
+
var layout = areaData.getItemLayout(newIdx);
|
|
258
|
+
if (!layout.allClipped) {
|
|
259
|
+
if (polygon) {
|
|
260
|
+
graphic.updateProps(polygon, {
|
|
261
|
+
shape: {
|
|
262
|
+
points: layout.points
|
|
263
|
+
}
|
|
264
|
+
}, maModel, newIdx);
|
|
237
265
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
266
|
+
else {
|
|
267
|
+
polygon = new graphic.Polygon({
|
|
268
|
+
shape: {
|
|
269
|
+
points: layout.points
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
areaData.setItemGraphicEl(newIdx, polygon);
|
|
274
|
+
polygonGroup.group.add(polygon);
|
|
275
|
+
}
|
|
276
|
+
else if (polygon) {
|
|
277
|
+
polygonGroup.group.remove(polygon);
|
|
278
|
+
}
|
|
241
279
|
})
|
|
242
280
|
.remove(function (idx) {
|
|
243
281
|
var polygon = polygonGroup.__data.getItemGraphicEl(idx);
|