Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freeze zoom level when adding/removing points #83

Open
Tixierae opened this issue Aug 19, 2019 · 1 comment
Open

Freeze zoom level when adding/removing points #83

Tixierae opened this issue Aug 19, 2019 · 1 comment

Comments

@Tixierae
Copy link

Is there any way to freeze the zoom level when adding/removing points to/from the scatter? Right now, the zoom level is reset every time such an action is performed. In the example below, click the zoom checkbox then the add/remove checkbox for an illustration of the issue.

library(shiny)
library(scatterD3)

my_x = rnorm(2); my_y = rnorm(2)
my_x_extra = c(my_x,my_x[1]-0.01); my_y_extra = c(my_y,my_y[1]+0.01)

ui = shinyUI(
  fluidPage(
    checkboxInput('zoom','zoom in/out'),
    checkboxInput('point','add/remove point'),
    scatterD3Output('scatterd3')
  )
)
server = shinyServer(function(input, output, session) {
  output$scatterd3 = renderScatterD3({
    scatterD3(if(input$point){my_x_extra}else{my_x},if(input$point){my_y_extra}else{my_y},transitions=TRUE,zoom_on=if(input$zoom){c(my_x[1],my_y[1])}else{NULL},zoom_on_level=8)
  })
})
shinyApp(ui=ui, server=server)
@juba
Copy link
Owner

juba commented Aug 19, 2019

Unfortunately no, at this time there's only a small subset of changes (labels size or opacity for example) that doesn't reset the zoom. That's because most of the other changes affect the plot scales one way or another, so it is simpler to reset everything to avoid problems with the following plots. There may be a way, but it would require quite some work and rewrite that I'm not able to do for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants