Using guides to group categories

This demo shows how you can put clusters of columns into virtual "groups" by adding guides around them.

A guide can either be a thin line on a single category, of span several categories by setting its category and toCategory properties. This is exactly what we are doing here.

We're also using guide's expand parameter to make it span the whole width of the the category selection - from the start of the first category and the end of the last category in group. Without it, our guide band would start and end in the middle of the category.

There's one caveat, though. The categories repeat. You'll notice we have two sets of Q1 through Q4. So a guide would not know which one to attach to.

We work around that, by having separate, unique field as a categoryField like "2015-Q1" and "2016-Q1". This way we can specify which particular category to start/end guide on.

Finally, we're using category axis' labelFunction setting to set a custom function which formats labels for our categories.