Documentation
¶
Index ¶
- func RemoveIndexFromSlice[K comparable](index int, slice []K) []K
- func ShiftSlice[K comparable](newData K, slice []K) []K
- type ChartDatapoint
- type ChartOption
- func WithBottomLeftLabel(label string) ChartOption
- func WithBottomRightLabel(label string) ChartOption
- func WithColorLegend(enable bool) ChartOption
- func WithDataPointMarkers(enable bool) ChartOption
- func WithDataPoints(seriesData map[string][]*ChartDatapoint) ChartOption
- func WithDebugLogging(enable bool) ChartOption
- func WithFooter(label string) ChartOption
- func WithHorizGridLines(enable bool) ChartOption
- func WithLeftScaleLabel(label string) ChartOption
- func WithMinSize(width, height float32) ChartOption
- func WithMousePointDisplay(enable bool) ChartOption
- func WithOnHoverPointCallback(callBack func(series string, dataPoint ChartDatapoint)) ChartOption
- func WithRightScaleLabel(label string) ChartOption
- func WithTitle(label string) ChartOption
- func WithTopLeftLabel(label string) ChartOption
- func WithTopRightLabel(label string) ChartOption
- func WithVertGridLines(enable bool) ChartOption
- func WithYScaleFactor(maxYScaleLabel int) ChartOption
- type ChartOptions
- type GraphAverage
- type GraphPointSmoothing
- type LineChart
- func New(topTitle, bottomTitle string, yScaleFactor int, ...) (LineChart, error)
- func NewLineChart(topTitle, bottomTitle string, yScaleFactor int, ...) (LineChart, error)
- func NewLineChartViaOptions(options *ChartOptions) (LineChart, error)
- func NewWithOptions(options *ChartOptions) (LineChart, error)
- type LineChartSkn
- func (w *LineChartSkn) ApplyDataPoint(seriesName string, newDataPoint *ChartDatapoint)
- func (w *LineChartSkn) ApplyDataSeries(seriesName string, newSeries []*ChartDatapoint) error
- func (w *LineChartSkn) CreateRenderer() fyne.WidgetRenderer
- func (w *LineChartSkn) EnableDebugLogging(enable bool)
- func (w *LineChartSkn) GetBottomCenteredLabel() string
- func (w *LineChartSkn) GetBottomLeftLabel() string
- func (w *LineChartSkn) GetBottomRightLabel() string
- func (w *LineChartSkn) GetLineStrokeSize() float32
- func (w *LineChartSkn) GetMiddleLeftLabel() string
- func (w *LineChartSkn) GetMiddleRightLabel() string
- func (w *LineChartSkn) GetTitle() string
- func (w *LineChartSkn) GetTopLeftLabel() string
- func (w *LineChartSkn) GetTopRightLabel() string
- func (w *LineChartSkn) IsColorLegendEnabled() bool
- func (w *LineChartSkn) IsDataPointMarkersEnabled() bool
- func (w *LineChartSkn) IsHorizGridLinesEnabled() bool
- func (w *LineChartSkn) IsMousePointDisplayEnabled() bool
- func (w *LineChartSkn) IsVertGridLinesEnabled() bool
- func (w *LineChartSkn) MouseIn(*desktop.MouseEvent)
- func (w *LineChartSkn) MouseMoved(me *desktop.MouseEvent)
- func (w *LineChartSkn) MouseOut()
- func (w *LineChartSkn) ObjectCount() int
- func (w *LineChartSkn) SetBottomCenteredLabel(newValue string)
- func (w *LineChartSkn) SetBottomLeftLabel(newValue string)
- func (w *LineChartSkn) SetBottomRightLabel(newValue string)
- func (w *LineChartSkn) SetColorLegend(enable bool)
- func (w *LineChartSkn) SetDataPointMarkers(enable bool)
- func (w *LineChartSkn) SetHorizGridLines(enable bool)
- func (w *LineChartSkn) SetLineStrokeSize(newSize float32)
- func (w *LineChartSkn) SetMiddleLeftLabel(newValue string)
- func (w *LineChartSkn) SetMiddleRightLabel(newValue string)
- func (w *LineChartSkn) SetMinSize(s fyne.Size)
- func (w *LineChartSkn) SetMousePointDisplay(enable bool)
- func (w *LineChartSkn) SetOnHoverPointCallback(f func(series string, dataPoint ChartDatapoint))
- func (w *LineChartSkn) SetTitle(newValue string)
- func (w *LineChartSkn) SetTopLeftLabel(newValue string)
- func (w *LineChartSkn) SetTopRightLabel(newValue string)
- func (w *LineChartSkn) SetVertGridLines(enable bool)
- func (w *LineChartSkn) Tapped(*fyne.PointEvent)
- func (w *LineChartSkn) TappedSecondary(*fyne.PointEvent)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RemoveIndexFromSlice ¶
func RemoveIndexFromSlice[K comparable](index int, slice []K) []K
RemoveIndexFromSlice remove the given index from any type of slice
func ShiftSlice ¶
func ShiftSlice[K comparable](newData K, slice []K) []K
ShiftSlice drops index 0 and append newData to any type of slice
Types ¶
type ChartDatapoint ¶
type ChartDatapoint interface { Value() float32 SetValue(y float32) ColorName() string SetColorName(n string) Timestamp() string SetTimestamp(t string) // ExternalID string uuid assigned when created ExternalID() string // Copy returns a cloned copy of current item Copy() ChartDatapoint // MarkerPosition internal use only: current data point marker location MarkerPosition() (*fyne.Position, *fyne.Position) // SetMarkerPosition internal use only: screen location of where data point marker is located SetMarkerPosition(top *fyne.Position, bottom *fyne.Position) }
ChartDatapoint data container interface for LineChart
func NewChartDatapoint ¶
func NewChartDatapoint(value float32, colorName, timestamp string) ChartDatapoint
type ChartOption ¶
type ChartOption func(lc *LineChartSkn) error
ChartOption alternate methodof sett chart properties
func WithBottomLeftLabel ¶
func WithBottomLeftLabel(label string) ChartOption
WithBottomLeftLabel sets the chart label
func WithBottomRightLabel ¶
func WithBottomRightLabel(label string) ChartOption
WithBottomRightLabel sets the chart label
func WithColorLegend ¶
func WithColorLegend(enable bool) ChartOption
WithColorLegend shows colored series legend in bottom right of chart
func WithDataPointMarkers ¶
func WithDataPointMarkers(enable bool) ChartOption
WithDataPointMarkers enables the use of markers on chart lines; mouse button 2 also toggles
func WithDataPoints ¶
func WithDataPoints(seriesData map[string][]*ChartDatapoint) ChartOption
WithDataPoints Primary series data to initialize chart with
func WithDebugLogging ¶
func WithDebugLogging(enable bool) ChartOption
WithDebugLogging activate logger to record method entry/exits
func WithHorizGridLines ¶
func WithHorizGridLines(enable bool) ChartOption
WithHorizGridLines enables horizontal grid lines display
func WithLeftScaleLabel ¶
func WithLeftScaleLabel(label string) ChartOption
WithLeftScaleLabel sets the chart label
func WithMinSize ¶
func WithMinSize(width, height float32) ChartOption
WithMinSize sets the minimum x/y size of chart
func WithMousePointDisplay ¶
func WithMousePointDisplay(enable bool) ChartOption
WithMousePointDisplay enables OnHover display over any line point
func WithOnHoverPointCallback ¶
func WithOnHoverPointCallback(callBack func(series string, dataPoint ChartDatapoint)) ChartOption
WithOnHoverPointCallback set callback function for datapoint under mouse postion
func WithRightScaleLabel ¶
func WithRightScaleLabel(label string) ChartOption
WithRightScaleLabel sets the chart label
func WithTopLeftLabel ¶
func WithTopLeftLabel(label string) ChartOption
WithTopLeftLabel sets the chart label
func WithTopRightLabel ¶
func WithTopRightLabel(label string) ChartOption
WithTopRightLabel sets the chart label
func WithVertGridLines ¶
func WithVertGridLines(enable bool) ChartOption
WithVertGridLines enables vertical grid lines display
func WithYScaleFactor ¶
func WithYScaleFactor(maxYScaleLabel int) ChartOption
WithYScaleFactor controls the yScale value y time 13 equals max y scale
type ChartOptions ¶
type ChartOptions struct {
// contains filtered or unexported fields
}
ChartOptions container of chart options
func NewChartOptions ¶
func NewChartOptions(opts ...ChartOption) *ChartOptions
NewChartOptions() returns a container for chart options
func (*ChartOptions) Add ¶
func (o *ChartOptions) Add(opt ChartOption)
Add adds a ChartOption to the container
func (*ChartOptions) Apply ¶
func (o *ChartOptions) Apply(lc *LineChartSkn) error
Apply applies the ChartOption to the provided linechart : Internal Use Only
type GraphAverage ¶
type GraphAverage struct {
// contains filtered or unexported fields
}
func NewGraphAverage ¶
func NewGraphAverage(seriesName string, graphPeriod time.Duration) *GraphAverage
func (*GraphAverage) AddValue ¶
func (g *GraphAverage) AddValue(value float64) float64
AddValue adds the given float64 value into the queue and return the average value of the queue value queue's size is limited by graph period config value
func (*GraphAverage) IsNil ¶
func (g *GraphAverage) IsNil() bool
func (*GraphAverage) SeriesName ¶
func (g *GraphAverage) SeriesName() string
func (*GraphAverage) String ¶
func (g *GraphAverage) String() string
type GraphPointSmoothing ¶
type GraphPointSmoothing interface { AddValue(value float64) float64 SeriesName() string IsNil() bool String() string }
GraphPointSmoothing support for different implementation of averaging or smooth data; current provides rolling average from last x reading.
type LineChart ¶
type LineChart interface { GetLineStrokeSize() float32 SetLineStrokeSize(newSize float32) IsDataPointMarkersEnabled() bool // mouse button 2 toggles IsHorizGridLinesEnabled() bool IsVertGridLinesEnabled() bool IsColorLegendEnabled() bool IsMousePointDisplayEnabled() bool // hoverable and mouse button one SetDataPointMarkers(enable bool) SetHorizGridLines(enable bool) SetVertGridLines(enable bool) SetColorLegend(enable bool) SetMousePointDisplay(enable bool) GetMiddleLeftLabel() string GetMiddleRightLabel() string GetTopLeftLabel() string GetTitle() string GetTopRightLabel() string GetBottomLeftLabel() string GetBottomCenteredLabel() string GetBottomRightLabel() string SetTopLeftLabel(newValue string) SetTitle(newValue string) SetTopRightLabel(newValue string) SetMiddleLeftLabel(newValue string) SetMiddleRightLabel(newValue string) SetBottomLeftLabel(newValue string) SetBottomCenteredLabel(newValue string) SetBottomRightLabel(newValue string) // ApplyDataSeries add a whole data series at once // expect this will rarely be used, since loading more than 130 point will raise error ApplyDataSeries(seriesName string, newSeries []*ChartDatapoint) error // ApplyDataPoint primary method to add another data point to any series // If series has more than 130 points, point 0 will be rolled out making room for this one ApplyDataPoint(seriesName string, newDataPoint *ChartDatapoint) // SetMinSize set the minimum size limit for the linechart SetMinSize(s fyne.Size) // EnableDebugLogging turns method entry/exit logging on or off EnableDebugLogging(enable bool) // SetHoverPointCallback method to call when a onscreen datapoint is hovered over by pointer SetOnHoverPointCallback(func(series string, dataPoint ChartDatapoint)) // ObjectCount internal use only: return the default ui elements for testing ObjectCount() int // fyne.CanvasObject compliance // implemented by BaseWidget Hide() MinSize() fyne.Size Move(position fyne.Position) Position() fyne.Position Refresh() Resize(size fyne.Size) Show() Size() fyne.Size Visible() bool }
LineChart feature list
func NewLineChart ¶
func NewLineChart(topTitle, bottomTitle string, yScaleFactor int, dataPoints *map[string][]*ChartDatapoint) (LineChart, error)
NewLineChart Create the Line Chart be careful not to exceed the series data point limit, which defaults to 150
can return a valid chart object and an error object; errors really should be handled and are caused by data points exceeding the container limit of 150; they will be truncated
func NewLineChartViaOptions ¶
func NewLineChartViaOptions(options *ChartOptions) (LineChart, error)
NewLineChartViaOptions Create the Line Chart using ChartOptions model be careful not to exceed the series data point limit, which defaults to 150
can return a valid chart object and an error object; errors really should be handled and are caused by data points exceeding the container limit of 150; they will be truncated
func NewWithOptions ¶
func NewWithOptions(options *ChartOptions) (LineChart, error)
type LineChartSkn ¶
type LineChartSkn struct { widget.BaseWidget // Inherit from BaseWidget OnHoverPointCallback func(series string, dataPoint ChartDatapoint) // contains filtered or unexported fields }
LineChartSkn widget implements the LineChart interface to display multiple series of data points which will roll off older point beyond the point limit.
func (*LineChartSkn) ApplyDataPoint ¶
func (w *LineChartSkn) ApplyDataPoint(seriesName string, newDataPoint *ChartDatapoint)
ApplyDataPoint adds a new datapoint to an existing series will shift out the oldest point if containers limit is exceeded
func (*LineChartSkn) ApplyDataSeries ¶
func (w *LineChartSkn) ApplyDataSeries(seriesName string, newSeries []*ChartDatapoint) error
ApplyDataSeries adds a new series of data to existing chart set. throws error if new series exceeds containers point limit
func (*LineChartSkn) CreateRenderer ¶
func (w *LineChartSkn) CreateRenderer() fyne.WidgetRenderer
CreateRenderer Create the renderer. This is called by the fyne application
func (*LineChartSkn) EnableDebugLogging ¶
func (w *LineChartSkn) EnableDebugLogging(enable bool)
EnableDebugLogging turns method entry/exit logging on or off
func (*LineChartSkn) GetBottomCenteredLabel ¶
func (w *LineChartSkn) GetBottomCenteredLabel() string
GetBottomCenteredLabel returns text of bottom center label
func (*LineChartSkn) GetBottomLeftLabel ¶
func (w *LineChartSkn) GetBottomLeftLabel() string
GetBottomLeftLabel returns text of bottom left label
func (*LineChartSkn) GetBottomRightLabel ¶
func (w *LineChartSkn) GetBottomRightLabel() string
GetBottomRightLabel returns text of bottom right label
func (*LineChartSkn) GetLineStrokeSize ¶
func (w *LineChartSkn) GetLineStrokeSize() float32
GetLineStrokeSize sets thickness of all lines drawn
func (*LineChartSkn) GetMiddleLeftLabel ¶
func (w *LineChartSkn) GetMiddleLeftLabel() string
GetMiddleLeftLabel returns text of middle left label
func (*LineChartSkn) GetMiddleRightLabel ¶
func (w *LineChartSkn) GetMiddleRightLabel() string
GetMiddleRightLabel returns text of middle right label
func (*LineChartSkn) GetTitle ¶
func (w *LineChartSkn) GetTitle() string
GetTitle return text of the chart's title from top center
func (*LineChartSkn) GetTopLeftLabel ¶
func (w *LineChartSkn) GetTopLeftLabel() string
GetTopLeftLabel return text from top left label
func (*LineChartSkn) GetTopRightLabel ¶
func (w *LineChartSkn) GetTopRightLabel() string
GetTopRightLabel returns text of top right label
func (*LineChartSkn) IsColorLegendEnabled ¶
func (w *LineChartSkn) IsColorLegendEnabled() bool
IsColorLegendEnabled returns state of color legend at bottom right of chart
func (*LineChartSkn) IsDataPointMarkersEnabled ¶
func (w *LineChartSkn) IsDataPointMarkersEnabled() bool
IsDataPointMarkersEnabled returns state of chart's use of data point markers on series data
func (*LineChartSkn) IsHorizGridLinesEnabled ¶
func (w *LineChartSkn) IsHorizGridLinesEnabled() bool
IsHorizGridLinesEnabled returns state of chart's display of horizontal grid line
func (*LineChartSkn) IsMousePointDisplayEnabled ¶
func (w *LineChartSkn) IsMousePointDisplayEnabled() bool
IsMousePointDisplayEnabled return state of mouse popups when hovered over a chart datapoint
func (*LineChartSkn) IsVertGridLinesEnabled ¶
func (w *LineChartSkn) IsVertGridLinesEnabled() bool
IsVertGridLinesEnabled returns state of chart's display of vertical grid line
func (*LineChartSkn) MouseIn ¶
func (w *LineChartSkn) MouseIn(*desktop.MouseEvent)
MouseIn unused interface method
func (*LineChartSkn) MouseMoved ¶
func (w *LineChartSkn) MouseMoved(me *desktop.MouseEvent)
MouseMoved interface method to discover which data point is under mouse
func (*LineChartSkn) MouseOut ¶
func (w *LineChartSkn) MouseOut()
MouseOut disable display of mouse data point display
func (*LineChartSkn) ObjectCount ¶
func (w *LineChartSkn) ObjectCount() int
ObjectCount testing method return static object count
func (*LineChartSkn) SetBottomCenteredLabel ¶
func (w *LineChartSkn) SetBottomCenteredLabel(newValue string)
SetBottomCenteredLabel changes displayed text, empty disables display
func (*LineChartSkn) SetBottomLeftLabel ¶
func (w *LineChartSkn) SetBottomLeftLabel(newValue string)
SetBottomLeftLabel changes displayed text, empty disables display
func (*LineChartSkn) SetBottomRightLabel ¶
func (w *LineChartSkn) SetBottomRightLabel(newValue string)
SetBottomRightLabel changes displayed text, empty disables display
func (*LineChartSkn) SetColorLegend ¶
func (w *LineChartSkn) SetColorLegend(enable bool)
SetColorLegend enables the color legend at bottom right on chart
func (*LineChartSkn) SetDataPointMarkers ¶
func (w *LineChartSkn) SetDataPointMarkers(enable bool)
SetDataPointMarkers enables data point markers on display series points
func (*LineChartSkn) SetHorizGridLines ¶
func (w *LineChartSkn) SetHorizGridLines(enable bool)
SetHorizGridLines enables chart horizontal grid lines
func (*LineChartSkn) SetLineStrokeSize ¶
func (w *LineChartSkn) SetLineStrokeSize(newSize float32)
SetLineStrokeSize sets thickness of all lines drawn
func (*LineChartSkn) SetMiddleLeftLabel ¶
func (w *LineChartSkn) SetMiddleLeftLabel(newValue string)
SetMiddleLeftLabel changes displayed text, empty disables display
func (*LineChartSkn) SetMiddleRightLabel ¶
func (w *LineChartSkn) SetMiddleRightLabel(newValue string)
SetMiddleRightLabel changes displayed text, empty disables display
func (*LineChartSkn) SetMinSize ¶
func (w *LineChartSkn) SetMinSize(s fyne.Size)
SetMinSize set the minimum size limit for the linechart
func (*LineChartSkn) SetMousePointDisplay ¶
func (w *LineChartSkn) SetMousePointDisplay(enable bool)
SetMousePointDisplay true/false, enables data point display under mouse pointer
func (*LineChartSkn) SetOnHoverPointCallback ¶
func (w *LineChartSkn) SetOnHoverPointCallback(f func(series string, dataPoint ChartDatapoint))
func (*LineChartSkn) SetTitle ¶
func (w *LineChartSkn) SetTitle(newValue string)
SetTitle sets text to be display on chart at top center
func (*LineChartSkn) SetTopLeftLabel ¶
func (w *LineChartSkn) SetTopLeftLabel(newValue string)
SetTopLeftLabel sets text to be display on chart at top left
func (*LineChartSkn) SetTopRightLabel ¶
func (w *LineChartSkn) SetTopRightLabel(newValue string)
SetTopRightLabel changes displayed text, empty disables display
func (*LineChartSkn) SetVertGridLines ¶
func (w *LineChartSkn) SetVertGridLines(enable bool)
SetVertGridLines enables chart vertical grid lines
func (*LineChartSkn) Tapped ¶
func (w *LineChartSkn) Tapped(*fyne.PointEvent)
Tapped From the Tappable Interface
func (*LineChartSkn) TappedSecondary ¶
func (w *LineChartSkn) TappedSecondary(*fyne.PointEvent)
TappedSecondary From the SecondaryTappable Interface