User (Old forums)MemberOctober 6, 2008 at 3:43 pmPost count: 23064
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;
double y = (double)pointseries .Values;
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)MemberOctober 7, 2008 at 12:42 pmPost 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.
//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 :
Imported from legacy forums. Posted by André (had 218 views)
- You must be logged in to reply to this topic.