echarts 4.4.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/ISSUE_TEMPLATE.md +1 -1
- package/.github/workflows/nodejs.yml +31 -0
- package/CONTRIBUTING.md +2 -2
- package/README.md +6 -12
- package/dist/echarts-en.common.js +2354 -1029
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +2727 -1138
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +2028 -759
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +2354 -1029
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +2727 -1138
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +2028 -759
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/dataTool.js +9 -0
- package/dist/extension/dataTool.js.map +1 -1
- package/echarts.all.js +1 -1
- package/lib/chart/bar/BarSeries.js +4 -1
- package/lib/chart/bar/BarView.js +20 -6
- package/lib/chart/bar/BaseBarSeries.js +5 -1
- package/lib/chart/candlestick/CandlestickSeries.js +1 -0
- package/lib/chart/candlestick/CandlestickView.js +42 -1
- package/lib/chart/custom.js +1 -0
- package/lib/chart/effectScatter/EffectScatterSeries.js +3 -1
- package/lib/chart/funnel/FunnelSeries.js +15 -5
- package/lib/chart/gauge/GaugeSeries.js +0 -9
- package/lib/chart/graph/GraphSeries.js +11 -4
- package/lib/chart/graph/GraphView.js +28 -8
- package/lib/chart/graph/forceHelper.js +8 -2
- package/lib/chart/graph/forceLayout.js +5 -2
- package/lib/chart/heatmap/HeatmapView.js +4 -4
- package/lib/chart/helper/Symbol.js +8 -0
- package/lib/chart/helper/createListFromArray.js +14 -8
- package/lib/chart/helper/whiskerBoxCommon.js +22 -16
- package/lib/chart/line/LineSeries.js +3 -1
- package/lib/chart/line/LineView.js +8 -2
- package/lib/chart/map/MapSeries.js +8 -1
- package/lib/chart/pie/PieSeries.js +27 -6
- package/lib/chart/pie/PieView.js +1 -1
- package/lib/chart/pie/labelLayout.js +102 -19
- package/lib/chart/pie/pieLayout.js +19 -7
- package/lib/chart/radar/RadarSeries.js +3 -3
- package/lib/chart/sankey/SankeyView.js +28 -9
- package/lib/chart/scatter/ScatterSeries.js +3 -1
- package/lib/chart/themeRiver/ThemeRiverSeries.js +3 -3
- package/lib/chart/tree/TreeSeries.js +15 -1
- package/lib/chart/tree/TreeView.js +4 -2
- package/lib/component/axis/AngleAxisView.js +97 -20
- package/lib/component/axis/AxisBuilder.js +63 -24
- package/lib/component/axis/CartesianAxisView.js +55 -11
- package/lib/component/axis/RadiusAxisView.js +36 -4
- package/lib/component/brush/BrushView.js +6 -0
- package/lib/component/brush/brushAction.js +5 -0
- package/lib/component/dataZoom/DataZoomModel.js +15 -1
- package/lib/component/dataZoom/SliderZoomView.js +4 -10
- package/lib/component/helper/BrushController.js +43 -25
- package/lib/component/legend/LegendModel.js +3 -3
- package/lib/component/legend/LegendView.js +17 -13
- package/lib/component/toolbox/ToolboxView.js +16 -7
- package/lib/component/toolbox/feature/MagicType.js +19 -14
- package/lib/coord/Axis.js +44 -12
- package/lib/coord/axisDefault.js +21 -2
- package/lib/coord/axisTickLabelBuilder.js +9 -1
- package/lib/coord/cartesian/Cartesian2D.js +0 -15
- package/lib/coord/geo/geoJSONLoader.js +1 -1
- package/lib/coord/polar/polarCreator.js +11 -2
- package/lib/coord/radar/Radar.js +3 -1
- package/lib/coord/radar/RadarModel.js +4 -1
- package/lib/data/DataDiffer.js +2 -4
- package/lib/data/DataDimensionInfo.js +157 -0
- package/lib/data/List.js +29 -23
- package/lib/data/Tree.js +2 -1
- 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 +2 -2
- package/lib/layout/barGrid.js +136 -11
- package/lib/layout/barPolar.js +2 -2
- package/lib/model/Global.js +1 -1
- package/lib/model/Series.js +3 -3
- package/lib/model/referHelper.js +40 -12
- package/lib/scale/Interval.js +87 -2
- package/lib/scale/Log.js +9 -2
- package/lib/scale/helper.js +1 -43
- package/lib/theme/dark.js +3 -0
- package/lib/util/graphic.js +1 -2
- package/lib/util/number.js +25 -1
- package/lib/util/shape/sausage.js +93 -0
- package/lib/visual/LegendVisualProvider.js +75 -0
- package/lib/visual/dataColor.js +2 -12
- package/lib/visual/seriesColor.js +15 -7
- package/map/js/china.js +2 -2
- package/map/json/china.json +1 -1
- package/map/json/province/tianjin.json +1 -1
- package/package.json +3 -2
- package/src/chart/bar/BarSeries.js +5 -1
- package/src/chart/bar/BarView.js +24 -8
- package/src/chart/bar/BaseBarSeries.js +5 -1
- package/src/chart/candlestick/CandlestickSeries.js +2 -0
- package/src/chart/candlestick/CandlestickView.js +44 -1
- package/src/chart/custom.js +1 -0
- package/src/chart/effectScatter/EffectScatterSeries.js +1 -1
- package/src/chart/funnel/FunnelSeries.js +11 -4
- package/src/chart/gauge/GaugeSeries.js +0 -6
- package/src/chart/graph/GraphSeries.js +10 -3
- package/src/chart/graph/GraphView.js +26 -8
- package/src/chart/graph/forceHelper.js +7 -3
- package/src/chart/graph/forceLayout.js +6 -3
- package/src/chart/heatmap/HeatmapView.js +4 -4
- package/src/chart/helper/Symbol.js +9 -0
- package/src/chart/helper/createClipPathFromCoordSys.js +5 -1
- package/src/chart/helper/createGraphFromNodeEdge.js +1 -1
- package/src/chart/helper/createListFromArray.js +13 -8
- package/src/chart/helper/whiskerBoxCommon.js +21 -16
- package/src/chart/line/LineSeries.js +1 -1
- package/src/chart/line/LineView.js +6 -1
- package/src/chart/map/MapSeries.js +5 -1
- package/src/chart/pie/PieSeries.js +26 -5
- package/src/chart/pie/PieView.js +1 -1
- package/src/chart/pie/labelLayout.js +114 -22
- package/src/chart/pie/pieLayout.js +20 -7
- package/src/chart/radar/RadarSeries.js +5 -3
- package/src/chart/sankey/SankeyView.js +26 -9
- package/src/chart/scatter/ScatterSeries.js +1 -1
- package/src/chart/themeRiver/ThemeRiverSeries.js +4 -3
- package/src/chart/tree/TreeSeries.js +12 -1
- package/src/chart/tree/TreeView.js +5 -2
- package/src/component/axis/AngleAxisView.js +106 -19
- package/src/component/axis/AxisBuilder.js +78 -33
- package/src/component/axis/CartesianAxisView.js +58 -11
- package/src/component/axis/RadiusAxisView.js +37 -4
- package/src/component/brush/BrushView.js +6 -0
- package/src/component/brush/brushAction.js +6 -1
- package/src/component/dataZoom/DataZoomModel.js +15 -1
- package/src/component/dataZoom/SliderZoomView.js +4 -9
- package/src/component/helper/BrushController.js +50 -28
- package/src/component/legend/LegendModel.js +3 -3
- package/src/component/legend/LegendView.js +18 -12
- package/src/component/toolbox/ToolboxView.js +18 -5
- package/src/component/toolbox/feature/MagicType.js +18 -13
- package/src/coord/Axis.js +48 -13
- package/src/coord/axisDefault.js +25 -1
- package/src/coord/axisTickLabelBuilder.js +10 -0
- package/src/coord/cartesian/Cartesian2D.js +0 -13
- package/src/coord/geo/geoJSONLoader.js +2 -2
- package/src/coord/polar/polarCreator.js +16 -3
- package/src/coord/radar/Radar.js +3 -1
- package/src/coord/radar/RadarModel.js +5 -2
- package/src/data/DataDiffer.js +1 -4
- package/src/data/DataDimensionInfo.js +135 -0
- package/src/data/Graph.js +1 -1
- package/src/data/List.js +33 -20
- package/src/data/Tree.js +3 -1
- 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 +2 -2
- package/src/layout/barGrid.js +136 -13
- package/src/layout/barPolar.js +3 -2
- package/src/model/Global.js +1 -1
- package/src/model/Series.js +3 -3
- package/src/model/referHelper.js +34 -11
- package/src/scale/Interval.js +84 -4
- package/src/scale/Log.js +9 -2
- package/src/scale/helper.js +1 -39
- package/src/theme/dark.js +3 -0
- package/src/util/graphic.js +1 -2
- package/src/util/number.js +22 -2
- package/src/util/shape/sausage.js +93 -0
- package/src/visual/LegendVisualProvider.js +55 -0
- package/src/visual/dataColor.js +0 -13
- package/src/visual/seriesColor.js +13 -7
- package/theme/azul.js +163 -0
- package/theme/bee-inspired.js +178 -0
- package/theme/blue.js +178 -0
- package/theme/caravan.js +178 -0
- package/theme/carp.js +163 -0
- package/theme/cool.js +180 -0
- package/theme/dark-blue.js +168 -0
- package/theme/dark-bold.js +168 -0
- package/theme/dark-digerati.js +168 -0
- package/theme/dark-fresh-cut.js +168 -0
- package/theme/dark-mushroom.js +168 -0
- package/theme/dark.js +69 -62
- package/theme/eduardo.js +178 -0
- package/theme/forest.js +163 -0
- package/theme/fresh-cut.js +163 -0
- package/theme/fruit.js +178 -0
- package/theme/gray.js +220 -0
- package/theme/green.js +222 -0
- package/theme/helianthus.js +263 -0
- package/theme/infographic.js +72 -57
- package/theme/inspired.js +163 -0
- package/theme/jazz.js +163 -0
- package/theme/london.js +163 -0
- package/theme/macarons.js +80 -57
- package/theme/macarons2.js +251 -0
- package/theme/mint.js +155 -0
- package/theme/red-velvet.js +163 -0
- package/theme/red.js +225 -0
- package/theme/roma.js +55 -22
- package/theme/royal.js +163 -0
- package/theme/sakura.js +140 -0
- package/theme/shine.js +52 -45
- package/theme/tech-blue.js +180 -0
- package/theme/vintage.js +37 -23
- package/.travis.yml +0 -16
|
@@ -21,17 +21,20 @@ import * as zrUtil from 'zrender/src/core/util';
|
|
|
21
21
|
import ChartView from '../../view/Chart';
|
|
22
22
|
import * as graphic from '../../util/graphic';
|
|
23
23
|
import Path from 'zrender/src/graphic/Path';
|
|
24
|
+
import {createClipPath} from '../helper/createClipPathFromCoordSys';
|
|
24
25
|
|
|
25
26
|
var NORMAL_ITEM_STYLE_PATH = ['itemStyle'];
|
|
26
27
|
var EMPHASIS_ITEM_STYLE_PATH = ['emphasis', 'itemStyle'];
|
|
27
28
|
var SKIP_PROPS = ['color', 'color0', 'borderColor', 'borderColor0'];
|
|
28
29
|
|
|
29
|
-
|
|
30
30
|
var CandlestickView = ChartView.extend({
|
|
31
31
|
|
|
32
32
|
type: 'candlestick',
|
|
33
33
|
|
|
34
34
|
render: function (seriesModel, ecModel, api) {
|
|
35
|
+
// If there is clipPath created in large mode. Remove it.
|
|
36
|
+
this.group.removeClipPath();
|
|
37
|
+
|
|
35
38
|
this._updateDrawMode(seriesModel);
|
|
36
39
|
|
|
37
40
|
this._isLargeDraw
|
|
@@ -64,6 +67,10 @@ var CandlestickView = ChartView.extend({
|
|
|
64
67
|
var group = this.group;
|
|
65
68
|
var isSimpleBox = data.getLayout('isSimpleBox');
|
|
66
69
|
|
|
70
|
+
var needsClip = seriesModel.get('clip', true);
|
|
71
|
+
var coord = seriesModel.coordinateSystem;
|
|
72
|
+
var clipArea = coord.getArea && coord.getArea();
|
|
73
|
+
|
|
67
74
|
// There is no old data only when first rendering or switching from
|
|
68
75
|
// stream mode to normal mode, where previous elements should be removed.
|
|
69
76
|
if (!this._data) {
|
|
@@ -76,12 +83,18 @@ var CandlestickView = ChartView.extend({
|
|
|
76
83
|
var el;
|
|
77
84
|
|
|
78
85
|
var itemLayout = data.getItemLayout(newIdx);
|
|
86
|
+
|
|
87
|
+
if (needsClip && isNormalBoxClipped(clipArea, itemLayout)) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
79
91
|
el = createNormalBox(itemLayout, newIdx, true);
|
|
80
92
|
graphic.initProps(el, {shape: {points: itemLayout.ends}}, seriesModel, newIdx);
|
|
81
93
|
|
|
82
94
|
setBoxCommon(el, data, newIdx, isSimpleBox);
|
|
83
95
|
|
|
84
96
|
group.add(el);
|
|
97
|
+
|
|
85
98
|
data.setItemGraphicEl(newIdx, el);
|
|
86
99
|
}
|
|
87
100
|
})
|
|
@@ -95,6 +108,11 @@ var CandlestickView = ChartView.extend({
|
|
|
95
108
|
}
|
|
96
109
|
|
|
97
110
|
var itemLayout = data.getItemLayout(newIdx);
|
|
111
|
+
if (needsClip && isNormalBoxClipped(clipArea, itemLayout)) {
|
|
112
|
+
group.remove(el);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
98
116
|
if (!el) {
|
|
99
117
|
el = createNormalBox(itemLayout, newIdx);
|
|
100
118
|
}
|
|
@@ -118,7 +136,19 @@ var CandlestickView = ChartView.extend({
|
|
|
118
136
|
|
|
119
137
|
_renderLarge: function (seriesModel) {
|
|
120
138
|
this._clear();
|
|
139
|
+
|
|
121
140
|
createLarge(seriesModel, this.group);
|
|
141
|
+
|
|
142
|
+
var clipPath = seriesModel.get('clip', true)
|
|
143
|
+
? createClipPath(seriesModel.coordinateSystem, false, seriesModel)
|
|
144
|
+
: null;
|
|
145
|
+
if (clipPath) {
|
|
146
|
+
this.group.setClipPath(clipPath);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.group.removeClipPath();
|
|
150
|
+
}
|
|
151
|
+
|
|
122
152
|
},
|
|
123
153
|
|
|
124
154
|
_incrementalRenderNormal: function (params, seriesModel) {
|
|
@@ -184,6 +214,7 @@ var NormalBoxPath = Path.extend({
|
|
|
184
214
|
}
|
|
185
215
|
});
|
|
186
216
|
|
|
217
|
+
|
|
187
218
|
function createNormalBox(itemLayout, dataIndex, isInit) {
|
|
188
219
|
var ends = itemLayout.ends;
|
|
189
220
|
return new NormalBoxPath({
|
|
@@ -196,6 +227,18 @@ function createNormalBox(itemLayout, dataIndex, isInit) {
|
|
|
196
227
|
});
|
|
197
228
|
}
|
|
198
229
|
|
|
230
|
+
function isNormalBoxClipped(clipArea, itemLayout) {
|
|
231
|
+
var clipped = true;
|
|
232
|
+
for (var i = 0; i < itemLayout.ends.length; i++) {
|
|
233
|
+
// If any point are in the region.
|
|
234
|
+
if (clipArea.contain(itemLayout.ends[i][0], itemLayout.ends[i][1])) {
|
|
235
|
+
clipped = false;
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return clipped;
|
|
240
|
+
}
|
|
241
|
+
|
|
199
242
|
function setBoxCommon(el, data, dataIndex, isSimpleBox) {
|
|
200
243
|
var itemModel = data.getItemModel(dataIndex);
|
|
201
244
|
var normalItemStyleModel = itemModel.getModel(NORMAL_ITEM_STYLE_PATH);
|
package/src/chart/custom.js
CHANGED
|
@@ -539,6 +539,7 @@ function makeRenderItem(customSeries, data, ecModel, api) {
|
|
|
539
539
|
* @param {number} opt.count Positive interger.
|
|
540
540
|
* @param {number} [opt.barWidth]
|
|
541
541
|
* @param {number} [opt.barMaxWidth]
|
|
542
|
+
* @param {number} [opt.barMinWidth]
|
|
542
543
|
* @param {number} [opt.barGap]
|
|
543
544
|
* @param {number} [opt.barCategoryGap]
|
|
544
545
|
* @return {Object} {width, offset, offsetCenter} is not support, return undefined.
|
|
@@ -27,7 +27,7 @@ export default SeriesModel.extend({
|
|
|
27
27
|
dependencies: ['grid', 'polar'],
|
|
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',
|
|
@@ -18,8 +18,12 @@
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
import * as echarts from '../../echarts';
|
|
21
|
+
import * as zrUtil from 'zrender/src/core/util';
|
|
21
22
|
import createListSimply from '../helper/createListSimply';
|
|
22
23
|
import {defaultEmphasis} from '../../util/model';
|
|
24
|
+
import {makeSeriesEncodeForNameBased} from '../../data/helper/sourceHelper';
|
|
25
|
+
import LegendVisualProvider from '../../visual/LegendVisualProvider';
|
|
26
|
+
import {bind} from 'zrender/src/core/util';
|
|
23
27
|
|
|
24
28
|
var FunnelSeries = echarts.extendSeriesModel({
|
|
25
29
|
|
|
@@ -30,15 +34,18 @@ var FunnelSeries = echarts.extendSeriesModel({
|
|
|
30
34
|
|
|
31
35
|
// Enable legend selection for each data item
|
|
32
36
|
// Use a function instead of direct access because data reference may changed
|
|
33
|
-
this.
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
this.legendVisualProvider = new LegendVisualProvider(
|
|
38
|
+
bind(this.getData, this), bind(this.getRawData, this)
|
|
39
|
+
);
|
|
36
40
|
// Extend labelLine emphasis
|
|
37
41
|
this._defaultLabelLine(option);
|
|
38
42
|
},
|
|
39
43
|
|
|
40
44
|
getInitialData: function (option, ecModel) {
|
|
41
|
-
return createListSimply(this,
|
|
45
|
+
return createListSimply(this, {
|
|
46
|
+
coordDimensions: ['value'],
|
|
47
|
+
encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this)
|
|
48
|
+
});
|
|
42
49
|
},
|
|
43
50
|
|
|
44
51
|
_defaultLabelLine: function (option) {
|
|
@@ -19,18 +19,12 @@
|
|
|
19
19
|
|
|
20
20
|
import createListSimply from '../helper/createListSimply';
|
|
21
21
|
import SeriesModel from '../../model/Series';
|
|
22
|
-
import * as zrUtil from 'zrender/src/core/util';
|
|
23
22
|
|
|
24
23
|
var GaugeSeries = SeriesModel.extend({
|
|
25
24
|
|
|
26
25
|
type: 'series.gauge',
|
|
27
26
|
|
|
28
27
|
getInitialData: function (option, ecModel) {
|
|
29
|
-
var dataOpt = option.data || [];
|
|
30
|
-
if (!zrUtil.isArray(dataOpt)) {
|
|
31
|
-
dataOpt = [dataOpt];
|
|
32
|
-
}
|
|
33
|
-
option.data = dataOpt;
|
|
34
28
|
return createListSimply(this, ['value']);
|
|
35
29
|
},
|
|
36
30
|
|
|
@@ -24,6 +24,7 @@ import {defaultEmphasis} from '../../util/model';
|
|
|
24
24
|
import Model from '../../model/Model';
|
|
25
25
|
import {encodeHTML} from '../../util/format';
|
|
26
26
|
import createGraphFromNodeEdge from '../helper/createGraphFromNodeEdge';
|
|
27
|
+
import LegendVisualProvider from '../../visual/LegendVisualProvider';
|
|
27
28
|
|
|
28
29
|
var GraphSeries = echarts.extendSeriesModel({
|
|
29
30
|
|
|
@@ -32,10 +33,14 @@ var GraphSeries = echarts.extendSeriesModel({
|
|
|
32
33
|
init: function (option) {
|
|
33
34
|
GraphSeries.superApply(this, 'init', arguments);
|
|
34
35
|
|
|
36
|
+
var self = this;
|
|
37
|
+
function getCategoriesData() {
|
|
38
|
+
return self._categoriesData;
|
|
39
|
+
}
|
|
35
40
|
// Provide data for legend select
|
|
36
|
-
this.
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
this.legendVisualProvider = new LegendVisualProvider(
|
|
42
|
+
getCategoriesData, getCategoriesData
|
|
43
|
+
);
|
|
39
44
|
|
|
40
45
|
this.fillDataTextStyle(option.edges || option.links);
|
|
41
46
|
|
|
@@ -215,6 +220,8 @@ var GraphSeries = echarts.extendSeriesModel({
|
|
|
215
220
|
// Node repulsion. Can be an array to represent range.
|
|
216
221
|
repulsion: [0, 50],
|
|
217
222
|
gravity: 0.1,
|
|
223
|
+
// Initial friction
|
|
224
|
+
friction: 0.6,
|
|
218
225
|
|
|
219
226
|
// Edge length. Can be an array to represent range.
|
|
220
227
|
edgeLength: 30,
|
|
@@ -94,6 +94,7 @@ export default echarts.extendChartView({
|
|
|
94
94
|
},
|
|
95
95
|
|
|
96
96
|
render: function (seriesModel, ecModel, api) {
|
|
97
|
+
var graphView = this;
|
|
97
98
|
var coordSys = seriesModel.coordinateSystem;
|
|
98
99
|
|
|
99
100
|
this._model = seriesModel;
|
|
@@ -163,6 +164,7 @@ export default echarts.extendChartView({
|
|
|
163
164
|
|
|
164
165
|
if (itemModel.get('focusNodeAdjacency')) {
|
|
165
166
|
el.on('mouseover', el[FOCUS_ADJACENCY] = function () {
|
|
167
|
+
graphView._clearTimer();
|
|
166
168
|
api.dispatchAction({
|
|
167
169
|
type: 'focusNodeAdjacency',
|
|
168
170
|
seriesId: seriesModel.id,
|
|
@@ -170,10 +172,7 @@ export default echarts.extendChartView({
|
|
|
170
172
|
});
|
|
171
173
|
});
|
|
172
174
|
el.on('mouseout', el[UNFOCUS_ADJACENCY] = function () {
|
|
173
|
-
|
|
174
|
-
type: 'unfocusNodeAdjacency',
|
|
175
|
-
seriesId: seriesModel.id
|
|
176
|
-
});
|
|
175
|
+
graphView._dispatchUnfocus(api);
|
|
177
176
|
});
|
|
178
177
|
}
|
|
179
178
|
|
|
@@ -187,6 +186,7 @@ export default echarts.extendChartView({
|
|
|
187
186
|
|
|
188
187
|
if (edge.getModel().get('focusNodeAdjacency')) {
|
|
189
188
|
el.on('mouseover', el[FOCUS_ADJACENCY] = function () {
|
|
189
|
+
graphView._clearTimer();
|
|
190
190
|
api.dispatchAction({
|
|
191
191
|
type: 'focusNodeAdjacency',
|
|
192
192
|
seriesId: seriesModel.id,
|
|
@@ -194,10 +194,7 @@ export default echarts.extendChartView({
|
|
|
194
194
|
});
|
|
195
195
|
});
|
|
196
196
|
el.on('mouseout', el[UNFOCUS_ADJACENCY] = function () {
|
|
197
|
-
|
|
198
|
-
type: 'unfocusNodeAdjacency',
|
|
199
|
-
seriesId: seriesModel.id
|
|
200
|
-
});
|
|
197
|
+
graphView._dispatchUnfocus(api);
|
|
201
198
|
});
|
|
202
199
|
}
|
|
203
200
|
});
|
|
@@ -249,6 +246,27 @@ export default echarts.extendChartView({
|
|
|
249
246
|
dispose: function () {
|
|
250
247
|
this._controller && this._controller.dispose();
|
|
251
248
|
this._controllerHost = {};
|
|
249
|
+
this._clearTimer();
|
|
250
|
+
},
|
|
251
|
+
|
|
252
|
+
_dispatchUnfocus: function (api, opt) {
|
|
253
|
+
var self = this;
|
|
254
|
+
this._clearTimer();
|
|
255
|
+
this._unfocusDelayTimer = setTimeout(function () {
|
|
256
|
+
self._unfocusDelayTimer = null;
|
|
257
|
+
api.dispatchAction({
|
|
258
|
+
type: 'unfocusNodeAdjacency',
|
|
259
|
+
seriesId: self._model.id
|
|
260
|
+
});
|
|
261
|
+
}, 500);
|
|
262
|
+
|
|
263
|
+
},
|
|
264
|
+
|
|
265
|
+
_clearTimer: function () {
|
|
266
|
+
if (this._unfocusDelayTimer) {
|
|
267
|
+
clearTimeout(this._unfocusDelayTimer);
|
|
268
|
+
this._unfocusDelayTimer = null;
|
|
269
|
+
}
|
|
252
270
|
},
|
|
253
271
|
|
|
254
272
|
focusNodeAdjacency: function (seriesModel, ecModel, api, payload) {
|
|
@@ -69,11 +69,12 @@ export function forceLayout(nodes, edges, opts) {
|
|
|
69
69
|
// var k = scale * Math.sqrt(width * height / nodes.length);
|
|
70
70
|
// var k2 = k * k;
|
|
71
71
|
|
|
72
|
-
var
|
|
72
|
+
var initialFriction = opts.friction == null ? 0.6 : opts.friction;
|
|
73
|
+
var friction = initialFriction;
|
|
73
74
|
|
|
74
75
|
return {
|
|
75
76
|
warmUp: function () {
|
|
76
|
-
friction = 0.
|
|
77
|
+
friction = initialFriction * 0.8;
|
|
77
78
|
},
|
|
78
79
|
|
|
79
80
|
setFixed: function (idx) {
|
|
@@ -95,6 +96,9 @@ export function forceLayout(nodes, edges, opts) {
|
|
|
95
96
|
var nLen = nodes.length;
|
|
96
97
|
for (var i = 0; i < edges.length; i++) {
|
|
97
98
|
var e = edges[i];
|
|
99
|
+
if (e.ignoreForceLayout) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
98
102
|
var n1 = e.n1;
|
|
99
103
|
var n2 = e.n2;
|
|
100
104
|
|
|
@@ -156,4 +160,4 @@ export function forceLayout(nodes, edges, opts) {
|
|
|
156
160
|
cb && cb(nodes, edges, friction < 0.01);
|
|
157
161
|
}
|
|
158
162
|
};
|
|
159
|
-
}
|
|
163
|
+
}
|
|
@@ -83,11 +83,13 @@ export default function (ecModel) {
|
|
|
83
83
|
if (isNaN(d)) {
|
|
84
84
|
d = (edgeLength[0] + edgeLength[1]) / 2;
|
|
85
85
|
}
|
|
86
|
+
var edgeModel = edge.getModel();
|
|
86
87
|
return {
|
|
87
88
|
n1: nodes[edge.node1.dataIndex],
|
|
88
89
|
n2: nodes[edge.node2.dataIndex],
|
|
89
90
|
d: d,
|
|
90
|
-
curveness:
|
|
91
|
+
curveness: edgeModel.get('lineStyle.curveness') || 0,
|
|
92
|
+
ignoreForceLayout: edgeModel.get('ignoreForceLayout')
|
|
91
93
|
};
|
|
92
94
|
});
|
|
93
95
|
|
|
@@ -95,7 +97,8 @@ export default function (ecModel) {
|
|
|
95
97
|
var rect = coordSys.getBoundingRect();
|
|
96
98
|
var forceInstance = forceLayout(nodes, edges, {
|
|
97
99
|
rect: rect,
|
|
98
|
-
gravity: forceModel.get('gravity')
|
|
100
|
+
gravity: forceModel.get('gravity'),
|
|
101
|
+
friction: forceModel.get('friction')
|
|
99
102
|
});
|
|
100
103
|
var oldStep = forceInstance.step;
|
|
101
104
|
forceInstance.step = function (cb) {
|
|
@@ -147,4 +150,4 @@ export default function (ecModel) {
|
|
|
147
150
|
graphSeries.forceLayout = null;
|
|
148
151
|
}
|
|
149
152
|
});
|
|
150
|
-
}
|
|
153
|
+
}
|
|
@@ -185,10 +185,10 @@ export default echarts.extendChartView({
|
|
|
185
185
|
|
|
186
186
|
rect = new graphic.Rect({
|
|
187
187
|
shape: {
|
|
188
|
-
x: point[0] - width / 2,
|
|
189
|
-
y: point[1] - height / 2,
|
|
190
|
-
width: width,
|
|
191
|
-
height: height
|
|
188
|
+
x: Math.floor(point[0] - width / 2),
|
|
189
|
+
y: Math.floor(point[1] - height / 2),
|
|
190
|
+
width: Math.ceil(width),
|
|
191
|
+
height: Math.ceil(height)
|
|
192
192
|
},
|
|
193
193
|
style: {
|
|
194
194
|
fill: data.getItemVisual(idx, 'color'),
|
|
@@ -236,6 +236,15 @@ symbolProto._updateCommon = function (data, idx, symbolSize, seriesScope) {
|
|
|
236
236
|
strokeNoScale: true
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
|
+
else {
|
|
240
|
+
symbolPath.setStyle({
|
|
241
|
+
opacity: null,
|
|
242
|
+
shadowBlur: null,
|
|
243
|
+
shadowOffsetX: null,
|
|
244
|
+
shadowOffsetY: null,
|
|
245
|
+
shadowColor: null
|
|
246
|
+
});
|
|
247
|
+
}
|
|
239
248
|
|
|
240
249
|
var itemStyle = seriesScope && seriesScope.itemStyle;
|
|
241
250
|
var hoverItemStyle = seriesScope && seriesScope.hoverItemStyle;
|
|
@@ -24,15 +24,17 @@ import {SOURCE_FORMAT_ORIGINAL} from '../../data/helper/sourceType';
|
|
|
24
24
|
import {getDimensionTypeByAxis} from '../../data/helper/dimensionHelper';
|
|
25
25
|
import {getDataItemValue} from '../../util/model';
|
|
26
26
|
import CoordinateSystem from '../../CoordinateSystem';
|
|
27
|
-
import {
|
|
27
|
+
import {getCoordSysInfoBySeries} from '../../model/referHelper';
|
|
28
28
|
import Source from '../../data/Source';
|
|
29
29
|
import {enableDataStack} from '../../data/helper/dataStackHelper';
|
|
30
|
+
import {makeSeriesEncodeForAxisCoordSys} from '../../data/helper/sourceHelper';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* @param {module:echarts/data/Source|Array} source Or raw data.
|
|
33
34
|
* @param {module:echarts/model/Series} seriesModel
|
|
34
35
|
* @param {Object} [opt]
|
|
35
36
|
* @param {string} [opt.generateCoord]
|
|
37
|
+
* @param {boolean} [opt.useEncodeDefaulter]
|
|
36
38
|
*/
|
|
37
39
|
function createListFromArray(source, seriesModel, opt) {
|
|
38
40
|
opt = opt || {};
|
|
@@ -44,14 +46,14 @@ function createListFromArray(source, seriesModel, opt) {
|
|
|
44
46
|
var coordSysName = seriesModel.get('coordinateSystem');
|
|
45
47
|
var registeredCoordSys = CoordinateSystem.get(coordSysName);
|
|
46
48
|
|
|
47
|
-
var
|
|
49
|
+
var coordSysInfo = getCoordSysInfoBySeries(seriesModel);
|
|
48
50
|
|
|
49
51
|
var coordSysDimDefs;
|
|
50
52
|
|
|
51
|
-
if (
|
|
52
|
-
coordSysDimDefs = zrUtil.map(
|
|
53
|
+
if (coordSysInfo) {
|
|
54
|
+
coordSysDimDefs = zrUtil.map(coordSysInfo.coordSysDims, function (dim) {
|
|
53
55
|
var dimInfo = {name: dim};
|
|
54
|
-
var axisModel =
|
|
56
|
+
var axisModel = coordSysInfo.axisMap.get(dim);
|
|
55
57
|
if (axisModel) {
|
|
56
58
|
var axisType = axisModel.get('type');
|
|
57
59
|
dimInfo.type = getDimensionTypeByAxis(axisType);
|
|
@@ -72,14 +74,17 @@ function createListFromArray(source, seriesModel, opt) {
|
|
|
72
74
|
|
|
73
75
|
var dimInfoList = createDimensions(source, {
|
|
74
76
|
coordDimensions: coordSysDimDefs,
|
|
75
|
-
generateCoord: opt.generateCoord
|
|
77
|
+
generateCoord: opt.generateCoord,
|
|
78
|
+
encodeDefaulter: opt.useEncodeDefaulter
|
|
79
|
+
? zrUtil.curry(makeSeriesEncodeForAxisCoordSys, coordSysDimDefs, seriesModel)
|
|
80
|
+
: null
|
|
76
81
|
});
|
|
77
82
|
|
|
78
83
|
var firstCategoryDimIndex;
|
|
79
84
|
var hasNameEncode;
|
|
80
|
-
|
|
85
|
+
coordSysInfo && zrUtil.each(dimInfoList, function (dimInfo, dimIndex) {
|
|
81
86
|
var coordDim = dimInfo.coordDim;
|
|
82
|
-
var categoryAxisModel =
|
|
87
|
+
var categoryAxisModel = coordSysInfo.categoryAxisMap.get(coordDim);
|
|
83
88
|
if (categoryAxisModel) {
|
|
84
89
|
if (firstCategoryDimIndex == null) {
|
|
85
90
|
firstCategoryDimIndex = dimIndex;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
import createListSimply from '../helper/createListSimply';
|
|
22
22
|
import * as zrUtil from 'zrender/src/core/util';
|
|
23
23
|
import {getDimensionTypeByAxis} from '../../data/helper/dimensionHelper';
|
|
24
|
+
import {makeSeriesEncodeForAxisCoordSys} from '../../data/helper/sourceHelper';
|
|
24
25
|
|
|
25
26
|
export var seriesModelMixin = {
|
|
26
27
|
|
|
@@ -47,7 +48,7 @@ export var seriesModelMixin = {
|
|
|
47
48
|
var addOrdinal;
|
|
48
49
|
|
|
49
50
|
// FIXME
|
|
50
|
-
//
|
|
51
|
+
// Consider time axis.
|
|
51
52
|
|
|
52
53
|
if (xAxisType === 'category') {
|
|
53
54
|
option.layout = 'horizontal';
|
|
@@ -95,25 +96,29 @@ export var seriesModelMixin = {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
var defaultValueDimensions = this.defaultValueDimensions;
|
|
99
|
+
var coordDimensions = [{
|
|
100
|
+
name: baseAxisDim,
|
|
101
|
+
type: getDimensionTypeByAxis(baseAxisType),
|
|
102
|
+
ordinalMeta: ordinalMeta,
|
|
103
|
+
otherDims: {
|
|
104
|
+
tooltip: false,
|
|
105
|
+
itemName: 0
|
|
106
|
+
},
|
|
107
|
+
dimsDef: ['base']
|
|
108
|
+
}, {
|
|
109
|
+
name: otherAxisDim,
|
|
110
|
+
type: getDimensionTypeByAxis(otherAxisType),
|
|
111
|
+
dimsDef: defaultValueDimensions.slice()
|
|
112
|
+
}];
|
|
98
113
|
|
|
99
114
|
return createListSimply(
|
|
100
115
|
this,
|
|
101
116
|
{
|
|
102
|
-
coordDimensions:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
tooltip: false,
|
|
108
|
-
itemName: 0
|
|
109
|
-
},
|
|
110
|
-
dimsDef: ['base']
|
|
111
|
-
}, {
|
|
112
|
-
name: otherAxisDim,
|
|
113
|
-
type: getDimensionTypeByAxis(otherAxisType),
|
|
114
|
-
dimsDef: defaultValueDimensions.slice()
|
|
115
|
-
}],
|
|
116
|
-
dimensionsCount: defaultValueDimensions.length + 1
|
|
117
|
+
coordDimensions: coordDimensions,
|
|
118
|
+
dimensionsCount: defaultValueDimensions.length + 1,
|
|
119
|
+
encodeDefaulter: zrUtil.curry(
|
|
120
|
+
makeSeriesEncodeForAxisCoordSys, coordDimensions, this
|
|
121
|
+
)
|
|
117
122
|
}
|
|
118
123
|
);
|
|
119
124
|
},
|
|
@@ -34,7 +34,7 @@ export default SeriesModel.extend({
|
|
|
34
34
|
throw new Error('Line not support coordinateSystem besides cartesian and polar');
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
return createListFromArray(this.getSource(), this);
|
|
37
|
+
return createListFromArray(this.getSource(), this, {useEncodeDefaulter: true});
|
|
38
38
|
},
|
|
39
39
|
|
|
40
40
|
defaultOption: {
|
|
@@ -354,7 +354,7 @@ export default ChartView.extend({
|
|
|
354
354
|
// FIXME step not support polar
|
|
355
355
|
var step = !isCoordSysPolar && seriesModel.get('step');
|
|
356
356
|
var clipShapeForSymbol;
|
|
357
|
-
if (coordSys && coordSys.getArea) {
|
|
357
|
+
if (coordSys && coordSys.getArea && seriesModel.get('clip', true)) {
|
|
358
358
|
clipShapeForSymbol = coordSys.getArea();
|
|
359
359
|
// Avoid float number rounding error for symbol on the edge of axis extent.
|
|
360
360
|
// See #7913 and `test/dataZoom-clip.html`.
|
|
@@ -369,6 +369,7 @@ export default ChartView.extend({
|
|
|
369
369
|
clipShapeForSymbol.r1 += 0.5;
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
+
this._clipShapeForSymbol = clipShapeForSymbol;
|
|
372
373
|
// Initialization animation or coordinate system changed
|
|
373
374
|
if (
|
|
374
375
|
!(polyline && prevCoordSys.type === coordSys.type && step === this._step)
|
|
@@ -521,6 +522,10 @@ export default ChartView.extend({
|
|
|
521
522
|
// Null data
|
|
522
523
|
return;
|
|
523
524
|
}
|
|
525
|
+
// fix #11360: should't draw symbol outside clipShapeForSymbol
|
|
526
|
+
if (this._clipShapeForSymbol && !this._clipShapeForSymbol.contain(pt[0], pt[1])) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
524
529
|
symbol = new SymbolClz(data, dataIndex);
|
|
525
530
|
symbol.position = pt;
|
|
526
531
|
symbol.setZ(
|
|
@@ -24,6 +24,7 @@ import {encodeHTML, addCommas} from '../../util/format';
|
|
|
24
24
|
import dataSelectableMixin from '../../component/helper/selectableMixin';
|
|
25
25
|
import {retrieveRawAttr} from '../../data/helper/dataProvider';
|
|
26
26
|
import geoSourceManager from '../../coord/geo/geoSourceManager';
|
|
27
|
+
import {makeSeriesEncodeForNameBased} from '../../data/helper/sourceHelper';
|
|
27
28
|
|
|
28
29
|
var MapSeries = SeriesModel.extend({
|
|
29
30
|
|
|
@@ -46,7 +47,10 @@ var MapSeries = SeriesModel.extend({
|
|
|
46
47
|
seriesGroup: [],
|
|
47
48
|
|
|
48
49
|
getInitialData: function (option) {
|
|
49
|
-
var data = createListSimply(this,
|
|
50
|
+
var data = createListSimply(this, {
|
|
51
|
+
coordDimensions: ['value'],
|
|
52
|
+
encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this)
|
|
53
|
+
});
|
|
50
54
|
var valueDim = data.mapDimension('value');
|
|
51
55
|
var dataNameMap = zrUtil.createHashMap();
|
|
52
56
|
var selectTargetList = [];
|
|
@@ -24,6 +24,8 @@ import * as modelUtil from '../../util/model';
|
|
|
24
24
|
import {getPercentWithPrecision} from '../../util/number';
|
|
25
25
|
import dataSelectableMixin from '../../component/helper/selectableMixin';
|
|
26
26
|
import {retrieveRawAttr} from '../../data/helper/dataProvider';
|
|
27
|
+
import {makeSeriesEncodeForNameBased} from '../../data/helper/sourceHelper';
|
|
28
|
+
import LegendVisualProvider from '../../visual/LegendVisualProvider';
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
var PieSeries = echarts.extendSeriesModel({
|
|
@@ -36,9 +38,9 @@ var PieSeries = echarts.extendSeriesModel({
|
|
|
36
38
|
|
|
37
39
|
// Enable legend selection for each data item
|
|
38
40
|
// Use a function instead of direct access because data reference may changed
|
|
39
|
-
this.
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
this.legendVisualProvider = new LegendVisualProvider(
|
|
42
|
+
zrUtil.bind(this.getData, this), zrUtil.bind(this.getRawData, this)
|
|
43
|
+
);
|
|
42
44
|
|
|
43
45
|
this.updateSelectedMap(this._createSelectableList());
|
|
44
46
|
|
|
@@ -53,7 +55,10 @@ var PieSeries = echarts.extendSeriesModel({
|
|
|
53
55
|
},
|
|
54
56
|
|
|
55
57
|
getInitialData: function (option, ecModel) {
|
|
56
|
-
return createListSimply(this,
|
|
58
|
+
return createListSimply(this, {
|
|
59
|
+
coordDimensions: ['value'],
|
|
60
|
+
encodeDefaulter: zrUtil.curry(makeSeriesEncodeForNameBased, this)
|
|
61
|
+
});
|
|
57
62
|
},
|
|
58
63
|
|
|
59
64
|
_createSelectableList: function () {
|
|
@@ -142,12 +147,28 @@ var PieSeries = echarts.extendSeriesModel({
|
|
|
142
147
|
|
|
143
148
|
// cursor: null,
|
|
144
149
|
|
|
150
|
+
left: 0,
|
|
151
|
+
top: 0,
|
|
152
|
+
right: 0,
|
|
153
|
+
bottom: 0,
|
|
154
|
+
width: null,
|
|
155
|
+
height: null,
|
|
156
|
+
|
|
145
157
|
label: {
|
|
146
158
|
// If rotate around circle
|
|
147
159
|
rotate: false,
|
|
148
160
|
show: true,
|
|
149
161
|
// 'outer', 'inside', 'center'
|
|
150
|
-
position: 'outer'
|
|
162
|
+
position: 'outer',
|
|
163
|
+
// 'none', 'labelLine', 'edge'. Works only when position is 'outer'
|
|
164
|
+
alignTo: 'none',
|
|
165
|
+
// Closest distance between label and chart edge.
|
|
166
|
+
// Works only position is 'outer' and alignTo is 'edge'.
|
|
167
|
+
margin: '25%',
|
|
168
|
+
// Works only position is 'outer' and alignTo is not 'edge'.
|
|
169
|
+
bleedMargin: 10,
|
|
170
|
+
// Distance between text and label line.
|
|
171
|
+
distanceToLabelLine: 5
|
|
151
172
|
// formatter: 标签文本格式器,同Tooltip.formatter,不支持异步回调
|
|
152
173
|
// 默认使用全局文本样式,详见TEXTSTYLE
|
|
153
174
|
// distance: 当position为inner时有效,为label位置到圆心的距离与圆半径(环状图为内外半径和)的比例系数
|
package/src/chart/pie/PieView.js
CHANGED
|
@@ -273,7 +273,7 @@ piePieceProto._updateLabel = function (data, idx, withAnimation) {
|
|
|
273
273
|
{
|
|
274
274
|
labelFetcher: data.hostModel,
|
|
275
275
|
labelDataIndex: idx,
|
|
276
|
-
defaultText:
|
|
276
|
+
defaultText: labelLayout.text,
|
|
277
277
|
autoColor: visualColor,
|
|
278
278
|
useInsideStyle: !!labelLayout.inside
|
|
279
279
|
},
|