corelibraries-devexpress-dot-xtracharts-dot-seriescollection-dot-indexof-x28-devexpress-dot-xtracharts-dot-series-x29.md
Returns the specified object’s position within the collection.
Namespace : DevExpress.XtraCharts
Assembly : DevExpress.XtraCharts.v25.2.dll
NuGet Package : DevExpress.Charts
public int IndexOf(
Series series
)
Public Function IndexOf(
series As Series
) As Integer
| Name | Type | Description |
|---|---|---|
| series | Series |
A Series object to locate in the collection.
|
| Type | Description |
|---|---|
| Int32 |
A zero-based integer which represents the object’s position within the collection. -1 if the object doesn’t belong to the collection.
|
This method scans the collection starting from the first element and returns the index of the first matching element found.
The following code snippets (auto-collected from DevExpress Examples) contain references to the IndexOf(Series) method.
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.
winforms-charts-show-chart-legend-with-markers-in-separate-control/CS/Form1.cs#L77
{
gridView1.FocusedRowHandle = gridView1.GetRowHandle(chart.Series.IndexOf(((Series)e.Object)));
}
asp-net-web-forms-web-chart-control-create-drill-down-chart/CS/DrillDownChart/WebForm1.aspx.cs#L52
if (e.States.Last().Parameters.TryGetValue("ProductCategory", out categoryValue)) {
int seriesIndex = WebChartControl1.Series.IndexOf(WebChartControl1.Series[(string)categoryValue]);
int colorIndex = seriesIndex % WebChartControl1.PaletteRepository[WebChartControl1.PaletteName].Count + 1;
Color GetSeriesColor(Series series, ChartControl chartControl) {
int seriesIndex = chartControl.Series.IndexOf(series);
string paletteName = chartControl.PaletteName;
winforms-charts-show-chart-legend-with-markers-in-separate-control/VB/Form1.vb#L72
If e.HitInfo.InSeries Then
gridView1.FocusedRowHandle = gridView1.GetRowHandle(chart.Series.IndexOf(CType(e.Object, Series)))
End If
asp-net-web-forms-web-chart-control-create-drill-down-chart/VB/DrillDownChart/WebForm1.aspx.vb#L51
If e.States.Last().Parameters.TryGetValue("ProductCategory", categoryValue) Then
Dim seriesIndex As Integer = WebChartControl1.Series.IndexOf(WebChartControl1.Series(DirectCast(categoryValue, String)))
Dim colorIndex As Integer = seriesIndex Mod WebChartControl1.PaletteRepository(WebChartControl1.PaletteName).Count + 1
Private Function GetSeriesColor(ByVal series As Series, ByVal chartControl As ChartControl) As Color
Dim seriesIndex As Integer = chartControl.Series.IndexOf(series)
Dim paletteName As String = chartControl.PaletteName
See Also