* Handle plotly_update events emitted by the Plotly.js library * @param data
(data: any)
| 1237 | * @param data |
| 1238 | */ |
| 1239 | handle_plotly_update(data: any) { |
| 1240 | if (data === null || data === undefined) { |
| 1241 | // No data to report to the Python side |
| 1242 | return; |
| 1243 | } |
| 1244 | |
| 1245 | if (data["data"] && data["data"][0].hasOwnProperty("_doNotReportToPy")) { |
| 1246 | // Update originated on the Python side |
| 1247 | return; |
| 1248 | } |
| 1249 | |
| 1250 | /** @type {Js2PyUpdateMsg} */ |
| 1251 | var updateMsg: Js2PyUpdateMsg = { |
| 1252 | style_data: data["data"][0], |
| 1253 | style_traces: data["data"][1], |
| 1254 | layout_data: data["layout"], |
| 1255 | source_view_id: this.viewID, |
| 1256 | }; |
| 1257 | |
| 1258 | // Log message |
| 1259 | this.model.set("_js2py_update", updateMsg); |
| 1260 | this.touch(); |
| 1261 | } |
| 1262 | |
| 1263 | /** |
| 1264 | * Handle plotly_click events emitted by the Plotly.js library |
no test coverage detected