Options to disable annotations

This commit is contained in:
David Högborg
2015-07-17 11:27:39 +02:00
parent 74849e6aee
commit 25ae939d37
2 changed files with 24 additions and 14 deletions

View File

@@ -56,7 +56,7 @@ func main() {
cli.StringFlag{ cli.StringFlag{
Name: "input,i", Name: "input,i",
Value: "", Value: "",
Usage: "CSV input file generated by rtl_power", Usage: "CSV input file generated by rtl_power [required]",
}, },
cli.StringFlag{ cli.StringFlag{
Name: "output,o", Name: "output,o",
@@ -72,6 +72,10 @@ func main() {
Name: "verbose", Name: "verbose",
Usage: "Enable more verbose output", Usage: "Enable more verbose output",
}, },
cli.BoolFlag{
Name: "no-annotations",
Usage: "Disabled annotations such as time and frequency scales",
},
} }
app.Run(os.Args) app.Run(os.Args)

View File

@@ -13,9 +13,10 @@ import (
) )
type RunConfig struct { type RunConfig struct {
InputFile string InputFile string
OutputFile string OutputFile string
Format string Format string
Annotations bool
} }
type GoPow struct { type GoPow struct {
@@ -27,9 +28,10 @@ type GoPow struct {
func NewGoPow(c *cli.Context) (*GoPow, error) { func NewGoPow(c *cli.Context) (*GoPow, error) {
config := &RunConfig{ config := &RunConfig{
InputFile: c.String("input"), InputFile: c.String("input"),
OutputFile: c.String("output"), OutputFile: c.String("output"),
Format: c.String("format"), Format: c.String("format"),
Annotations: !c.Bool("no-annotations"),
} }
if config.InputFile == "" { if config.InputFile == "" {
@@ -79,14 +81,18 @@ func (g *GoPow) Render() error {
} }
} }
annotator, err := NewAnnotator(g.image, table) if g.config.Annotations {
if err != nil {
return err
}
// add some frequency and date annotation annotator, err := NewAnnotator(g.image, table)
annotator.DrawXScale() if err != nil {
annotator.DrawYScale() return err
}
// add some frequency and time annotation
annotator.DrawXScale()
annotator.DrawYScale()
}
return nil return nil
} }