timeline

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateTics

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

func ChooseFormat added in v0.0.7

func ChooseFormat(d time.Duration) string

func GenFrame

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

Types

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 {
	HeadlineWidth   float64
	TimelineWidth   float64
	EntryHeight     float64
	OnlineBarHeight float64
}

func DefaultLayout added in v0.0.3

func DefaultLayout() Layout

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 {
	Interval time.Duration
	Color    color.Color
	Label    design.TextBox
}

func (Tics) Valid added in v0.0.7

func (t Tics) Valid() bool

type Timeline

type Timeline struct {
	Title     design.TextBox
	StartTime time.Time
	Indicator time.Time
	EndTime   time.Time
	Entries   []Entry
	Margin    design.EdgeInsets
	Padding   design.EdgeInsets
	Layout    Layout
	MainTics  Tics
	SubTics   Tics
}

func (Timeline) Generate

func (t Timeline) Generate() io.Reader

func (Timeline) GridLeft added in v0.0.7

func (t Timeline) GridLeft() float64

func (Timeline) GridTop added in v0.0.7

func (t Timeline) GridTop() float64

func (Timeline) Height added in v0.0.7

func (t Timeline) Height() float64

func (Timeline) Width added in v0.0.7

func (t Timeline) Width() float64

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

func (*TimelineBuilder) SetMainTics added in v0.0.5

func (b *TimelineBuilder) SetMainTics(tics Tics) *TimelineBuilder

func (*TimelineBuilder) SetMargin added in v0.0.7

func (b *TimelineBuilder) SetMargin(margin design.EdgeInsets) *TimelineBuilder

func (*TimelineBuilder) SetPadding added in v0.0.7

func (b *TimelineBuilder) SetPadding(padding design.EdgeInsets) *TimelineBuilder

func (*TimelineBuilder) SetSubTics added in v0.0.5

func (b *TimelineBuilder) SetSubTics(tics Tics) *TimelineBuilder

func (*TimelineBuilder) SetTitle added in v0.0.7

func (b *TimelineBuilder) SetTitle(title design.TextBox) *TimelineBuilder

Jump to

Keyboard shortcuts

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