(buffer *bytes.Buffer, colWidth int, xAmount int)
| 357 | } |
| 358 | |
| 359 | func (p HeatmapPrinter) renderHeader(buffer *bytes.Buffer, colWidth int, xAmount int) { |
| 360 | buffer.WriteString("\n") |
| 361 | if p.Boxed { |
| 362 | buffer.WriteString(p.SeparatorStyle.Sprint(p.LSeparator)) |
| 363 | } |
| 364 | if p.Grid { |
| 365 | for i := 0; i < xAmount+1; i++ { |
| 366 | buffer.WriteString(strings.Repeat(p.SeparatorStyle.Sprint(p.HorizontalSeparator), colWidth)) |
| 367 | if i < xAmount { |
| 368 | buffer.WriteString(p.SeparatorStyle.Sprint(p.TCrossSeparator)) |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | if p.Boxed { |
| 373 | buffer.WriteString(p.SeparatorStyle.Sprint(p.LReverseSeparator)) |
| 374 | } |
| 375 | if p.Grid { |
| 376 | buffer.WriteString("\n") |
| 377 | } |
| 378 | for j, f := range p.Axis.XAxis { |
| 379 | if j == 0 { |
| 380 | if p.Boxed { |
| 381 | buffer.WriteString(p.SeparatorStyle.Sprint(p.VerticalSeparator)) |
| 382 | } |
| 383 | ct := internal.CenterText(" ", colWidth) |
| 384 | if len(ct) < colWidth { |
| 385 | ct += strings.Repeat(" ", colWidth-len(ct)) |
| 386 | } |
| 387 | buffer.WriteString(p.AxisStyle.Sprint(ct)) |
| 388 | if p.Grid { |
| 389 | buffer.WriteString(p.SeparatorStyle.Sprint(p.VerticalSeparator)) |
| 390 | } |
| 391 | } |
| 392 | var ct string |
| 393 | ct = internal.CenterText(Sprintf("%v", f), colWidth) |
| 394 | if len(ct) < colWidth { |
| 395 | ct += strings.Repeat(" ", colWidth-len(ct)) |
| 396 | } |
| 397 | buffer.WriteString(p.AxisStyle.Sprint(ct)) |
| 398 | |
| 399 | if j < xAmount { |
| 400 | if !p.Boxed && j == xAmount-1 { |
| 401 | continue |
| 402 | } |
| 403 | if p.Grid { |
| 404 | buffer.WriteString(p.SeparatorStyle.Sprint(p.VerticalSeparator)) |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | func (p HeatmapPrinter) renderData(buffer *bytes.Buffer, colWidth int, xAmount int, yAmount int) { |
| 411 | for i, datum := range p.Data { |
no test coverage detected