nxt3AT / sankeydiagram.net

sankeydiagram.net is an easy-to-use webapp for generating Sankey Diagrams to visualize flows and budgets.
Other
75 stars 12 forks source link

Overlapping graphics need optimization #55

Closed wuyang26 closed 5 days ago

wuyang26 commented 1 week ago

After conducting some data tests, it has been found that the above libraries perform perfectly for layer by layer data transmission such as A ->B ->C ->D. However, if there is a cross level data transmission such as A ->B and A ->C, the design of graphic avoidance and anti overlap may not perform well, and further optimization may be needed. look the data: var datas = new List() { new SankeyData("United States 1", "Canada", 1.553 0.18), new SankeyData("United States 1", "Mexico", 1.553 0.157), new SankeyData("United States 1", "China", 1.553 0.084), new SankeyData("United States 1", "Japan", 1.553 0.044),

    new SankeyData("Germany1", "United States", 1.434 * 0.088),
    new SankeyData("Germany1", "France", 1.434 * 0.082),
    new SankeyData("Germany1", "China", 1.434 * 0.068),
    new SankeyData("Germany1", "Netherlands", 1.434 * 0.067),
    new SankeyData("Germany1", "United Kingdom", 1.434 * 0.066),
    new SankeyData("Germany1", "Italy", 1.434 * 0.051),

    new SankeyData("France1", "Germany", 0.549 * 0.148),
    new SankeyData("France1", "Spain", 0.549 * 0.077),
    new SankeyData("France1", "Italy", 0.549 * 0.075),
    new SankeyData("France1", "United States", 0.549 * 0.072),

    new SankeyData("Italy", "Germany", 0.496 * 0.125),
    new SankeyData("Italy", "France", 0.496 * 0.103),
    new SankeyData("Italy", "United States", 0.496 * 0.09),

    new SankeyData("United Kingdom", "United States", 0.441 * 0.132),
    new SankeyData("United Kingdom", "Germany", 0.441 * 0.105),
    new SankeyData("United Kingdom", "France", 0.441 * 0.074),
    new SankeyData("United Kingdom", "Netherlands", 0.441 * 0.062),

    new SankeyData("Canada", "United States", 0.4235 * 0.764),
    new SankeyData("Canada", "China", 0.4235 * 0.043),

    new SankeyData("China1", "United States", 2.216 * 0.192),
    new SankeyData("China1", "Japan", 2.216 * 0.059),
    new SankeyData("China1", "South Korea", 2.216 * 0.044),

    new SankeyData("Australia", "China", 0.2172 * 0.218),
    new SankeyData("Australia", "United States", 0.2172 * 0.125),
    new SankeyData("Australia", "Argentina", 0.2172 * 0.081),
    new SankeyData("Australia", "Netherlands", 0.2172 * 0.043),

    new SankeyData("Mexico", "United States", 0.409 * 0.799),

    new SankeyData("Japan", "United States", 0.6889 * 0.194),
    new SankeyData("Japan", "China", 0.6889 * 0.19),
    new SankeyData("Japan", "South Korea", 0.6889 * 0.076),

    new SankeyData("Brazil", "China", 0.2172 * 0.218),
    new SankeyData("Brazil", "United States", 0.2172 * 0.125),
    new SankeyData("Brazil", "Argentina", 0.2172 * 0.081),
}; 

SankeyDatas = datas;

wuyang26 commented 1 week ago

This is the representation of other controls image

JonasDoesThings commented 1 week ago

Hi, what input did you enter into https://sankeydiagram.net/?

wuyang26 commented 6 days ago

sankeydiagram.txt I tested this website "https://sankeydiagram.net" using the data above ,It has lost some data display image

The effect displayed by this WPF library is as follows: image The data in this WPF library is displayed completely, but there is severe graphic overlap at certain positions.

wuyang26 commented 6 days ago

Especially at nodes "Canada" and "Japan" with severe overlap,you can see that the other control at the top is displayed very well

JonasDoesThings commented 6 days ago

I see. Thx for providing the data @wuyang26 The problem with missing data in the output is caused by the small numbers. It can partially be fixed by going into "Settings" and raising the "decimal precision" setting to a higher value.

But yeah, data should not be dropped either way, so I will work on a bugfix for that

wuyang26 commented 5 days ago

Although some data was lost, the graphic avoidance was done very well.

I'm sorry, my previous statement was about the WPF library: https://github.com/iou90/SankeyDiagram I sent it to the wrong location. This library is a JavaScript library, not the same.

JonasDoesThings commented 5 days ago

Great, :) I have released v1.4.1 now including a fix for the data-loss