Page 1 of 1

Custom axis lable

Posted: Thu Dec 03, 2020 3:44 am
by hyetc
Add the axis label as shown.Why is the last coordinate tag set to True for visible property, and why is it hidden.
Is there a way to ensure that the first and last label of an array of labels are always displayed.
Is there any way to tell if adjacent coordinates are going to overlap

Re: Custom axis lable

Posted: Thu Dec 03, 2020 3:23 pm
by ArctionKestutis
You could measure size of label and compare it to available space. The size of required text’s space could be measured with _chart.MeasureText(Text, Font) [please note that Chart.MeasureText(Text, Font) output in DIP units; use DpiHelper.DipToPx() where needed]. Space between Axis minimum and maximum in PX could be measured with following (axisX.ValueToCoord(axisX.Maximum, false) - axisX.ValueToCoord(axisX.Minimum, false).
It should be noted that it is not complete overlap. Several Axis properties control how much distance is maintained: DivisionReduction, AutoDivSpacing, AutoDivSeparationPercent.

You can use Axis.CustomTicks to place in the precise location (only DivisionReduction could remove those).