Home Forums WinForms controls Xceed Chart for WinForms Getting PointSeries actual x,y

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18996 |

    I have a chart which is 700×550 pixels in size.  The scale of the chart is set as follows:  Min x = 70, Max x=190.  Min y = 1200, Max y=5000.  I am plotting single spheres (SeriesType.Point) on the chart in the form of a point series using the AddXY method call.  Now the question:  I am trying to iterate through the chart’s point series in order to determine which spheres fall within the physical regions that are defined based on the actual chart size (700×550) and not the scale.  While I am able to get the values used to plot the sphere I cannot seem to find a way to correlate the plot to the physical point.  here is a small snippet of how I am retrieving the plots:

    foreach (PointSeries pointseries in m_chart.Series)
    {
      double x = (double)pointseries .XValues[0];
     
    double y = (double)pointseries .Values[0];
    }

    Is there a method that will correlate the scaled x,y values to the physical x,y ?  I am open to any constructive suggestions.

    Imported from legacy forums. Posted by David (had 1318 views)

    User (Old forums)
    Member
    Post count: 23064

    You can use the different methods on the Chart class to go from scale to model coordinates, and then from model to client coordinates, which should give you want you want.

    e.g. :

    //get the model coordinates from the data points (scale) coordinates

    Vector modelVector = new Vector();

    modelVector.x = chart.Axis(

    StandardAxis.PrimaryX ).ConvertScaleToModelCoordinate( false, ( double )pointseries.XValues[ 0 ] );

    modelVector.y = chart.Axis(

    StandardAxis.PrimaryY ).ConvertScaleToModelCoordinate( false, ( double )pointseries.Values[ 0 ] );

    //get the client coordinates form the model coordinates

    Vector clientVector = new Vector();

    if( chart.ConvertModelToClientCoordinate( modelVector, ref clientVector ) )

    {

        Debug.WriteLine( modelVector.x.ToString() + ” “ + modelVector.y.ToString() );

        Debug.WriteLine( clientVector.x.ToString() + ” “ + clientVector.y.ToString() );

    }

    I suggest you read the following topic in our help documentation that explains in details how the different conversions work :

    http://doc.xceedsoft.com/products/XceedChart/Converting_Chart_Coordinates.html

     

    Imported from legacy forums. Posted by André (had 218 views)

    User (Old forums)
    Member
    Post count: 23064

    Perfect!  Thank you for the documentation link as well!

    Imported from legacy forums. Posted by David (had 1880 views)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.