Hi,
I am working with ViewX automation to program the creation and update of thousands of trend objects. Templates won't work here, the customer has many different internal opinions about which trends look good.
I can seem to edit almost all the properties but I cannot seem to edit the Marker limit or other marker properties.
private void AddTrace(dynamic traces, string relativePath, string label,
TraceDataMode mode, TraceColors color, string yaxis, DrwDashStyle style = DrwDashStyle.DashSolid)
{
// added for CS 2017 R2 August
System.Threading.Thread.Sleep(1000);
dynamic newTrace = traces.Add(mode, _systemName, relativePath);
newTrace.Label = label;
newTrace.TraceStyle = TraceStyle.TraceLine;
newTrace.Interval = "5M";
newTrace.LineColour = (int)color;
newTrace.LineStyle = style;
newTrace.LineWidth = 1.0;
newTrace.MarkerLimit = "0"; // This line and the next two fail
newTrace.MarkerSize = 2; // What is the correct field name?
newTrace.MarkerStyle = MarkerStyle.Diamond; // Fails too (this enums to zero)
newTrace.ShowMarkers = 0;
newTrace.ShowAnnotations = 0;
newTrace.ShowAlarmLimits = 0;
newTrace.YAxis = yaxis;
}
Solved! Go to Solution.
So I ended up figuring out something and getting this working. Updated code looks like:
private void AddTrace(dynamic traces, string relativePath, string label,
TraceDataMode mode, TraceColors color, string yaxis, DrwDashStyle style = DrwDashStyle.DashSolid)
{
// added for CS 2017 R2 August
System.Threading.Thread.Sleep(1000);
dynamic newTrace = traces.Add(mode, _systemName, relativePath);
newTrace.Label = label;
newTrace.TraceStyle = TraceStyle.TraceLine;
newTrace.Interval = "5M";
newTrace.LineColour = (int)color;
newTrace.LineStyle = style;
newTrace.LineWidth = 1.0;
newTrace.MarkerLimit = (int)1; // I think the API won't let values less than 1 go by
// Following two lines were not required for this config, commented out
// newTrace.MarkerSize = 2;
// newTrace.MarkerStyle = MarkerStyle.Diamond;
newTrace.ShowMarkers = 0;
newTrace.ShowAnnotations = 0;
newTrace.ShowAlarmLimits = 0;
newTrace.YAxis = yaxis;
}
So I ended up figuring out something and getting this working. Updated code looks like:
private void AddTrace(dynamic traces, string relativePath, string label,
TraceDataMode mode, TraceColors color, string yaxis, DrwDashStyle style = DrwDashStyle.DashSolid)
{
// added for CS 2017 R2 August
System.Threading.Thread.Sleep(1000);
dynamic newTrace = traces.Add(mode, _systemName, relativePath);
newTrace.Label = label;
newTrace.TraceStyle = TraceStyle.TraceLine;
newTrace.Interval = "5M";
newTrace.LineColour = (int)color;
newTrace.LineStyle = style;
newTrace.LineWidth = 1.0;
newTrace.MarkerLimit = (int)1; // I think the API won't let values less than 1 go by
// Following two lines were not required for this config, commented out
// newTrace.MarkerSize = 2;
// newTrace.MarkerStyle = MarkerStyle.Diamond;
newTrace.ShowMarkers = 0;
newTrace.ShowAnnotations = 0;
newTrace.ShowAlarmLimits = 0;
newTrace.YAxis = yaxis;
}
Discuss challenges in energy and automation with 30,000+ experts and peers.
Find answers in 10,000+ support articles to help solve your product and business challenges.
Find peer based solutions to your questions. Provide answers for fellow community members!