createChart
Top  Previous  Next

createChart (integer Chart, string File , string Param1, integer Class1 [, string Param2, integer Class2 ] )

Use this function to create a chart linked to a data file or global grid.

Arguments
 
Chart  
 
An integer between 1 and 100 specifying the ID of the chart to be created. If a chart with the specified ID exists, it will be replaced with the new one.  
 
File  
 
A string specifying the path and name of the data file to be used to plot the chart. If the path is not specified, the default directory will be used. The format of the data file is defined by a file extension. See the remarks below for a list of valid file extensions. If this parameter is zero, the data will be taken from the global grid.  
 
Param1, Param2..  
 
Strings specifying the measured parameters whose values represent the data series to be plotted.  
 
Class1, Class2..  
 
Integers specifying the class IDs of the objects whose measured parameters will be used to plot the data. Class1 corresponds to Param1, Class2 to Param2 etc. If the class ID is set to zero, all objects measured will be used.  
 
Error flags
ERR_OK  
 
The flag set if successful.  
 
ERR_FAILED  
 
The flag set if failed.  
 
ERR_NOTFOUND  
 
The flag set if the file was not found.  
 
ERR_BADFORMAT  
 
The flag set if the file format was not recognized  
 
Example

This set of statements measures objects on a sample image and displays a 3D-histogram of two measured parameters:  
 
SelectParam("Area","Perim","DCircle","DMin","DMax")  
grabim(1)  
threshunimod(1,1,0,1)  
scrap(1,1,50,400,1)  
measobjects(1,1,"")  
setChartAttr(GR_3D,8,5)  
createchart(1,"","Area",0, "DMin",0)  
 
Remark

The number of pairs Param-Class used depends on the type of the graph (selected with setChartAttr). For the Bar Histogram, Line Histogram, and Pie Diagram only the first pair is used to mark the X-axis. The Scattegram and 3D-Histogram use the first and second pair. The Multi-histogram will use all the specified pairs to plot all data series next to each other.