You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
In a diagram with only two stacks, I've noticed that the 'x' position of the right boxes is being wrongly calculated.
I have a 800x400 area, with the default 100 margin on each side. I'm using stack 0 and stack 1 for my boxes.
Thus, the result of the function 'Sankey.calculateXStep' would be (800 - 100 - 100) / 1 = 600.
For the boxes in stack 1 to respect the right margin, their 'x' should be exactly the result above, as both margins have been accounted for in the calculation.
However, they're being positioned on box.x = 100 + (1 * 600) = 700, as per 'Sankey.position_boxes_and_lines'.
This should probably be changed to 'box.x = this.left_margin + (x > 0 ? (x * x_step) - this.box_width : 0);', or some equivalent expression, assuming no negative stack indexes are used (not sure if this expression would work for more than two stacks).
Following is a screenshot of the issue, where you can see the left margin being respected, as opposed to the right margin.
Kind regards.
The text was updated successfully, but these errors were encountered:
Actually, I think I've figured out how to deal with more than two stacks.
The following seems to work for me.
// this.maximum_stack_x is saved when calculating x_stepbox.x=this.left_margin+(x*x_step);// just add the following (assuming the minimum stack.x is zero):if(x===this.maximum_stack_x){box.x-=this.box_width;}elseif(x>0){box.x-=this.box_width/2;}
Hello.
In a diagram with only two stacks, I've noticed that the 'x' position of the right boxes is being wrongly calculated.
I have a 800x400 area, with the default 100 margin on each side. I'm using stack 0 and stack 1 for my boxes.
Thus, the result of the function 'Sankey.calculateXStep' would be (800 - 100 - 100) / 1 = 600.
For the boxes in stack 1 to respect the right margin, their 'x' should be exactly the result above, as both margins have been accounted for in the calculation.
However, they're being positioned on box.x = 100 + (1 * 600) = 700, as per 'Sankey.position_boxes_and_lines'.
This should probably be changed to 'box.x = this.left_margin + (x > 0 ? (x * x_step) - this.box_width : 0);', or some equivalent expression, assuming no negative stack indexes are used (not sure if this expression would work for more than two stacks).
Following is a screenshot of the issue, where you can see the left margin being respected, as opposed to the right margin.
Kind regards.
The text was updated successfully, but these errors were encountered: