Bar chart bars are very thin for some datasets!

6 posts, 1 answers
  1. Brian
    Brian avatar
    9 posts
    Member since:
    Aug 2014

    Posted 14 Sep Link to this post

    Hi,

    Sometimes the bars are extremely thin for some sparse datasets.  When I display a bar chart with a DateTimeContinuousAxis horizontal axis, spanning just a few hours with only 2 or 3 items, the bars are extremely thin.  If I change the timespan to a day, also with just a few items, the bars look normal (see attached screenshots).  I'm using UI for WPF Q2 2016, Is this s bug?

    Thanks,

    Brian

  2. Dinko
    Admin
    Dinko avatar
    418 posts

    Posted 19 Sep Link to this post

    Hi Brian,

    Thank you for inquiring about our RadChartView control.

    Using only the provided information I am not sure what exactly is the reason behind this. In your post, you mentioned that you change the timespan to a day and also few other items. Can you elaborate more on which ones? Have you changed the PlotMode property of the DateTimeContinuousAxis? Have you specified custom Style/DataTemplate to the BarSeries?

    It will be great if you can send me an isolated project from your application reproducing this type of behavior. This way I can directly investigate it on my side.

    I am looking forward to your reply.

    Regards,
    Dinko
    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. Brian
    Brian avatar
    9 posts
    Member since:
    Aug 2014

    Posted 19 Sep Link to this post

    Hi Dinko,

    You can download a simple project showing the issue from the link below (can't attach a zip file to this message).

    https://qisoft1-my.sharepoint.com/personal/brian_qisoft_com/_layouts/15/guestaccess.aspx?docid=1fa10317323aa4516924a5840a251669d&authkey=AUESDzcGFhILHOzb6M7j5sA&expiration=2017-10-18T23%3a00%3a00.000Z

    The sample shows the chart and a toggle button to switch between thin and thick bars - all the button does is change the minimum and maximum dates for the date axis from a 1.5 hour range to a 13 hour range, so I assume this is the cause of the issue, but I don't see why the bars should get thinner when the date range gets smaller.  Any help much appreciated.

    Thanks,

    Brian

  4. Martin Vatev
    Admin
    Martin Vatev avatar
    129 posts

    Posted 22 Sep Link to this post

    Hello Brian,

    Thank you for the provided sample. We are researching the case but we need a little more time for this. We will get back to you as soon as possible. Hopefully, this will be on Monday.

    Regards,
    Martin Vatev
    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.
  5. Answer
    Dinko
    Admin
    Dinko avatar
    418 posts

    Posted 25 Sep Link to this post

    Hi Brian,

    Thanks for your patience.

    This is expected behavior. Let me try to explain. Basically, DateTimeContinuous axis calculates the bars' length based on the date time range and the major step, which can be calculated automatically or specified manually. By default, if the major step is not specified, the axis will try to come up with a step and unit that will allow your axis to show a reasonable amount of ticks (and labels). If the range and the step are such that there are many units between the start and end dates, the bars' length will be smaller. On the other hand, if there are not many units, the bar's length will be larger.

    So in your case when the range of the axis is 1.5 hour the chart internally calculate the MajorStepUnit (Minute) and the MajorStep ( 1 ) which will lead to small length for the data items (bars) - the length of each bar will be 1 minute mapped to pixels.

    If you know that the granularity for your data is an hour, you can adjust the length of the bars by specifying MajorStep and MajorStepUnit depending on the incoming data.

    Regards,
    Dinko
    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.
  6. Brian
    Brian avatar
    9 posts
    Member since:
    Aug 2014

    Posted 26 Sep in reply to Dinko Link to this post

    Hi Dinko,

    Thanks for the explanation, I'll play with these values and see if I can get a reasonable compromise for our data.

    Brian

Back to Top