in src/visual.ts [831:881]
private renderXAxisLabels(): void {
this.axes
.selectAll(StreamGraph.XAxisLabelSelector.selectorName)
.remove();
const categoryAxisSettings: BaseAxisSettings = this.data.settings.categoryAxis;
this.margin.bottom = categoryAxisSettings.show
? StreamGraph.XAxisOnSize + parseInt(this.data.settings.categoryAxis.fontSize.toString())
: StreamGraph.XAxisOffSize;
if (!categoryAxisSettings.showAxisTitle
|| !this.dataView.categorical.categories[0]
|| !this.dataView.categorical.categories[0].source) {
return;
}
const valueAxisSettings: BaseAxisSettings = this.data.settings.valueAxis,
isYAxisOn: boolean = valueAxisSettings.show,
isYTitleOn: boolean = valueAxisSettings.showAxisTitle,
leftMargin: number = (isYAxisOn
? StreamGraph.YAxisOnSize
: StreamGraph.YAxisOffSize)
+ (isYTitleOn
? StreamGraph.YAxisLabelSize
: StreamGraph.MinLabelSize),
width: number = this.viewport.width - (this.margin.right + this.data.xAxisValueMaxTextHalfSize) - leftMargin,
height: number = this.viewport.height + StreamGraph.XAxisLabelSize + StreamGraph.TickHeight;
let xAxisText: string = this.dataView.categorical.categories[0].source.displayName;
const textSettings: TextProperties = StreamGraph.getTextPropertiesFunction(xAxisText);
xAxisText = textMeasurementService.getTailoredTextOrDefault(textSettings, width);
const xAxisLabel: Selection<d3.BaseType, any, any, any> = this.axes.append("text")
.style("font-family", textSettings.fontFamily)
.style("font-size", textSettings.fontSize)
.style("font-weight", textSettings.fontWeight)
.attr("transform", translate(
leftMargin + (width / StreamGraph.AxisLabelMiddle),
height))
.attr("fill", categoryAxisSettings.labelColor)
.attr("dy", StreamGraph.XAxisLabelDy)
.classed(StreamGraph.XAxisLabelSelector.className, true)
.text(xAxisText);
xAxisLabel.call(
AxisHelper.LabelLayoutStrategy.clip,
width,
textMeasurementService.svgEllipsis);
}