Graphics Programs Reference
In-Depth Information
FIGurE 5-14 Stacked bar graph without any labels
For each bar, look to see if it is greater than 11 percent. If it is, a white
label that reads the percentage rounded to the nearest integer is drawn in
the middle of the bar.
Now add the labels for each issue on the x-axis. Ideally, you want to make
all labels read horizontally, but there is obviously not enough space to
do that. If the graph were a horizontal bar chart, you could fit horizontal
labels, but for this you want to see them at 45-degree angles. You can
make the labels completely vertical, but that'd make them harder to read.
bar.anchor(“bottom”).add(pv.Label)
.visible(function() !this.parent.index)
.textAlign(“right”)
.top(260)
.left(function() x(this.index)+20)
.textAngle(-Math.PI / 4)
.text(function() cat[this.index]);
This works in the same way you added number labels to the middle of
each bar. However, this time around add labels only to the bars at the bot-
tom, that is, the ones for approval. Then right-align the text and set their
absolute vertical position with textAlign() and top() . Their x-position is
Search WWH ::




Custom Search