Merge branch 'NodeSelf' of https://github.com/HCLacids/echarts into HCLacids-NodeSelf
diff --git a/src/chart/graph/circularLayoutHelper.ts b/src/chart/graph/circularLayoutHelper.ts
index d2c1031..5ce5f1c 100644
--- a/src/chart/graph/circularLayoutHelper.ts
+++ b/src/chart/graph/circularLayoutHelper.ts
@@ -25,7 +25,7 @@
import List from '../../data/List';
import * as zrUtil from 'zrender/src/core/util';
import {getCurvenessForEdge} from '../helper/multipleGraphEdgeHelper';
-import {cubicPosition} from './simpleLayoutHelper'
+import {cubicPosition} from './simpleLayoutHelper';
const PI = Math.PI;
@@ -101,7 +101,7 @@
const outEdges = edge.node1.outEdges.filter((edge) => {
return edge.node1 !== edge.node2;
});
- const allNodes: GraphNode[] = []
+ const allNodes: GraphNode[] = [];
inEdges.forEach((edge) => {
allNodes.push(edge.node1);
});
@@ -114,11 +114,11 @@
let pt2: number[] = [];
if (allNodes.length > 1) {
allNodes.forEach(node => {
- let v: any[] = [];
+ const v: any[] = [];
vec2.sub(v, node.getLayout(), edge.node1.getLayout());
vec2.normalize(v, v);
vectors.push(v);
- })
+ });
// find the max angle
for (let i = 0; i < vectors.length; i++) {
for (let j = i + 1; j < vectors.length; j++) {
@@ -142,7 +142,7 @@
const v2 = [Math.cos((degree + 30) * Math.PI / 180), Math.sin((degree + 30) * Math.PI / 180)];
vec2.scaleAndAdd(v1, p1, v1, 10 * radius);
vec2.scaleAndAdd(v2, p2, v2, 10 * radius);
- cp1 = v1;
+ cp1 = v1;
cp2 = v2;
}
else {
@@ -153,8 +153,8 @@
}
}
else {
- cp1 = [p1[0] - radius * 2, p2[1] - radius * 4]
- cp2 = [p1[0] + radius * 2, p2[1] - radius * 4]
+ cp1 = [p1[0] - radius * 2, p2[1] - radius * 4];
+ cp2 = [p1[0] + radius * 2, p2[1] - radius * 4];
}
}
else if (+curveness) {
diff --git a/src/chart/graph/forceLayout.ts b/src/chart/graph/forceLayout.ts
index dc553f0..21d5aaa 100644
--- a/src/chart/graph/forceLayout.ts
+++ b/src/chart/graph/forceLayout.ts
@@ -155,7 +155,7 @@
const outEdges = edge.node1.outEdges.filter((edge) => {
return edge.node1 !== edge.node2;
});
- const allNodes: GraphNode[] = []
+ const allNodes: GraphNode[] = [];
inEdges.forEach((edge) => {
allNodes.push(edge.node1);
});
@@ -168,11 +168,11 @@
let pt2: number[] = [];
if (allNodes.length > 1) {
allNodes.forEach(node => {
- let v: any[] = [];
+ const v: any[] = [];
vec2.sub(v, node.getLayout(), edge.node1.getLayout());
vec2.normalize(v, v);
vectors.push(v);
- })
+ });
// find the max angle
for (let i = 0; i < vectors.length; i++) {
for (let j = i + 1; j < vectors.length; j++) {
@@ -187,13 +187,15 @@
if (vec2.distSquare(pt1, pt2) > Math.sqrt(3)) {
vec2.scaleAndAdd(pt1, p1, pt1, radius);
vec2.scaleAndAdd(pt2, p2, pt2, radius);
- const point1 = cubicPosition(pt1, p1, 10 * radius)
- const point2 = cubicPosition(pt2, p2, 10 * radius)
+ const point1 = cubicPosition(pt1, p1, 10 * radius);
+ const point2 = cubicPosition(pt2, p2, 10 * radius);
const mid = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
vec2.sub(mid, mid, p1);
const degree = Math.atan2(mid[1], mid[0]) / Math.PI * 180;
- const v1 = [Math.cos((degree - 30) * Math.PI / 180), Math.sin((degree - 30) * Math.PI / 180)];
- const v2 = [Math.cos((degree + 30) * Math.PI / 180), Math.sin((degree + 30) * Math.PI / 180)];
+ const v1 = [Math.cos((degree - 30) * Math.PI / 180),
+ Math.sin((degree - 30) * Math.PI / 180)];
+ const v2 = [Math.cos((degree + 30) * Math.PI / 180),
+ Math.sin((degree + 30) * Math.PI / 180)];
vec2.scaleAndAdd(v1, p1, v1, 10 * radius);
vec2.scaleAndAdd(v2, p2, v2, 10 * radius);
points[2] = v1;
@@ -209,11 +211,11 @@
else {
points[2] = [
p1[0] - radius * 4,
- p2[1] - radius * 6,
+ p2[1] - radius * 6
];
points[3] = [
p1[0] + radius * 4,
- p2[1] - radius * 6,
+ p2[1] - radius * 6
];
}
}
diff --git a/src/chart/graph/simpleLayoutHelper.ts b/src/chart/graph/simpleLayoutHelper.ts
index d43ca60..b0c54b3 100644
--- a/src/chart/graph/simpleLayoutHelper.ts
+++ b/src/chart/graph/simpleLayoutHelper.ts
@@ -70,7 +70,7 @@
const p2 = vec2.clone(edge.node2.getLayout());
const points = [p1, p2];
if (edge.node1 === edge.node2) {
- const curve = getCurvenessForEdge(edge, seriesModel, index, true)
+ const curve = getCurvenessForEdge(edge, seriesModel, index, true);
const curveness = curve >= 1 ? curve : 1 - curve;
const symbolSize = seriesModel.get('symbolSize');
const size = zrUtil.isArray(symbolSize) ? Number((symbolSize[0] + symbolSize[1]) / 2) : Number(symbolSize);
@@ -81,7 +81,7 @@
const outEdges = edge.node1.outEdges.filter((edge) => {
return edge.node1 !== edge.node2;
});
- const allNodes: GraphNode[] = []
+ const allNodes: GraphNode[] = [];
inEdges.forEach((edge) => {
allNodes.push(edge.node1);
});
@@ -94,11 +94,11 @@
let pt2: number[] = [];
if (allNodes.length > 1) {
allNodes.forEach(node => {
- let v: any[] = [];
+ const v: any[] = [];
vec2.sub(v, node.getLayout(), edge.node1.getLayout());
vec2.normalize(v, v);
vectors.push(v);
- })
+ });
// find the max angle
for (let i = 0; i < vectors.length; i++) {
for (let j = i + 1; j < vectors.length; j++) {
@@ -113,12 +113,12 @@
if (vec2.distSquare(pt1, pt2) > Math.sqrt(3)) {
vec2.scaleAndAdd(pt1, p1, pt1, radius);
vec2.scaleAndAdd(pt2, p2, pt2, radius);
- const point1 = cubicPosition(pt1, p1, 10 * radius)
- const point2 = cubicPosition(pt2, p2, 10 * radius)
+ const point1 = cubicPosition(pt1, p1, 10 * radius);
+ const point2 = cubicPosition(pt2, p2, 10 * radius);
const mid = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
vec2.sub(mid, mid, p1);
const degree = Math.atan2(mid[1], mid[0]) / Math.PI * 180;
- const v1 = [Math.cos((degree - 30) * Math.PI /180), Math.sin((degree - 30) * Math.PI / 180)];
+ const v1 = [Math.cos((degree - 30) * Math.PI / 180), Math.sin((degree - 30) * Math.PI / 180)];
const v2 = [Math.cos((degree + 30) * Math.PI / 180), Math.sin((degree + 30) * Math.PI / 180)];
vec2.scaleAndAdd(v1, p1, v1, 10 * radius);
vec2.scaleAndAdd(v2, p2, v2, 10 * radius);
@@ -134,11 +134,11 @@
else {
points.push([
p1[0] - radius * 4,
- p2[1] - radius * 6,
+ p2[1] - radius * 6
]);
points.push([
p1[0] + radius * 4,
- p2[1] - radius * 6,
+ p2[1] - radius * 6
]);
}
}
diff --git a/src/chart/helper/multipleGraphEdgeHelper.ts b/src/chart/helper/multipleGraphEdgeHelper.ts
index 87acf74..f267359 100644
--- a/src/chart/helper/multipleGraphEdgeHelper.ts
+++ b/src/chart/helper/multipleGraphEdgeHelper.ts
@@ -210,33 +210,31 @@
const curveness = curvenessList.filter(num => num > 0);
return curveness[edgeIndex];
}
- else {
- if (!edgeArray.isForward) {
- // the opposite edge show outside
- const oppositeKey = getOppositeKey(curKey);
- const len = getEdgeMapLengthWithKey(oppositeKey, seriesModel);
- const resValue = curvenessList[edgeIndex + len + parityCorrection];
- // isNeedReverse, simple, force type need reverse the curveness in the junction of the forword and the opposite
- if (needReverse) {
- // set as array may make the parity handle with the len of opposite
- if (isArrayParam) {
- if (autoCurvenessParams && autoCurvenessParams[0] === 0) {
- return (len + parityCorrection) % 2 ? resValue : -resValue;
- }
- else {
- return ((len % 2 ? 0 : 1) + parityCorrection) % 2 ? resValue : -resValue;
- }
+ else if (!edgeArray.isForward) {
+ // the opposite edge show outside
+ const oppositeKey = getOppositeKey(curKey);
+ const len = getEdgeMapLengthWithKey(oppositeKey, seriesModel);
+ const resValue = curvenessList[edgeIndex + len + parityCorrection];
+ // isNeedReverse, simple, force type need reverse the curveness in the junction of the forword and the opposite
+ if (needReverse) {
+ // set as array may make the parity handle with the len of opposite
+ if (isArrayParam) {
+ if (autoCurvenessParams && autoCurvenessParams[0] === 0) {
+ return (len + parityCorrection) % 2 ? resValue : -resValue;
}
else {
- return (len + parityCorrection) % 2 ? resValue : -resValue;
+ return ((len % 2 ? 0 : 1) + parityCorrection) % 2 ? resValue : -resValue;
}
}
else {
- return curvenessList[edgeIndex + len + parityCorrection];
+ return (len + parityCorrection) % 2 ? resValue : -resValue;
}
}
else {
- return curvenessList[parityCorrection + edgeIndex];
+ return curvenessList[edgeIndex + len + parityCorrection];
}
}
+ else {
+ return curvenessList[parityCorrection + edgeIndex];
+ }
}
\ No newline at end of file