bokeh / bokeh

Interactive Data Visualization in the browser, from Python
https://bokeh.org
BSD 3-Clause "New" or "Revised" License
19.35k stars 4.19k forks source link

Allow in-place edit of text on the canvas #12523

Open mattpap opened 2 years ago

mattpap commented 2 years ago

This is to allow annotating (in a broad sense) data directly on the canvas. This is also related to allowing general purpose editing and selection or copying of text on the canvas. Details will follow as we discuss the requirements within the Holoviz ecosystem.

bryevdv commented 1 year ago

within the Holoviz ecosystem.

@philippjfr @jbednar can you elaborate on the use cases here? By default a page-reload will lose any and all edits. I guess in the server case the edits could be captured and responded to in some way, but they would still be lost on reload unless that response is to save out data to some persistent store that subsequent sessions consult. It would be very helpful to have a concrete use case scenario described fully.

mattpap commented 1 year ago

This is for allowing data annotation, broadly speaking. You click on a plot and can edit a description in-place, instead of having to be redirected to a text field somewhere in the UI outside of the plot. Though such UI would be provided as an alternative.

jbednar commented 1 year ago

@jlstevens, can you please weigh in here? Yes, we have implemented general-purpose support in HoloViz for writing to a configurable persistent location, so that the annotations are not lost. At the Bokeh level all that is needed is the ability to create the annotations; a HoloViews-based tool then handles the persistence. We've already written it to cover a variety of common cases, not currently including having text on a plot as described here, and Jean-Luc is working out how to publish that as a configurable plugin for HoloViews.

jlstevens commented 1 year ago

... unless that response is to save out data to some persistent store that subsequent sessions consult

The HoloViews annotation tool that I am working on does exactly this: a user authors metadata (e.g. collected from the text typed onto the canvas about some region of the data) and then the application allows the user to persist that metadata to a database. That database is then consulted for every new session, allowing multiple users to build up the database of metadata in a collaborative fashion. This textual information is displayed back to the visitor visually (typically via the hover tool).

While the HoloViews approach I am working on aims to make this kind of workflow easy, this kind of text entry tool is something that I think non-HoloViews Bokeh users would also benefit from. For instance, it doesn't seem unreasonable that someone might wish to create a flask or Django application that connects to a database to store information that is both collected and displayed on a Bokeh plot, where the input is made possible with such a text tool.

To elaborate with a concrete example, I can imagine a Bokeh app where an image is displayed, someone marks a region of interest, types some associated information with this text tool and then persists their work. Then another visitor could examine/update/delete the metadata created by earlier users.

bryevdv commented 1 year ago

👍 thanks for all the background, it definitely makes sense with the accompanying backend work, I just was not aware of that work and wanted to make sure I was not missing something!