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

Vertical labels in matrix table


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+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • February 1, 2024

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 ●
  • 11 replies
  • February 1, 2024

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

 

 


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • February 1, 2024
djunius wrote:

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

 

Which layout are you using?

 


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • 11 replies
  • February 1, 2024

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


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • February 2, 2024

  

djunius wrote:

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 ●
  • 11 replies
  • February 5, 2024

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 ●●●●●●●●
  • 5926 replies
  • February 5, 2024
djunius wrote:

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 ●
  • 11 replies
  • February 5, 2024

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

 


Forum|alt.badge.img+5
  • Author
  • Level 1 ●
  • 11 replies
  • February 14, 2024

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 ●●
  • 18 replies
  • May 3, 2024

How do I achieve vertical headings in the modern layout?

Both suggestions above unfortunately do not work…

Thanks!


Leave a Reply