HI. Custom Labels
In the Network tab in the Display panel locate Label field and press its dropdown: there is a preloaded list of preconfigured labels for Segments, Blocks, Nodes and Joins. We can add to this list by configuring custom labels. Find below examples of some custom labels.
Adding Custom Label
Press the gear icon on the right from the Label dropdown.
Click the blue plus icon to add a new label.
Rename the label as desired.
Paste the sample formula into the code editor window.
Press OK to finish.
Select the newly added label from the Label: field dropdown.
To view the label, make sure you the Labels eye toggle is enabled.
Note, that you can change label’s colors and alignments by pressing the Aa button on the right.
Available Formulas
In the Formulas tab, there is a list of available formulas. Double click on one of the code hints and paste it in the “return” row.
To convert data of the “double” type to the “string” type, you’ll need to use “.ToString()” method.
To display a certain number of decimals in the text label, use formats like “"#,##0.00"“.
To add a new line in the label, use ““\n”“.
To add any other text in the label, use +””…””, for example, “ + " m"“;.
Segments Distance Label
using System;
using Alastri.HaulInfinity.ScriptExtensions.Shading;
public class CustomLabel : ISegmentLabel
{
public string GetLabel(ISegmentShadingContext context)
{
return (context.Distance).ToString("#,##0.00") + " m";
}
}
Segments Gradient Label
using System;
using Alastri.HaulInfinity.ScriptExtensions.Shading;
public class CustomLabel : ISegmentLabel
{
public string GetLabel(ISegmentShadingContext context)
{
return (context.GradePct).ToString("#,##0.00") + "%";
}
}
Segments Custom Property
using System;
using Alastri.HaulInfinity.ScriptExtensions.Shading;
public class CustomLabel : ISegmentLabel
{
public string GetLabel(ISegmentShadingContext context)
{
return (context.GetCustomProperty("Region"));
}
}
Blocks Name
Blocks Auto Joins Number
Nodes Data Source
Nodes Coordinates