(min, max float64)
| 125 | type commaTicks struct{} |
| 126 | |
| 127 | func (commaTicks) Ticks(min, max float64) []plot.Tick { |
| 128 | tks := plot.DefaultTicks{}.Ticks(min, max) |
| 129 | for i, t := range tks { |
| 130 | if t.Label == "" { // Skip minor ticks, they are fine. |
| 131 | continue |
| 132 | } |
| 133 | tks[i].Label = addCommas(t.Label) |
| 134 | } |
| 135 | return tks |
| 136 | } |
| 137 | |
| 138 | // AddCommas adds commas after every 3 characters from right to left. |
| 139 | // NOTE: This function is a quick hack, it doesn't work with decimal |