3D Stacked Bar Series

11 posts, 2 answers
  1. Châu Thịnh
    Châu Thịnh avatar
    6 posts
    Member since:
    Jun 2018

    Posted 12 Jul 2018 Link to this post

    Hi, we are developing a product which supposed to have 3D Stacked Bar Series. But I haven't found any documents for this type of chart in both of your documents and examples. I'm not sure your products supporting for this Chart.
    Please tell me if you have any suggestions.

    Thanks and best regards.

    Harry

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2240 posts

    Posted 12 Jul 2018 Link to this post

    Hello Harry

    The RadChartView3D suite doesn't provide stacking mechanism for its series visualizations. However, there is a feature request for introducing such feature. You can find it logged in our feedback portal where you can track its status.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  3. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    2240 posts

    Posted 12 Jul 2018 Link to this post

    Hello Harry,

    I've prepared a small example showing a possible approach to achieve stacked bars visualization using the BarSeries3D with MaterialSelector and MeshGeometry3D. I hope this helps.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  4. Châu Thịnh
    Châu Thịnh avatar
    6 posts
    Member since:
    Jun 2018

    Posted 13 Jul 2018 in reply to Martin Ivanov Link to this post

    Hi Martin Ivanov,

    Thank you very much for your support. I used your example and it worked.

  5. Châu Thịnh
    Châu Thịnh avatar
    6 posts
    Member since:
    Jun 2018

    Posted 14 Jul 2018 in reply to Martin Ivanov Link to this post

    Hi Martin Ivanov,

    There is one more problem. Does your library support MouseClickEvent() on column of BarSeries3D? Concretely, we need to show more information by clicking on particular column. (Ex: Opening new ImageWindow).

    Do you have any suggestions?

    Thank for your helps.

     

  6. Answer
    Martin Ivanov
    Admin
    Martin Ivanov avatar
    2240 posts

    Posted 16 Jul 2018 Link to this post

    Hello Châu,

    RadChartView3D doesn't expose an API that allows you to subscribe directly to a mouse click event of the bars (columns) but you can use the WPF native API to get the clicked element. For example:
    this.chart.AddHandler(RadCartesianChart3D.MouseLeftButtonDownEvent, new MouseButtonEventHandler(Chart_MouseLeftButtonDown), true); 
    //-----------------
    private void Chart_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        Viewport3D viewport = ChildrenOfTypeExtensions.FindChildByType<Viewport3D>(this.chart);
        Point position = e.GetPosition(this.chart);
        Visual3D visualHit = HitTest(viewport, position);
         
        if (visualHit != null)
        {
            RadRect3D radLayoutSlot = GetLayoutSlot(visualHit);
     
            foreach (BarSeries3D series in this.chart.Series)
            {
                foreach (XyzDataPoint3D dp in series.DataPoints)
                {
                    if (dp.LayoutSlot.Equals(radLayoutSlot))
                    {
                        var dataItem = (MyPlotInfo)dp.DataItem;
                        return;
                    }
                }
            }
        }
    }
     
    private Visual3D HitTest(Viewport3D viewport, Point position)
    {
        Visual3D visualHit = null;
     
        HitTestResultCallback callback = result =>
        {
            RayMeshGeometry3DHitTestResult rayMeshResult = result as RayMeshGeometry3DHitTestResult;
            visualHit = rayMeshResult.VisualHit;
            return HitTestResultBehavior.Stop;
        };
        VisualTreeHelper.HitTest(viewport, null, callback, new PointHitTestParameters(position));
     
        return visualHit;
    }
    I also attached a small examples showing this approach. I hope it helps.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  7. Châu Thịnh
    Châu Thịnh avatar
    6 posts
    Member since:
    Jun 2018

    Posted 17 Jul 2018 Link to this post

    Hi Martin Ivanov,

    Thanks for your helps. I used your example and it worked for us. 
    Could you help me with one more issue. We need to make the grid line inside the 3D chart. You will be more clear with the picture I attached.
    Is that possible to make it like that?

    Thanks and best regards,
    Harry

  8. Châu Thịnh
    Châu Thịnh avatar
    6 posts
    Member since:
    Jun 2018

    Posted 17 Jul 2018 Link to this post

    I used your example with 3D Stacked Series. You will see that the bars now look curved in the corner compared to 3D Seires (the bar filled with one brush color). If I need to make it more sharpness in the corner. Are there any ways to improve this? I also attached the picture.

    Thank for your help.
  9. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2240 posts

    Posted 18 Jul 2018 Link to this post

    Hello Harry,

    The 3D chart doesn't support grid lines inside of the plot area. You can get a similar effect by adding a new BarSeries3D with custom geometry that shows a wireframe. Here is a blog post on how to create a 3D wireframe in WPF. Maybe you can use this information to create a custom geometry and apply it to the DefaultVisualGeometry of the series.

    About the curved bars, this effect appears because of the custom geometry applied. It is quite simple compared to the default geometry of the series and the light is reflected differently from the surface. In order to alter this and get an effect similar to the one in the default bars you will need to alter the custom MeshGeometry3D. You can read how the geometry works in the MSDN article related to 3D in WPF. For example you can use the Normals or the Positions collections of the mesh object.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
  10. Châu Thịnh
    Châu Thịnh avatar
    6 posts
    Member since:
    Jun 2018

    Posted 19 Jul 2018 in reply to Martin Ivanov Link to this post

    Hi Martin Ivanov, 

    I've get into this trouble. Sometimes the axes of 3D Bar Chart somehow is stuck (the picture I've attached). Do you have any ideas for this problem. 

    Thanks for your helps.

  11. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2240 posts

    Posted 20 Jul 2018 Link to this post

    Hello Harry,

    This is curious. We haven't seen this issue. May I ask you to open a new support ticket from your telerik.com account and send a runnable project showing the issue? This way someone can test it and investigate what happens. Alternatively, you can try reproducing this in the project I've attached few replies back and let me know what was modified in order to reproduce the issue.

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top