I created a constant line and tried to label the countries. But I wasn't able to get it as expected.
Any help on this?
This is the small multiple bar chart
And this is the chart with constant line. For one, I don't even get a line chart when I chose the mark type to Line. It gives me a dot. Can anybody explain me what's happening here?
Labeling small multiples is always pretty tricky, unfortunately. I would suggest that you start by pivoting the measures as a dimension will be easier to work with than Measure Names. The biggest problem we'll have is trying to center the label, so here's a bit of tricky stuff to get that to work. We're going to use the 3rd measure (Females by 15) to do some trickery. Create the following:
Bar Position
// Position of the bar, based on category.
CASE [Category]
WHEN "Females Married by 18" THEN 0
WHEN "Males Married by 18" THEN 1
ELSE 0.5
END
Right-click this field and change it to a dimension. Then use that on the rows shelf and make it continuous. That will give you something like this:
You don't actually want to show "Females by 15" but we've placed this in the center so that we can center the label. But first we need to hide that value. To do that, right-click it in the color legend and choose "Hide".
On the bar axis, click the size then change it to fixed and centered. You can adjust the width as desired.
We now have this:
Now create the following calculated field:
Country Label
// Only label the center point.
IF [Category]="Females Married by 15" THEN
[Country]
END
On the other axis, drag this to the text card, then right-click it and make it an attribute.
Change the label to be aligned middle center. And change the mark type to circle. Make the size as small as possible and change the opacity to 0%.
There's a bit more fine tuning required, such as changing the direction of the text, ensuring that labels always show, etc. but the result should look like this.
See attached.