New to Telerik UI for WPF? Download free 30-day trial

Restrict the First Axis Label to be Within the RadChartView Pane Width

Environment

Product Version 2023.2.718
Product RadChartView for WPF

Description

How to clip the first axis label so that it is within the plot area clip of RadCartesianChart.

Solution

Manually clip the horizontal axis based on the plot area of the chart. To do this, set the Clip property of the axis.

private void RadCartesianChart_SizeChanged(object sender, SizeChangedEventArgs e) 
{ 
    var chart = (RadCartesianChart)sender; 
    RadRect plotArea = chart.PlotAreaClip; 
    var clipGeometry = new RectangleGeometry(new Rect(plotArea.X +  chart.PanOffset.X, plotArea.Bottom, plotArea.Width, 100)); 
    this.hAxis.Clip = clipGeometry; 
} 
In this article