Message Boards Message Boards

0
|
4024 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Bug in Dataset Alignment option for Center (still in version 14.2)

Posted 3 years ago

I'm using version 12.3. The Dataset Alignment is not working for the Center option, neither for the entire Dataset nor for a specific column.

Dataset[{
      <|"colA" -> 1, "colB" -> 2, "colC" -> 3|>
    , <|"colA" -> 4, 
"colB" -> 5, "colC" -> 6 |>
    }, Alignment -> Center
]

case 1

Dataset[{
      <|"colA"-> 1, "colB"-> 2, "colC"-> 3|>
    , <|"colA"-> 4, "colB"-> 5, "colC"-> 6 |>
    }, Alignment->{"colA"-> Right, "colB"-> Center, "colC"-> Center}
]

enter image description here

POSTED BY: Rodrigo Murta
3 Replies

Unfortunately, it still doesn’t work, even on version 14.2. When I use {Center, Center}, it does center, but the vertical spacing between lines changes, disrupting the layout of the dataset.

Attachment

POSTED BY: Rodrigo Murta
Posted 7 days ago

Try this:

Dataset[
  {<|"colA"->1,"colB"->2,"colC"->3|>,<|"colA"->4,"colB"->5,"colC"->6|>},
  Alignment->{"colA"->Right,"colB"->{Center,Automatic},"colC"->{Center,Automatic}}
]
POSTED BY: Hans Milton
Posted 3 years ago

Well, I'm not entirely sure why, but Dataset seems to need both vertical and horizontal alignments to be specified. In the documentation, the default Alignment for Dataset is {Left,Baseline}. Maybe when you just set Alignment->Center all it does is replace Baseline with Center. I don't know. But anyway, if you use a pair for Alignment, the Dataset displays as expected. For example, try Alignment->{Center,Center}.

POSTED BY: Eric Rimbey
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract