3 Replies Latest reply on Jul 17, 2013 11:57 PM by eraufars

    I want 1 pixel wide fixed size bars in a bar chart


      I'm making a bar chart to illustrate a timeline/distribution of numbers (if sorted, it gives a good view of the distribution).

      The individual values on the X axis are not very important but since there are thousands of data points, I just want an overview.


      For this I want to create a bar chart with the smallest possible width of bars and no spacing in between them. I cannot find the settings to do this. Any pointers?


      The sample image is as far as I've got, but these bars are not equal sized and they look bad in some places since the green bars are sometimes covered up by red ones above them. This should never happen since a bar is either green or red, and any space above the green would always be white.

        • 1. Re: I want 1 pixel wide fixed size bars in a bar chart
          Jim Wahl

          I'd be interested in what you come up with, as I've occasionally wanted to do something similar.


          I think the minimum bar (or any mark) width is 2 pixels, which you can get by selecting Fit height / width / entire view. If the number of rows is greater than the number of pixels/2, Tableau will start dropping rows (in the case of a discrete dimension). You can workaround this somewhat by putting the worksheet in a dashboard and selecting a dashboard size that is ~2x the number of rows. But the max dashboard height, width is 4000 pixels. Perhaps you could use paging to go through a screen of data at a time or wrap the rows.



          • 2. Re: I want 1 pixel wide fixed size bars in a bar chart
            Jonathan Drummey

            Emil, in the future please include a packaged workbook with some sample data, it would save time in making responses without having to manufacture data. See So Your Question Didn't Get Answered... for details.


            Jim, I didn't know the minimum size was 2 pixels…fascinating. Here's a bar and a line, the line looks smaller than the bar, but it's a little fuzzy, like some shading or anti-aliasing is going on:


            Screen Shot 2013-07-17 at 9.27.31 AM.PNG.pngScreen Shot 2013-07-17 at 9.28.18 AM.PNG.png

            here's a 400% blown up screenshot of a bar, and it's 2 pixels:


            Screen Shot 2013-07-17 at 9.19.11 AM.PNG.png


            And here's a line, also at 400% - yep, there's some shading there:


            Screen Shot 2013-07-17 at 9.22.22 AM.PNG.png

            I did a test with the lines with no spacing and only 1px wide, the anti-aliasing causes a problem. Where I circled the image, the antialiasing of the darker blue line makes the shorter lighter blue line look like it's taller when at at full resolution.


            Screen Shot 2013-07-17 at 9.40.41 AM.PNG.png


            So, 2px bars it is. (Though I wonder how Tableau works with Retina displays, is that 2px really 2px on the Retina display, or is it 4px)?


            Here's a way to get 2px wide bars with no spacing:


            - Build your worksheet

            - Set the Size slider to be 0

            - On the Color Shelf, turn off Borders.

            - Make sure you are using a continuous dimension or measure on Columns.

            - Fix the Columns continuous pill's axis size to have Start = minimum value of continuous pill -1 and End = maximum value of continuous pill +1. This is because Tableau draws bars on the center of each tick, so if we have the axis range the same as the data range then Tableau will cut off the first and last bars.

            - Put the worksheet in a dashboard. If it's just one worksheet in a dashboard in a tiled layout, the width needs to be:


            2 pixels * number of bars = N pixels

            + 8 pixel padding margin * 2 sides = 16 pixels

            + 1 pixel border margin * 2 sides = 2 pixels

            + space at end of axis = 1 pixel


            For a floating element, use the same equation for the width of the view, only take out the 16 pixels from the padding margin.


            I set up both in the attached.


            Finally, I recommend against using red/green in a view like this because red/green color blind folks wouldn't be able to make out the difference between the bars.

            • 3. Re: I want 1 pixel wide fixed size bars in a bar chart

              Thanks for the suggestion of including workbook. I did so in my latest post on another topic.