-
Notifications
You must be signed in to change notification settings - Fork 3
Feature: Edge Weights #285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…data writing yet)
When a property doesn't exist in the data (due to old version of project), the key (e.g. 'weight') can be undefined leading to unsortable NaN value
…emove duplicate edges for d3 rendering.
Can we change the default display name and export name for Weight to be Weight? |
Maybe in the Edge table make Weight slightly smaller and Comments slightly wider? |
To avoid confusion, when creating a new edge, if weights are visible can we add the weight number to it? It displays the edge correctly as 1 but having the field blank feels potentially confusion. |
By the way I tested adding a letter to the edge weight and it was fine - it just left the prior number it seemed. However, given the long-term goal of using more validation it'd be nice if this required an integer like the focus field does (assuming its easy to use the same code - if not, this can wait since I imagine that if we are validating numbers we'll eventually want a range to be something we can identify in the template? though this can have a range similar to focus of 1-infinity so long as it is a positive integer?). |
Ooops. Sorry, victim of copy and paste.
Done
How do you want to handle the case where an old project is converted to add weight? Do we respect the fact that the old project did not define weight and leave it blank? Or do we always insert 1 if it wasn't defined? And should we do that when the project is opened (applies to all edges), or when an EdgeEditor is opened (applies only to opened+edited edges)?
We can spec a
Hmm...checking my algorithms... |
Forcing all to 1 on open works for me since they’ll be hidden until someone makes them visible.The red box to define a range of 1 but more robust layer works great.Thanks!!
|
…d increase "comments"
…e sizes were ridiculously large because "2" + "2" became "22".
…properly refer to "weight"
… label from template.
…l show red border if value is less than 1.
…Required` and `defaultValue`. If both are set, and the node/edge property is undefined or '', then the property is set to the `defaultValue` You can actually use this to auto-insert values simply by editing a project's template without affecting the template schema.
Fixes
Migrating Data
Currently this is primarily being used to add the "Weight" to any project that has "Weight" defined as set as "isRequired" and has a
You can use this technique to auto-populate data on a project. Just add [nodeDefs.type]
...
isRequired = true
defaultValue = "Person"
[[nodeDefs.type.options]]
color = "#eeeeee"
label = ""
[[nodeDefs.type.options]]
color = "#ff0000"
label = "Person" NOTE the migration does NOT save the changes until you do something to modify the database and trigger an autosave. |
Two minor issues, but I'll accept and then add those. They are: 1) If you delete the number in weight field it now makes a 0 and you cannot delete that. Which is weird. Also 2) It'd be nice to show the color on an edge of the edge with the highest weight (e.g., if I have a->b (green) and a->d (blue) but c-d is weight 2 and a-b is weight 1, it should be displayed green. |
Looks good! |
Addresses #245
This adds a new parameter
weight
to edges.edgeSizeMax
parameter.edgeSizeMax
only affects how edges are rendered in d3. So an edge can have a weight of 100, but ifedgeSizeMax
is 20, it will display only as a 20-pixel wide link.edgeSizeMax
to0
to turn off the max limit. WARNING: You can potentially end up with lines far wider than the nodes they point to.DEV NOTES:
weight
will be hidden by default. You'll have to edit the template to unhideweight
before you'll see when you edit edges.See also user input data flow whimsical diagram for system architecture.
Migrating Data
server-database.js
will now "migrate" graph data as it opens the project file. It uses parameters defined in the template to determine if migration is necessary and can automatically define missing fields and set default values. It currently does not do more sophisticated migration (e.g. change a property from one name to another), but these can be easily added.Currently this is primarily being used to add the "Weight" to any project that has "Weight" defined as set as "isRequired" and has a
defaultValue
defined.You can use this technique to auto-populate data on a project. Just add
isRequired
anddefaultValue
to the projects'*.template.toml
file. e.g. this will set all node types toPerson
if the node type was not previously set when the project is opened:NOTE the migration does NOT save the changes until you do something to modify the database and trigger an autosave.