Vijay - you may use a Cursor.
However, you can only draw a cursor at a valid XYPair, so you must have a value at V(70) in your data. If you ensure this, you identify the XYPair for V(70) and add a cursor at this point. This will draw a vertical line from the X axis to this XY pair and a horizontal line from the Y axis to the XY pair. Not exactly what you are looking for, but close.
Thanks Andreas. I will try this.
You can only have Y axis constants on a ProcesBook XYPlot. Andreas' cursor above is as far as you can push the XYPlot, for other uses you need a different chart object (or tool).
Here is a short code snippet that adds cursors to a XYPlot:
' the XY Pairs Dim myXYPairs As XYPairs ' setting the XYPairs from the XYPlot Set myXYPairs = XYPlot1.Pairs ' a single XYPair Dim myXYPair As XYPair ' search the right one For Each myXYPair In myXYPairs ' Looking for one that is ~60 If myXYPair.XValue > 59.5 Then If myXYPair.XValue < 60.5 Then ' Add the cursor Call Me.XYPlot1.Cursors.Add(myXYPair) Exit For End If End If Next ' Refresh to make sure it is drawn Refresh
Thanks a lot Andreas.
Hi Andreas and Rhys, Thanks for your post.
I tried with Cursor but it won’t completely fulfill my requirement.
Is there any other way to get the vertical line?
For better understanding requirements, PFB the scenario..
Here I need to find the apparent age (calculated) of equipment from the date of its installation based on the functions (and below calculation)
First we need to calculate Y –axis value, tdef(as above) and based on that we need to calculate the X-axis value.
If we assume we got X as 70 , then I need a Vertical line at 70.(X-axis).
Please share your comments/ experiences on how can I achieve this requirement?
Can some body please help me on this ... I am stuck here ....:(
If you can't get your requirements in using the XYPlot I'd consider using another visualization component.
I have created add-ins which utilize the new .NET Chart (formerly known as Dundas Charts), and there you have full control of all data series and there's no problem creating a vertical line as you need.
Of course it'd take some time just getting the framework for an add-in up and running, but there are code and resources in the forums (just search). After you've added the component you can use VBA to feed the component with data from ProcessBook.
I was contacted by Eric Lemay from Accenture regarding this same requirement. I suggested adding a vertical line on top of the XY plot that moves based on a tag value calculated using the above formula.
I have a built an example for you to check. In this example I am using:
1- Line1 and lin2 as my reference lines to denote the LEFT of the minimum and maximum value on the xyplot. (you can hardcode the left and right values of the xyplot if you need to, but it would be more dynamic if you have the lines in case you move the xyplot around)
2- Lin3 is the line you need to move based on the value from the calculated tag from ACE.
3- I have used some SDK code to get the value from the PI server for a test point (sinusoid) and set the line location based on this point value and the position of line1 and line2.
The range of values is hardcoded to 100 so this can be changed in your case. I have also added a value symbol that moves with the line to denote the current value we are trending on the vertical line.
the code is simple as you see below:
Dim MyServer As PISDK.Server
Dim MyTag As PISDK.PIPoint
Dim MyValue As PISDK.PIValue
Dim min As Double
Dim max As Double
Dim range As Double
' Set the PI Server & Tag
Set MyServer = PISDK.Servers.DefaultServer
Set MyTag = MyServer.PIPoints.Item("Sinusoid")
' Get the Snapshot value
Set MyValue = MyTag.Data.Snapshot
min = ThisDisplay.Line2.Left
max = ThisDisplay.Line1.Left
range = max - min
ThisDisplay.Line3.Left = min + (MyValue / 100 * range)
ThisDisplay.Value1.Left = min + (MyValue / 100 * range) - 40
This seems to have worked out well for them.
Gharib Nehme, OSIsoft
Thanks a lot Gahrib.