feat: initial release v0.3.0

- Support 9 chart types: line, bar, pie, scatter, bubble, donut, mixed, polar, radar
- Multi-format output: ANSI, SVG, PNG, Markdown
- Go + Fiber + gonum/plot
- Docker support
- Morandi color palette
This commit is contained in:
2026-04-16 04:33:02 +08:00
commit ba927c2b2f
21 changed files with 2918 additions and 0 deletions

61
internal/types/chart.go Normal file
View File

@@ -0,0 +1,61 @@
package types
type ChartType string
const (
ChartTypeLine ChartType = "line"
ChartTypeBar ChartType = "bar"
ChartTypePie ChartType = "pie"
ChartTypeScatter ChartType = "scatter"
ChartTypeBubble ChartType = "bubble"
ChartTypeDonut ChartType = "donut"
ChartTypeMixed ChartType = "mixed"
ChartTypePolar ChartType = "polar"
ChartTypeRadar ChartType = "radar"
)
type ChartRequest struct {
Type ChartType `json:"type"`
Title string `json:"title"`
Data ChartData `json:"data"`
Options *ChartOptions `json:"options,omitempty"`
}
type ChartData struct {
Labels []string `json:"labels"`
Datasets []Dataset `json:"datasets"`
Options *ChartOptions `json:"options,omitempty"`
}
type Dataset struct {
Name string `json:"name"`
Values []float64 `json:"values"`
Color string `json:"color,omitempty"`
}
type ChartOptions struct {
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
}
type ChartResponse struct {
ChartID string `json:"chart_id"`
Text string `json:"text"`
ANSI string `json:"ansi"`
SVG string `json:"svg"`
PNGURL string `json:"png_url"`
Markdown string `json:"markdown"`
}
type ErrorResponse struct {
Error string `json:"error"`
}
type Chart struct {
ID string
Type ChartType
Title string
Data ChartData
SVG []byte
PNG []byte
}