update: functional log parser
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user