AnyBody™ Tutorials
Lesson 4: The Chart Views

The AnyBody Modeling System has two different window types for graphing results:

The ChartFX View and the AnyChart View. The former gives you a large gallery of different graph types to choose from and has useful features for interfacing with other windows applications such as the option to copy data on many different formats. However, this view is restricted to two-dimensional graphs.

The AnyChart View gives you the opportunity to make three-dimensional surface plots. It is based on the AnyScript drawing object class also called AnyChart and this reuse of functionality allows you to make identic charts in the AnyChart View and inside the model scene, i.e., in Model View. AnyChart is still a fairly simple chart option, but its functionlity is being extended in future version of AnyBody.

The ChartFX View

Do you still have the demo.Arm2D.any model loaded? If not, try loading it in and we'll play a little with it and see how results can be investigated.

Please load the model and run the ArmStudy.InverseDynamicAnalysis. Then open a ChartFX View by clicking Window -> ChartFX (new). You will get a window like this:

Notice that the window like all other windows in the AnyBody Modeling System is divided into a tree pane on the left and the actual data area to the right. If you play around a bit with the tree you will soon see that it resembles the trees from most of the other window types, but that some stuff is missing. This is because the tree is filtered, and it requires a further explanation:

The AnyBody Modeling System contains a special type of data called output data. This is essentially what comes out of a computation. Output data is organized in series with one item for each time step of the analysis, so the output data is not available until an analysis has been performed. The tree in the Chart View has been filtered such that you only see the output data. This makes browsing a bit less confusing. However, the tree retains its basic structure, so to get to useful data you normally have to expand the tree through Main.ArmStudy.Output.Model. Notice that the other option next to Output is Abscissa. The standard Abscissa in an InverseDynamicAnalysis is time, so if you expand the Abscissa branch and click the 't' variable, you will get a straight line with slope 1 because you are plotting time against time.

Global output data

Directly under output you also find some data pertaining to the "global" properties of the model:

  • Ekin - the total kinetic energy of the system
  • Epot - the total potential energy of the system
  • Emech - the total mechanical energy of the system, i.e. the sum of potential and kinetic energies
  • Pmech - the mechanical power of the system

Try clicking Ekin, Epot, and Emech in turn. You will notice that Epot and Emech are very similar. This is because the movement in this model is relatively slow, so the kinetic energy remains small throughout the simulation and has little influence.

The KinematicError is not very interesting unless something is wrong with the analysis. It stores the error in the kinematic analysis as a measure of how far the kinematic constraints of the problem are from being satisfied. Normally this should be zero or very close to zero. If is it not, information about the development of the kinematic error may help you determine the cause of the problem.

Finally, the MaxMuscleActivity is the a measure of the overall effort of the body model but it requires further explanation, so we shall get to it a little later.

Time-dependent data

The predominant way of looking at data is as a function of time or rather time steps. If you expand the Model branch into the Segs section, you can investigate the movement of the "hand" of the model as shown in the figure above.

Expand the tree until you get to the HandNode object as shown to the left. Then click the r property. This displays three curves on the screen corresponding to the x, y, and z coordinates of the handnode as the arm moves. The z coordinate is zero because it is a 2-D problem. By the way, the color codes of the chart view are red, green and blue in that order, so red is for x, green is for y, and blue is for z.

Let us look as more complex data. Most users of musculoskeletal analysis are interested in muscle forces. In this model we can find the muscles in the tree by expanding the nodes Main.Model.Muscles. Take the first muscle, brachialis, and click the Fm property.

Fm is the muscle force, and as you can see, the brachialis force declines as the arm moves. Not all of the muscle data items in the tree contain any reasonable results. It depends a bit on the muscle model in question. But the muscle force, Fm, and the active state, Activity, are always available. Please refer to the Muscle Modeling tutorial for more information.

Detailed data investigation

Having an item graphed you may want to investigate the results a little closer, and the toolbar above the graph gives you different options for doing so.

However, the first thing you might notice is that if you hold the mouse pointer still above the curve for a short moment, a small box will pop up and give you the name of the data series and the value of the closest data point. In the example to the right you can see how the little box informs you that the curve passes through point (0.04; 1.46e+002). Please notice that the decimal commas are because this picture is made on a computer with a European language setting. Notice also that the Chart View uses 'x' and 'y' to designate the two axes regardless of which parameters are actually being graphed.

To facilitate studying of the details of the data you can switch on the grid lines horizontally, vertically, or in both directions simultaneously, and you can edit the properties of the x and y axes to display the grid lines as closely as you desire as shown below.

