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

Can I implement a doubleclick drilldown?

3 Answers 145 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 21 Feb 2012, 09:15 PM
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

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 24 Feb 2012, 02:33 PM
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 >>
0
Ani Maks
Top achievements
Rank 1
answered on 18 Dec 2016, 10:29 AM

Dear admin, 

What about the selection by double click?

Is it possible?

Thanks, Ani

0
Martin Ivanov
Telerik team
answered on 21 Dec 2016, 10:05 AM
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.
Tags
ChartView
Asked by
Jack
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Ani Maks
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or