100pah commented on a change in pull request #10084: Update sankey diagram with
levels setting, reducing code size and so on.
URL:
https://github.com/apache/incubator-echarts/pull/10084#discussion_r264233572
##########
File path: src/chart/sankey/sankeyLayout.js
##########
@@ -315,32 +296,24 @@ function prepareNodesByBreadth(nodes, orient) {
* @param {number} height the whole height of the area to draw the view
* @param {number} nodeGap the vertical distance between two nodes
*/
-function initializeNodeDepth(nodes, nodesByBreadth, edges, height, width,
nodeGap, orient) {
- var kyArray = [];
+function initializeNodeDepth(nodesByBreadth, edges, height, width, nodeGap,
orient) {
+ var minKy = Infinity;
zrUtil.each(nodesByBreadth, function (nodes) {
var n = nodes.length;
var sum = 0;
- var ky = 0;
zrUtil.each(nodes, function (node) {
sum += node.getLayout().value;
});
- if (orient === 'vertical') {
- ky = (width - (n - 1) * nodeGap) / sum;
- }
- else {
- ky = (height - (n - 1) * nodeGap) / sum;
+ var ky = orient === 'vertical' ? (width - (n - 1) * nodeGap) / sum
+ : (height - (n - 1) * nodeGap) / sum;
Review comment:
code style about indent.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]