Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the gauge colors #38

Open
kng229 opened this issue Jul 10, 2014 · 3 comments
Open

Changing the gauge colors #38

kng229 opened this issue Jul 10, 2014 · 3 comments

Comments

@kng229
Copy link

kng229 commented Jul 10, 2014

How can I reverse the colors? When the gauge is low I'd like it to be green instead of red, and vice versa. Thanks in advance for your help with my rookie question! I'm using the built-in gaugeOutput function in R that I've pasted below. Unfortunately I don't know Java, can only code in R - do you know if/how I could modify this function to pass in the "levelColors" argument?

function (outputId, title = "Title", min = 0, max = 1, units = "",
width = "200px", height = "200px", value = min)
{
tagList(singleton(tags$head(initResourcePaths(), tags$script(src = "shinyDash/justgage/justgage.1.0.1.min.js"),
tags$script(src = "shinyDash/justgage/raphael.2.1.0.min.js"),
tags$script(src = "shinyDash/justgage/justgage_binding.js"))),
tags$div(id = outputId, class = "justgage_output", style = paste("width:",
validateCssUnit(width), ";", "height:", validateCssUnit(height),
";")), tags$script(paste("GageOutput('", outputId,
"',\n '", title, "',\n '",
min, "',\n '", max, "',\n '",
units, "',\n '", validateCssUnit(width),
"',\n '", validateCssUnit(height),
"',\n '", value, "')", sep = "")))
}

@maodonovan
Copy link

Its almost a year since this question was posted so I give you my hack solution.
Find the R file called something like "justgage.1.0.1.min.js". Mine is in /usr/local/lib/R/site-library/ShinyDash/shinyDash/justgage/

In vim/nano/emacs find the line reading percentColors=["#f9c802","#a9d70b","#ff0000"] its about 2/3rd of the way in.
Change the color codes as desired. To reverse the codes it will become:
percentColors=["#ff0000","#f9c802","#a9d70b"]. Restart shiny and voila BUT if you break something forget you ever read this.

@kng229
Copy link
Author

kng229 commented Oct 2, 2015

That worked beautifully, thank you!

@zineb007
Copy link

zineb007 commented Dec 6, 2017

Thank youuuu !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants