07-19-2013 11:48 AM
Hi Near,
You should set the DisplayType property to be "CurveChart2D" before you can access the Graph elements. Then if the Graph is truly empty, you must first create a new curve.
Set Sheet = View.Sheets("Sheet 1") Set NewViewArea = Sheet.Areas(2) NewViewArea.DisplayObjType = "CurveChart2D" Set NewViewGraph = NewViewArea.DisplayObj Call NewViewGraph.Curves.Add(XChannel, YChannel)
Brad Turpin
DIAdem Product Support Engineer
National Instruments
07-22-2013 04:02 AM
Thank you Brad !
When I try to display a channel from scratch using a script, I bump into the following error: "An invalid index was accessed."
Here is my code:
View.ActiveSheet.Cursor.Type = "Curve" Set DisplaySheet = View.Sheets("Sheet 1") Set DisplayArea = DisplaySheet.Areas.Item(1) DisplayArea.DisplayObjType = "CurveChart2D" Call View.Sheets("Sheet 1").Areas.Item(1).DisplayObj.Curves.RemoveAll View.Sheets("Sheet 1").Areas(1).DisplayObj.Curves.Item(1).YChannelName = "ChannelName"
Even when I replace the last line by this one:
DisplayArea.DisplayObj.Curves.Add("", 1)
I get the following error: "Cannot use parentheses when calling a Sub". The problem is that I am not using any sub in the VBS file containing this code... I am feeling that the error is minor and only few characters should be corrected.
07-22-2013 08:12 AM - edited 07-22-2013 08:24 AM
Actually do not bother anymore, I was forgetting a Call somewhere and it obviously took me hours to realize it........
I would be interested in the commands used to change markers and colors in VIEW, I'm sure a couple methods will do but I could not find the right one (especially for colors) while exploring this forum as well as the help. Edit: done
07-29-2013 03:34 PM
Hi Near,
I suggest you interactively configure the VIEW graph to show the markers just like you want them to look, then pop up the configuration dialog and hit <Ctrl-A> for DIAdem 2011 and older or <Ctrl-C> for DIAdem 2012 or newer. This will put the whole contents of that dialog onto the Windows Clipboard. If you then go to a script in the SCRIPT panel and hit <Ctrl-V>, you will get the following code:
Dim oCurveObj Set oCurveObj = View.Sheets(1).Areas(1).DisplayObj.Curves.item(1) oCurveObj.LabelChannelName ="" oCurveObj.LabelIndexChannelName ="" oCurveObj.LabelChannelOrientation ="horizontal" oCurveObj.MarkerType ="circle" oCurveObj.MarkerLineWidth ="min" oCurveObj.MarkerSize =2 oCurveObj.MarkerColorAuto =true oCurveObj.MarkerColor ="black" oCurveObj.MarkerColorRGB =0 oCurveObj.MarkerFillColorAuto =true oCurveObj.MarkerFillColor ="" oCurveObj.MarkerFillColorRGB =0 oCurveObj.MarkerFrequencyMode ="CalcNPoint" oCurveObj.MarkerIntervalPoints =1 oCurveObj.MarkerIntervalLength =10 oCurveObj.MarkerAtBegin =false oCurveObj.MarkerAtEnd =false
Brad Turpin
DIAdem Product Support Engineer
National Instruments