Detect clicking on a chart data item

10 posts, 0 answers
  1. johns
    johns avatar
    20 posts
    Member since:
    Jul 2007

    Posted 13 Jul 2007 Link to this post

    How do you detect what data item a user clicks on with the mouse.
    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
  2. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 16 Jul 2007 Link to this post

    Hello johns,

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. johns
    johns avatar
    20 posts
    Member since:
    Jul 2007

    Posted 19 Jul 2007 Link to this post

    I can't quite see how to do this.  The RadChart ClickEvent returns a MouseEventArgs object.  Is there another event I should use.

    Can you show me some quick sample code.

    Many Thanks,

    John Schneider
  5. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 23 Jul 2007 Link to this post

    Hello johns,

    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
  6. johns
    johns avatar
    20 posts
    Member since:
    Jul 2007

    Posted 26 Jul 2007 Link to this post

    I copied this code into a very simple test program, and it did not work.
    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.
  7. Vladimir Milev
    Admin
    Vladimir Milev avatar
    1061 posts

    Posted 30 Jul 2007 Link to this post

    Hi johns,

    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
  8. johns
    johns avatar
    20 posts
    Member since:
    Jul 2007

    Posted 02 Aug 2007 Link to this post

    Well,  I cannot get your sample to comple. 

    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.

  9. Dwight
    Admin
    Dwight avatar
    475 posts

    Posted 03 Aug 2007 Link to this post

    Hi johns,

    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
  10. Leonardo
    Leonardo avatar
    4 posts
    Member since:
    Nov 2010

    Posted 08 Nov 2010 Link to this post

    Hello guys,

    have you reached some solution about this problem?
    I'm loking for exactly the same thing. 

    Thank you, 
  11. Ales
    Ales avatar
    5 posts
    Member since:
    Dec 2011

    Posted 17 Dec 2011 Link to this post

    Hi,
    is possible to post the small sample for demonstrating cick even ?

    thlt
Back to Top
UI for WinForms is Visual Studio 2017 Ready