Documentation ¶
Index ¶
- func LoadFontFace(fontBytes []byte, options opentype.FaceOptions) (font.Face, error)
- func LoadFontFaceFromFile(fontPath string, options opentype.FaceOptions) (font.Face, error)
- func WriteHeatmap(conf HeatmapConfig, w io.Writer) error
- type BasicColorScale
- type ColorScale
- type Day
- type DayBoxVisitor
- type DayIterator
- type DayVisitor
- type HeatmapConfig
- type LabelsProvider
- type MonthLabel
- type MonthLabelsVisitor
- type MonthSeparatorVisitor
- type Params
- type WeekdayLabel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadFontFace ¶ added in v1.5.0
LoadFontFace loads font face from bytes
func LoadFontFaceFromFile ¶ added in v1.4.1
LoadFontFaceFromFile loads font face from file
func WriteHeatmap ¶ added in v1.4.1
func WriteHeatmap(conf HeatmapConfig, w io.Writer) error
WriteHeatmap writes image with heatmap and additional elements
Types ¶
type BasicColorScale ¶ added in v1.4.1
BasicColorScale is color scale with variable number of colors
func NewBasicColorscaleFromCSV ¶ added in v1.5.0
func NewBasicColorscaleFromCSV(reader io.Reader) (BasicColorScale, error)
NewBasicColorscaleFromCSV creates colorscale from reader
func NewBasicColorscaleFromCSVFile ¶ added in v1.4.1
func NewBasicColorscaleFromCSVFile(path string) (BasicColorScale, error)
NewBasicColorscaleFromCSVFile loads basic colorscale from CSV file
type ColorScale ¶ added in v1.4.1
ColorScale is interface for extracting color based on value from 0 to 1
type DayBoxVisitor ¶
type DayBoxVisitor struct { Img *image.RGBA ColorScale ColorScale BoxSize int }
DayBoxVisitor draws signle heatbox
func (*DayBoxVisitor) Visit ¶
func (d *DayBoxVisitor) Visit(iter *DayIterator)
Visit called on every iteration
type DayIterator ¶
DayIterator has data for updating image based on a day
func NewDayIterator ¶
func NewDayIterator(counts map[string]int, offset image.Point, boxSize int, margin int) *DayIterator
NewDayIterator initializes iterator for a year
func (*DayIterator) Count ¶ added in v1.4.0
func (d *DayIterator) Count() int
Count returns count value
func (*DayIterator) Done ¶
func (d *DayIterator) Done() bool
Done returns true if no entries left, else false
func (*DayIterator) Next ¶
func (d *DayIterator) Next()
Next will update current iterator to next value
func (*DayIterator) Point ¶
func (d *DayIterator) Point() image.Point
Point returns position of top left corner of box for drawing
func (*DayIterator) Time ¶
func (d *DayIterator) Time() time.Time
Time returns time representation of iterator
func (*DayIterator) Value ¶
func (d *DayIterator) Value() float64
Value returns relative value in range 0 ~ 1
type DayVisitor ¶
type DayVisitor interface {
Visit(iter *DayIterator)
}
DayVisitor is interface to update image based on current box
type HeatmapConfig ¶
type HeatmapConfig struct { Counts map[string]int ColorScale ColorScale DrawMonthSeparator bool DrawLabels bool BoxSize int Margin int MonthSeparatorWidth int MonthLabelYOffset int TextWidthLeft int TextHeightTop int TextColor color.RGBA BorderColor color.RGBA Locale string Format string FontFace font.Face ShowWeekdays map[time.Weekday]bool }
HeatmapConfig contains config of calendar heatmap image
type LabelsProvider ¶ added in v1.3.0
type LabelsProvider struct {
// contains filtered or unexported fields
}
LabelsProvider provides labels for locale
func NewLabelsProvider ¶ added in v1.3.0
func NewLabelsProvider(locale string) LabelsProvider
NewLabelsProvider initializes labels provider for locale
func (LabelsProvider) GetMonth ¶ added in v1.3.0
func (p LabelsProvider) GetMonth(month time.Month) string
GetMonth returns month label
func (LabelsProvider) GetWeekday ¶ added in v1.3.0
func (p LabelsProvider) GetWeekday(weekday time.Weekday) string
GetWeekday returns weekday label
type MonthLabel ¶ added in v1.4.1
MonthLabel is SVG template month label parameters
type MonthLabelsVisitor ¶
type MonthLabelsVisitor struct { Img *image.RGBA YOffset int Color color.RGBA LabelsProvider LabelsProvider FontFace font.Face }
MonthLabelsVisitor draws month label on top of first row 0 of month
func (*MonthLabelsVisitor) Visit ¶
func (d *MonthLabelsVisitor) Visit(iter *DayIterator)
Visit on every iteration
type MonthSeparatorVisitor ¶
type MonthSeparatorVisitor struct { Img *image.RGBA MinY int MaxY int Margin int BoxSize int Width int Color color.RGBA }
MonthSeparatorVisitor draws month separator
func (*MonthSeparatorVisitor) Visit ¶
func (d *MonthSeparatorVisitor) Visit(iter *DayIterator)
Visit called on every iteration
type Params ¶ added in v1.4.0
type Params struct { BoxAreaHeight int BoxAreaWidth int BoxSize int Margin int Days [53][7]Day LabelsMonths []MonthLabel LabelsWeekdays []WeekdayLabel LabelsColor string MonthSeparators []string }
Params is total SVG template parameters
type WeekdayLabel ¶ added in v1.4.0
WeekdayLabel is SVG template weekday label parameters