Here is a way using the Jcrop JavaScript library.
library(shiny)
js <- HTML(c(
"$(document).ready(function(){",
" $('#myimg').Jcrop({",
" onSelect: function(coords){",
" Shiny.setInputValue('crop', coords);",
" }",
" });",
"});"
))
ui <- fluidPage(
tags$head(
tags$link(rel = "stylesheet", href = "https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.15/css/jquery.Jcrop.min.css"),
tags$script(src = "https://cdnjs.cloudflare.com/ajax/libs/jquery-jcrop/0.9.15/js/jquery.Jcrop.min.js"),
tags$script(js)
),
fluidRow(
column(
width = 6,
tags$img(id = "myimg", src = "RadialBarChart.png", width = 400, height = 400)
),
column(
width = 6,
verbatimTextOutput("coordinates")
)
)
)
server <- function(input, output){
output[["coordinates"]] <- renderPrint(input[["crop"]])
}
shinyApp(ui, server)