in src/EnhancedScatterChart.ts [2514:2607]
private renderAxesLabels(
axisLabels: ChartAxesLabels,
legendMargin: number,
hideXAxisTitle: boolean,
hideYAxisTitle: boolean,
hideY2AxisTitle: boolean,
xAxisSettings: AxisSettings,
yAxisSettings: AxisSettings
): void {
this.removeAxisLabels();
const margin: IMargin = this.margin,
width: number = this.viewportIn.width,
height: number = this.viewport.height,
fontSize: number = EnhancedScatterChart.AxisFontSize,
yAxisOrientation: string = this.yAxisOrientation,
showY1OnRight: boolean = yAxisOrientation === yAxisPosition.right;
if (!hideXAxisTitle) {
const xAxisLabel: Selection<any> = this.axisGraphicsContext
.append("text")
.style("text-anchor", EnhancedScatterChart.TextAnchor)
.style("fill", xAxisSettings.axisColor)
.text(axisLabels.x)
.call((text: Selection<any>) => {
text.each(function () {
const textSelection: Selection<any> = d3.select(this);
textSelection
.attr("class", EnhancedScatterChart.XAxisLabelSelector.className)
.attr("transform", manipulation.translate(
width / EnhancedScatterChart.AxisLabelOffset,
height - fontSize - EnhancedScatterChart.AxisLabelOffset
),
);
});
});
xAxisLabel.call(
axis.LabelLayoutStrategy.clip,
width,
svgEllipsis
);
}
if (!hideYAxisTitle) {
const yAxisLabel: Selection<any> = this.axisGraphicsContext
.append("text")
.style("text-anchor", EnhancedScatterChart.TextAnchor)
.style("fill", yAxisSettings.axisColor)
.text(axisLabels.y)
.call((text: Selection<any>) => {
text.each(function () {
const text: Selection<any> = d3.select(this);
text.attr("class", EnhancedScatterChart.YAxisLabelSelector.className)
.attr("transform", EnhancedScatterChart.YAxisLabelTransformRotate)
.attr("y", showY1OnRight ? width + margin.right - fontSize : -margin.left)
.attr("x", -((height - margin.top - legendMargin) / EnhancedScatterChart.AxisLabelOffset))
.attr("dy", EnhancedScatterChart.DefaultDY);
});
});
yAxisLabel.call(
axis.LabelLayoutStrategy.clip,
height - (margin.bottom + margin.top),
svgEllipsis
);
}
if (!hideY2AxisTitle && axisLabels.y2) {
const y2AxisLabel: Selection<any> = this.axisGraphicsContext
.append("text")
.style("text-anchor", EnhancedScatterChart.TextAnchor)
.text(axisLabels.y2)
.call((text: Selection<any>) => {
text.each(function () {
const text: Selection<any> = d3.select(this);
text.attr("class", EnhancedScatterChart.YAxisLabelSelector.className)
.attr("transform", EnhancedScatterChart.YAxisLabelTransformRotate)
.attr("y", showY1OnRight ? -margin.left : width + margin.right - fontSize)
.attr("x", -((height - margin.top - legendMargin) / EnhancedScatterChart.AxisLabelOffset))
.attr("dy", EnhancedScatterChart.DefaultDY);
});
});
y2AxisLabel.call(
axis.LabelLayoutStrategy.clip,
height - (margin.bottom + margin.top),
svgEllipsis);
}
}