I have a bit of javascript that I am using to calculate the y-scale of a graph. I need to adjust the scale according to the value. This works but seems really verbose. Is there a more streamlined way to do this?
if (maxValue <= 20000){
chartMaxY = 20000
}
if (maxValue <= 10000){
chartMaxY = 10000
}
if (maxValue <= 5000){
chartMaxY = 5000
}
if (maxValue <= 2500){
chartMaxY = 2500
}
if (maxValue <= 1000){
chartMaxY = 1000
}
if (maxValue <= 500){
chartMaxY = 500
}
if (maxValue <= 250){
chartMaxY = 250
}
if (maxValue <= 100){
chartMaxY = 100
}
if (maxValue <= 50){
chartMaxY = 50
}
if (maxValue <= 10){
chartMaxY = 10
}