outputgen

package
v0.0.0-...-4a518ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2017 License: BSD-3-Clause Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const (

	//OutDirMode is the file mode of the directory
	//to which output artifacts will be written
	OutDirMode = 0777

	//OutDir is the path to the directory
	//(absolute or relative to the analyst executable)
	//to which output artifacts will be written
	OutDir = "../out"
)

Variables

This section is empty.

Functions

func BuildBarChart

func BuildBarChart(chartable BarChartable) (string, error)

BuildBarChart creates a bar chart from the given chartdata, exports it to PNG, saves it to the outDir (according to the given chart name) and returns the path to the png.

func BuildPDF

func BuildPDF(sections ...PDFSection) error

BuildPDF creates a PDF file

*with the given PDFSections.
*The resulting PDF will be written to the
*outDir directory.

Types

type BarChartable

type BarChartable interface {
	GetOrderedBarChartValues() BarChartableValuesOrdered
	SetTitle(string)
	// Should raise an error if title is empty
	Title() string
}

BarChartable must be implemented by any type that will be used as the chartdata input of a BarChart generator.

type BarChartableValue

type BarChartableValue struct {
	Value int
	Label string
}

BarChartableValue Is a value containing a label and value which can be transformed into a printable bar of a bar chart.

type BarChartableValuesOrdered

type BarChartableValuesOrdered []BarChartableValue

BarChartableValuesOrdered is a slice of structs that will be generated by a GetBarChartValues() method implementation of any struct that implements BarChartable. The bars will be rendered on the order of appearance in this slice.

type PDFSection

type PDFSection struct {
	Title       string
	Description string
	ChartFiles  []string
}

PDFSection describes a

*standardized section of the
*analytics report PDF to be generated.
*Each section consitst of a title, a description
*and a number of charts.
*In the document each section will be presented
*in this order, (i.e. first the title, then the description then the charts),
*whereas the charts (within one section)
*will be printed below each other with nothing inbetween.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL