XYCreate creates a new 2D dataset from a single value as a horizontal or vertical line or from a min/max value as a horizontal or vertical range (bar).

hData = XYThresholdCreate(ssName, rsValue, nType)
hData = XYThresholdCreate(ssName, rvRangeValue, nType)

Return Value

If the function succeeds, the return value is the handle of the newly created 2D dataset. If the function fails, the return value is 0.



ssName is the name for the dataset.


rsValue is a scalar value with x-coordinate or y-coordinate.


rvRangeValue is a vector with two elements to define the range.


nType sets the type. For a vertical line the value is XY_THRESHOLD_XCONST and for a horizontal line the value is XY_THRESHOLD_YCONST


To create a threshold line:

* hData = XYThresholdCreate("Test", 12, XY_THRESHOLD_YCONST); // line
* hLayer = LayerCreate();
* hDoc = DocCreate();
* hPage = PageCreate();
* DocAddPage(hDoc, hPage);
* PageAddLayer(hPage, hLayer);
* LayerAddDataset(hLayer, hData);
* LayerAutoScale(hLayer);
* PageReplot(hPage);

To create a threshold range:

rsMin = 27;
rsMax = 34;
hData = XYThresholdCreate("Test", [rsMin, rsMax], XY_THRESHOLD_YCONST); // range
// ! means without an item in the legend
//  XYSetLegendText(hData, "!" + svRet[obj.id.LegendText]);
XYSetLegendText(hData, "NOx range");
XYSetFillColor(hData, [127,255,0,0];  // red with 50% transparency
LayerAddDataset(hLayer, hData);
LayerMoveDataset(hLayer, hData, 0); // send to beginning of list (background).

To modify a threshold range:

rvX = [rsMin, rsMin, rsMax, rsMax];
rvY = [rsMin, rsMin, rsMax, rsMax];
XYSetData(hData, rvX, rvY);


Version Description
R2018.2 Threshold range added.