feat: support table redner
This commit is contained in:
parent
2fb0ebcbf7
commit
b3a3018ea2
8 changed files with 433 additions and 116 deletions
64
README_zh.md
64
README_zh.md
|
|
@ -373,6 +373,70 @@ func main() {
|
|||
}
|
||||
```
|
||||
|
||||
### Table
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/vicanso/go-charts/v2"
|
||||
)
|
||||
|
||||
func main() {
|
||||
header := []string{
|
||||
"Name",
|
||||
"Age",
|
||||
"Address",
|
||||
"Tag",
|
||||
"Action",
|
||||
}
|
||||
data := [][]string{
|
||||
{
|
||||
"John Brown",
|
||||
"32",
|
||||
"New York No. 1 Lake Park",
|
||||
"nice, developer",
|
||||
"Send Mail",
|
||||
},
|
||||
{
|
||||
"Jim Green ",
|
||||
"42",
|
||||
"London No. 1 Lake Park",
|
||||
"wow",
|
||||
"Send Mail",
|
||||
},
|
||||
{
|
||||
"Joe Black ",
|
||||
"32",
|
||||
"Sidney No. 1 Lake Park",
|
||||
"cool, teacher",
|
||||
"Send Mail",
|
||||
},
|
||||
}
|
||||
spans := map[int]int{
|
||||
0: 2,
|
||||
1: 1,
|
||||
// 设置第三列的span
|
||||
2: 3,
|
||||
3: 2,
|
||||
4: 2,
|
||||
}
|
||||
p, err := charts.TableRender(
|
||||
header,
|
||||
data,
|
||||
spans,
|
||||
)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
buf, err := p.Bytes()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
// snip...
|
||||
}
|
||||
```
|
||||
### ECharts Render
|
||||
|
||||
```go
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue