Vertical labels in matrix table | Experience Community
Skip to main content
Question

Vertical labels in matrix table

  • Feb 1, 2024 2:59 PM UTC
  • 10 replies
  • 348 views

Forum|alt.badge.img+5

We have a matrix table with a lot of labels on the top axis. Wondering if anyone out there knows the html to change the labels to vertical like you can do in Excel and in the image below. It would be much easier on the user so they wouldn’t have to scroll to the right to see the other options. Thank you. 

 

 

10 replies

Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • Feb 1, 2024 6:23 PM UTC

Try the below code in the Matrix question JS:

	jQuery("#"+this.questionId+" .Answers th .LabelWrapper span").css({"writing-mode":"vertical-rl","text-orientation":"mixed","white-space":"nowrap"});

 


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • Feb 1, 2024 6:42 PM UTC

Unfortunately, it still is showing up horizontally after adding the JS …

 

 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • Feb 1, 2024 6:44 PM UTC

Unfortunately, it still is showing up horizontally after adding the JS …

 

Which layout are you using?

 


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • Feb 1, 2024 7:08 PM UTC

Simple. Which one is best for the JS to take? Appreciate your assistance. 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+34
  • Level 8 ●●●●●●●●
  • Feb 2, 2024 7:09 AM UTC

  

Simple. Which one is best for the JS to take? Appreciate your assistance. 

You can try classic layout for JS to take but if you want Simple layout then use below CSS in the HTML view of Matrix question text.

<style>
.matrix .matrix-table .matrix-scale-points-item{
writing-mode: vertical-lr;
text-orientation: mixed;
white-space: nowrap;
align-items:center
}
</style>

 


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • Feb 5, 2024 6:05 PM UTC

Holy cow - that worked!!! Thank you so much. Any way to get them to orientate the other way so they read from bottom to top rather than top to bottom below? I thought it was maybe changing “vertical-lr” to “vertical-rl” but that didn’t work. If not, this will work. 

 

 


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Feb 5, 2024 6:20 PM UTC

Holy cow - that worked!!! Thank you so much. Any way to get them to orientate the other way so they read from bottom to top rather than top to bottom below? I thought it was maybe changing “vertical-lr” to “vertical-rl” but that didn’t work. If not, this will work. 

 

 

Add transform: rotate(180deg); to your CSS rule.


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • Feb 5, 2024 6:26 PM UTC

Boom! Awesome. Thanks, Tom and Shashi! This will make a big difference.

 


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • Feb 14, 2024 4:27 PM UTC

Shashi -

To be able to move my entire survey to Simple, I have to undo a bunch of requirements and validations, which I’d rather not do since it is a long and complex survey. I’ve tried your JS in Classic and it isn’t taking. Do I need to change anything in the coding that points to the exact questionID or anything? Again, much thanks for your help.

-dj


Forum|alt.badge.img+3
  • Level 2 ●●
  • May 3, 2024 7:39 PM UTC

How do I achieve vertical headings in the modern layout?

Both suggestions above unfortunately do not work…

Thanks!