For the better part of twelve years, I had been on a search for an easy, cheap and reliable way of creating bar graphs that integrate with InDesign’s Data Merge feature. After many attempts and efforts, I discovered a way to do this using only one character style and an excel formula that makes the magic happen. I’ve written this technique in full over at CreativePro and encourage you to read the article.
I’ll tell anyone who will listen
If you’re unfamiliar with this tale, it is the journey of the various versions of the techniques that I’ve developed over the last 12 years to prepare the technique. These iterations were:
- A complicated way of turning the value into a binary number that would then make the bar graph out of linked images that – when combined – would represent the correct value. For example, the value of 250 becomes 11111010 in binary. The graph would then be made out of the images that represent the widths of 128, 64, 32, 16, 8 and 2 (collectively these images add up to 250). It works but is complicated, not very transferrable, and couldn’t display a value beyond 255 easily.
- The chartwell font, particularly the chartwell bars typeface. This font uses opentype ligatures to change numbers into a visible graph. This works but was beyond the budget allowed at the time, and was limited to values of 1000 or less.
- A paragraph style that used GREP styles and character styles that would turn a fixed width font – that had no fill or stroke, but a solid underline or strikethrough – to represent the appropriate value. This worked but took far too long to create from scratch – it required 55 character styles and GREP styles, but could represent larger values of 1999 or less.
- A refined version of the previous technique, but required 27 GREP styles and 27 character styles, and could be implemented via a javascript. This was less complicated and could represent values of 1999 or less.
- The ultimate answer was one character style that again used a fixed width font with no fill or stroke but a solid underline or strikethrough, but would be applied to a data merge field that had the values represented as a string of the same letter that was the value to be shown. In Excel, a formula called REPT can take a character and repeat it the same amount of times as the value to be shown.
But… crickets!
To me, this solution was my Magnum Opus – it took an otherwise complicated issue and turned it into an elegant and simple solution that could be implemented not just in InDesign, but in any application that:
- Allows the formatting of underlines; and
- Has a data merge or mail merge function.
When I’d published the article, I knew the issue was esoteric and would only appeal to a limited audience… but there was barely a reaction at all. Whether that was fatigue from readers going “Here’s Colin banging on about bar graphs again… ignore” or “He must have got it from 27 GREP styles to 22 GREP styles…”, I don’t know.
If you don’t get their attention at first, yell louder
Confident that this was such a good solution, an opportunity arose to speak at the Ignite session at the recent CreativePro conference in Washington DC. The Ignite session is a five minute, 20 slide presentation open to attendees. My topic of course: My bar graph journey.

If you weren’t in the audience and didn’t experience this journey with me, the take-away from the presentation is that there were five iterations before reaching what I consider to be the best answer.
Why is this technique the best one?
Putting the simplicity aside, the technique adds the following functionality to Data Merge:
- Move graphics or layout on an X axis – this is ideal when wanting to swap out layouts depending on the content. This article explains this in more depth.
- Move graphics or layout on X and Y axes. This is ideal when placing a graphic on a particular coordinate, such as a “you are here” map or blood pressure chart such as this example.
- Hide portions of a graphic, such as this example using alcohol bottles.
- Change the colour of the bar in real time. This uses the “square peg round hole” technique to use GREP styles to find a length of characters, but instead of condensing the line to fit a given space, now changes the colour of the underline or strikethrough to create a bargraph that changes colour depending on the context of the value.

Give it a try yourself!
If you’re not using this technique, then you’re not getting the most out of InDesign’s Data Merge. Go over to CreativePro and check out the article to see the technique and then try the technique for yourself!

