rename API call from Image to SVG

This commit is contained in:
2022-06-19 12:13:40 -04:00
parent 5f0293992b
commit 4ec06a5994
2 changed files with 4 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ func main() {
freq = append(freq, rand.Int()) freq = append(freq, rand.Int())
} }
w.Header().Add("Content-Type", "text/html") w.Header().Add("Content-Type", "text/html")
svg := graph.GetWeekImage(freq) svg := graph.GetWeekSVG(freq)
svg.WriteTo(w) svg.WriteTo(w)
}) })
@@ -31,7 +31,7 @@ func main() {
for i := 0; i < 365; i++ { for i := 0; i < 365; i++ {
freq = append(freq, rand.Int()) freq = append(freq, rand.Int())
} }
svg := graph.GetYearImage(freq) svg := graph.GetYearSVG(freq)
w.Header().Add("Content-Type", "text/html") w.Header().Add("Content-Type", "text/html")
svg.WriteTo(w) svg.WriteTo(w)

View File

@@ -51,7 +51,7 @@ func ColorForFrequency(freq, min, max int) sc.SimpleColor {
} }
return colorScheme[colorIndex] return colorScheme[colorIndex]
} }
func GetWeekImage(frequencies []int) bytes.Buffer { func GetWeekSVG(frequencies []int) bytes.Buffer {
squareColors := []sc.SimpleColor{} squareColors := []sc.SimpleColor{}
min, max := minmax(frequencies) min, max := minmax(frequencies)
for _, f := range frequencies { for _, f := range frequencies {
@@ -76,7 +76,7 @@ func drawWeekImage(c []sc.SimpleColor) bytes.Buffer {
sbw.Flush() sbw.Flush()
return sb return sb
} }
func GetYearImage(frequencies []int) bytes.Buffer { func GetYearSVG(frequencies []int) bytes.Buffer {
squareColors := []sc.SimpleColor{} squareColors := []sc.SimpleColor{}
min, max := minmax(frequencies) min, max := minmax(frequencies)
for _, f := range frequencies { for _, f := range frequencies {