You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by de...@apache.org on 2018/04/23 13:18:25 UTC
[incubator-echarts] branch master updated: fix when resize the
sankey view after drag the node the position of the node won't be changed
accordingly
This is an automated email from the ASF dual-hosted git repository.
deqingli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/master by this push:
new 5c1f642 fix when resize the sankey view after drag the node the position of the node won't be changed accordingly
5c1f642 is described below
commit 5c1f6423d039069b1d9f77ecb7838d9504fe5dce
Author: deqingli <an...@gmail.com>
AuthorDate: Mon Apr 23 21:17:45 2018 +0800
fix when resize the sankey view after drag the node the position of the node won't be changed accordingly
---
src/chart/sankey/SankeyView.js | 21 +++++++++++++--------
src/chart/sankey/sankeyLayout.js | 2 +-
test/{sankey-jume.html => sankey-jump.html} | 0
3 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/chart/sankey/SankeyView.js b/src/chart/sankey/SankeyView.js
index 045c3a5..180f491 100644
--- a/src/chart/sankey/SankeyView.js
+++ b/src/chart/sankey/SankeyView.js
@@ -67,6 +67,11 @@ export default echarts.extendChartView({
var graph = seriesModel.getGraph();
var group = this.group;
var layoutInfo = seriesModel.layoutInfo;
+ // view width
+ var width = layoutInfo.width;
+ // view height
+ var height = layoutInfo.height;
+
var nodeData = seriesModel.getData();
var edgeData = seriesModel.getData('edge');
@@ -96,10 +101,10 @@ export default echarts.extendChartView({
curve.shape.extent = Math.max(1, edgeLayout.dy);
- var x1 = (dragX1 != null ? dragX1 : n1Layout.x) + n1Layout.dx;
- var y1 = (dragY1 != null ? dragY1 : n1Layout.y) + edgeLayout.sy + edgeLayout.dy / 2;
- var x2 = dragX2 != null ? dragX2 : n2Layout.x;
- var y2 = (dragY2 != null ? dragY2 : n2Layout.y) + edgeLayout.ty + edgeLayout.dy / 2;
+ var x1 = (dragX1 != null ? dragX1 * width : n1Layout.x) + n1Layout.dx;
+ var y1 = (dragY1 != null ? dragY1 * height : n1Layout.y) + edgeLayout.sy + edgeLayout.dy / 2;
+ var x2 = dragX2 != null ? dragX2 * width : n2Layout.x;
+ var y2 = (dragY2 != null ? dragY2 * height : n2Layout.y) + edgeLayout.ty + edgeLayout.dy / 2;
var cpx1 = x1 * (1 - curvature) + x2 * curvature;
var cpy1 = y1;
var cpx2 = x1 * curvature + x2 * (1 - curvature);
@@ -145,8 +150,8 @@ export default echarts.extendChartView({
var rect = new graphic.Rect({
shape: {
- x: dragX != null ? dragX : layout.x,
- y: dragY != null ? dragY : layout.y,
+ x: dragX != null ? dragX * width : layout.x,
+ y: dragY != null ? dragY * height : layout.y,
width: layout.dx,
height: layout.dy
},
@@ -187,8 +192,8 @@ export default echarts.extendChartView({
type: 'dragNode',
seriesId: seriesModel.id,
dataIndex: nodeData.getRawIndex(dataIndex),
- localX: this.shape.x,
- localY: this.shape.y
+ localX: this.shape.x / width,
+ localY: this.shape.y / height
});
};
diff --git a/src/chart/sankey/sankeyLayout.js b/src/chart/sankey/sankeyLayout.js
index 64fce8e..455bb44 100644
--- a/src/chart/sankey/sankeyLayout.js
+++ b/src/chart/sankey/sankeyLayout.js
@@ -19,7 +19,7 @@
/**
* @file The layout algorithm of sankey view
- * @author Deqing Li(annong035@gmail.com)
+ * @author Deqing Li(annong035@gmail.com)
*/
import * as layout from '../../util/layout';
diff --git a/test/sankey-jume.html b/test/sankey-jump.html
similarity index 100%
rename from test/sankey-jume.html
rename to test/sankey-jump.html
--
To stop receiving notification emails like this one, please contact
deqingli@apache.org.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org