Annotations editable by end-user

Is there an annotation capability in D3 that allows the end user to add a label and edit the text associated with the label?

This examples almost gets what I want, but it’s the developer who defines the text, not the end user.

I have looked up some of Susan Lu’s examples on her website, but they don’t seem to allow end-user interaction.

https://d3-annotation.susielu.com/#examples

This is a really cool idea! I totally get what you want to do: have the end user (the viewer of the visualization, not its author) be able to edit the text of the annotations.

Currently, you might be able to implement a flow where when the user clicks on the annotation, it pops up a text input field (e.g. Window.alert()), and the resulting text can feed into an update to the annotation. While this technically can work, it would not save the change permanently. The change would be reset whenever the page reloads.

I have been thinking a lot about how we might add the ability for users to interact with vizzes and then have the result saved. One day in the future I would like to introduce a new feature to VizHub that I think of as “Persistent State” or “Persistent Configuration” wherein a viz could make changes to its “state” or “configuration”, and that state lives inside the real-time enabled VizHub platform alongside files. This would have the added benefit that if one user makes a change, all other users viewing the same viz would get that update in real time. This is the ideal future, but it’s unfortunately not here yet.

Will post back here when it’s working!

Very cool @curran! Let me/us know if you ever open a repo on this.

Will do! Actually I have made a start on this https://github.com/curran/experimental-runtime

It’s a proof-of-concept outside of VizHub at the moment but proves out some of the ideas. The core idea I wanted to test out was the ability to update the state (or the code) without reloading the entire HTML page. The proof-of-concept works, now it’s a matter of iterating on it figuring out a plan to integrate this approach into VizHub itself. The experimental runtime is fundamentally different than what’s there now, so we might end up with a check box in the viz settings somewhere like “Enable new runtime” or something like this.

1 Like