Drilldown?

10 posts, 0 answers
  1. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 30 Mar Link to this post

    I am trying to figure out how to use the drilldown feature. 

     

    I looked at the drilldown "help" http://docs.telerik.com/devtools/winforms/chartview/features/drill-down but not sure how to get it to apply to my situation because I don't really have separate "views" or binding. I really just need to be able to get an event to tell me that I've double clicked on a data point.

     

    I have created a multi-level donut chart (attached), and I want to be able to double click on any segment and recreate the chart centered on that segment.

     

    I did try adding a view and a DrillDownController hoping that it would fire the "drill" event but it did not.

     

    As an aside, I believe that the description in the "help" for the "InnerRadiusFactor" of the donut series is either incorrect or at least misleading. It says that "its value is used as a percentage of the whole radius", but it appears to work as a percentage of the RadiusFactor amount. If it were the whole radius, I could set it to 0.2 and I should get consistently sized series bands that are 20% of the available space, but what it actually gives me are bands that are 20% of the radius of the series defined by RadiusFactor. I had to scale at (1 / (RadiusFactor * 5) to get a consistently 20% sized bands.

  2. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 30 Mar Link to this post

    Hi Steve,

    Thank you for writing.

    If you need to determine which part is selected you can use the Selection functionality: ChartView Selection.

    I have checked our Feedback Portal and we have an issue with the drill down functionality. The items details are located here: UI for Winforms Feedback Portal - FIX. RadChartView - pie series do not implement the ILegendInfoProvider interface.

    Could you please check if the suggested workaround works for your case? If not I would suggest you open a support thread and attach you project there. This will allow us to properly investigate this case.

    You are correct about the InnerRadiusFactor property and it behaves exactly as you have described. We will update the property description.

    I hope this will be useful.  

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 30 Mar in reply to Dimitar Link to this post

    The workaround does seem to work for my case and I am now able to get the drill event, but with the swapping around of the views, I think that the chart view selection will be a better approach.

     

    HOWEVER, for both the drill (with the workaround), and the selection, I only get the events for clicks on my first donut ring. Clicks on any other donut series seem to get lost. Also, tooltips only work on that first series.

  5. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 30 Mar in reply to Steve Link to this post

    Is there any event I can get to tell me when I have clicked on an area of the chart that is not one of the pie/donut data points? There does not appear to be a selection changed to nothing state.

     

    Also I think the object browser help text is wrong for RadChartView.DrillNavigationMode:

    Public Property DrillNavigationMode As Telerik.WinControls.UI.DrillNavigationMode
         Member of Telerik.WinControls.UI.RadChartView
    Summary:
    Show or hide Smart labels controller in RadChartView.

  6. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 04 Apr Link to this post

    Hi Steve,

    Thank you for writing back.

    I have checked this and it appears that there is an issue with the pie renderer. The issue is caused because the HitTest method only searches for the selected point in the first added series. I have logged this issue in our Feedback Portal. You can track the item for status changes and add your vote for it here.

    To workaround this you can create a custom PieRenderer and override the HitTest method (this will fix the tooltips as well):
    class MyPieRenderer : PieRenderer
    {
        public MyPieRenderer(PieArea area) : base(area)
        {
        }
     
        public override DataPoint HitTest(int x, int y)
        {
            
            if (this.DrawParts.Count > 0)
            {
                foreach (var item in this.DrawParts)
                {
                    if (item is PieSeriesDrawPart)
                    {
                        Dictionary<PieDataPoint, GraphicsPath> paths = ((PieSeriesDrawPart)item).PointPaths;
     
                        foreach (PieDataPoint point in paths.Keys)
                        {
                            GraphicsPath path = new GraphicsPath();
                            paths.TryGetValue(point, out path);
     
                            if (path != null)
                            {
                                if (path.IsVisible(x, y))
                                {
                                    return point;
                                }
                            }
                        }
                    }
                }
            }
            return null;
        }

    The following snippet shows how you can change the defaut renderer:
    private void RadChartView1_CreateRenderer(object sender, ChartViewCreateRendererEventArgs e)
    {
        e.Renderer = new MyPieRenderer((PieArea)e.Area);
    }

    Your Telerik Points have been updated for this report.

    In addition, you can use the HitTest method in the MouseDown event handler of the chart to determine where the user is clicking. The method will return null if no point is clicked:
    MyPieRenderer renderer;
    private void RadChartView1_CreateRenderer(object sender, ChartViewCreateRendererEventArgs e)
    {
        renderer = new MyPieRenderer((PieArea)e.Area);
        e.Renderer = renderer;
    }
    private void RadChartView1_MouseDown(object sender, MouseEventArgs e)
    {
        if (renderer.HitTest(e.Location.X,e.Location.Y) == null)
        {
            //No point is selected
        }
    }

    Indeed, the description for the DrillNavigationMode is wrong, we will change it as soon as possible.

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  7. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 04 Apr in reply to Dimitar Link to this post

    Thanks, providing my own hit test does solve the problem. Of course due to the quantity of my data (I have about 1000 series in that chart), the lag performing the hit test in this manner is pretty substantial. I found as an alternative I can get the angle from the point of the cursor to the origin and search only the data points containing that angle within their range according to the hierarchy of the wedges along the concentric rings.

     

    A few questions though. Is there an easy way to get the series containing the data point? I am currently storing it in a "wedge" class that derives from the pie data point, but if I can access one that already exists, that would be easier.

    Is there an easy way to get the center point of the pie or should I just get the layout slot of the area from the renderer and use its center? Is the viewport with the pie always going to be full plot area?

    The description for the pie series says that the pie pieces are rendered counter clockwise but that doesn't seem to be the case.

  8. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 05 Apr in reply to Steve Link to this post

    Also I noticed the PieDataPoint has its own read only start angle and sweep angle. What are these used for and is there any way to use them? I am storing this information as well in my derived wedge but I'd rather use properties that are already there.
  9. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 05 Apr Link to this post

    Hello Steve,

    Thank you for writing back.

    You can get the series by using the Presenter property:
    var series = point.Presenter as DonutSeries;

    You can get the center lie this: 
    var centerPoint = radChartView1.View.Viewport.Center;

    The pie will always take the entire available space, please note that it is always a square and the view has a default margin. The default margin can be changed as follows:
    radChartView1.View.Margin = new Padding(0);

    The StartAngle property indicates where the data point starts (imagine you have a standard coordinate system), and the SweepAngle indicates how large the point element is. 

    I hope this information is useful.

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  10. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 05 Apr in reply to Dimitar Link to this post

    Sorry I meant that the PieDataPoint class has a StartAngle and SweepAngle but they don't seem to get populated.

     

    Also the help for pie says "Note that pie slices are always rendered in counter-clockwise direction", but the example shows Germany, United States, France, and United Kingdom being displayed in a clockwise direction.

  11. Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 06 Apr Link to this post

    Hello Steve,

    Thank you for writing back.

    These properties are updated when the chart is made visible and all layout operations are completed. You can test this by putting a break point in the custom renderer where the point is returned (see attached image).

    In addition, you are right about the direction. I have changed this in our documentation and it will be made live soon. 

    Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready