TheAlongsider
TheAlongsider

Reputation: 53

Changing the minimum value for bullet chart in sparklines R package

I'd like to add a minimum value to a bullet graph using the sparklines R package. The default sets the minimum value to be 0.

sparkline(c(30,15), type = "bullet")

With chartRangeMin:

with chartRangeMin

Following the documentation for the original jquery here: https://omnipotent.net/jquery.sparkline/#common, I tried chartRangeMin:

sparkline(c(30,15), type = "bullet", chartRangeMin = 10)

but it appears to produce the same result as if we didn’t have this parameter

Without chartRangeMin:

enter image description here

How do I add a minimum value for the bullet graph?

Upvotes: 0

Views: 149

Answers (1)

TheAlongsider
TheAlongsider

Reputation: 53

Upon looking at the JS github code which is the base for the sparklines API for R, I discovered that the default minimum value for bullet graphs is set by a base variable.

To create the above bullet graph with a minimum of 10:

sparkline(c(30, 15), type = "bullet", base = 10)

With base parameter

Upvotes: 1

Related Questions