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:
@@ -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)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user