guptarohit/asciigraph

Two options: ColorAbove and ColorBelow

Opened this issue · 1 comments

perbu commented

Hi.

I've added some code to enable options to color the parts of the graph that is above/below a certain value. So this graph:
bilde

Is produced by the following code:

func main() {
	series := []float64{1, 2, 3, 4, 5, 4, 3, 2, 1}
	graph := asciigraph.Plot(series, asciigraph.Height(10),
		asciigraph.Width(50),
		asciigraph.Caption("A simple line graph"),
		asciigraph.ColorAbove(asciigraph.Red, 4.0),
		asciigraph.ColorBelow(asciigraph.DarkGreen, 2.0),
	)
	fmt.Println(graph)
}

Lemme know if you want me to contribute this in a proper manner. If so I'll but a bow on it and hand it over.

Cheers,

Per.

very helpful