Syntax 1 For all graph types except scatter
Description
Adds a data point to a series in a graph. Use Syntax 1 for
any graph type except scatter graphs.
Controls
Graph controls in windows and user objects. Does not apply
to graphs within DataWindow objects because their data comes directly
from the DataWindow.
Syntax
|
1 |
<span>controlname</span>.<span>AddData</span> ( <span>seriesnumber</span>, <span>datavalue</span> {, <span>categoryvalue</span> <span></span>} ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the graph in which you want |
|
seriesnumber |
The number that identifies the series |
|
datavalue |
The value of the data you want to add. |
|
categoryvalue (optional) |
The category for this data value on the |
Return Values
Long. Returns the position of the data
value in the series if it succeeds and -1 if an error occurs. If
any argument’s value is null, AddData returns null.
Usage
When you use Syntax 1, AddData adds a value
to the end of the specified series or to the specified category,
if it already exists. If categoryvalue is a
new category, the category is added to the end of the series with
a label for the data point’s tick mark. If the axis is
sorted, the new category is incorporated into the existing order.
If the category already exists, the new data replaces the old data at
the data point for the category.
For example, if the third category label specified in series
1 is March and you add data in series 4 and specify the category
label March, the data is added at data point 3 in series 4.
When the axis datatype is string, you
can specify the empty string (“”) as the category name. Because
category names must be unique, there can be only one category with
a blank name. If you use AddData to add data
without specifying a category, you will have data points without
categories, which is not the same as a category whose name is “”.
To insert data in the middle of a series, use InsertData.
You can also use InsertData to add data to the end of a series,
as AddData does, although it requires an additional
argument to do it.
For a comparison of AddData, InsertData,
and ModifyData, see Equivalent Syntax in InsertData.
Examples
These statements add a data value of 1250 to the
series named Costs and assign the data point the category label
Jan in the graph gr_product_data:
|
1 |
integer SeriesNbr |
|
1 |
|
1 |
// Get the number of the series. |
|
1 |
SeriesNbr = gr_product_data.FindSeries("Costs") |
|
1 |
gr_product_data.<span>AddData</span>(SeriesNbr, 1250, "Jan") |
These statements add a data value of 1250 to the
end of the series named Costs in the graph gr_product_data but
do not assign the data point to a category:
|
1 |
integer SeriesNbr |
|
1 |
|
1 |
// Get the number of the series. |
|
1 |
SeriesNbr = gr_product_data.FindSeries("Costs") |
|
1 |
gr_product_data.<span>AddData</span>(SeriesNbr, 1250) |