NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change the x-axis values on a graph that is generated in the html report?

Solved!
Go to solution

I have my report options set up to graph array data, however, the x-axis values start at 0.  I have 200 evenly spaced data points and I would like the x-axis to start at 200 and end at 400 (the graph currently starts at 0 and goes to 200).  Can I change the x-axis value?

0 Kudos
Message 1 of 5
(3,947 Views)

Hi Bill,

 

What report format are you using?  If you are using the XML report, it is simple to change the call that creates the graph in the default horizontal.xsl stylesheet.  If you search the stylesheet for the call that plots this graph (PlotY) you can change a parameter to change the starting x-value.  In the stylesheet for TestStand 4.1.1, the line looks like this: sRet += " Call CWGRAPH" + gGraphCount + ".PlotY(Array(" + graphArrayObj.GetGraphData(i) + " ),0,1) \n"; This builds a function call that will look like this: Call CWGRAPH0.PlotY(Array(1,2,3,4,5,6,7,8,9,10),0,1) .  This plots the given array and starts at the x-value 0.  Change the second parameter from 0 to 200 to change the starting point.  This will change all of the graphs in your report.

 

If you are using the HTML reporting, it is a little more complicated.  So, if you are using HTML or you only want to change one graph, let me know and I will look into that for you as well.

Message Edited by Eric B. on 05-07-2009 06:05 PM
Eric B.
National Instruments
Message 2 of 5
(3,923 Views)

Eric,

I'm using the html format.  I was able to change a single report by viewiing the source and changine the ploty() parameters, however, I would like to have teststand generate the plot with the x-axis starting at 200.

 

Bill

0 Kudos
Message 3 of 5
(3,903 Views)
Solution
Accepted by Bill_Simmons

As long as you want this to happen for all graphs, the following process should work for you:

 

First, you need to make sure your report options are set to use the Sequence report generating functions rather than the DLL report generating functions.  This option is in the Report Options menu at Configure»Report Options.  At the bottom, as long as you have HTML selected, you can switch between DLL and Sequence for the report generating functions.  Set it to Sequence.  Once you have made this selection, you can implement a process model callback that modifies each report entry.  Implement this callback (just a function that gets called during the report generation for every result in the report) by right-clicking in the sequences view in your sequence file and selecting "Sequence File Callbacks..."  Scroll down to ModifyReportEntry and click Add, then click OK.  You should have a new sequence called ModifyReportEntry.  All you need in this sequence is an if statement to check for the "PlotY" function and then a statement to modify the ReportEntry parameter.  The way this callback works is that it passes in the ReportEntry line, which is the entry for the current result in its HTML form.  We can modify the HTML here on the fly so the report gets generated properly.  First you need a statement to check if PlotY is in the ReportEntry string.  Then we need a statement to replace the "0" with "200" automatically like we did manually in the stylesheet and in the HTML code.  Here are the two statements:

 

If statementFind(Parameters.ReportEntry, "PlotY" ) > -1

The Find function returns the index of where the second argument exists in the first argument.  If it does not exist, it returns -1.  So, if the value is greater than -1, it does exist in the string, so we want to modify it.

 

Replace statement:  Replace(Parameters.ReportEntry, Find(Parameters.ReportEntry, " ), 0", Find(Parameters.ReportEntry, "PlotY" )), 4, " ), 200" )

The Replace function lets you replace a set number of characters with a new string.  In this expression we use part of the if statement expression to find where "PlotY" exists, so we can use that index as a starting point.  We then search for " ), 0", which signifies the end of the PlotY function call and the starting X value.  We replace these 4 characters with " ), 200" to make the PlotY function call start at 200.

 

NOTE: Anywhere there is a " ), it should not have a space inbetween...if there is no space, the forum turns it into this smiley: ")

 

The sequence should just look like this:

screenshot

 

This post touched on a few advanced topics, so if anything isn't absolutely clear, let me know and I can go into more detail if anyone needs it.

Message Edited by Eric B. on 05-12-2009 05:36 PM
Eric B.
National Instruments
Message 4 of 5
(3,882 Views)

Eric,

thanks for the solution to my problem.  It works perfect.

 

Regards,

Bill Simmons

0 Kudos
Message 5 of 5
(3,871 Views)