Hi, I want to assign a mouse event to a chart line series, I have been able to do it using "SeriesDefinition.PointMarkItemStyle" and a pointMark template, adding the MouseLeftButtonDown event to it. Is it possible to do the same to the line itself (not just the pointMark)?
Thanks
Thanks
3 Answers, 1 is accepted
0
Hi IƱigo,
and the event handler for the ChartArea MouseUp event:
Series is the base class for all series that are drawn in the RadChart. This assures that the approach is compatible with all series types.
The solution above is demonstrated in a sample application that is attached.
Sincerely yours,
Yavor Ivanov
the Telerik team
You can do this by listening to the MouseUp event of the ChartArea and scanning the OriginalSource of the event. This should be done to insure the user has specifically clicked it instead of something else (a grid line for example). A recursive method can look like this:
private
T GetParent<T>(DependencyObject obj)
where T : DependencyObject
{
if
(obj ==
null
)
{
return
null
;
}
else
if
(obj
is
T)
{
return
(T)obj;
}
DependencyObject parent = VisualTreeHelper.GetParent(obj);
return
GetParent<T>(parent);
}
and the event handler for the ChartArea MouseUp event:
void
ChartArea_MouseLeftButtonUp(
object
sender, MouseButtonEventArgs e)
{
Series clickedItem = GetParent<Series>(e.OriginalSource
as
DependencyObject);
if
(clickedItem !=
null
)
{
SeriesItemLabel_Click(clickedItem, e);
}
}
Series is the base class for all series that are drawn in the RadChart. This assures that the approach is compatible with all series types.
The solution above is demonstrated in a sample application that is attached.
Sincerely yours,
Yavor Ivanov
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Manish Kumar
Top achievements
Rank 1
answered on 06 Dec 2010, 01:47 PM
Hi
I have a similar requirement but I need to trap the value of AxisY on mouse hover or LeftButtonClicked event. Is this possible?
for reference i have attached image document
Thanks,
Manish
I have a similar requirement but I need to trap the value of AxisY on mouse hover or LeftButtonClicked event. Is this possible?
for reference i have attached image document
Thanks,
Manish
0
Hi Manish Kumar,
Yavor Ivanov
the Telerik team
You can find a similar thread here.
Kind regards,Yavor Ivanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight