-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Order by id, label nodes #1927
Comments
I'm closing this issue due to inactivity. |
Hi @mojoaxel and @wimrijnders , I believe I have the same question. I'm using hierarchical layout with the following settings and would love it if the LR order of my nodes followed the order that they are given in the dataset. Is that possible? Ideally I wouldn't want to specify a
|
I'm trying to understand the question.....what I think you mean, is that network flips around the order of the nodes when building up the network, right? I've been trying to hack a quick example of networks not following the dataset order, without success. I can show the converse though. I think this is what you want: So, given that the node id's are the order in the dataset, the second level is strictly numbered. After that, the ordering breaks down because of the defined edges. But the ordering is maintained as much as possible. Is this correct? So a changed ordering is the
The resulting layout will be less efficient in terms of space used, but it will probably be more like you want it. |
|
I tried setting the options you mentioned, but it didn't seem to make any difference.
|
OK. So my immediate reaction was 'Hold on, let me check the code...' Then I realized that that meant the answer is 'No'. There is no out of the box support for sorting per level. But I'll check the code anyway. |
Oh, that's too bad. Is it possible to define a function to sort nodes based on a custom value added in their data? |
Yeah, now that I understand the question a bit better, I realize that my suggestion is moot. What happens then, is that the order of definition in the |
As I do have full control of the order of the dataset, I was sending in the array with its values sorted, so I was hoping that they would be put into levels in the same order, eg:
|
And this didn't happen? The nodes don't get rendered in the order you enforced? I think a simple example is in order if you want to pursue this further. Would you mind setting up a |
Yes, in a roundabout way. Following code is untested, but it illustrates the process: var data = new vis.DataSet(input_data);
var sorted_data = data.get({
order: function(a, b) {
// Your glorious sort routine here
}
});
var data2 = new vis.DataSet(sorted_data);
var network = new vis.Network(container, data2, options); ... but TBH, Edit: It did give me an idea, though, on adding sorting to |
OK, here's a try: http://jsfiddle.net/ffq8ch6d/1/ . The nodes were passed in the order of their labels. |
Also, I realize what I really want is for ordering among sibling nodes. So in the above, my ideal would be:
I realize this is probably out of scope but it would be amazing if it could be accomplished. |
Oh my, the turnaround time is awesome here. It motivates me to check the code.
Yes, that is finally clear to me now. |
Interim note: It appears that the key method here is I'll let it rest for now; my evil pointy haired boss, which is me, is getting impatient. Update: Have to ask, is this something you want RSN? Because it's not something I can offer a workaround for. You'll have to wait for its release (one month at the very least). In the meantime you might use an interim build of |
@wimrijnders I am trying to demo a prototype of my project soon (in the next 2 weeks), so I might investigate a monkeypatched version of |
Hi @wimrijnders , I'm looking into this issue again and was curious if there's been any movement in the dev channels on this. Thanks again for the help with this question. Update:
to this:
|
Alas, no. I've been squashing bugs lately and haven't come around to handling stuff I regard as 'feature-requests'. Sorry.
Genius thought! Of course, the strict handling on order also applies to edges. I should have been able to think of that myself (which is what makes it genius). |
Hello again @wimrijnders, Do you have any ideas for workarounds? Or could I make a feature request to add an "order" field that would override the sorting at a given level of the hierarchy? Thanks much for any ideas. |
@wimrijnders, I wonder if you might have a moment to weigh in on my previous question? #1927 (comment) Thanks very much! |
Hi,
I´m using the version 4.15.0
I want to know if you can sort the nodes by id, label or other attribute which are at the same level.
I can send my example.
The text was updated successfully, but these errors were encountered: