plotly.R icon indicating copy to clipboard operation
plotly.R copied to clipboard

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

Open cymonegates opened this issue 7 years ago • 1 comments

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)

cymonegates avatar Nov 06 '19 23:11 cymonegates

did you find any solution?

Marjan-bkh avatar Dec 22 '21 07:12 Marjan-bkh