Can I implement a doubleclick drilldown?

4 posts, 0 answers
  1. Jack
    Jack avatar
    45 posts
    Member since:
    Feb 2009

    Posted 21 Feb 2012 Link to this post

    I have a bar chart that displays the count of various grouping of my data.  I would like the users to be able to select/double-click on one of the bars and open up another view with the list of data in that grouping.  Is there any way to currently do that?

    Thanks

    jack
  2. Yavor
    Admin
    Yavor avatar
    401 posts

    Posted 24 Feb 2012 Link to this post

    Hello Jack,

    RadChartView supports add-on behaviors, one of which is the selection behavior. You can add it in xaml or in code behind easily like this:

    <telerik:RadCartesianChart>
        <telerik:RadCartesianChart.Behaviors>
            <telerik:ChartSelectionBehavior SelectionChanged="ChartSelectionBehavior_SelectionChanged" />
        </telerik:RadCartesianChart.Behaviors>
        <telerik:RadCartesianChart.VerticalAxis>
            <telerik:LinearAxis />
        </telerik:RadCartesianChart.VerticalAxis>
        <telerik:RadCartesianChart.HorizontalAxis>
            <telerik:CategoricalAxis />
        </telerik:RadCartesianChart.HorizontalAxis>
        <telerik:BarSeries>
            <telerik:CategoricalDataPoint Value="0.5" />
            <telerik:CategoricalDataPoint Value="1.0" />
            <telerik:CategoricalDataPoint Value="0.7" />
        </telerik:BarSeries>
    </telerik:RadCartesianChart>

    You can apply your custom logic in the SelectionChanged event handler.

    Let me know if this works for you! Greetings,
    Yavor
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. Ani Maks
    Ani Maks avatar
    1 posts
    Member since:
    Mar 2014

    Posted 18 Dec 2016 Link to this post

    Dear admin, 

    What about the selection by double click?

    Is it possible?

    Thanks, Ani

  4. Martin
    Admin
    Martin avatar
    1161 posts

    Posted 21 Dec 2016 Link to this post

    Hello Ani,

    The chartview's selection behavior doesn't support double click selection. In order to achieve this you can subscribe for the MouseLeftButtonDown event of the chart and if the ClickCount == 2, get the DataPoint under the mouse and set its IsSelected property. For example:
    private void RadCartesianChart_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        if (e.ClickCount == 2)
        {
            var mousePosition = e.GetPosition(this.chart);
            foreach (ScatterPointSeries series in this.chart.Series)
            {
                foreach (var dp in series.DataPoints)
                {
                    if (dp.LayoutSlot.Contains(mousePosition.X, mousePosition.Y))
                    {
                        dp.IsSelected ^= true;
                    }
                }
            }
        }
    }

    Regards,
    Martin
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top