SeriesPoint.Values Property
Gets or sets the point’s data value(s).
Namespace: DevExpress.XtraCharts
Assembly: DevExpress.XtraCharts.v19.1.dll
Declaration
[XtraSerializableProperty(XtraSerializationVisibility.Hidden)]
public double[] Values { get; set; }
Property Value
Type | Description |
---|---|
Double[] | An array of floating-point values that represent the data value(s) of the series data point. |
Remarks
Each data point is defined by the values of two coordinates - X and Y - when speaking about most series types.
The X coordinate value of a point represents the point’s argument and is specified by the SeriesPoint.Argument property.
As for a point’s Y coordinate, it can be defined by one or more Y values. Most series types use one Y value, except for some other types (e.g. financial series such as the candle stick and stock series) where one data point can be defined by multiple Y values (for instance, four values are required to plot a stock point: high, low, open and close). Such a Y value(s) represents the value(s) of the data point. These values are stored within an array which can be accessed and customized via the Values property.
The individual value of a data point can be manipulated via the Values property using indexer notation (see the SeriesPoint.Item property). The length of the data values array can be obtained via the SeriesPoint.Length property.
Example
This example demonstrates how to add a custom item to the legend.
- Create a CustomLegendItem object and add it to the Legend.CustomItems collection.
- Use the MarkerImage and Text properties to specify the custom item’s content.
- The Legend.ItemVisibilityMode property allows you to define whether to show custom items and auto-generated items together.
The following code adds a custom legend item with an image and text.
private void Form1_Load(object sender, EventArgs e) {
double total = CalculateTotal(chartControl.Series[0]);
CustomLegendItem customLegendItem = new CustomLegendItem();
customLegendItem.MarkerImage.Image = new Bitmap("..\\..\\Images\\sum-icon.png");
customLegendItem.MarkerImageSizeMode = ChartImageSizeMode.Zoom;
customLegendItem.Text = string.Format("Total: ${0}M", total);
chartControl.Legend.CustomItems.Add(customLegendItem);
chartControl.Legend.ItemVisibilityMode = LegendItemVisibilityMode.AutoGeneratedAndCustom;
chartControl.Legend.Direction = LegendDirection.TopToBottom;
}
public Double CalculateTotal (Series series) {
double total = 0;
foreach(SeriesPoint point in series.Points) {
total += point.Values[0];
}
return total;
}
Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Values property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.