This is a migrated thread and some comments may be shown as answers.

how to find Line Chart Data items Active Region

1 Answer 32 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
kiran
Top achievements
Rank 1
kiran asked on 26 Jun 2008, 01:49 PM
Hi Telerik Team,

I am unable to find line chart data items active region points.(X,Y) values.
i used the following code to find the active region.

ChartSeriesItemsCollection

items = radChart1.Series[1].Items;
for (int i = 0; i < items.Count; i++)
{
    MessageBox.Show(items[i].ActiveRegion.Region.GetLastPoint().X.ToString());
    MessageBox.Show(items[i].ActiveRegion.Region.GetLastPoint().Y.ToString());
}

Please help me out. i need these points X and Y values. Please share some sample application to get the active region points.

Any help is highly appreciated.

Regards,
Kiran

1 Answer, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 30 Jun 2008, 06:46 AM
Hi kiran,

The items' ActiveRegion usually occupies a wider area than a single point. The easiest way to obtain a point is to retrieve the bounds of the region (which is a rectangular area) and get the center point:
private List<Point> RetrieveSeriesPoints(ChartSeries series) 
    if (series == null
        return null
 
    List<Point> itemPoints = new List<Point>(); 
    foreach (ChartSeriesItem item in series.Items) 
    { 
        RectangleF regionBounds = item.ActiveRegion.Region.GetBounds(); 
        Point position = new Point((int)(regionBounds.Left + regionBounds.Width / 2), (int)(regionBounds.Top + regionBounds.Height / 2)); 
        itemPoints.Add(position); 
    } 
 
    return itemPoints; 

All the best,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Chart (obsolete as of Q1 2013)
Asked by
kiran
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Share this question
or