timeline

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 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
	Series []Series
}

Entry represents a timeline entry. It contains an avatar and a timeline entry.

type EntryBuilder

type EntryBuilder struct {
	Entry
}

func NewEntryBuilder

func NewEntryBuilder(avatar image.Image) *EntryBuilder

func (*EntryBuilder) AddSeries added in v0.3.0

func (b *EntryBuilder) AddSeries(series Series) *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
}

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) Width added in v0.0.3

func (l Layout) Width() float64

type Section

type Section struct {
	Start time.Time
	End   time.Time
	Alpha float64 // 0(transparent) to 1(opaque)
}

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

type SectionOpt added in v0.2.0

type SectionOpt func(*Section)

func WithAlpha added in v0.2.0

func WithAlpha(alpha float64) SectionOpt

type Series added in v0.3.0

type Series struct {
	FillingFactor float64
	Color         color.Color
	Sections      []Section
}

type SeriesBuilder added in v0.3.0

type SeriesBuilder struct {
	Series
}

func NewSeriesBuilder added in v0.3.0

func NewSeriesBuilder(fillingFactor float64, color color.Color) *SeriesBuilder

func (*SeriesBuilder) AddSection added in v0.3.0

func (b *SeriesBuilder) AddSection(start, end time.Time, opts ...SectionOpt) *SeriesBuilder

func (*SeriesBuilder) Build added in v0.3.1

func (b *SeriesBuilder) Build() Series

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