update: functional log parser

This commit is contained in:
Inanc Gumus
2019-08-26 17:19:27 +03:00
parent 5215300d31
commit 51eb72bdaf
13 changed files with 372 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ import (
"sort"
"strconv"
c "github.com/wcharczuk/go-chart"
"github.com/wcharczuk/go-chart"
)
func chartWriter(w io.Writer) outputFn {
@@ -19,22 +19,22 @@ func chartWrite(w io.Writer, res []result) error {
return res[i].domain > res[j].domain
})
donut := c.DonutChart{
donut := chart.DonutChart{
Title: "Total Visits Per Domain",
TitleStyle: c.Style{
TitleStyle: chart.Style{
FontSize: 35,
Show: true,
FontColor: c.ColorAlternateGreen,
FontColor: chart.ColorAlternateGreen,
},
Width: 1920,
Height: 800,
}
for _, r := range res {
v := c.Value{
v := chart.Value{
Label: r.domain + r.page + ": " + strconv.Itoa(r.visits),
Value: float64(r.visits),
Style: c.Style{
Style: chart.Style{
FontSize: 14,
},
}
@@ -42,5 +42,5 @@ func chartWrite(w io.Writer, res []result) error {
donut.Values = append(donut.Values, v)
}
return donut.Render(c.SVG, w)
return donut.Render(chart.SVG, w)
}