Skip to content

Commit

Permalink
fix react() for plots with data and layout, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Oct 7, 2024
1 parent 208fdd2 commit 09c8795
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ end
# @in plot_cursor = Dict{String, Any}()
# end

Stipple.js_mounted(::Example) = watchplots()
@mounted Example watchplots()

# the keyword argument 'keepselection' (default = false) controls whether the selection outline shall be removed after selection
function ui()
Expand Down
11 changes: 10 additions & 1 deletion assets/js/vueplotly.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,16 @@
}
},
react() {
Plotly.react(this.$el, this.data, this.innerLayout, this.config)
Plotly.react(this.$el, this.data, this.innerLayout, this.config).then(
() => {
// if data and layout are stored in one object, it turns out that
// react() is not sufficient to update the plot and relayout() is needed.
// if layouting was successful, the height is different from '100%'
if (this.$el.querySelector('.user-select-none').style.height == '100%') {
this.relayout(this.innerLayout)
}
}
)
},
removeSelection() {
gd = this.$el;
Expand Down

0 comments on commit 09c8795

Please sign in to comment.