* Handle ploty_restyle events emitted by the Plotly.js library * @param data
(data: any)
| 1177 | * @param data |
| 1178 | */ |
| 1179 | handle_plotly_restyle(data: any) { |
| 1180 | if (data === null || data === undefined) { |
| 1181 | // No data to report to the Python side |
| 1182 | return; |
| 1183 | } |
| 1184 | |
| 1185 | if (data[0] && data[0].hasOwnProperty("_doNotReportToPy")) { |
| 1186 | // Restyle originated on the Python side |
| 1187 | return; |
| 1188 | } |
| 1189 | |
| 1190 | // Unpack data |
| 1191 | var styleData = data[0]; |
| 1192 | var styleTraces = data[1]; |
| 1193 | |
| 1194 | // Construct restyle message to send to the Python side |
| 1195 | /** @type {Js2PyRestyleMsg} */ |
| 1196 | var restyleMsg: Js2PyRestyleMsg = { |
| 1197 | style_data: styleData, |
| 1198 | style_traces: styleTraces, |
| 1199 | source_view_id: this.viewID, |
| 1200 | }; |
| 1201 | |
| 1202 | this.model.set("_js2py_restyle", restyleMsg); |
| 1203 | this.touch(); |
| 1204 | } |
| 1205 | |
| 1206 | touch() { |
| 1207 | this.model.save_changes(); |
no test coverage detected