OK, I seriously need help

Based on a maxValue I'm looking for a way to make some nicely rounded numbers to display in a chart.

Let me give some examples of what I mean.

maxValue = 61029
// returns
10000 - 20000 - 30000 - 40000 - 50000 - 60000

maxValue = 412
// returns
100 - 200 - 300 - 400

maxValue = 7
// returns
1 - 2 - 3 - 4 - 5 - 6

maxValue = 0.45
// returns
0.1 - 0.2 - 0.3 - 0.4

Any clues out there???
//pod

If it is any help I found this proto
*************
Number.prototype.roundTo = function(num) {
var resto = this%num;
if (resto <= (num/2)) {
return this-resto;
} else {
return this+num-resto;
}
}
************