Custom axis lable

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

hyetc
Posts: 10
Joined: Fri Oct 09, 2020 9:26 am

Custom axis lable

Post by hyetc » Thu Dec 03, 2020 3:44 am

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
Attachments
X_Axis.png
X_Axis.png (11.9 KiB) Viewed 404 times

ArctionKestutis
Posts: 401
Joined: Mon Mar 14, 2016 9:22 am

Re: Custom axis lable

Post by ArctionKestutis » Thu Dec 03, 2020 3:23 pm

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).