Skip to content

Commit

Permalink
Remove grid functionality
Browse files Browse the repository at this point in the history
This was previously identified as internal, but on closer inspection I think it should be removed.  This is not used by the table creation, so I would like a cleaer understanding of how it's used (and add an example of it) before continuing to support it.
  • Loading branch information
jentfoo committed Jan 1, 2025
1 parent 8fd74e2 commit 7090477
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 194 deletions.
74 changes: 0 additions & 74 deletions grid.go

This file was deleted.

65 changes: 0 additions & 65 deletions grid_test.go

This file was deleted.

55 changes: 0 additions & 55 deletions painter.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,6 @@ type multiTextOption struct {
LabelSkipCount int
}

type gridOption struct {
// Columns is the count of columns in the grid.
Columns int
// Rows are the count of rows in the grid.
Rows int
// ColumnSpans specifies the span for each column.
ColumnSpans []int
// IgnoreColumnLines specifies index for columns to not display.
IgnoreColumnLines []int
// IgnoreRowLines specifies index for rows to not display.
IgnoreRowLines []int
}

// PainterPaddingOption sets the padding of draw painter
func PainterPaddingOption(padding Box) PainterOption {
return func(p *Painter) {
Expand Down Expand Up @@ -745,48 +732,6 @@ func (p *Painter) multiText(opt multiTextOption) *Painter {
return p
}

func (p *Painter) grid(opt gridOption) *Painter {
width := p.Width()
height := p.Height()
drawLines := func(values []int, ignoreIndexList []int, isVertical bool) {
for index, v := range values {
if containsInt(ignoreIndexList, index) {
continue
}
x0 := 0
y0 := 0
x1 := 0
y1 := 0
if isVertical {
x0 = v
x1 = v
y1 = height
} else {
x1 = width
y0 = v
y1 = v
}
p.LineStroke([]Point{
{X: x0, Y: y0},
{X: x1, Y: y1},
})
}
}
columnCount := sumInt(opt.ColumnSpans)
if columnCount == 0 {
columnCount = opt.Columns
}
if columnCount > 0 {
values := autoDivideSpans(width, columnCount, opt.ColumnSpans)
drawLines(values, opt.IgnoreColumnLines, true)
}
if opt.Rows > 0 {
values := autoDivide(height, opt.Rows)
drawLines(values, opt.IgnoreRowLines, false)
}
return p
}

// Dots prints filled circles for the given points.
func (p *Painter) Dots(points []Point) *Painter {
for _, item := range points {
Expand Down

0 comments on commit 7090477

Please sign in to comment.