Paw ships chart helpers for time-series and bar-style data. They wrap ECharts while keeping the API in normal Go structs.
paw.ChartLineTimepaw.ChartBarpaw.ChartDataTypeBytepaw.ChartDataTypeBitRateAPI 接口 |
Description 说明 |
|---|---|
ChartLineTime + TimeFloat |
Time-series chart and its point type. 时序图及其点类型。 |
ChartBar + StringFloat |
Bar chart and its categorical point type. 柱状图及其分类点类型。 |
ChartDataTypeByte + ChartDataTypeBitRate |
Optional value-formatting helpers for byte-oriented data. 面向字节类数据的可选值格式化辅助常量。 |
A line chart only needs labels and per-series time/value pairs.
chart := paw.ChartLineTime{
Title: "Request rate",
Labels: []string{"app", "worker"},
Lines: [][]paw.TimeFloat{
{
{X: time.Now().Add(-time.Minute), Y: 12},
{X: time.Now(), Y: 18},
},
},
}
Stacked charts, data type formatting, and bar charts all use the same declarative struct style.
line.Stacked = true
line.StackedSum = true
line.DataTypes = []string{"", paw.ChartDataTypeByte, paw.ChartDataTypeBitRate}
line.LineTypes = []string{"scatter", "line", "scatter"}
line.LineSymbols = []string{"triangle", "pin", "diamond"}
bar := paw.ChartBar{
Title: "Deployments",
Stacked: true,
Bars: [][]paw.StringFloat{...},
}
When StackedSum is true, Paw automatically enables Stacked as well.
If a chart has no data, Paw renders a compact No Data state instead of an empty canvas.