TrendPen.GetOrAddYAxis()
Gets the existing Y-axis from the trend pen, or creates and adds a new Y-axis if
it does not exist.
public static ValueAxis GetOrAddYAxis(this TrendPen pen)
Arguments
- pen
- The trend pen to get or add the Y-axis to.
Returns
- ValueAxis
- Either created or existing Y-axis associated with the trend pen.
Exceptions
- ArgumentNullException
- Thrown when no validpenis provided.
Example
The following example shows how to add a trend pen and configure its Y-axis:
[ExportMethod] public void AddPen() { var tag = Project.Current.GetVariable("Model/Variable1"); var pen = InformationModel.Make<TrendPen>(tag.BrowseName + "_pen"); pen.SetDynamicLink(tag, DynamicLinkMode.ReadWrite); pen.Color = Colors.Coral; pen.Thickness = 3; var newAxis = pen.GetOrAddYAxis(); newAxis.MinValue = 0; newAxis.MaxValue = 100; Owner.Get<Trend>("Trend1").Pens.Add(pen); }
Provide Feedback