is now part of!

GREP-style bar graphs for Data Merge

1 0

Anyone who has tried to add a graph to an InDesign document will know that unlike Adobe Illustrator or Microsoft Excel, InDesign does not have dedicated graphing tools. It is possible to draw graphs within InDesign using its native drawing tools, but graphs usually need to be created in the preferred graph-creation software before being imported as images into Adobe InDesign.

In 2011, an alternative method to add graphs was created thanks to the Chartwell typeface – a series of fonts that cleverly use ligatures to represent whole numbers between 1-100 (or in the case of bar graphs, 1-1000) as graphs. See our earlier articles here:

I like the Chartwell typeface for creating graphs as it uses live type and works with InDesign’s Data Merge feature. I wondered if it was possible to make a bar graph that behaves in the same way as the Chartwell bars font does (i.e. display any whole number between 1-1000 as a bar with the correct width), but without using the Chartwell bars font. After many hours of research, I discovered that it is indeed possible, but required plenty of patience!

GREP Graph live example

GREP graph live example

The solution involves:

More after the jump! Continue reading below
Free and Premium members see fewer ads! Sign up and log-in today.
  • A monospaced typeface (in this case, Courier);
  • Over 50 character styles that vary the width of the characters; to in turn create
  • 1 paragraph style with no fill or stroke on the type, a customized underline, and GREP styles to apply the character styles that adjust the width of the characters.

This technique works by using GREP styles to parse the number being displayed and apply appropriate character styles to it, only changing the width of the number being displayed. For instance, if the number 7 appears, the GREP style applies the character style of 7% width to the number 7. A larger number such as 427 uses several GREP styles in the right sequence to apply several character styles that apply to the numbers, so in this instance one instance of 400% width is applied to the number 4, 20% width is applied to the number 2, and 7% width is applied to the number 7. Because the type is monospaced, all letters have the same starting width, so the scales are applied appropriately.

behind the scenes of GREPgraph

GREP Graph with a fill of white applied to the text

While that all looks straightforward, getting the GREPs to work correctly with varying widths takes a lot of GREP styles – in fact, the paragraph style that makes this technique work contains over 50 GREP styles… too many to mention in this article!

To adjust the underline that makes the bar graph, this can be done in one of two ways to show the line:

  • apply a large underline in the character style “color”, or
  • apply a large paragraph rule that applies to the text only.

Just like the Chartwell bars font, the solution is limited to whole numbers between 1-1000.

For one bar graph, I admit its easier to draw the graph using InDesign’s own drawing tools. However, if hundreds of graphs need to be prepared and are subject to change (or part of a data merge) then this technique would come in quite handy.

For those who attended the InDesignConference 2016 in Washington DC, a link was provided for attendees to an InDesign file with the styles already made. The file has been improved since, so make sure to download the latest version. For readers that did not attend the conference but would like a copy of the file, it is available from the Colecandoo site for a small donation.

With this technique, it’s now possible directly in Adobe InDesign to spice up Data Merge projects to create variable bar graphs that can not only be used for regular bar charts, but also for other purposes such as:

  • moving a graphic on X-Y coordinates, or


  • making friendlier infographics.

grepgraph3Both techniques illustrated above were Data Merge projects created wholly in InDesign without plug-ins.

A prepress operator and graphic designer for a South Australian commercial printer, with close to 20 years of experience in the trade. He is also a regular contributor to this site and InDesign Magazine, and hosts his own prepress blog "Colecandoo".
  • Jean-Claude Tremblay says:

    Love it! Especially the GREP Style trick! Thanks…

  • >