Documentation
¶
Index ¶
- func CreateBarChart(config BarChartConfig) *charts.Bar
- func CreateLineChart(config LineChartConfig) *charts.Line
- func CreatePieChart(config PieChartConfig) *charts.Pie
- func SaveHTML(chart Renderable, path string)
- func SavePNG(chart Renderable, pngPath string)
- type BarChartConfig
- type LineChartConfig
- type PieChartConfig
- type Renderable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBarChart ¶ added in v0.0.9
func CreateBarChart(config BarChartConfig) *charts.Bar
CreateBarChart generates and returns a *charts.Bar object based on BarChartConfig.
func CreateLineChart ¶ added in v0.0.9
func CreateLineChart(config LineChartConfig) *charts.Line
CreateLineChart generates and returns a *charts.Line object based on LineChartConfig.
func CreatePieChart ¶ added in v0.0.9
func CreatePieChart(config PieChartConfig) *charts.Pie
CreatePieChart generates and returns a *charts.Pie object based on PieChartConfig.
func SaveHTML ¶ added in v0.0.9
func SaveHTML(chart Renderable, path string)
SaveHTML 將圖表渲染並保存為 HTML 文件
func SavePNG ¶ added in v0.0.9
func SavePNG(chart Renderable, pngPath string)
SavePNG 將圖表渲染為 PNG 文件,使用 orcgen
Types ¶
type BarChartConfig ¶ added in v0.0.9
type BarChartConfig struct {
Title string // Title of the chart.
Subtitle string // Subtitle of the chart.
XAxis []string // X-axis data.
SeriesData any // Accepts map[string][]float64, []*insyra.DataList, or []insyra.IDataList.
XAxisName string // Optional: X-axis name.
YAxisName string // Optional: Y-axis name.
YAxisNameGap int // Optional: Gap between Y-axis name and subtitle.
Colors []string // Optional: Colors for the bars, for example: ["green", "orange"].
ShowLabels bool // Optional: Show labels on the bars.
LabelPos string // Optional: "top" | "bottom" | "left" | "right", default: "top".
GridTop string // Optional: default: "80".
}
BarChartConfig defines the configuration for a bar chart.
type LineChartConfig ¶ added in v0.0.9
type LineChartConfig struct {
Title string // Title of the chart.
Subtitle string // Subtitle of the chart.
XAxis []string // X-axis data.
SeriesData any // Accepts map[string][]float64, []*insyra.DataList, or []insyra.IDataList.
XAxisName string // Optional: X-axis name.
YAxisName string // Optional: Y-axis name.
YAxisNameGap int // Optional: Gap between Y-axis name and subtitle.
Colors []string // Optional: Colors for the lines, for example: ["blue", "red"].
ShowLabels bool // Optional: Show labels on the lines.
LabelPos string // Optional: "top" | "bottom" | "left" | "right", default: "top".
Smooth bool // Optional: Make the lines smooth.
FillArea bool // Optional: Fill the area under the lines.
GridTop string // Optional, default: "80".
}
LineChartConfig defines the configuration for a line chart.
type PieChartConfig ¶ added in v0.0.9
type PieChartConfig struct {
Title string // Title of the chart.
Subtitle string // Subtitle of the chart.
SeriesData any // Accepts []float64 or []*insyra.DataList.
Labels []string // Labels for each slice (for example: product names).
Colors []string // Optional: Colors for the slices, for example: ["green", "orange"].
ShowLabels bool // Optional: Show labels on the slices.
LabelPos string // Optional: "inside" | "outside", default: "outside".
RoseType string // Optional: "radius" or "area" for rose charts.
Radius []string // Optional: Radius configuration. First value is inner radius, second is outer radius, for example: ["40%", "75%"].
Center []string // Optional: Center position, for example: ["50%", "50%"].
ShowPercent bool // Optional: Show percentage on labels.
}
PieChartConfig defines the configuration for a pie chart.
type Renderable ¶ added in v0.0.9
Renderable 定義了可以被渲染的圖表接口
Click to show internal directories.
Click to hide internal directories.