plotly / plotly/plotly.R

Bullet Charts: Indicator Delta Reference shows dash symbol when value and reference are equal

Open
#1,649 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I am creating bullet charts using the guidance found here: https://plot.ly/r/bullet-charts/

All is working as expected, however when the value and reference values are the same, the rendered plot shows no difference. Just a straight line. I should say 0 as there's a difference of zero.

Example below with straight line for difference rendered.

  plot_ly(
    type = "indicator",
    mode = "number+gauge+delta",
    gauge = list(shape = "bullet"),
    delta = list(reference = .333, valueformat='%', relative=FALSE,position='right'),
    value = .33,
    domain = list(x = c(0, 1), y = c(0, 1)),
    title= list(text = "Profit"),
    height = 150)
  

However, if I add an additional digit to the reference or value as shown below, a percent difference of -0 or +0 is shown.

 plot_ly(
   type = "indicator",
   mode = "number+gauge+delta",
   gauge = list(shape = "bullet"),
   delta = list(reference = .333, valueformat='%', relative=FALSE,position='right'),
   value = .33,
   domain = list(x = c(0, 1), y = c(0, 1)),
   title= list(text = "Profit"),
   height = 150)
plot_ly(
  type = "indicator",
  mode = "number+gauge+delta",
  gauge = list(shape = "bullet"),
  delta = list(reference = .33, valueformat='%', relative=FALSE,position='right'),
  value = .333,
  domain = list(x = c(0, 1), y = c(0, 1)),
  title= list(text = "Profit"),
  height = 150)

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 by reproducing the R bullet-chart example and trace the indicator delta rendering path in plotly.R. The issue names no source file or test; identify the relevant coverage and add a regression check showing a zero delta when value and reference are equal.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.