timeline

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLayout = Layout{
	Margin: EdgeInsets{
		Top:    10,
		Right:  10,
		Bottom: 10,
		Left:   10,
	},
	LabelHeight:     30,
	HeadlineWidth:   100,
	TimelineWidth:   900,
	EntryHeight:     70,
	OnlineBarHeight: 20,
}

Functions

func CalculateTics

func CalculateTics(d time.Duration) (Tics, Tics)

func GenFrame

func GenFrame(start, now time.Time) time.Time

Types

type EdgeInsets added in v0.0.3

type EdgeInsets struct {
	Top    float64
	Right  float64
	Bottom float64
	Left   float64
}

type Entry

type Entry struct {
	Avatar   image.Image
	Color    color.Color
	Sections []Section
}

type EntryBuilder

type EntryBuilder struct {
	Entry
}

func NewEntryBuilder

func NewEntryBuilder(avatar image.Image, color color.Color) *EntryBuilder

func (*EntryBuilder) AddSection

func (b *EntryBuilder) AddSection(start, end time.Time) *EntryBuilder

func (*EntryBuilder) Build

func (b *EntryBuilder) Build() Entry

type Layout added in v0.0.3

type Layout struct {
	Margin          EdgeInsets
	HeadlineWidth   float64
	TimelineWidth   float64
	LabelHeight     float64
	EntryHeight     float64
	OnlineBarHeight float64
}

func (Layout) Height added in v0.0.3

func (l Layout) Height(nEntries int) float64

func (Layout) OnlineBarFillingFactor added in v0.0.3

func (l Layout) OnlineBarFillingFactor() float64

func (Layout) Width added in v0.0.3

func (l Layout) Width() float64

type Section

type Section struct {
	Start time.Time
	End   time.Time
}

Section represents a time Section in a timeline entry. It is defined by a start and end time.

type Tics

type Tics struct {
	// contains filtered or unexported fields
}

type Timeline

type Timeline struct {
	StartTime time.Time
	Indicator time.Time
	EndTime   time.Time
	Entries   []Entry
	Layout    Layout
}

func (Timeline) Generate

func (t Timeline) Generate() io.Reader

type TimelineBuilder

type TimelineBuilder struct {
	Timeline
}

func NewTimelineBuilder

func NewTimelineBuilder(start, end time.Time) *TimelineBuilder

func (*TimelineBuilder) AddEntries

func (b *TimelineBuilder) AddEntries(entries ...Entry) *TimelineBuilder

func (*TimelineBuilder) Build

func (b *TimelineBuilder) Build() Timeline

func (*TimelineBuilder) SetIndicator

func (b *TimelineBuilder) SetIndicator(indicator time.Time) *TimelineBuilder

func (*TimelineBuilder) SetLayout added in v0.0.3

func (b *TimelineBuilder) SetLayout(layout Layout) *TimelineBuilder

Jump to

Keyboard shortcuts

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