For example a user clicks on a certain piece of a pie chart or a specific bar on a barchart. Another possible feature would be to detect the X position in a line chart while the mouse hovers over it so you could display the Y value.
John Schneider
9 Answers, 1 is accepted
You should be able to do this using the RadChart Click event which will give you reference to the Series and Series items being clicked. About the second question - RadChart does not currently support a hover event.
We apologize for the inconvenience.
Sincerely yours,
Vladimir Milev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Can you show me some quick sample code.
Many Thanks,
John Schneider
Please, try something like this.
namespace WindowsApplication1 |
{ |
public partial class Form1 : Form |
{ |
public Form1() |
{ |
InitializeComponent(); |
foreach(ChartSeries series in radChart1.Series){ |
foreach(ChartSeriesItem item in series.Items){ |
item.ActiveRegion.Click+=new RegionClick(ActiveRegion_Click); |
} |
} |
} |
void ActiveRegion_Click(object sender) |
{ |
ChartSeriesItem item = (ChartSeriesItem) sender; |
MessageBox.Show(item.Parent.Name); |
} |
} |
} |
Hope this helps!
Greetings,
Vladimir Milev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I click on the bars in a bar chart and the event handler never gets called.
In addition to this I want to be able to click on the plotarea of a line chart (not necessarily right on the line) to retrieve that actual or closest Y data point value.
Another feature I wish to implement is draging a box in a line chart to zoom into it.
Can these features be implemented using the existing API?
Sorry to throw 3 things at you in one post, but I need to deliver a demo soon.
We have prepared a small sample application demonstrating how to use click detection. I hope that it helps. Please, note that clicking Line series is not supported.
We are intrigued by the your suggestions about the line chart click and zooming features. Those have popped up in the past and have been discussed, but unfortunately there are no concrete plans for their implementation. This does not mean we will not include them at some point in RadChart, rather that they will not be present in the immediate release and will remain on the watch list of potential features.
I hope I have been helpful. Your points have been updated.
Kind regards,
Vladimir Milev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
RegionClickEventHandler is not defined. Am I missing an assembly reference? By default the IDE adds a RegionClick when adding a delegate to Click. I don't even see a referece to RegionClickEventHandler in your documentation.
Also regarding the line clicking. What I need is not at all uncommon funtionality. I have used multiple charts for both Stock Market and device measurement applications. And almost all of them allow for a feature in which the user clicks somewhere on the chart (Usually line charts with lots of data) and the application will determine What the X-Axis point is and then display 1 or more corressponding Y values for that X point.
Go to bigcharts.com and run their interactive Java chart and click on the plot area. You will see what some people call a data cursor that when moved populates the current value under the cursor in a text box.
Or go to: http://www.smartmoney.com/eqsnaps/index.cfm?story=charting&symbol=IBM
This type of interactivity is critical for data analysis.
Please open a support ticket for this issue and we will try to help you with this issue.
Regards,
Evtim
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
have you reached some solution about this problem?
I'm loking for exactly the same thing.
Thank you,
is possible to post the small sample for demonstrating cick even ?
thlt