1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 10:08:52 +08:00

fix plot update

This commit is contained in:
lana-k
2025-03-26 20:59:17 +01:00
parent 58cdab94c1
commit 5a805fba80

View File

@@ -115,17 +115,13 @@ export default {
// https://github.com/plotly/react-chart-editor/issues/948 // https://github.com/plotly/react-chart-editor/issues/948
if (this.dataSources) { if (this.dataSources) {
dereference.default(this.state.data, this.dataSources) dereference.default(this.state.data, this.dataSources)
this.updatePlotly()
} }
} }
}, },
methods: { methods: {
async handleResize() { async handleResize() {
const plotComponent = this.$refs.plotlyEditor.plotComponentRef.current this.updatePlotly()
this.$refs.plotlyEditor.plotComponentRef.current.updatePlotly(
false, // shouldInvokeResizeHandler
plotComponent.props.onUpdate, // figureCallbackFunction
false // shouldAttachUpdateEvents
)
}, },
onRender(data, layout, frames) { onRender(data, layout, frames) {
// TODO: check changes and enable Save button if needed // TODO: check changes and enable Save button if needed
@@ -134,6 +130,14 @@ export default {
this.state = { data, layout, frames } this.state = { data, layout, frames }
this.$emit('update') this.$emit('update')
}, },
updatePlotly() {
const plotComponent = this.$refs.plotlyEditor.plotComponentRef.current
plotComponent.updatePlotly(
false, // shouldInvokeResizeHandler
plotComponent.props.onUpdate, // figureCallbackFunction
false // shouldAttachUpdateEvents
)
},
getOptionsForSave() { getOptionsForSave() {
return chartHelper.getOptionsForSave(this.state, this.dataSources) return chartHelper.getOptionsForSave(this.state, this.dataSources)
}, },