in src/visual.ts [859:934]
private drawAxes(model: BulletChartModel, reveresed: boolean, labelsStartPos) {
let bars: BarData[] = model.bars;
let barSelection: BulletSelection<any> = this.labelGraphicsContext
.selectAll("text")
.data(bars, (d: BarData) => d.key);
if (model.settings.axis.axis) {
const axisColor = model.settings.axis.axisColor;
// Using var instead of let since you can't pass let parameters to functions inside loops.
// needs to be changed to let when typescript 1.8 comes out.
for (let idx = 0; idx < bars.length; idx++) {
let bar = bars[idx];
this.bulletGraphicsContext
.append("g")
.attr("transform", () => {
let xLocation: number = bar.x;
let yLocation: number = this.calculateLabelHeight(
bar,
null,
reveresed
);
return "translate(" + xLocation + "," + yLocation + ")";
})
.classed("axis", true)
.call(bar.xAxisProperties.axis)
.style("fill", axisColor)
.style(
"font-size",
PixelConverter.fromPoint(BulletChart.AxisFontSizeInPt)
)
.selectAll("line")
.style("stroke", axisColor);
}
this.bulletGraphicsContext
.selectAll("g.axis path")
.style("stroke", axisColor);
this.bulletGraphicsContext
.selectAll(".tick line")
.style("stroke", axisColor);
this.bulletGraphicsContext
.selectAll(".tick text")
.style("fill", axisColor);
this.bulletGraphicsContext
.selectAll("g.axis > .tick text")
.call(
AxisHelper.LabelLayoutStrategy.clip,
BulletChart.XMarginVertical - BulletChart.value10,
TextMeasurementService.svgEllipsis
);
}
// Draw Labels
if (model.settings.labels.show) {
barSelection
.enter()
.append("text")
.merge(barSelection)
.classed("title", true)
.attr("x", (d: BarData) => d.x)
.attr("y", (d: BarData) => {
return labelsStartPos;
})
.attr("fill", model.settings.labels.labelColor)
.attr(
"font-size",
PixelConverter.fromPoint(model.settings.labels.fontSize)
)
.text((d: BarData) => d.categoryLabel)
.append("title")
.text((d: BarData) => d.categoryLabel);
}
}