Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to show labels on all marks in Tableau.
Tableau
worksheet.showMarksLabels([1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using false will hide labels instead of showing them.
Passing null or undefined causes errors.
✗ Incorrect
Setting true enables labels on all marks in the worksheet.
2fill in blank
mediumComplete the code to set label font size to 12 in Tableau.
Tableau
worksheet.getMarks().forEach(mark => mark.setLabelFontSize([1])) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a font size too small makes labels hard to read.
Choosing a font size too large may clutter the view.
✗ Incorrect
Font size 12 is a common readable size for labels.
3fill in blank
hardFix the error in the code to toggle label visibility correctly.
Tableau
if (worksheet.labelsVisible [1]) { worksheet.showMarksLabels(false) } else { worksheet.showMarksLabels(true) }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single equals
= assigns value instead of comparing.Using
== works but strict equality === is better.✗ Incorrect
Use === true for a proper comparison instead of assignment =.
4fill in blank
hardFill both blanks to set label color and alignment in Tableau.
Tableau
worksheet.getMarks().forEach(mark => { mark.setLabelColor([1]); mark.setLabelAlignment([2]); }) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using color codes without quotes causes errors.
Using invalid alignment strings causes labels to misalign.
✗ Incorrect
Setting label color to red #FF0000 and alignment to center improves visibility.
5fill in blank
hardFill all three blanks to create a calculated field for label display condition.
Tableau
IF [1] > [2] THEN '[3]' ELSE '' END
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a dimension instead of a measure in the condition.
Putting numbers in quotes causing syntax errors.
✗ Incorrect
This calculation shows label 'Show' only when Sales are greater than 1000.