plotly / plotly/plotly.R

pie labels/values aren't relayed in event_data()

Open
#1,655 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

At least the customdata workaround exists, but we should do a better job relaying more information (do we 'black-list' pt.data/pt._fullData and let everything else through)? https://codepen.io/cpsievert/pen/rNNZpVo

library(shiny)

ui <- fluidPage(
  plotlyOutput("category"),
  verbatimTextOutput("info")
)

server <- function(input, output) {
  
  output$category <- renderPlotly({
    sales %>%
      count(category, wt = sales) %>%
      plot_ly() %>%
      add_pie(labels = ~category, values = ~n)
  })
  
  output$info <- renderPrint({
    event_data("plotly_click")
  })
  
}

shinyApp(ui, server)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided Shiny example and the event_data("plotly_click") entry point, comparing the pie chart output with the customdata workaround. Determine which pie labels and values should be relayed and whether the existing pt.data and pt._fullData handling excludes them. Done means the intended fields appear in the event data for the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.