In some cases you can have curves with complicated shapes that you may want to investigate in details. The zoom tool is handy for that. When you press the toolbar button with the little magnifying glass, zoom mode switches on, and you can select an area of the chart for closer investigation by dragging the mouse. You can zoom again on the zoomed area and go as close to the detail you are interested in as you like. The zoom mode remains active until you click the magnifying glass again. This resets the view to the original area.

To investigate the data in even more detail you can switch the data box on by clicking the appropriate button on the toolbar. This gives you a spreadsheet-like box at the bottom of the screen, and you can investigate the numbers behind the graphs in detail. You can even double-click the numbers and edit them. Of course, that would be cheating...

The specification line

Above the toolbar in the chart view you find a specification panel. It is useful for several applications that are a bit more advanced. With the specification panel you can specify plotting of a family of curves, you can specify your own abscissa, and you can save and recall plot specifications.

You may want to look at several curves at a time. The secret to doing that is the Y data specification line. This line can to some extent parse the specification string. This means that you can compose the string with any number of wild characters such as you may know from file name specifications in Windows, Unix and other operative systems. If you, for instance, replace "brachialis" the data specification with '*' like this:

ArmStudy.Output.Model.Muscles.*.Fm

then you will get all the muscle force curves plotted simultaneously. as shown below:

We have eight muscles in this model, so why do you only see two curves? The explanation is that all the muscles in this model have the same strength, so they team up in groups where all the muscles pull exactly the same. This model has three groups. The brown curve at the top, the green curve in the middle, and another green curve of inactive muscles on the x axis. So several curves are hidden under each of the curves you can see.

As you can see, the legend box at the bottom of the window only shows one muscle. This is because the muscle names are rather long, and the box simply does not have room for more. However the box is dockable, and you can place it anywhere you like, including in its own window outside the Chart View, and you can resize it until it fits the legends you want to display, for instance as shown below:

User-defined abscissa

The default abscissa in the chart view is time. However, you can in principle plot data against any scalar property the system has computed. Let us imagine that the dumbbell curl study we are looking at is an ergonomic investigation of the effort of lifting the weight to different heights. In that case, it might be more relevant to plot the muscle force as a function of the height of the hand. The way to do so is simply to replace the ArmStudy.Output.Abscissa.t specification in the X specification line. Let us start by finding the position of the hand. If you browse down the tree through Main.Model.Segs.LowerArm.Handnode.r. You will get three graphs:

The three graphs (of which one is constant zero) is because the hand node position is a vector with three coordinates. We want to extract the height, which is the y coordinate, and use it as the abscissa. But the abscissa obviously cannot be a vector, so we must construct a scalar variable containing the y coordinate of the hand node in the AnyScript model. The way to do so represents a very useful and slightly subtle trick, and requires a bit of explanation.

At the beginning of this lesson you learned that the system automatically defines a group of variables containing the output from the analysis. But you can also define your own output variables. The only difference between an output variable and an ordinary AnyVar is that the values of output variables get stored for each time step.

So how can we make the system perceive a given variable as an output variable? The answer is that any variable defined inside an operation in a study is a user-defined output variable. Now we are getting to the point of the case at hand: We can define the y coordinate of the HandNode as a variable in the InverseDynamicAnalysis operation in the study and subsequently use it as the abscissa of the Chart View. Here's what to do:

AnyBodyStudy ArmStudy = {
AnyFolder &Model = .ArmModel;
InverseDynamics.Criterion.Type = MR_MinMaxStrict;
Gravity = {0.0, -9.81, 0.0};
InverseDynamicAnalysis = {
AnyVar HandHeight = Main.ArmModel.Segs.LowerArm.HandNode.r[1];
};
};

As you can see, the new code is an addition to the existing (implicitly defined) InverseDynamicAnalysis object. The result is that the model now contains a scalar output variable called HandHeight containing the y coordinate of the handle. Try adding that piece of code to the model, reload, and run the InverseDynamicAnalysis. You should now have the following section in the tree in the Chart View:

As you can see, the tree has been extended with the new variable we have defined. The next step is to use this variable as the abscissa.

Notice the first line of the panel above. It holds the time specification, but it is grayed out, and you cannot write anything in the field. To be able to change this line, first click the "Out" button. "Out" means that this is where to click if you want to select a new abscissa among the output variables. Clicking the button changes its name to "Auto" and ungrayes the line. Now you can place the cursor by clicking somewhere on the formerly gray line and subsequently browse your way in the tree to the HandHeight variable and click it. This places the variable in the X specification, and it is now used as the abscissa of the graph.

