cancel
Showing results for 
Search instead for 
Did you mean: 

Participate in challenges and sweepstakes

3D Bar Chart

View the live report here

 dmp_0-1653196637883.png

I'm not a huge fan of 3D visuals, but I've been intrigued as to whether something can be done on a 2D plot segment using a combination of marks. This was achieved with a single glyph, data axis, guides, 2 measures and 6 marks:

 charticulator-3d-bar-glyph.png

  • A data axis is added, just short of the total glyph height (you may want to use a y-guide for positioning it).
  • An x-guide is added to the glyph, with a count of 2.
  • The primary measure is bound to this as you might do for a normal bar chart (in this case [Sales]).
  • A secondary measure is calculated, based on the highest value of the primary measure, so that the perspective is consistent for all glyphs in the plot segment. In this case I've called mine [Highest Sales], e.g.:

 

 

MAXX(
    ALLSELECTED( Demographic[Country Code] ), 
    [Sales]
)

 

 

  • ​The secondary measure is then added four times to the data axis and modified as follows:
    • avg(`Highest Sales`) * 0.05                (5% of value)
    • avg(`Highest Sales`) * 0.1                 (10% of value)
    • avg(Sales) + avg(`Highest Sales`) * 0.05   (primary measure + 5% of value)
    • avg(Sales) - avg(`Highest Sales`) * 0.05   (primary measure - 5% of value)
  • The first mark, a rectangle is added partially across the width of the glyph, to the 2nd guide, or 0.75 of the glyph width (much like the data axis height), and to the value of the primary measure on the data axis (much like a regular binding for a mark).
  • Two triangle marks are added for the top face (both oriented vertically):
    • One from the left side, spanning to the width of the first mark. Its height is then bound to the 3rd variation of our secondary measure.
    • One from the 1st guide (or 0.25 of the glyph width) to the full width of the glyph. Its height is similarly bound to the 3rd variation of our secondary measure. 
    • Because triangle shapes do not have rotation, you will need to 'flip' them by moving the top to underneath the bottom to orient them correctly.
  • A second rectangle mark is added:
    • This spans vertically from the primary measure, to the 1st variation of the secondary measure (5%).
    • Horizontally, this spans from the 2nd guide to the width of the glyph.
  • Two further triangle marks are added:
    • One at the bottom, spanning vertically from 0 on the axis to the 2nd variation of the secondary measure (10%)
    • One at the top, spanning from the 3rd variation of the secondary measure to the 4th.
    • Again, these may need to be 'flipped' accordingly so that they face the correct way and give the correct illusion of perspective.
  • Marks are then shaded accordingly, so that they all look like they are grouped as part of the same face.

There is a second page in the report, showing what could happen if we bound a parameter to the calculations for our secondary measure to change the 'angle' of the perspective.