📄 graph.h
字号:
/**
The "X" property - the Scale object representing the X-axis in the layer.
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
void run_Scale_X()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
// Intialize a Scale object from the X-axis scale of the GraphLayer
// (gl.X is the X-axis scale for the layer attached to "gl").
Scale s(gl.X);
// Display the "From" property (the left limit of the X-axis):
out_double("From = ", s.From);
}
*/
Scale X;
/**
The "Y" property - the Scale object representing the Y-axis in the layer.
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
void run_Scale_Y()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
// Intialize a Scale object from the Y-axis scale of the GraphLayer
// (gl.Y is the Y-axis scale for the layer attached to "gl").
Scale s(gl.Y);
// Display the "From" property (the left limit of the Y-axis):
out_double("From = ", s.From);
}
*/
Scale Y;
/**
Gets an arbitrary DataPlot in layer.
Parameters:
index = 0-offset index of the data plot in layer.
Returns:
the index'th DataPlot.
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
// Make sure that the graph has at least one data plot and that there are at least ten
// data points in the plot.
// After the function executes, the data plot will show
// only the data points from 5 to 10.
void run_DataPlots()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
// Get the first data plot in the layer:
DataPlot dp = gl.DataPlots(0);
// Change the display range of the data plot to
// show only points from 5 to 10:
dp.SetRange(5, 10);
}
*/
DataPlot DataPlots(int index);
/**
Gets an arbitrary DataPlot in layer.
Parameters:
lpcszName = the name of the dataset that the desired DataPlot should contain.
Returns:
the DataPlot.
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
// Make sure that the graph has at least one data plot using
// the dataset "Data1_b" and that there are at least ten
// data points in the plot.
// After the function executes, the data plot will show
// only the data points from 5 to 10.
void run_DataPlots()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
// Get the data plot in the layer which contains dataset "Data1_b":
DataPlot dp = gl.DataPlots("Data1_b");
// Change the display range of the data plot to
// show only points from 5 to 10:
dp.SetRange(5, 10);
}
*/
DataPlot DataPlots(LPCSTR lpcszName);
/**
Removes one DataPlot from layer. The object is referred to by index.
Parameters:
index = the DataPlot index
Return:
TRUE for success, otherwise FALSE
*/
BOOL RemovePlot(int nIndex);
/**
Removes one DataPlot from layer. The object is referred to by refercence.
Parameters:
dp = the DataPlot reference
Return:
TRUE for success, otherwise FALSE
*/
BOOL RemovePlot(DataPlot& dp);
/**
The Collection property of all DataPlots in the layer.
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
// Make sure that the graph has at least one data plot there are at least ten
// data points in every the plot.
// After the function executes, all the data plots will show
// only the data points from 5 to 10.
void run_DataPlots()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
Collection<DataPlot> dpColl;
// Get the collection of all dataplots in the layer:
dpColl = gl.DataPlots;
// Loop over all the dataplots in the collection:
foreach (DataPlot dp in dpColl)
{
// Change the display range of the data plot to
// show only points from 5 to 10:
dp.SetRange(5, 10);
}
}
*/
Collection<DataPlot> DataPlots;
/**#
Gets an arbitrary StyleHolder in layer.
Parameters:
index = 0-offset index of the StyleHolder in layer.
Returns:
the index'th StyleHolder.
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
void run_StyleHolders()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
StyleHolder sh;
// Get the first style holder:
sh = gl.StyleHolders(0);
// Display its name:
out_str(sh.GetName());
}
*/
StyleHolder StyleHolders(int index);
/**#
Gets an arbitrary StyleHolder in layer.
Parameters:
lpcszName = the name of the style holder in layer (the name of a style holder
starts with an underscore followed by a number
indicating the plot type).
Returns:
the StyleHolder.
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
// Make sure that you use the line-symbol plot template or graph, because
// the function tries to access the style holder with the name "_202" which
// corresponds to the line-symbol plot type.
void run_StyleHolders()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
StyleHolder sh;
// Get the style holder "_202":
sh = gl.StyleHolders("_202");
// Display its name:
out_str(sh.GetName());
}
*/
StyleHolder StyleHolders(LPCSTR lpcszName);
/**#
The Collection property of all StyleHolders in the layer.
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
void run_StyleHolders()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
Collection<StyleHolder> shColl;
// Get the collection of all style holders in the layer:
shColl = gl.StyleHolders;
// Loop over all the style holders in the collection:
foreach (StyleHolder style in shColl)
{
// Display the name (the name of a style holder
// starts with an underscore followed by a number
// indicating the plot type):
out_str(style.GetName());
}
}
*/
Collection<StyleHolder> StyleHolders;
#if _OC_VER > 0x0703
/**#
Example:
GraphLayer gl("Graph1");
gl.SetDataMarkers(1,3);
int i1,i2;
gl.GetDataMarkers(i1, i2);
*/
BOOL SetDataMarkers(int i1, int i2);
/**#
SeeAlso:
GraphLayer::SetDataMarkers
*/
BOOL GetDataMarkers(int& i1, int& i2);
/**#
Example:
GraphLayer gl("Graph1");
Axis x = gl.XAxis;
*/
Axis XAxis;
/**#
Example:
GraphLayer gl("Graph1");
Axis y = gl.YAxis;
*/
Axis YAxis;
/**#
Example:
GraphLayer gl("Graph1");
Axis z = gl.ZAxis;
*/
Axis ZAxis;
/**#
Example:
GraphLayer gl("Graph1"); //Least two plots on the graph layer
gl.GroupPlots(0,1); //make a group for the two plots
GroupPlot gPlot;
gPlot = gl.Groups(0);
*/
GroupPlot Groups(int nIndex);
#endif // _OC_VER > 0x0703
};
/** >Internal Origin Objects
The GraphObject class provides methods and properties common to all Origin graph
objects. Origin graph objects include such things as text annotations, graphic
annotations (e.g. rectangles, arrows, line objects, etc.), data plot style holders,
and region of interest objects. Origin graph objects are generally contained by
layers on an Origin page thus the Origin C GraphLayer class contains a collection
of GraphObjects. An Origin C GraphObject is a wrapper object that is a reference to
an internal Origin graph object. Origin C wrapper objects do not actually exist
in Origin and merely refer to the internal Origin object. Consequently, multiple
Origin C wrapper objects can refer to the same internal Origin object. The GraphObject
class is derived from the OriginObject class from which it inherits methods and
properties.
Example:
// Assumes Graph1 window is active in Origin
GraphLayer gl = Project.ActiveLayer(); // Get active layer in project file
if(gl) // If valid graph layer...
{
GraphObject go; // Declare GraphObject
go = gl.GraphObjects("YL"); // Attach go to "YL" which is the the left Y-axis title
out_str(go.Text);
}
*/
class GraphObject : public OriginObject
{
public:
/**
Default constructor which creates a GraphObject which is not
attached to an internal graphic object. It should be initialized using
"GraphObjects" method of the Layer class because all the GraphObject's are conatined in
layers.
Example:
For this example to run, a graph window with the name "Graph1" must exist in the project.
void test_GraphObject()
{
GraphLayer glMyLayer("Graph1");
GraphObject goMyObj = glMyLayer.GraphObjects("Text");
out_str(goMyObj.Text);
}
*/
GraphObject();
/**
Copy Constructor: The new GrpahObject object created is attached to the internal graphic object
goOriginal was attached to. If goOriginal was invalid (not attached) so will be the new object.
Example:
For this example to run, a graph window with the name "Graph1" must exist in the project.
void test_GraphObject()
{
GraphLayer glMyLayer("Graph1");
GraphObject goOriginal;
goOriginal = glMyLayer.GraphObjects("Text");
GraphObject goNew(goOriginal);
out_str(goNew.Text);
}
*/
GraphObject(GraphObject &goOriginal);
/**
The X coordinate of the center of the object.
Read and Set access
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
// Also, the active layer in the Graph should have a graphic object (such as rectangle) with
// the name "Rect".
void run_GraphObject_X()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
GraphObject grobj;
// Get the graphic object:
grobj = gl.GraphObjects("Rect");
// Display the X coordinate:
out_double("X = ", grobj.X);
}
*/
double X;
/**
The Y coordinate of the center of the object.
Read and Set access
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
// Also, the active layer in the Graph should have a graphic object (such as rectangle) with
// the name "Rect".
void run_GraphObject_Y()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
GraphObject grobj;
// Get the graphic object:
grobj = gl.GraphObjects("Rect");
// Display the Y coordinate:
out_double("Y = ", grobj.Y);
}
*/
double Y;
/**
Width of the object in axes units
Read and Set access
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
// Also, the active layer in the Graph should have a graphic object (such as rectangle) with
// the name "Rect".
void run_GraphObject_DX()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
GraphObject grobj;
// Get the graphic object:
grobj = gl.GraphObjects("Rect");
// Display the width:
out_double("DX = ", grobj.DX);
}
*/
double DX;
/**
Height of the object in axes units.
Read and Set access
Example:
// For this example to run, a graph window with the name "Graph1" must exist in the project.
// Also, the active layer in the Graph should have a graphic object (such as rectangle) with
// the name "Rect".
void run_GraphObject_DY()
{
// Create and attach a graph layer from "Graph1":
GraphLayer gl("Graph1");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -