diff --git a/advfuncs/logparser/functional/chartwriter.go b/advfuncs/logparser/functional/chartwriter.go index 2c3d3c1..e89e5f1 100644 --- a/advfuncs/logparser/functional/chartwriter.go +++ b/advfuncs/logparser/functional/chartwriter.go @@ -1,46 +1,38 @@ package main -import ( - "io" - "sort" - "strconv" +// func chartWriter(w io.Writer) outputFn { +// return func(res []result) error { +// return chartWrite(w, res) +// } +// } - "github.com/wcharczuk/go-chart" -) +// func chartWrite(w io.Writer, res []result) error { +// sort.Slice(res, func(i, j int) bool { +// return res[i].domain > res[j].domain +// }) -func chartWriter(w io.Writer) outputFn { - return func(res []result) error { - return chartWrite(w, res) - } -} +// donut := chart.DonutChart{ +// Title: "Total Visits Per Domain", +// TitleStyle: chart.Style{ +// FontSize: 35, +// Show: true, +// FontColor: chart.ColorAlternateGreen, +// }, +// Width: 1920, +// Height: 800, +// } -func chartWrite(w io.Writer, res []result) error { - sort.Slice(res, func(i, j int) bool { - return res[i].domain > res[j].domain - }) +// for _, r := range res { +// v := chart.Value{ +// Label: r.domain + r.page + ": " + strconv.Itoa(r.visits), +// Value: float64(r.visits), +// Style: chart.Style{ +// FontSize: 14, +// }, +// } - donut := chart.DonutChart{ - Title: "Total Visits Per Domain", - TitleStyle: chart.Style{ - FontSize: 35, - Show: true, - FontColor: chart.ColorAlternateGreen, - }, - Width: 1920, - Height: 800, - } +// donut.Values = append(donut.Values, v) +// } - for _, r := range res { - v := chart.Value{ - Label: r.domain + r.page + ": " + strconv.Itoa(r.visits), - Value: float64(r.visits), - Style: chart.Style{ - FontSize: 14, - }, - } - - donut.Values = append(donut.Values, v) - } - - return donut.Render(chart.SVG, w) -} +// return donut.Render(chart.SVG, w) +// } diff --git a/interfaces/log-parser/oop/chartreport.go b/interfaces/log-parser/oop/chartreport.go index 0c4cfbe..efaaf14 100644 --- a/interfaces/log-parser/oop/chartreport.go +++ b/interfaces/log-parser/oop/chartreport.go @@ -1,45 +1,38 @@ package main -import ( - "os" - "strconv" - - "github.com/wcharczuk/go-chart" -) - // You need to run: // go get -u github.com/wcharczuk/go-chart -type chartReport struct { - title string - width, height int -} +// type chartReport struct { +// title string +// width, height int +// } -func (s *chartReport) report(results iterator) error { - w := os.Stdout +// func (s *chartReport) report(results iterator) error { +// w := os.Stdout - donut := chart.DonutChart{ - Title: s.title, - TitleStyle: chart.Style{ - FontSize: 35, - Show: true, - FontColor: chart.ColorAlternateGreen, - }, - Width: s.width, - Height: s.height, - } +// donut := chart.DonutChart{ +// Title: s.title, +// TitleStyle: chart.Style{ +// FontSize: 35, +// Show: true, +// FontColor: chart.ColorAlternateGreen, +// }, +// Width: s.width, +// Height: s.height, +// } - results.each(func(r result) { - v := chart.Value{ - Label: r.domain + r.page + ": " + strconv.Itoa(r.visits), - Value: float64(r.visits), - Style: chart.Style{ - FontSize: 14, - }, - } +// results.each(func(r result) { +// v := chart.Value{ +// Label: r.domain + r.page + ": " + strconv.Itoa(r.visits), +// Value: float64(r.visits), +// Style: chart.Style{ +// FontSize: 14, +// }, +// } - donut.Values = append(donut.Values, v) - }) +// donut.Values = append(donut.Values, v) +// }) - return donut.Render(chart.SVG, w) -} +// return donut.Render(chart.SVG, w) +// }