Stacking graphs

As you have seen, getting the specifications of a graph completely right can sometimes require a some amount of clicking around in the tree and in the specification panel. So some way to save your carefully selected plot specifications can be handy. The specification panel allows you to put your carefully selected graphs on a stack and to recall them when you want them back. Whenever you click the "Ins" button the current graph is inserted into the stack and given a number. By means of the "<<" and ">>" buttons you can scroll back and forth between the plots you have saved. The "Del" button removes the current graph from the stack.

Exporting data

You are almost bound to want to save your data in various ways. Perhaps you want to save a graph for inclusion in a report you are writing. Perhaps you desire to save the chart on a compact format for later review without having to run the AnyBody analysis again. Perhaps you want to export the data to a text file for processing by statistical software. Or perhaps you want to paste the data into a spreadsheet to make customized combinations of data for presentation in customized graph types.

The Chart View has its own file format that you can save and load. The files have extension .CHT, and they are very compact and easy to store and exchange. You Open and Save .CHT files with the first two buttons on the toolbar. A stored .CHT file can be sent to other AnyBody users, and they can load it in and investigate the results you have produced. Please notice that a loaded .CHT file is only computational data. It has no connection to the model that generated the output data, and you do not get the model loaded when you load the .CHT file.

.CHT files are a convenient way of storing analysis data because they can subsequently be reformatted and displayed in other ways than you initially planned, for instance a stacked column diagram or a pie chart instead of curves.

Data can also be exported from the Chart View via the clipboard. The "Copy to clipboard" icon on the toolbar gives you the opportunity to copy the present chart on different formats:

  • As a bitmap picture. The picture will have screen resolution, so the quality depends on the size of the Model View. For maximum quality, maximize the AnyBody Modeling System main frame on your desktop and maximize the Chart View inside the main frame.
  • As a vector-based windows meta file. This type of file has infinite resolution, so you can scale it up and down without loss of quality. However, this requires that the application into which you intend to import the file supports vector graphics.
  • As a windows object. This option is currently not active.
  • As a text. This option copies the graphed numbers to the clipboard on text format, and you can subsequently paste them into a spreadsheet or a text editor. Pasting into a spreadsheet can be very useful because it allows you to use the data in subsequent processing such as statistical analysis.

A word of caution regarding the the text option: Different countries have different conventions for decimal numbers. Some use a point as decimal separator, and some use a comma. The numbers copied to the clipboard from the Chart View follow the nationality settings for decimal point or comma. When you subsequently paste the numbers into a spreadsheet it is important that the spreadsheet follows the same conventions. If the numbers coming out of the Chart View for instance use decimal comma and the spreadsheet receiving them expects number with decimal points, then the spreadsheet will interpret the numbers you paste in as text rather than numbers.

The AnyChart View

AnyChart is AnyBody's alternative for making charts. AnyChart is special compared to ChartFX in the way that AnyChart uses the AnyScript class called AnyChart to make the visualization. The AnyScript class AnyChart is a draw object that can be used in the AnyScript code to make charts in the Model View of the model. The AnyChart View wraps the features of the AnyChart class into a window in the AnyBody GUI. Currently, AnyChartpocesses only simple charting features, and therefore AnyChart and ChartFX still lives side-by-side in the system.

AnyChart collects all its properties as described for the AnyChart class in the AnyScript Reference Manual. In contrast to ChartFX, all these properties are saved in workspace files, so AnyChart Views are generally reestablished better, when introduced into workspaces.

AnyChart is AnyBody's only tool for showing 3-D surfaces. One main difference between AnyChart and ChartFX is that AnyChart allows you to define two Abscissa axes. AnyChart is mainly used in conjunction with parameter studies and optimization. Please refer to the Parameter Studies and Optimization tutorial for a demostration of these features.

AnyChart also introduces multiple series in the same chart. The primary mechanism of selecting values to be depicted in the chart is the same as for ChartFX, but with multiple series you can add several selections together in the same chart.

One additional small difference between the charts is AnyChart's selection line also that allows you select elements of vectors, matrices, and higher order tensors. Like in AnyScript code, [] bracket can be used to select subelements.

The next interface lesson is concerned with a part of the system that really has a minimum interface: The command line version .

AnyBody Technology A/S · Niels Jernes vej 10 · DK-9220 Aalborg Ø · Denmark · Tel. +45 9635 4286 · Fax. +45 9635 4599            Sitemap