plotly / plotly/plotly.R

Customdata should accept a data frame

Open
#1,548 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

My understanding is that anything that can be serialized to JSON from R can be passed to customdata, so probably what I want to do is fine for that part I'm not sure where I read this, I can't set customdata to a data frame.

My request is to make it possible to specify in the special "%{}" notation of hovertemplate to access fields of customdata. Or is there a more appropriate way to do this?

I would like something this to work:
plot_ly(x=mpg$displ, y=mpg$hwy, customdata=mpg, hovertemplate="x: %{x}\ny: %{y}\ncustom: %{customdata$year}")
alternatively customdata["year"] with javascript syntax, or whatever is appropriate.

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

The issue names no file, test, or entry point. Start by tracing how customdata and hovertemplate are handled, using the provided mpg example to reproduce the limitation. Done means a data frame can be passed as customdata and hovertemplate can access its year field with documented syntax.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, r
Domain
data-visualization
Issue type
Feature
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.