ABSTRACT

The customdata attribute can hold any R object that can be serialized as JSON, so the readers could, for example, attach complex data to markers/lines/text/etc. using base strings. This could be useful for a number of things such as displaying an image on hover or click. On the JS side, the customdata attribute is designed to support any JS array of appropriate length, so if the readers need to supply numerous custom values to particular marker, list-columns in R provide a nice way to do so. Sometimes supplying and accessing customdata alone is not quite enough for the task at hand. The highlighting, annotations, and circle shapes are triggered by a "plotly_hover" event and they all work in tandem because event handlers are cumulative. However, when trying to target another object, it gets trickier because id attributes are randomly generated by htmlwidgets.