KNOWLEDGE BASE

Square Mark Does Not Uniformly Fill Background of Cell


Published: 05 Feb 2019
Last Modified Date: 06 Nov 2019

Issue

When using a square mark type and a discrete field on color, the background color of each cell in a text table view is not uniformly filled. Instead, by adjusting the size slider all the way to the left, marks overlap their cell borders, potentially skewing the colors of other cells in the view.

In certain situations, adjusting the size of the cell can lead to the square not filling the entirety of the cell and displays whitespace on either side.

Environment

  • Windows 10
  • Excel

Resolution

Use one of the following workarounds: 

Option 1: 

Use a continuous, rather than a discrete, field on Color. 

Option 2:

Use a different mark type with a uniform size field to fill the cell background color while using a discrete field on color. See the attached workbook.
Step 1: Build the view 
  1. Drag "Category" and "Sub-Category" from Dimensions to Rows.
  2. Set the Mark type to Bar or Gantt Bar.
  3. Drag "Sales" from Measures to Label on the Marks card.
  4. Drag another instance of "Sales" from Measures to Color on the Marks card.
  5. Right-click "Sales" on Color > Discrete to convert the field from Continuous to Discrete.
Step 2: Create a calculated field to assign a uniform size to each bar in the view.
Create a new calculated field. Name the field "!Size", insert 1 into the formula pane, and click Ok.
Step 3: Adjust the size of marks in the view.
  1. Drag "!Size" from Measures to Size on the Marks card.
  2. Right-click "!Size" on Size > Dimension to assign a uniform value of 1 to each bar in the view.
  3. Select Size on the Marks card and drag the slider all the way to the left to fill the entirety of the cell background.

Cause

Square mark type will only uniformly fill the background color of a text table if a continuous field is used on color.

Square marks maintain size vertically, but cap themselves horizontally, leading to whitespace in the view.
Did this article resolve the issue?