BASE DE CONNAISSANCES

Text Wrap Not Applied for Labels


Date de publication : 04 Dec 2020
Date de dernière modification : 20 Nov 2023

Problème

Wrapping text labels displayed on a stacked bar chart by [Format] > [Alignment] > [Wrap] > [On] menu may not work as expected.

[Format] > [Alignment]  menu
 User-added image

Environnement

  • Tableau Desktop 2021, 2022 and 2023 versions

Résolution

Using a string function (eg:  LEFT() , MID())  to break up the long label string into short sub-strings can be accomplished by creating calculation fields and then displaying sub-strings one by one vertically on the bar chart.  Follow along with a sample packaged workbook found in the Attachments section of this article.

Information about string functions is available in Tableau Online Help.

Example:
1. Create calculation field [Substring1]
LEFT([Text Label],15)

2. Create calculation field [Substring2]
MID([Text Label],FIND([Text Label],",")+1,14)

3. Place [Substring1] and [Substring2] on [Text] mark label.
User-added image

Informations supplémentaires

This example is for a stacked bar chart, but the display challenge can exist in other types of chart with mark labels. The example above shows splitting the texts at 15 characters, but you can set other values or conditions depending on the requirements.
Cet article vous a-t-il permis de résoudre le problème ?