# README
Charts for Go
Basic charts in go.
This package focuses more on autoscaling, error bars, and logarithmic plots than on beautifull or marketing ready charts.
Examples
Chart Types
The following chart types are implemented:
- Strip Charts
- Scatter / Function-Plot Charts
- Histograms
- Bar and Categorical Bar Charts
- Pie/Ring Charts
- Boxplots
Some Features
- Axis can be linear, logarithmical, categorical or time/date axis.
- Autoscaling with lots of options
- Fine control of tics and labels
Output / Graphic Formats
Package chart itself provideds the charts/plots itself, the charts/plots can be output to different graphic drivers. Currently
- txtg: ASCII art charts
- svgg: scalable vector graphics (via github.com/ajstarks/svgo), and
- imgg: Go image.RGBA (via code.google.com/p/draw2d/draw2d/ and code.google.com/p/freetype-go) are implemented.
For a quick overview save as xbestof.{png,svg,txt} run
$ example/example -best
A fuller overview can be generated by
$ example/example -All
Quirks
- Style handling (especialy colour) is a bit of a mess .
- Text based charts are cute. But the general graphics would be much easier without.
- Time handling code dates back to pre Go1, it should be reworked.
# Functions
AbsoluteValue will format value (ignoring sum).
AutoStyle produces a styles based on StandardColors, StandardLineStyles, and StandardSymbols.
No description provided by the author
FmtFloat yields a string representation of f.
No description provided by the author
GenericBars draws the bars in the given style using bg.
GenericBoxes draws box plots.
GenericCircle approximates a circle of radius r around (x,y) with lines.
GenericKey draws the key onto bg at (x,y).
GenericPath is the incomplete implementation of a list of points connected by straight lines.
GenericRect draws a rectangle of size w x h at (x,y).
GeenricRings draws wedges for pie/ring charts charts.
GenericScatter draws the given points according to style.
GenericSymbol draws the symbol defined by style at (x,y).
GenericTextLen tries to determine the width in pixel of t if rendered into mg in using font.
GenericWedge draws a pie/wedge just by lines.
GenericXAxis draws the x-axis with range rng solely by graphic primitives of bg.
GenericYAxis draws the y-axis with the range rng solely by graphic primitives of bg.
IntegerValue will format value (ignoring sum) as an integer.
No description provided by the author
NextSymbol returns the next symbol of s: Either in the global list Symbol or (if not found there) the next character.
No description provided by the author
Return p percentil of pre-sorted integer data.
PercentValue formats value as percentage of sum.
RoundDown will round tp down to next "full" d.
RoundNext will round t to nearest full d.
RoundUp will round tp up to next "full" d.
SanitizeRect returns the top left corner and the positive width and height of the given (possibly unsanitized) rectangle taking into account the line width r.
Compute minimum, p percentil, median, average, 100-p percentil and maximum of values in data.
Compute minimum, p percentil, median, average, 100-p percentil and maximum of values in data.
SymbolIndex returns the index of the symbol s in Symbol or -1 if not found.
# Constants
---- - - ---- - -.
---- ---- ---- ----.
- - - - - - - - - - -.
Like ExpandToTic and add/subtract ExpandABitFraction of tic distance.
Set min/max to next tic really below/above min/max of data.
Use data min/max as limit.
Set to next tic below/above or equal to min/max of data.
No description provided by the author
Zebra style background.
No description provided by the author
Grid lines.
No grid lines.
No description provided by the author
No description provided by the author
No description provided by the author
.
The supported line styles.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
draw a full mirrored axis including tics.
just draw a mirrord axis, but omit tics.
do not draw a mirrored axis.
No description provided by the author
produce boxplot.
connect data points by straight lines.
symbols and lines.
draw symbol at data point.
No description provided by the author
No description provided by the author
----------------------.
No description provided by the author
No description provided by the author
No description provided by the author
# Variables
15/16 * (1-x^2)^2.
CharacterWidth is a table of the (relative) width of common runes.
DebugLogger is used to log some information about the chart generation.
DefaultStyle maps chart elements to styles.
Delta is a list of increasing time deltas used to construct tic spacings for date/time axis.
3/4 * (1-x^2).
ExpandABitFraction is the fraction of a major tic spacing added during axis range expansion with the ExpandABit mode.
1/sqrt(2pi) * exp(-1/2x^2).
Horizontal spacing between two columns in key.
Horizontal spacing between key box and content.
Vertical spacing between individual rows.
Horizontal spacing bewteen symbol and text.
Horizontal length/space reserved for symbol.
Vertical spacing between key box and content.
How much are flaged segments offset.
Scaling factor of radius of next data set.
1/2.
Standard colors used by AutoStyle.
How much brighter/darker filled elements become.
Standard line styles used by AutoStyle (fill=false).
Standard symbols used by AutoStyle.
Symbol is the list of different symbols.
1 - |x|.
35/32 * (1-x^2)^3.
Units are the SI prefixes for 10^3n.
# Structs
BarChart draws simple bar charts.
BarChartData encapsulates data sets in a bar chart.
Barinfo describes a rectangular bar (e.g.
Box represents a box in an boxplot.
BoxChart represents box charts.
BoxChartData encapsulates a data set in a box chart.
No description provided by the author
CatValue is the standard implementation for CategoryValue.
Day.
EPoint represents a point in two dimensions (X,Y) with possible error ranges in both dimensions.
Font describes a font.
HistChart represents histogram charts.
HistChartData encapsulates one data set in a histogram chart.
Hour.
Key encapsulates settings for keys/legends in a chart.
KeyEntry encapsulates an antry in the key/legend.
LayoutData encapsulates the layout of the graph area in the whole drawing area.
Minute.
Month.
PieChart represents pie and ring charts.
Point is a point in two dimensions (x,y) implementing XYValue.
Range encapsulates all information about an axis.
RangeMode describes how one end of an axis is set up.
ScatterChart represents scatter charts, line charts and function plots.
ScatterChartData encapsulates a data set or function in a scatter chart.
Second.
StripChart represents very simple strip charts.
Style contains all information about all graphic elements in a chart.
Tic describs a single tic on an axis.
TicSetting describes how (if at all) tics are shown on an axis.
Wedgeinfo describes a wedge in a pie chart.
Week.
Year.
# Interfaces
BasicGraphics is an interface of the most basic graphic primitives.
CategoryValue is the interface for any type of data which is a category-real-pair.
Chart ist the very simple interface for all charts: They can be plotted to a graphics output.
Graphics is the interface all chart drivers have to implement.
MinimalGraphics is the interface any graphics driver must implement, so that he can fall back to the generic routines for the higher level outputs.
Represents a tic-distance in a timed axis.
Value is the interface for any type of data representable by a real.
XYErrValue is the interface for any type of data which is point-like (x,y) and has some measurement error.
XYValue is the interface for any type of data which is point-like and has a x- and y-coordinate.
# Type aliases
Expansion determines the way an axis range is expanded to align nicely with the tics on the axis.
FontSize is the relative font size used in chart.
GridMode describes the way a grid on the major tics is drawn.
Kernel is a smoothing kernel for histograms.
LineStyle describes the different types of lines.
MirrorAxis describes if and how an axis is drawn on the oposite side of a chart,.
PlotElement identifies one element in a plot/chart.
PlotOptions contains a Style for each PlotElement.
PlotStyle describes how data and functions are drawn in scatter plots.
Real is a float64 implementing the Value interface.