1 AT_BANNER([pivot table rendering])
3 AT_SETUP([1-d pivot table])
4 AT_DATA([pivot.txt], [[
5 /col "a"*("a1", "a2", "a3")
7 /title "Columns" /display
8 /title "Rows" /transpose.
10 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
31 AT_SETUP([2-d pivot table])
32 AT_DATA([pivot.txt], [[
33 /col "a"("a1", "a2", "a3")
34 /col "b"("b1", "b2", "b3")
36 /title "Columns" /display
37 /title "Rows" /transpose /display
38 /title "Column x Row" /move "a" column /display
39 /title "Row x Column" /transpose
41 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
43 ╭────────┬────────┬────────╮
45 ├──┬──┬──┼──┬──┬──┼──┬──┬──┤
46 │a1│a2│a3│a1│a2│a3│a1│a2│a3│
47 ├──┼──┼──┼──┼──┼──┼──┼──┼──┤
48 │ 0│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│
49 ╰──┴──┴──┴──┴──┴──┴──┴──┴──╯
86 AT_SETUP([2-d pivot table - dimension labels])
87 AT_DATA([pivot.txt], [[
88 /col "a"*("a1", "a2", "a3")
89 /col "b"*("b1", "b2", "b3")
91 /title "Columns" /display
92 /title "Rows - Corner" /transpose /display
93 /title "Rows - Nested" /look rowlabels=nested /display
94 /title "Column x Row - Corner" /move "a" column /look rowlabels=corner /display
95 /title "Column x Row - Nested" /look rowlabels=nested /display
96 /title "Row x Column - Corner" /transpose /look rowlabels=corner /display
97 /title "Row x Column - Nested" /look rowlabels=nested
99 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
101 ╭──────────────────────────╮
103 ├────────┬────────┬────────┤
105 ├────────┼────────┼────────┤
107 ├──┬──┬──┼──┬──┬──┼──┬──┬──┤
108 │a1│a2│a3│a1│a2│a3│a1│a2│a3│
109 ├──┼──┼──┼──┼──┼──┼──┼──┼──┤
110 │ 0│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│
111 ╰──┴──┴──┴──┴──┴──┴──┴──┴──╯
145 Column x Row - Corner
156 Column x Row - Nested
167 Row x Column - Corner
178 Row x Column - Nested
191 AT_SETUP([2-d pivot table - groups])
192 AT_DATA([pivot.txt], [[
193 /col "a"("a1", "ag1"("a2", "a3"))
194 /col "b"("bg1"("b1", "b2"), "b3")
196 /title "Columns" /display
197 /title "Rows" /transpose /display
198 /title "Column x Row" /move "a" column /display
199 /title "Row x Column" /transpose /display
200 /title "Row x Column - delete b2" /cells[all,1]=delete /display
201 /title "Row x Column - delete b2 - show empty" /look empty=show /display
202 /title "Row x Column - delete b1" /cells[all,0]=delete /look empty=hide /display
203 /title "Row x Column - delete b1 - show empty" /look empty=show.
205 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
207 ╭─────────────────┬────────╮
209 ├────────┬────────┤ │
211 ├──┬─────┼──┬─────┼──┬─────┤
212 │ │ ag1 │ │ ag1 │ │ ag1 │
213 │ ├──┬──┤ ├──┬──┤ ├──┬──┤
214 │a1│a2│a3│a1│a2│a3│a1│a2│a3│
215 ├──┼──┼──┼──┼──┼──┼──┼──┼──┤
216 │ 0│ 1│ 2│ 3│ 4│ 5│ 6│ 7│ 8│
217 ╰──┴──┴──┴──┴──┴──┴──┴──┴──╯
261 Row x Column - delete b2
273 Row x Column - delete b2 - show empty
285 Row x Column - delete b1
295 Row x Column - delete b1 - show empty
309 AT_SETUP([2-d pivot table - layers])
310 AT_DATA([pivot.txt], [[
311 /col "a"("a1", "a2", "a3")
312 /layer "b"("b1", "b2", "b3")
314 /title "Column x b1" /display
315 /title "Row x b1" /transpose /display
316 /title "Column x b2" /show layer 1 /transpose /display
317 /title "Row x b2" /transpose /display
318 /title "Column (All Layers)" /look layers=all /display
319 /title "Row (All Layers)" /transpose /look layers=all
321 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
404 AT_SETUP([pivot table title and caption])
405 AT_DATA([pivot.txt], [[
409 /title "Title + Caption" /caption "Title + Caption" /display
410 /title "Title Only" /caption "(Not Shown)" /show title=yes caption=no /display
411 /title "(Not Shown)" /caption "Caption Only" /show title=no caption=yes /display
412 /title "(Not Shown)" /caption "(Not Shown)" /show title=no caption=no
414 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
449 AT_SETUP([pivot table with no dimensions])
450 AT_DATA([pivot.txt], [[
451 /title "No Dimensions"
453 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
460 AT_SETUP([pivot table with empty dimensions])
461 AT_DATA([pivot.txt], [[
464 /title "One Empty Dimension" /display
465 /title "Two Empty Dimensions" /row "b"*() /display
466 /title "Three Dimensions, Two Empty" /row "c"("c1", "c2")
468 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
473 Three Dimensions, Two Empty
477 AT_SETUP([pivot table with empty groups])
478 AT_DATA([pivot.txt], [[
479 /col "a"("a1", "a2"(), "a3")
480 /row "b"("b1"(), "b2", "b3")
485 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
496 AT_SETUP([pivot table - category and dimension borders])
497 AT_DATA([pivot.txt], [[
498 /col "a"("a1", "ag1"("a2", "a3"))
499 /col "b"("bg1"("b1", "b2"), "b3")
500 /row "c"("c1", "cg1"("c2", "c3"))
501 /row "d"("dg1"("d1", "d2"), "d3")
502 /cell[all, all, all, all]
504 /border "dim-row-horz" (solid "blue")
505 "cat-row-horz" (dashed "red")
506 "dim-row-vert" (solid "blue")
507 "cat-row-vert" (dashed "red")
508 "dim-col-horz" (solid "blue")
509 "cat-col-horz" (dashed "red")
510 "dim-col-vert" (solid "blue")
511 "cat-col-vert" (dashed "red")
512 /title "Category and Dimension Borders"
514 AT_CHECK([pivot-table-test --table-look $srcdir/output/look.stt pivot.txt --box unicode], [0], [dnl
515 Category and Dimension Borders
519 ╶──┬─────┼──┬─────┼──┬─────
520 │ ag1 │ │ ag1 │ │ ag1
521 ├╌╌┬╌╌┤ ├╌╌┬╌╌┤ ├╌╌┬╌╌
522 a1│a2┊a3│a1│a2┊a3│a1│a2┊a3
523 dg1┊d1│c1 0│ 1┊ 2│ 3│ 4┊ 5│ 6│ 7┊ 8
524 ┊ ├───┬─────┼──┼──┼──┼──┼──┼──┼──┼──
525 ┊ │cg1┊c2 9│10┊11│12│13┊14│15│16┊17
526 ┊ │ ├╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
527 ┊ │ ┊c3 18│19┊20│21│22┊23│24│25┊26
528 ├──┼───┴─────┼──┼──┼──┼──┼──┼──┼──┼──
529 ┊d2│c1 27│28┊29│30│31┊32│33│34┊35
530 ┊ ├───┬─────┼──┼──┼──┼──┼──┼──┼──┼──
531 ┊ │cg1┊c2 36│37┊38│39│40┊41│42│43┊44
532 ┊ │ ├╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
533 ┊ │ ┊c3 45│46┊47│48│49┊50│51│52┊53
534 ───┴──┼───┴─────┼──┼──┼──┼──┼──┼──┼──┼──
535 d3 │c1 54│55┊56│57│58┊59│60│61┊62
536 ├───┬─────┼──┼──┼──┼──┼──┼──┼──┼──
537 │cg1┊c2 63│64┊65│66│67┊68│69│70┊71
538 │ ├╌╌╌╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌┼╌╌┼╌╌+╌╌
539 │ ┊c3 72│73┊74│75│76┊77│78│79┊80