From 25ae939d37f4e3e058bae508103a80367fd6ffbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ho=CC=88gborg?= Date: Fri, 17 Jul 2015 11:27:39 +0200 Subject: [PATCH] Options to disable annotations --- gopow.go | 6 +++++- internal/gopow/gopow.go | 32 +++++++++++++++++++------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/gopow.go b/gopow.go index 88614c0..45e9da7 100644 --- a/gopow.go +++ b/gopow.go @@ -56,7 +56,7 @@ func main() { cli.StringFlag{ Name: "input,i", Value: "", - Usage: "CSV input file generated by rtl_power", + Usage: "CSV input file generated by rtl_power [required]", }, cli.StringFlag{ Name: "output,o", @@ -72,6 +72,10 @@ func main() { Name: "verbose", Usage: "Enable more verbose output", }, + cli.BoolFlag{ + Name: "no-annotations", + Usage: "Disabled annotations such as time and frequency scales", + }, } app.Run(os.Args) diff --git a/internal/gopow/gopow.go b/internal/gopow/gopow.go index 1262549..2309409 100644 --- a/internal/gopow/gopow.go +++ b/internal/gopow/gopow.go @@ -13,9 +13,10 @@ import ( ) type RunConfig struct { - InputFile string - OutputFile string - Format string + InputFile string + OutputFile string + Format string + Annotations bool } type GoPow struct { @@ -27,9 +28,10 @@ type GoPow struct { func NewGoPow(c *cli.Context) (*GoPow, error) { config := &RunConfig{ - InputFile: c.String("input"), - OutputFile: c.String("output"), - Format: c.String("format"), + InputFile: c.String("input"), + OutputFile: c.String("output"), + Format: c.String("format"), + Annotations: !c.Bool("no-annotations"), } if config.InputFile == "" { @@ -79,14 +81,18 @@ func (g *GoPow) Render() error { } } - annotator, err := NewAnnotator(g.image, table) - if err != nil { - return err - } + if g.config.Annotations { - // add some frequency and date annotation - annotator.DrawXScale() - annotator.DrawYScale() + annotator, err := NewAnnotator(g.image, table) + if err != nil { + return err + } + + // add some frequency and time annotation + annotator.DrawXScale() + annotator.DrawYScale() + + } return nil }