echarts 4.8.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/workflows/nodejs.yml +3 -1
- package/.huskyrc +5 -0
- package/README.md +1 -1
- package/asset/.DS_Store +0 -0
- package/build/.DS_Store +0 -0
- package/dist/echarts-en.common.js +284 -93
- package/dist/echarts-en.common.min.js +1 -1
- package/dist/echarts-en.js +816 -284
- package/dist/echarts-en.js.map +1 -1
- package/dist/echarts-en.min.js +1 -1
- package/dist/echarts-en.simple.js +60 -26
- package/dist/echarts-en.simple.min.js +1 -1
- package/dist/echarts.common.js +284 -93
- package/dist/echarts.common.min.js +1 -1
- package/dist/echarts.js +816 -284
- package/dist/echarts.js.map +1 -1
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +60 -26
- package/dist/echarts.simple.min.js +1 -1
- package/dist/extension/bmap.js +33 -345
- 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 -14
- package/extension-src/bmap/BMapCoordSys.js +14 -4
- package/extension-src/bmap/BMapModel.js +6 -1
- package/extension-src/bmap/BMapView.js +16 -10
- package/lib/chart/bar/BarView.js +49 -16
- package/lib/chart/bar/PictorialBarSeries.js +1 -1
- package/lib/chart/funnel/FunnelSeries.js +1 -0
- package/lib/chart/funnel/funnelLayout.js +162 -46
- package/lib/chart/graph/GraphSeries.js +12 -2
- 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/helper/Line.js +35 -9
- package/lib/chart/helper/Symbol.js +1 -1
- package/lib/chart/helper/multipleGraphEdgeHelper.js +258 -0
- package/lib/chart/lines/LinesSeries.js +0 -2
- package/lib/chart/map/MapSeries.js +3 -2
- package/lib/chart/radar/RadarSeries.js +4 -3
- package/lib/chart/radar/RadarView.js +3 -1
- package/lib/chart/sunburst/SunburstPiece.js +4 -1
- package/lib/chart/sunburst/SunburstSeries.js +17 -5
- package/lib/chart/themeRiver/ThemeRiverSeries.js +21 -30
- package/lib/chart/tree/TreeSeries.js +1 -1
- package/lib/chart/tree/TreeView.js +4 -4
- package/lib/chart/treemap/TreemapSeries.js +14 -5
- package/lib/chart/treemap/treemapLayout.js +1 -1
- package/lib/chart/treemap/treemapVisual.js +9 -15
- package/lib/component/axisPointer/axisTrigger.js +1 -1
- package/lib/component/legend/ScrollableLegendView.js +1 -1
- package/lib/component/marker/MarkAreaView.js +53 -15
- 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/timeline/SliderTimelineView.js +7 -1
- package/lib/component/title.js +1 -1
- package/lib/component/toolbox/feature/DataView.js +23 -8
- package/lib/component/toolbox/feature/DataZoom.js +6 -6
- package/lib/component/toolbox/feature/SaveAsImage.js +2 -1
- package/lib/component/tooltip/TooltipContent.js +42 -8
- package/lib/component/tooltip/TooltipRichContent.js +56 -8
- package/lib/component/tooltip/TooltipView.js +4 -4
- package/lib/component/visualMap/VisualMapModel.js +1 -1
- package/lib/coord/axisDefault.js +1 -1
- package/lib/coord/axisHelper.js +2 -2
- package/lib/coord/geo/GeoModel.js +2 -1
- package/lib/data/Graph.js +1 -6
- package/lib/data/List.js +1 -1
- package/lib/data/Tree.js +4 -31
- package/lib/echarts.js +2 -2
- package/lib/layout/barPolar.js +1 -1
- package/lib/processor/dataSample.js +1 -1
- package/lib/stream/Scheduler.js +1 -1
- package/lib/visual/VisualMapping.js +1 -1
- package/map/.DS_Store +0 -0
- package/map/js/.DS_Store +0 -0
- package/map/js/province/.DS_Store +0 -0
- package/map/json/.DS_Store +0 -0
- package/package.json +3 -2
- package/src/.DS_Store +0 -0
- package/src/chart/.DS_Store +0 -0
- package/src/chart/bar/BarView.js +50 -16
- package/src/chart/bar/PictorialBarSeries.js +2 -2
- package/src/chart/funnel/FunnelSeries.js +1 -0
- package/src/chart/funnel/funnelLayout.js +179 -53
- package/src/chart/graph/GraphSeries.js +9 -3
- 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/helper/Line.js +38 -11
- package/src/chart/helper/Symbol.js +2 -2
- package/src/chart/helper/createGraphFromNodeEdge.js +2 -1
- package/src/chart/helper/multipleGraphEdgeHelper.js +229 -0
- package/src/chart/lines/LinesSeries.js +1 -3
- package/src/chart/map/MapSeries.js +3 -2
- package/src/chart/radar/RadarSeries.js +4 -3
- package/src/chart/radar/RadarView.js +4 -2
- package/src/chart/sunburst/SunburstPiece.js +5 -1
- package/src/chart/sunburst/SunburstSeries.js +16 -8
- package/src/chart/themeRiver/ThemeRiverSeries.js +21 -27
- package/src/chart/tree/TreeSeries.js +1 -1
- package/src/chart/tree/TreeView.js +3 -3
- package/src/chart/treemap/TreemapSeries.js +11 -3
- package/src/chart/treemap/treemapLayout.js +2 -2
- package/src/chart/treemap/treemapVisual.js +8 -25
- package/src/component/axisPointer/axisTrigger.js +1 -1
- package/src/component/legend/ScrollableLegendView.js +1 -1
- package/src/component/marker/MarkAreaView.js +53 -15
- 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/timeline/SliderTimelineView.js +9 -6
- package/src/component/title.js +2 -2
- package/src/component/toolbox/.DS_Store +0 -0
- package/src/component/toolbox/feature/DataView.js +20 -8
- package/src/component/toolbox/feature/DataZoom.js +6 -6
- package/src/component/toolbox/feature/SaveAsImage.js +2 -1
- package/src/component/tooltip/TooltipContent.js +36 -7
- package/src/component/tooltip/TooltipRichContent.js +52 -9
- package/src/component/tooltip/TooltipView.js +4 -4
- package/src/component/visualMap/VisualMapModel.js +1 -1
- package/src/coord/axisDefault.js +1 -1
- package/src/coord/axisHelper.js +4 -2
- package/src/coord/geo/GeoModel.js +3 -6
- package/src/data/Graph.js +0 -5
- package/src/data/List.js +1 -1
- package/src/data/Tree.js +4 -32
- package/src/echarts.js +2 -2
- package/src/layout/barPolar.js +4 -2
- package/src/model/.DS_Store +0 -0
- package/src/preprocessor/.DS_Store +0 -0
- package/src/processor/dataSample.js +1 -1
- package/src/stream/Scheduler.js +1 -1
- package/src/util/.DS_Store +0 -0
- package/src/visual/VisualMapping.js +1 -1
- package/theme/.DS_Store +0 -0
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
* under the License.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
var _config = require("../../config");
|
|
22
|
+
|
|
23
|
+
var __DEV__ = _config.__DEV__;
|
|
24
|
+
|
|
21
25
|
var layout = require("../../util/layout");
|
|
22
26
|
|
|
23
27
|
var _number = require("../../util/number");
|
|
@@ -79,6 +83,7 @@ function labelLayout(data) {
|
|
|
79
83
|
var itemModel = data.getItemModel(idx);
|
|
80
84
|
var labelModel = itemModel.getModel('label');
|
|
81
85
|
var labelPosition = labelModel.get('position');
|
|
86
|
+
var orient = itemModel.get('orient');
|
|
82
87
|
var labelLineModel = itemModel.getModel('labelLine');
|
|
83
88
|
var layout = data.getItemLayout(idx);
|
|
84
89
|
var points = layout.points;
|
|
@@ -108,6 +113,7 @@ function labelLayout(data) {
|
|
|
108
113
|
var x1;
|
|
109
114
|
var y1;
|
|
110
115
|
var x2;
|
|
116
|
+
var y2;
|
|
111
117
|
var labelLineLen = labelLineModel.get('length');
|
|
112
118
|
|
|
113
119
|
if (labelPosition === 'left') {
|
|
@@ -124,46 +130,101 @@ function labelLayout(data) {
|
|
|
124
130
|
x2 = x1 + labelLineLen;
|
|
125
131
|
textX = x2 + 5;
|
|
126
132
|
textAlign = 'left';
|
|
133
|
+
} else if (labelPosition === 'top') {
|
|
134
|
+
// Top side
|
|
135
|
+
x1 = (points[3][0] + points[0][0]) / 2;
|
|
136
|
+
y1 = (points[3][1] + points[0][1]) / 2;
|
|
137
|
+
y2 = y1 - labelLineLen;
|
|
138
|
+
textY = y2 - 5;
|
|
139
|
+
textAlign = 'center';
|
|
140
|
+
} else if (labelPosition === 'bottom') {
|
|
141
|
+
// Bottom side
|
|
142
|
+
x1 = (points[1][0] + points[2][0]) / 2;
|
|
143
|
+
y1 = (points[1][1] + points[2][1]) / 2;
|
|
144
|
+
y2 = y1 + labelLineLen;
|
|
145
|
+
textY = y2 + 5;
|
|
146
|
+
textAlign = 'center';
|
|
127
147
|
} else if (labelPosition === 'rightTop') {
|
|
128
148
|
// RightTop side
|
|
129
|
-
x1 = points[1][0];
|
|
130
|
-
y1 = points[1][1];
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
149
|
+
x1 = orient === 'horizontal' ? points[3][0] : points[1][0];
|
|
150
|
+
y1 = orient === 'horizontal' ? points[3][1] : points[1][1];
|
|
151
|
+
|
|
152
|
+
if (orient === 'horizontal') {
|
|
153
|
+
y2 = y1 - labelLineLen;
|
|
154
|
+
textY = y2 - 5;
|
|
155
|
+
textAlign = 'center';
|
|
156
|
+
} else {
|
|
157
|
+
x2 = x1 + labelLineLen;
|
|
158
|
+
textX = x2 + 5;
|
|
159
|
+
textAlign = 'top';
|
|
160
|
+
}
|
|
134
161
|
} else if (labelPosition === 'rightBottom') {
|
|
135
162
|
// RightBottom side
|
|
136
163
|
x1 = points[2][0];
|
|
137
164
|
y1 = points[2][1];
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
165
|
+
|
|
166
|
+
if (orient === 'horizontal') {
|
|
167
|
+
y2 = y1 + labelLineLen;
|
|
168
|
+
textY = y2 + 5;
|
|
169
|
+
textAlign = 'center';
|
|
170
|
+
} else {
|
|
171
|
+
x2 = x1 + labelLineLen;
|
|
172
|
+
textX = x2 + 5;
|
|
173
|
+
textAlign = 'bottom';
|
|
174
|
+
}
|
|
141
175
|
} else if (labelPosition === 'leftTop') {
|
|
142
176
|
// LeftTop side
|
|
143
177
|
x1 = points[0][0];
|
|
144
|
-
y1 = points[1][1];
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
178
|
+
y1 = orient === 'horizontal' ? points[0][1] : points[1][1];
|
|
179
|
+
|
|
180
|
+
if (orient === 'horizontal') {
|
|
181
|
+
y2 = y1 - labelLineLen;
|
|
182
|
+
textY = y2 - 5;
|
|
183
|
+
textAlign = 'center';
|
|
184
|
+
} else {
|
|
185
|
+
x2 = x1 - labelLineLen;
|
|
186
|
+
textX = x2 - 5;
|
|
187
|
+
textAlign = 'right';
|
|
188
|
+
}
|
|
148
189
|
} else if (labelPosition === 'leftBottom') {
|
|
149
190
|
// LeftBottom side
|
|
150
|
-
x1 = points[3][0];
|
|
151
|
-
y1 = points[2][1];
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
191
|
+
x1 = orient === 'horizontal' ? points[1][0] : points[3][0];
|
|
192
|
+
y1 = orient === 'horizontal' ? points[1][1] : points[2][1];
|
|
193
|
+
|
|
194
|
+
if (orient === 'horizontal') {
|
|
195
|
+
y2 = y1 + labelLineLen;
|
|
196
|
+
textY = y2 + 5;
|
|
197
|
+
textAlign = 'center';
|
|
198
|
+
} else {
|
|
199
|
+
x2 = x1 - labelLineLen;
|
|
200
|
+
textX = x2 - 5;
|
|
201
|
+
textAlign = 'right';
|
|
202
|
+
}
|
|
155
203
|
} else {
|
|
156
|
-
// Right side
|
|
204
|
+
// Right side or Bottom side
|
|
157
205
|
x1 = (points[1][0] + points[2][0]) / 2;
|
|
158
206
|
y1 = (points[1][1] + points[2][1]) / 2;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
207
|
+
|
|
208
|
+
if (orient === 'horizontal') {
|
|
209
|
+
y2 = y1 + labelLineLen;
|
|
210
|
+
textY = y2 + 5;
|
|
211
|
+
textAlign = 'center';
|
|
212
|
+
} else {
|
|
213
|
+
x2 = x1 + labelLineLen;
|
|
214
|
+
textX = x2 + 5;
|
|
215
|
+
textAlign = 'left';
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (orient === 'horizontal') {
|
|
220
|
+
x2 = x1;
|
|
221
|
+
textX = x2;
|
|
222
|
+
} else {
|
|
223
|
+
y2 = y1;
|
|
224
|
+
textY = y2;
|
|
162
225
|
}
|
|
163
226
|
|
|
164
|
-
var y2 = y1;
|
|
165
227
|
linePoints = [[x1, y1], [x2, y2]];
|
|
166
|
-
textY = y2;
|
|
167
228
|
}
|
|
168
229
|
|
|
169
230
|
layout.label = {
|
|
@@ -184,7 +245,12 @@ function _default(ecModel, api, payload) {
|
|
|
184
245
|
var sort = seriesModel.get('sort');
|
|
185
246
|
var viewRect = getViewRect(seriesModel, api);
|
|
186
247
|
var indices = getSortedIndices(data, sort);
|
|
187
|
-
var
|
|
248
|
+
var orient = seriesModel.get('orient');
|
|
249
|
+
var viewWidth = viewRect.width;
|
|
250
|
+
var viewHeight = viewRect.height;
|
|
251
|
+
var x = viewRect.x;
|
|
252
|
+
var y = viewRect.y;
|
|
253
|
+
var sizeExtent = orient === 'horizontal' ? [parsePercent(seriesModel.get('minSize'), viewHeight), parsePercent(seriesModel.get('maxSize'), viewHeight)] : [parsePercent(seriesModel.get('minSize'), viewWidth), parsePercent(seriesModel.get('maxSize'), viewWidth)];
|
|
188
254
|
var dataExtent = data.getDataExtent(valueDim);
|
|
189
255
|
var min = seriesModel.get('min');
|
|
190
256
|
var max = seriesModel.get('max');
|
|
@@ -199,37 +265,65 @@ function _default(ecModel, api, payload) {
|
|
|
199
265
|
|
|
200
266
|
var funnelAlign = seriesModel.get('funnelAlign');
|
|
201
267
|
var gap = seriesModel.get('gap');
|
|
202
|
-
var
|
|
203
|
-
var
|
|
268
|
+
var viewSize = orient === 'horizontal' ? viewWidth : viewHeight;
|
|
269
|
+
var itemSize = (viewSize - gap * (data.count() - 1)) / data.count();
|
|
204
270
|
|
|
205
|
-
var getLinePoints = function (idx,
|
|
271
|
+
var getLinePoints = function (idx, offset) {
|
|
206
272
|
// End point index is data.count() and we assign it 0
|
|
273
|
+
if (orient === 'horizontal') {
|
|
274
|
+
var val = data.get(valueDim, idx) || 0;
|
|
275
|
+
var itemHeight = linearMap(val, [min, max], sizeExtent, true);
|
|
276
|
+
var y0;
|
|
277
|
+
|
|
278
|
+
switch (funnelAlign) {
|
|
279
|
+
case 'top':
|
|
280
|
+
y0 = y;
|
|
281
|
+
break;
|
|
282
|
+
|
|
283
|
+
case 'center':
|
|
284
|
+
y0 = y + (viewHeight - itemHeight) / 2;
|
|
285
|
+
break;
|
|
286
|
+
|
|
287
|
+
case 'bottom':
|
|
288
|
+
y0 = y + (viewHeight - itemHeight);
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return [[offset, y0], [offset, y0 + itemHeight]];
|
|
293
|
+
}
|
|
294
|
+
|
|
207
295
|
var val = data.get(valueDim, idx) || 0;
|
|
208
296
|
var itemWidth = linearMap(val, [min, max], sizeExtent, true);
|
|
209
297
|
var x0;
|
|
210
298
|
|
|
211
299
|
switch (funnelAlign) {
|
|
212
300
|
case 'left':
|
|
213
|
-
x0 =
|
|
301
|
+
x0 = x;
|
|
214
302
|
break;
|
|
215
303
|
|
|
216
304
|
case 'center':
|
|
217
|
-
x0 =
|
|
305
|
+
x0 = x + (viewWidth - itemWidth) / 2;
|
|
218
306
|
break;
|
|
219
307
|
|
|
220
308
|
case 'right':
|
|
221
|
-
x0 =
|
|
309
|
+
x0 = x + viewWidth - itemWidth;
|
|
222
310
|
break;
|
|
223
311
|
}
|
|
224
312
|
|
|
225
|
-
return [[x0,
|
|
313
|
+
return [[x0, offset], [x0 + itemWidth, offset]];
|
|
226
314
|
};
|
|
227
315
|
|
|
228
316
|
if (sort === 'ascending') {
|
|
229
317
|
// From bottom to top
|
|
230
|
-
|
|
318
|
+
itemSize = -itemSize;
|
|
231
319
|
gap = -gap;
|
|
232
|
-
|
|
320
|
+
|
|
321
|
+
if (orient === 'horizontal') {
|
|
322
|
+
x += viewWidth;
|
|
323
|
+
} else {
|
|
324
|
+
y += viewHeight;
|
|
325
|
+
}
|
|
326
|
+
|
|
233
327
|
indices = indices.reverse();
|
|
234
328
|
}
|
|
235
329
|
|
|
@@ -237,24 +331,46 @@ function _default(ecModel, api, payload) {
|
|
|
237
331
|
var idx = indices[i];
|
|
238
332
|
var nextIdx = indices[i + 1];
|
|
239
333
|
var itemModel = data.getItemModel(idx);
|
|
240
|
-
var height = itemModel.get('itemStyle.height');
|
|
241
334
|
|
|
242
|
-
if (
|
|
243
|
-
|
|
335
|
+
if (orient === 'horizontal') {
|
|
336
|
+
var width = itemModel.get('itemStyle.width');
|
|
337
|
+
|
|
338
|
+
if (width == null) {
|
|
339
|
+
width = itemSize;
|
|
340
|
+
} else {
|
|
341
|
+
width = parsePercent(width, viewWidth);
|
|
342
|
+
|
|
343
|
+
if (sort === 'ascending') {
|
|
344
|
+
width = -width;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
var start = getLinePoints(idx, x);
|
|
349
|
+
var end = getLinePoints(nextIdx, x + width);
|
|
350
|
+
x += width + gap;
|
|
351
|
+
data.setItemLayout(idx, {
|
|
352
|
+
points: start.concat(end.slice().reverse())
|
|
353
|
+
});
|
|
244
354
|
} else {
|
|
245
|
-
height =
|
|
355
|
+
var height = itemModel.get('itemStyle.height');
|
|
246
356
|
|
|
247
|
-
if (
|
|
248
|
-
height =
|
|
357
|
+
if (height == null) {
|
|
358
|
+
height = itemSize;
|
|
359
|
+
} else {
|
|
360
|
+
height = parsePercent(height, viewHeight);
|
|
361
|
+
|
|
362
|
+
if (sort === 'ascending') {
|
|
363
|
+
height = -height;
|
|
364
|
+
}
|
|
249
365
|
}
|
|
250
|
-
}
|
|
251
366
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
367
|
+
var start = orient === 'horizontal' ? getLinePoints(idx, x) : getLinePoints(idx, y);
|
|
368
|
+
var end = orient === 'horizontal' ? getLinePoints(nextIdx, x + width) : getLinePoints(nextIdx, y + height);
|
|
369
|
+
y += height + gap;
|
|
370
|
+
data.setItemLayout(idx, {
|
|
371
|
+
points: start.concat(end.slice().reverse())
|
|
372
|
+
});
|
|
373
|
+
}
|
|
258
374
|
}
|
|
259
375
|
|
|
260
376
|
labelLayout(data);
|
|
@@ -38,6 +38,11 @@ var createGraphFromNodeEdge = require("../helper/createGraphFromNodeEdge");
|
|
|
38
38
|
|
|
39
39
|
var LegendVisualProvider = require("../../visual/LegendVisualProvider");
|
|
40
40
|
|
|
41
|
+
var _multipleGraphEdgeHelper = require("../helper/multipleGraphEdgeHelper");
|
|
42
|
+
|
|
43
|
+
var initCurvenessList = _multipleGraphEdgeHelper.initCurvenessList;
|
|
44
|
+
var createEdgeMapForCurveness = _multipleGraphEdgeHelper.createEdgeMapForCurveness;
|
|
45
|
+
|
|
41
46
|
/*
|
|
42
47
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
43
48
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -88,7 +93,13 @@ var GraphSeries = echarts.extendSeriesModel({
|
|
|
88
93
|
var self = this;
|
|
89
94
|
|
|
90
95
|
if (nodes && edges) {
|
|
91
|
-
|
|
96
|
+
// auto curveness
|
|
97
|
+
initCurvenessList(this);
|
|
98
|
+
var graph = createGraphFromNodeEdge(nodes, edges, this, true, beforeLink);
|
|
99
|
+
zrUtil.each(graph.edges, function (edge) {
|
|
100
|
+
createEdgeMapForCurveness(edge.node1, edge.node2, this, edge.dataIndex);
|
|
101
|
+
}, this);
|
|
102
|
+
return graph.data;
|
|
92
103
|
}
|
|
93
104
|
|
|
94
105
|
function beforeLink(nodeData, edgeData) {
|
|
@@ -265,7 +276,6 @@ var GraphSeries = echarts.extendSeriesModel({
|
|
|
265
276
|
lineStyle: {
|
|
266
277
|
color: '#aaa',
|
|
267
278
|
width: 1,
|
|
268
|
-
curveness: 0,
|
|
269
279
|
opacity: 0.5
|
|
270
280
|
},
|
|
271
281
|
emphasis: {
|
|
@@ -25,6 +25,12 @@ var _graphHelper = require("./graphHelper");
|
|
|
25
25
|
var getSymbolSize = _graphHelper.getSymbolSize;
|
|
26
26
|
var getNodeGlobalScale = _graphHelper.getNodeGlobalScale;
|
|
27
27
|
|
|
28
|
+
var zrUtil = require("zrender/lib/core/util");
|
|
29
|
+
|
|
30
|
+
var _multipleGraphEdgeHelper = require("../helper/multipleGraphEdgeHelper");
|
|
31
|
+
|
|
32
|
+
var getCurvenessForEdge = _multipleGraphEdgeHelper.getCurvenessForEdge;
|
|
33
|
+
|
|
28
34
|
/*
|
|
29
35
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
30
36
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -93,8 +99,8 @@ function circularLayout(seriesModel, basedOn) {
|
|
|
93
99
|
|
|
94
100
|
_layoutNodesBasedOn[basedOn](seriesModel, coordSys, graph, nodeData, r, cx, cy, count);
|
|
95
101
|
|
|
96
|
-
graph.eachEdge(function (edge) {
|
|
97
|
-
var curveness = edge.getModel().get('lineStyle.curveness')
|
|
102
|
+
graph.eachEdge(function (edge, index) {
|
|
103
|
+
var curveness = zrUtil.retrieve3(edge.getModel().get('lineStyle.curveness'), getCurvenessForEdge(edge, seriesModel, index), 0);
|
|
98
104
|
var p1 = vec2.clone(edge.node1.getLayout());
|
|
99
105
|
var p2 = vec2.clone(edge.node2.getLayout());
|
|
100
106
|
var cp1;
|
|
@@ -38,6 +38,10 @@ var vec2 = require("zrender/lib/core/vector");
|
|
|
38
38
|
|
|
39
39
|
var zrUtil = require("zrender/lib/core/util");
|
|
40
40
|
|
|
41
|
+
var _multipleGraphEdgeHelper = require("../helper/multipleGraphEdgeHelper");
|
|
42
|
+
|
|
43
|
+
var getCurvenessForEdge = _multipleGraphEdgeHelper.getCurvenessForEdge;
|
|
44
|
+
|
|
41
45
|
/*
|
|
42
46
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
43
47
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -123,11 +127,12 @@ function _default(ecModel) {
|
|
|
123
127
|
}
|
|
124
128
|
|
|
125
129
|
var edgeModel = edge.getModel();
|
|
130
|
+
var curveness = zrUtil.retrieve3(edgeModel.get('lineStyle.curveness'), -getCurvenessForEdge(edge, graphSeries, idx, true), 0);
|
|
126
131
|
return {
|
|
127
132
|
n1: nodes[edge.node1.dataIndex],
|
|
128
133
|
n2: nodes[edge.node2.dataIndex],
|
|
129
134
|
d: d,
|
|
130
|
-
curveness:
|
|
135
|
+
curveness: curveness,
|
|
131
136
|
ignoreForceLayout: edgeModel.get('ignoreForceLayout')
|
|
132
137
|
};
|
|
133
138
|
});
|
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
|
|
21
21
|
var vec2 = require("zrender/lib/core/vector");
|
|
22
22
|
|
|
23
|
+
var zrUtil = require("zrender/lib/core/util");
|
|
24
|
+
|
|
25
|
+
var _multipleGraphEdgeHelper = require("../helper/multipleGraphEdgeHelper");
|
|
26
|
+
|
|
27
|
+
var getCurvenessForEdge = _multipleGraphEdgeHelper.getCurvenessForEdge;
|
|
28
|
+
|
|
23
29
|
/*
|
|
24
30
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
25
31
|
* or more contributor license agreements. See the NOTICE file
|
|
@@ -50,12 +56,12 @@ function simpleLayout(seriesModel) {
|
|
|
50
56
|
var model = node.getModel();
|
|
51
57
|
node.setLayout([+model.get('x'), +model.get('y')]);
|
|
52
58
|
});
|
|
53
|
-
simpleLayoutEdge(graph);
|
|
59
|
+
simpleLayoutEdge(graph, seriesModel);
|
|
54
60
|
}
|
|
55
61
|
|
|
56
|
-
function simpleLayoutEdge(graph) {
|
|
57
|
-
graph.eachEdge(function (edge) {
|
|
58
|
-
var curveness = edge.getModel().get('lineStyle.curveness')
|
|
62
|
+
function simpleLayoutEdge(graph, seriesModel) {
|
|
63
|
+
graph.eachEdge(function (edge, index) {
|
|
64
|
+
var curveness = zrUtil.retrieve3(edge.getModel().get('lineStyle.curveness'), -getCurvenessForEdge(edge, seriesModel, index, true), 0);
|
|
59
65
|
var p1 = vec2.clone(edge.node1.getLayout());
|
|
60
66
|
var p2 = vec2.clone(edge.node2.getLayout());
|
|
61
67
|
var points = [p1, p2];
|
package/lib/chart/helper/Line.js
CHANGED
|
@@ -65,19 +65,23 @@ function makeSymbolTypeKey(symbolCategory) {
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
function createSymbol(name, lineData, idx) {
|
|
68
|
-
var color = lineData.getItemVisual(idx, 'color');
|
|
69
68
|
var symbolType = lineData.getItemVisual(idx, name);
|
|
70
|
-
var symbolSize = lineData.getItemVisual(idx, name + 'Size');
|
|
71
69
|
|
|
72
70
|
if (!symbolType || symbolType === 'none') {
|
|
73
71
|
return;
|
|
74
72
|
}
|
|
75
73
|
|
|
74
|
+
var color = lineData.getItemVisual(idx, 'color');
|
|
75
|
+
var symbolSize = lineData.getItemVisual(idx, name + 'Size');
|
|
76
|
+
var symbolRotate = lineData.getItemVisual(idx, name + 'Rotate');
|
|
77
|
+
|
|
76
78
|
if (!zrUtil.isArray(symbolSize)) {
|
|
77
79
|
symbolSize = [symbolSize, symbolSize];
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
var symbolPath = symbolUtil.createSymbol(symbolType, -symbolSize[0] / 2, -symbolSize[1] / 2, symbolSize[0], symbolSize[1], color);
|
|
82
|
+
var symbolPath = symbolUtil.createSymbol(symbolType, -symbolSize[0] / 2, -symbolSize[1] / 2, symbolSize[0], symbolSize[1], color); // rotate by default if symbolRotate is not specified or NaN
|
|
83
|
+
|
|
84
|
+
symbolPath.__specifiedRotation = symbolRotate == null || isNaN(symbolRotate) ? void 0 : +symbolRotate * Math.PI / 180 || 0;
|
|
81
85
|
symbolPath.name = name;
|
|
82
86
|
return symbolPath;
|
|
83
87
|
}
|
|
@@ -143,16 +147,38 @@ function updateSymbolAndLabelBeforeLineUpdate() {
|
|
|
143
147
|
vector.normalize(d, d);
|
|
144
148
|
|
|
145
149
|
if (symbolFrom) {
|
|
146
|
-
symbolFrom.attr('position', fromPos);
|
|
147
|
-
|
|
148
|
-
|
|
150
|
+
symbolFrom.attr('position', fromPos); // Fix #12388
|
|
151
|
+
// when symbol is set to be 'arrow' in markLine,
|
|
152
|
+
// symbolRotate value will be ignored, and compulsively use tangent angle.
|
|
153
|
+
// rotate by default if symbol rotation is not specified
|
|
154
|
+
|
|
155
|
+
var specifiedRotation = symbolFrom.__specifiedRotation;
|
|
156
|
+
|
|
157
|
+
if (specifiedRotation == null) {
|
|
158
|
+
var tangent = line.tangentAt(0);
|
|
159
|
+
symbolFrom.attr('rotation', Math.PI / 2 - Math.atan2(tangent[1], tangent[0]));
|
|
160
|
+
} else {
|
|
161
|
+
symbolFrom.attr('rotation', specifiedRotation);
|
|
162
|
+
}
|
|
163
|
+
|
|
149
164
|
symbolFrom.attr('scale', [invScale * percent, invScale * percent]);
|
|
150
165
|
}
|
|
151
166
|
|
|
152
167
|
if (symbolTo) {
|
|
153
|
-
symbolTo.attr('position', toPos);
|
|
154
|
-
|
|
155
|
-
|
|
168
|
+
symbolTo.attr('position', toPos); // Fix #12388
|
|
169
|
+
// when symbol is set to be 'arrow' in markLine,
|
|
170
|
+
// symbolRotate value will be ignored, and compulsively use tangent angle.
|
|
171
|
+
// rotate by default if symbol rotation is not specified
|
|
172
|
+
|
|
173
|
+
var specifiedRotation = symbolTo.__specifiedRotation;
|
|
174
|
+
|
|
175
|
+
if (specifiedRotation == null) {
|
|
176
|
+
var tangent = line.tangentAt(1);
|
|
177
|
+
symbolTo.attr('rotation', -Math.PI / 2 - Math.atan2(tangent[1], tangent[0]));
|
|
178
|
+
} else {
|
|
179
|
+
symbolTo.attr('rotation', specifiedRotation);
|
|
180
|
+
}
|
|
181
|
+
|
|
156
182
|
symbolTo.attr('scale', [invScale * percent, invScale * percent]);
|
|
157
183
|
}
|
|
158
184
|
|