Documentation
¶
Index ¶
- Variables
- func Plot(series []float64, options ...Option) string
- func PlotMany(data [][]float64, options ...Option) string
- type AnsiColor
- type CharSet
- type Option
- func AxisColor(ac AnsiColor) Option
- func Caption(caption string) Option
- func CaptionColor(ac AnsiColor) Option
- func Height(h int) Option
- func LabelColor(ac AnsiColor) Option
- func LineEnding(ending string) Option
- func LowerBound(min float64) Option
- func Offset(o int) Option
- func Precision(p uint) Option
- func SeriesChars(charSets ...CharSet) Option
- func SeriesColors(ac ...AnsiColor) Option
- func SeriesLegends(text ...string) Option
- func UpperBound(max float64) Option
- func Width(w int) Option
- func XAxisRange(min, max float64) Option
- func XAxisTickCount(n int) Option
- func XAxisValueFormatter(f XAxisValueFormatterFunc) Option
- func YAxisValueFormatter(f YAxisValueFormatterFunc) Option
- type XAxisValueFormatterFunc
- type YAxisValueFormatterFunc
Constants ¶
This section is empty.
Variables ¶
var Clear func()
clear terminal screen
var ColorNames = map[string]AnsiColor{}/* 141 elements not displayed */
var DefaultCharSet = CharSet{
Horizontal: "─",
VerticalLine: "│",
ArcDownRight: "╭",
ArcDownLeft: "╮",
ArcUpRight: "╰",
ArcUpLeft: "╯",
EndCap: "╴",
StartCap: "╶",
UpRight: "└",
DownHorizontal: "┬",
}
DefaultCharSet provides the default box-drawing characters.
Functions ¶
Types ¶
type AnsiColor ¶ added in v0.5.5
type AnsiColor byte
var ( Default AnsiColor = 0 AliceBlue AnsiColor = 255 AntiqueWhite AnsiColor = 255 Aqua AnsiColor = 14 Aquamarine AnsiColor = 122 Azure AnsiColor = 15 Beige AnsiColor = 230 Bisque AnsiColor = 224 Black AnsiColor = 188 // dummy value BlanchedAlmond AnsiColor = 230 Blue AnsiColor = 12 BlueViolet AnsiColor = 92 Brown AnsiColor = 88 BurlyWood AnsiColor = 180 CadetBlue AnsiColor = 73 Chartreuse AnsiColor = 118 Chocolate AnsiColor = 166 Coral AnsiColor = 209 CornflowerBlue AnsiColor = 68 Cornsilk AnsiColor = 230 Crimson AnsiColor = 161 Cyan AnsiColor = 14 DarkBlue AnsiColor = 18 DarkCyan AnsiColor = 30 DarkGoldenrod AnsiColor = 136 DarkGray AnsiColor = 248 DarkGreen AnsiColor = 22 DarkKhaki AnsiColor = 143 DarkMagenta AnsiColor = 90 DarkOliveGreen AnsiColor = 59 DarkOrange AnsiColor = 208 DarkOrchid AnsiColor = 134 DarkRed AnsiColor = 88 DarkSalmon AnsiColor = 173 DarkSeaGreen AnsiColor = 108 DarkSlateBlue AnsiColor = 60 DarkSlateGray AnsiColor = 238 DarkTurquoise AnsiColor = 44 DarkViolet AnsiColor = 92 DeepPink AnsiColor = 198 DeepSkyBlue AnsiColor = 39 DimGray AnsiColor = 242 DodgerBlue AnsiColor = 33 Firebrick AnsiColor = 124 FloralWhite AnsiColor = 15 ForestGreen AnsiColor = 28 Fuchsia AnsiColor = 13 Gainsboro AnsiColor = 253 GhostWhite AnsiColor = 15 Gold AnsiColor = 220 Goldenrod AnsiColor = 178 Gray AnsiColor = 8 Green AnsiColor = 2 GreenYellow AnsiColor = 155 Honeydew AnsiColor = 15 HotPink AnsiColor = 205 IndianRed AnsiColor = 167 Indigo AnsiColor = 54 Ivory AnsiColor = 15 Khaki AnsiColor = 222 Lavender AnsiColor = 254 LavenderBlush AnsiColor = 255 LawnGreen AnsiColor = 118 LemonChiffon AnsiColor = 230 LightBlue AnsiColor = 152 LightCoral AnsiColor = 210 LightCyan AnsiColor = 195 LightGoldenrodYellow AnsiColor = 230 LightGray AnsiColor = 252 LightGreen AnsiColor = 120 LightPink AnsiColor = 217 LightSalmon AnsiColor = 216 LightSeaGreen AnsiColor = 37 LightSkyBlue AnsiColor = 117 LightSlateGray AnsiColor = 103 LightSteelBlue AnsiColor = 152 LightYellow AnsiColor = 230 Lime AnsiColor = 10 LimeGreen AnsiColor = 77 Linen AnsiColor = 255 Magenta AnsiColor = 13 Maroon AnsiColor = 1 MediumAquamarine AnsiColor = 79 MediumBlue AnsiColor = 20 MediumOrchid AnsiColor = 134 MediumPurple AnsiColor = 98 MediumSeaGreen AnsiColor = 72 MediumSlateBlue AnsiColor = 99 MediumSpringGreen AnsiColor = 48 MediumTurquoise AnsiColor = 80 MediumVioletRed AnsiColor = 162 MidnightBlue AnsiColor = 17 MintCream AnsiColor = 15 MistyRose AnsiColor = 224 Moccasin AnsiColor = 223 OldLace AnsiColor = 230 Olive AnsiColor = 3 OliveDrab AnsiColor = 64 Orange AnsiColor = 214 OrangeRed AnsiColor = 202 Orchid AnsiColor = 170 PaleGoldenrod AnsiColor = 223 PaleGreen AnsiColor = 120 PaleTurquoise AnsiColor = 159 PaleVioletRed AnsiColor = 168 PapayaWhip AnsiColor = 230 PeachPuff AnsiColor = 223 Peru AnsiColor = 173 Pink AnsiColor = 218 Plum AnsiColor = 182 PowderBlue AnsiColor = 152 Purple AnsiColor = 5 Red AnsiColor = 9 RosyBrown AnsiColor = 138 RoyalBlue AnsiColor = 63 SaddleBrown AnsiColor = 94 Salmon AnsiColor = 210 SandyBrown AnsiColor = 215 SeaGreen AnsiColor = 29 SeaShell AnsiColor = 15 Sienna AnsiColor = 131 Silver AnsiColor = 7 SkyBlue AnsiColor = 117 SlateBlue AnsiColor = 62 SlateGray AnsiColor = 66 Snow AnsiColor = 15 SpringGreen AnsiColor = 48 SteelBlue AnsiColor = 67 Tan AnsiColor = 180 Teal AnsiColor = 6 Thistle AnsiColor = 182 Tomato AnsiColor = 203 Turquoise AnsiColor = 80 Violet AnsiColor = 213 Wheat AnsiColor = 223 White AnsiColor = 15 WhiteSmoke AnsiColor = 255 Yellow AnsiColor = 11 YellowGreen AnsiColor = 149 )
type CharSet ¶ added in v0.8.0
type CharSet struct {
Horizontal string // Horizontal line character (default: ─)
VerticalLine string // Vertical line character (default: │)
ArcDownRight string // Arc character going down and right (default: ╭)
ArcDownLeft string // Arc character going down and left (default: ╮)
ArcUpRight string // Arc character going up and right (default: ╰)
ArcUpLeft string // Arc character going up and left (default: ╯)
EndCap string // End cap character (default: ╴)
StartCap string // Start cap character (default: ╶)
UpRight string // Axis corner character (default: └)
DownHorizontal string // X-axis tick mark character (default: ┬)
}
CharSet defines the characters used for plotting a series.
func CreateCharSet ¶ added in v0.8.0
CreateCharSet is a helper function that creates a CharSet with all fields set to the same character. This is useful for simple uniform character sets like "*", "•", "#", etc.
type Option ¶ added in v0.3.0
type Option interface {
// contains filtered or unexported methods
}
Option represents a configuration setting.
func CaptionColor ¶ added in v0.5.5
CaptionColor sets the caption color.
func LabelColor ¶ added in v0.5.5
LabelColor sets the axis label color.
func LineEnding ¶ added in v0.8.0
LineEnding sets the line ending sequence. Use "\r\n" for raw terminals (e.g., Windows terminals) or "\n" for standard Unix-style output. Defaults to "\n".
func LowerBound ¶ added in v0.5.6
LowerBound sets the graph's minimum value for the vertical axis. It will be ignored if the series contains a lower value.
func SeriesChars ¶ added in v0.8.0
SeriesChars sets the character sets for each series. If fewer CharSets are provided than series, DefaultCharSet is used for remaining series.
func SeriesColors ¶ added in v0.5.5
SeriesColors sets the series colors.
func SeriesLegends ¶ added in v0.6.0
SeriesLegends sets the legend text for the corresponding series.
func UpperBound ¶ added in v0.5.6
UpperBound sets the graph's maximum value for the vertical axis. It will be ignored if the series contains a bigger value.
func Width ¶ added in v0.3.0
Width sets the graphs width. By default, the width of the graph is determined by the number of data points. If the value given is a positive number, the data points are interpolated on the x axis. Values <= 0 reset the width to the default value.
func XAxisRange ¶ added in v0.9.0
XAxisRange enables the X-axis and maps the given domain [min, max] onto the plot width.
func XAxisTickCount ¶ added in v0.9.0
XAxisTickCount sets the number of ticks on the X-axis. Default is 5, minimum is 2.
func XAxisValueFormatter ¶ added in v0.9.0
func XAxisValueFormatter(f XAxisValueFormatterFunc) Option
XAxisValueFormatter formats values printed on the X-axis.
func YAxisValueFormatter ¶ added in v0.8.0
func YAxisValueFormatter(f YAxisValueFormatterFunc) Option
YAxisValueFormatter formats values printed on the Y-axis.
type XAxisValueFormatterFunc ¶ added in v0.9.0
XAxisValueFormatterFunc formats a single X-axis tick value.
type YAxisValueFormatterFunc ¶ added in v0.8.0
YAxisValueFormatterFunc formats a single Y-axis value.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
asciigraph
command
|
|
|
examples
|
|
|
custom-chars
command
|
|
|
rainbow
command
|
|
|
rainbow-legends
command
|
|
|
sine
command
|
|
|
x-axis
command
|

