[Bug]: Sankey Diagram Poor Mouse Hover Performance for Complex Diagrams
Library
React / v8 (@fluentui/react)
System Info
System:
OS: Windows 11 10.0.22631
CPU: (16) x64 AMD EPYC 7763 64-Core Processor
Memory: 36.35 GB / 63.95 GB
Browsers:
Edge: Chromium (119.0.2151.97), ChromiumDev (121.0.2248.1)
Internet Explorer: 11.0.22621.1
Are you reporting Accessibility issue?
None
Reproduction
https://msazure.visualstudio.com/DefaultCollection/One/_git/AD-ISP-UX-ConditionalAccess/
Bug Description
Actual Behavior
The UX is sluggish to respond to mouse movements within the Sankey Diagram. In particular, when I move the mouse it might take a visible fraction of a second to highlight the Link that the mouse is over.
In the example data, this is particularly prominent if the mouse hovers over links that are at the far right of the rendered diagram. The left-hand links appear to respond more quickly (although still a little sluggish) than the links on the right-hand side of the diagram. On a relatively powerful machine, the example data below appears to have a 1/4 to 1/2 second delay from mouse movement to UX reflecting the hovered-over link.
Expected Behavior
I expect the hit testing code to be fast so that the UX can highlight links instantly within the UX. My suspicion is that the underlying code just keeps a list of nodes rendered on the screen and as the mouse moves the code does a simple hit-test on each node in the list. However, performing a hit-test on a link will be slow because of the complicated computation related to the inside/outside test for the shape of the link (the swoop).
A simple way to speed this hit-test code up would be to perform a bounds check on the element before performing the more-complicated inside/outside test. Just taking the bounding box of the element (upper-left corner, width, and height) would be a simple test which if failed would allow the hit-test code to move onto the next element in the list. The vast majority of the elements would fail the simple bounding-box test. Only the elements which pass the bounding-box test would then perform the more-complex inside/outside test.
Such an approach may give the performance we need for this particular UX.
If such an approach is not sufficient to give the performance needed, then a deeper optimization would be breaking the UX into high-level boxes and placing each element into the high-level box its bounding box overlaps with. For example, break the whole control into 50 pixel by 50 pixel boxes. Each box would have a list of controls which overlap with that high-level box. Then each element would be placed in the lists of each high-level box. At hit-test time, the hit-test code would find the high-level box the mouse is over and then loop through the elements contained within that high-level box (again, using a quick bounding-box test followed by a deeper inside/outside check).
Example Data
Nodes:
[
{
"nodeId": 0,
"name": "Sign-ins"
},
{
"nodeId": 1,
"name": "United States"
},
{
"nodeId": 2,
"name": "Great Britan"
},
{
"nodeId": 3,
"name": "Canada"
},
{
"nodeId": 4,
"name": "Japan"
},
{
"nodeId": 5,
"name": "China"
},
{
"nodeId": 6,
"name": "South Korea"
},
{
"nodeId": 7,
"name": "Mexico"
},
{
"nodeId": 8,
"name": "Other"
},
{
"nodeId": 9,
"name": "Windows"
},
{
"nodeId": 10,
"name": "Macintosh"
},
{
"nodeId": 11,
"name": "iPhone/iPad"
},
{
"nodeId": 12,
"name": "Android"
},
{
"nodeId": 13,
"name": "Linux"
},
{
"nodeId": 14,
"name": "Other"
},
{
"nodeId": 15,
"name": "First Application"
},
{
"nodeId": 16,
"name": "Second Application"
},
{
"nodeId": 17,
"name": "Third Application"
},
{
"nodeId": 18,
"name": "Fourth Application"
},
{
"nodeId": 19,
"name": "Fifth Application"
},
{
"nodeId": 20,
"name": "Sixth Application"
},
{
"nodeId": 21,
"name": "Seventh Application"
},
{
"nodeId": 22,
"name": "Other"
},
{
"nodeId": 23,
"name": "All conditional access controls satisfied"
},
{
"nodeId": 24,
"name": "All conditional access controls not satisfied"
},
{
"nodeId": 25,
"name": "Conditional access not applied"
}
]
Links
[
{
"source": 0,
"target": 1,
"value": 56259,
"unnormalizedValue": 56259
},
{
"source": 0,
"target": 2,
"value": 18563,
"unnormalizedValue": 18563
},
{
"source": 0,
"target": 3,
"value": 6023,
"unnormalizedValue": 6023
},
{
"source": 0,
"target": 4,
"value": 1881,
"unnormalizedValue": 1881
},
{
"source": 0,
"target": 5,
"value": 532,
"unnormalizedValue": 532
},
{
"source": 0,
"target": 6,
"value": 114,
"unnormalizedValue": 114
},
{
"source": 0,
"target": 7,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 0,
"target": 8,
"value": 14592,
"unnormalizedValue": 14592
},
{
"source": 1,
"target": 9,
"value": 32015,
"unnormalizedValue": 32015
},
{
"source": 1,
"target": 10,
"value": 10621,
"unnormalizedValue": 10621
},
{
"source": 1,
"target": 11,
"value": 3515,
"unnormalizedValue": 3515
},
{
"source": 1,
"target": 12,
"value": 1140,
"unnormalizedValue": 1140
},
{
"source": 1,
"target": 13,
"value": 361,
"unnormalizedValue": 361
},
{
"source": 1,
"target": 14,
"value": 8607,
"unnormalizedValue": 8607
},
{
"source": 2,
"target": 9,
"value": 10621,
"unnormalizedValue": 10621
},
{
"source": 2,
"target": 10,
"value": 3515,
"unnormalizedValue": 3515
},
{
"source": 2,
"target": 11,
"value": 1140,
"unnormalizedValue": 1140
},
{
"source": 2,
"target": 12,
"value": 361,
"unnormalizedValue": 361
},
{
"source": 2,
"target": 13,
"value": 95,
"unnormalizedValue": 95
},
{
"source": 2,
"target": 14,
"value": 2831,
"unnormalizedValue": 2831
},
{
"source": 3,
"target": 9,
"value": 3515,
"unnormalizedValue": 3515
},
{
"source": 3,
"target": 10,
"value": 1140,
"unnormalizedValue": 1140
},
{
"source": 3,
"target": 11,
"value": 361,
"unnormalizedValue": 361
},
{
"source": 3,
"target": 12,
"value": 95,
"unnormalizedValue": 95
},
{
"source": 3,
"target": 13,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 3,
"target": 14,
"value": 893,
"unnormalizedValue": 893
},
{
"source": 4,
"target": 9,
"value": 1140,
"unnormalizedValue": 1140
},
{
"source": 4,
"target": 10,
"value": 361,
"unnormalizedValue": 361
},
{
"source": 4,
"target": 11,
"value": 95,
"unnormalizedValue": 95
},
{
"source": 4,
"target": 12,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 4,
"target": 14,
"value": 266,
"unnormalizedValue": 266
},
{
"source": 5,
"target": 9,
"value": 361,
"unnormalizedValue": 361
},
{
"source": 5,
"target": 10,
"value": 95,
"unnormalizedValue": 95
},
{
"source": 5,
"target": 11,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 5,
"target": 14,
"value": 57,
"unnormalizedValue": 57
},
{
"source": 6,
"target": 9,
"value": 95,
"unnormalizedValue": 95
},
{
"source": 6,
"target": 10,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 7,
"target": 9,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 8,
"target": 9,
"value": 8398,
"unnormalizedValue": 8398
},
{
"source": 8,
"target": 10,
"value": 2755,
"unnormalizedValue": 2755
},
{
"source": 8,
"target": 11,
"value": 874,
"unnormalizedValue": 874
},
{
"source": 8,
"target": 12,
"value": 266,
"unnormalizedValue": 266
},
{
"source": 8,
"target": 13,
"value": 57,
"unnormalizedValue": 57
},
{
"source": 8,
"target": 14,
"value": 2242,
"unnormalizedValue": 2242
},
{
"source": 9,
"target": 15,
"value": 28234,
"unnormalizedValue": 28234
},
{
"source": 9,
"target": 16,
"value": 9367,
"unnormalizedValue": 9367
},
{
"source": 9,
"target": 17,
"value": 3078,
"unnormalizedValue": 3078
},
{
"source": 9,
"target": 18,
"value": 1007,
"unnormalizedValue": 1007
},
{
"source": 9,
"target": 19,
"value": 304,
"unnormalizedValue": 304
},
{
"source": 9,
"target": 20,
"value": 76,
"unnormalizedValue": 76
},
{
"source": 9,
"target": 21,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 9,
"target": 22,
"value": 14079,
"unnormalizedValue": 14079
},
{
"source": 10,
"target": 15,
"value": 9367,
"unnormalizedValue": 9367
},
{
"source": 10,
"target": 16,
"value": 3078,
"unnormalizedValue": 3078
},
{
"source": 10,
"target": 17,
"value": 1007,
"unnormalizedValue": 1007
},
{
"source": 10,
"target": 18,
"value": 304,
"unnormalizedValue": 304
},
{
"source": 10,
"target": 19,
"value": 76,
"unnormalizedValue": 76
},
{
"source": 10,
"target": 20,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 10,
"target": 22,
"value": 4655,
"unnormalizedValue": 4655
},
{
"source": 11,
"target": 15,
"value": 3078,
"unnormalizedValue": 3078
},
{
"source": 11,
"target": 16,
"value": 1007,
"unnormalizedValue": 1007
},
{
"source": 11,
"target": 17,
"value": 304,
"unnormalizedValue": 304
},
{
"source": 11,
"target": 18,
"value": 76,
"unnormalizedValue": 76
},
{
"source": 11,
"target": 19,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 11,
"target": 22,
"value": 1520,
"unnormalizedValue": 1520
},
{
"source": 12,
"target": 15,
"value": 1007,
"unnormalizedValue": 1007
},
{
"source": 12,
"target": 16,
"value": 304,
"unnormalizedValue": 304
},
{
"source": 12,
"target": 17,
"value": 76,
"unnormalizedValue": 76
},
{
"source": 12,
"target": 18,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 12,
"target": 22,
"value": 475,
"unnormalizedValue": 475
},
{
"source": 13,
"target": 15,
"value": 304,
"unnormalizedValue": 304
},
{
"source": 13,
"target": 16,
"value": 76,
"unnormalizedValue": 76
},
{
"source": 13,
"target": 17,
"value": 19,
"unnormalizedValue": 19
},
{
"source": 13,
"target": 22,
"value": 133,
"unnormalizedValue": 133
},
{
"source": 14,
"target": 15,
"value": 7581,
"unnormalizedValue": 7581
},
{
"source": 14,
"target": 16,
"value": 2489,
"unnormalizedValue": 2489
},
{
"source": 14,
"target": 17,
"value": 779,
"unnormalizedValue": 779
},
{
"source": 14,
"target": 18,
"value": 228,
"unnormalizedValue": 228
},
{
"source": 14,
"target": 19,
"value": 38,
"unnormalizedValue": 38
},
{
"source": 14,
"target": 22,
"value": 3781,
"unnormalizedValue": 3781
},
{
"source": 15,
"target": 25,
"value": 2609,
"unnormalizedValue": 2609
},
{
"source": 15,
"target": 24,
"value": 10436,
"unnormalizedValue": 10436
},
{
"source": 15,
"target": 23,
"value": 36526,
"unnormalizedValue": 36526
},
{
"source": 16,
"target": 25,
"value": 859,
"unnormalizedValue": 859
},
{
"source": 16,
"target": 24,
"value": 3436,
"unnormalizedValue": 3436
},
{
"source": 16,
"target": 23,
"value": 12026,
"unnormalizedValue": 12026
},
{
"source": 17,
"target": 25,
"value": 277,
"unnormalizedValue": 277
},
{
"source": 17,
"target": 24,
"value": 1108,
"unnormalizedValue": 1108
},
{
"source": 17,
"target": 23,
"value": 3878,
"unnormalizedValue": 3878
},
{
"source": 18,
"target": 25,
"value": 86,
"unnormalizedValue": 86
},
{
"source": 18,
"target": 24,
"value": 344,
"unnormalizedValue": 344
},
{
"source": 18,
"target": 23,
"value": 1204,
"unnormalizedValue": 1204
},
{
"source": 19,
"target": 25,
"value": 23,
"unnormalizedValue": 23
},
{
"source": 19,
"target": 24,
"value": 92,
"unnormalizedValue": 92
},
{
"source": 19,
"target": 23,
"value": 322,
"unnormalizedValue": 322
},
{
"source": 20,
"target": 25,
"value": 5,
"unnormalizedValue": 5
},
{
"source": 20,
"target": 24,
"value": 20,
"unnormalizedValue": 20
},
{
"source": 20,
"target": 23,
"value": 70,
"unnormalizedValue": 70
},
{
"source": 21,
"target": 25,
"value": 1,
"unnormalizedValue": 1
},
{
"source": 21,
"target": 24,
"value": 4,
"unnormalizedValue": 4
},
{
"source": 21,
"target": 23,
"value": 14,
"unnormalizedValue": 14
},
{
"source": 22,
"target": 25,
"value": 1297,
"unnormalizedValue": 1297
},
{
"source": 22,
"target": 24,
"value": 5188,
"unnormalizedValue": 5188
},
{
"source": 22,
"target": 23,
"value": 18158,
"unnormalizedValue": 18158
}
]
Logs
No response
Requested priority
Normal
Products/sites affected
portal.azure.com
Are you willing to submit a PR to fix?
yes
Validations
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Thanks for reporting this issue. We will not be able to prioritize fixing it in the current Semester (Jan-June). Feel free to submit a fix if it is important for your scenario.