in src/visual.ts [752:801]
private renderYAxisLabels(): void {
this.axes
.selectAll(StreamGraph.YAxisLabelSelector.selectorName)
.remove();
const valueAxisSettings: BaseAxisSettings = this.data.settings.valueAxis;
this.margin.left = valueAxisSettings.show
? StreamGraph.YAxisOnSize + this.data.yAxisValueMaxTextSize
: StreamGraph.YAxisOffSize;
if (valueAxisSettings.showAxisTitle) {
this.margin.left += StreamGraph.YAxisLabelSize;
const categoryAxisSettings: BaseAxisSettings = this.data.settings.categoryAxis,
isXAxisOn: boolean = categoryAxisSettings.show,
isXTitleOn: boolean = categoryAxisSettings.showAxisTitle,
marginTop: number = (this.margin.top + this.data.yAxisFontHalfSize),
height: number = this.viewport.height
- marginTop
- (isXAxisOn
? StreamGraph.XAxisOnSize + this.data.xAxisFontSize
: StreamGraph.XAxisOffSize)
- (isXTitleOn
? StreamGraph.XAxisLabelSize
: StreamGraph.MinLabelSize),
values = this.dataView.categorical.values;
let yAxisText: string = values.source
? values.source.displayName
: StreamGraph.getYAxisTitleFromValues(values);
const textSettings: TextProperties = StreamGraph.getTextPropertiesFunction(yAxisText);
yAxisText = textMeasurementService.getTailoredTextOrDefault(textSettings, height);
const yAxisLabel: Selection<d3.BaseType, any, any, any> = this.axes.append("text")
.style("font-family", textSettings.fontFamily)
.style("font-size", textSettings.fontSize)
.style("font-style", textSettings.fontStyle)
.style("font-weight", textSettings.fontWeight)
.attr("transform", StreamGraph.YAxisLabelAngle)
.attr("fill", valueAxisSettings.labelColor)
.attr("x", -(marginTop + (height / StreamGraph.AxisLabelMiddle)))
.attr("y", PixelConverter.fromPoint(-(this.margin.left - StreamGraph.YAxisLabelDy)))
.classed(StreamGraph.YAxisLabelSelector.className, true)
.text(yAxisText);
yAxisLabel.call(
AxisHelper.LabelLayoutStrategy.clip,
height,
textMeasurementService.svgEllipsis);
}
}