Dundas Chart for ASP.NET
FindValue(Double,String,Int32) Method
See Also  Example Send comments on this topic.
Dundas.Charting.WebControl Namespace > DataPointCollection Class > FindValue Method : FindValue(Double,String,Int32) Method


valueToFind

The value of the data point to find (e.g. 15.5).


Point value to find.
useValue

The point value to be examined (e.g. X, Y, Y2, etc.).


Which point value to use (X, Y1, Y2,...).
startFromIndex

The location within the collection to start the search at (0-based). If a matching data point is found this parameter will be populated with the index of the returned data point, otherwise it will be set to negative one (-1).


Index of the point to start looking from. Returns index of found point or -1.

Returns the first data point with the specified X or Y-value, and starts the search at the specified index. Can be used in a loop to find all data points that have a specific value.


Find first point with Max value from specified index.

Syntax

Visual Basic (Declaration)  
Public Overloads Function FindValue( _
   ByVal valueToFind As Double, _
   ByVal useValue As String, _
   ByRef startFromIndex As Integer _
) As DataPoint
Visual Basic (Usage) Copy Code
Dim instance As DataPointCollection
Dim valueToFind As Double
Dim useValue As String
Dim startFromIndex As Integer
Dim value As DataPoint
 
value = instance.FindValue(valueToFind, useValue, startFromIndex)
C#  
public DataPoint FindValue( 
   double valueToFind,
   string useValue,
   ref int startFromIndex
)

Parameters

valueToFind

The value of the data point to find (e.g. 15.5).


Point value to find.
useValue

The point value to be examined (e.g. X, Y, Y2, etc.).


Which point value to use (X, Y1, Y2,...).
startFromIndex

The location within the collection to start the search at (0-based). If a matching data point is found this parameter will be populated with the index of the returned data point, otherwise it will be set to negative one (-1).


Index of the point to start looking from. Returns index of found point or -1.

Return Value

The first DataPoint object in the DataPointCollection that has the specified X or Y-value. If no matching data point is found then null will be returned.


Found point or null.

Example

In the following sample we search for data points in the DataPointCollection that have a second Y-value of 10. We then set the color of these points.

Visual Basic Copy Code
Imports Dundas.Charting.WebControl
...

    ' Declare data point index
    Dim index As Integer = 0

    ' Find all points that have value of 10, and change their color
    Dim dataPoint As DataPoint = chart1.Series(0).Points.FindValue(10,"Y2",ref index)

    ' Find any other points that have value of 10
    While Not dataPoint Is Nothing
        dataPoInteger.Color = Color.FromArgb(255, 128, 128)
        index = index + 1
        dataPoint = chart1.Series(0).Points.FindValue(10, "Y2", index)
    End While

...
C# Copy Code
using Dundas.Charting.WebControl;
...
    
   
// Declare data point index
   
int index = 0;
    
   
// Find all points that have value of 10, and change their color
   
DataPoint dataPoint = chart1.Series[0].Points.FindValue(10, "Y2", ref index);

   
// Find any other points that have value of 10
   
while (dataPoint != null)
   {
       dataPoint.Color = Color.FromArgb(255, 128, 128);
       index = index + 1;
       dataPoint = chart1.Series[0].Points.FindValue(10,
"Y2", ref index);
   }
    
...

Remarks

Returns the first matching data point that has the specified point value (e.g. the first data point with a Y1 value of 15.5).

This definition can be used in a loop to locate all data points in the collection that have a specific value. This is accomplished by incrementing the startFromIndex parameter in the loop that performs the search (see sample code below).

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Copyright © 2001 - 2009 Dundas Data Visualization, Inc. and others.