plot

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeneralOptions

type GeneralOptions struct {
	Title           string      // 圖表標題
	Width           int         // 圖表寬度
	Height          int         // 圖表高度
	BackgroundColor color.Color // 背景顏色
}

type LinePlot

type LinePlot struct {
	*Plotter
	Options *LinePlotOptions
}

LinePlot 繪製折線圖的結構體

func NewLinePlot

func NewLinePlot(data []float64, plotter *Plotter, options *LinePlotOptions) *LinePlot

NewLinePlot 創建一個新的 LinePlot

func (*LinePlot) Draw

func (lp *LinePlot) Draw() *image.RGBA

Draw 繪製折線圖

func (*LinePlot) Save

func (lp *LinePlot) Save(outputFile string) error

Save 保存繪製的圖到文件

type LinePlotOptions

type LinePlotOptions struct {
	LineStyle       LineStyle
	XLabel          string
	YLabel          string
	GridColor       color.Color
	AxisColor       color.Color
	LineColor       color.Color
	PointColor      color.Color
	BackgroundColor color.Color
	LineThickness   int // 新增線條粗細選項
}

type LineStyle

type LineStyle int
const (
	Solid   LineStyle = iota // 實線
	Dashed                   // 虛線
	Dotted                   // 點線
	DashDot                  // 虛點線
)

type Plot

type Plot interface {
	Draw()
	Save(outputFile string)
}

Plot is an interface that defines the methods for plotting

type Plotter

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

Plotter is a struct that contains the data to be plotted

func NewPlotter

func NewPlotter(data interface{}, options *GeneralOptions) *Plotter

NewPlotter creates a new Plotter instance

func (*Plotter) BarPlot

func (p *Plotter) BarPlot(outputFile string) error

BarPlot draws a bar plot

func (*Plotter) SavePlot

func (p *Plotter) SavePlot(outputFile string) error

SavePlot 將圖形保存到文件中

Jump to

Keyboard shortcuts

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