Adjusting the width of BarSeries

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    1 posts
    Member since:
    Jan 2014

    Posted 18 Sep 2015 Link to this post

    I have been creating a Dashboard so show traffic at each minute.

    On our largest time scale (4 hours) the BarSeries will overlap each other (There being a max of 240 points).

    I haven't found anything in the Xamarin.Forms or Xamarin.Android documentation indicating this can be changed.

     

    I am guessing that I am going to have to make a custom Chart Renderer, but I haven't explored that route yet as I am still learning the lay of the land to mobile developing.

     

    Will a  custom Chart Renderer work? Is it my only option? Or is there already support for this feature?

  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 23 Sep 2015 Link to this post

    Hi Jonathan,

    DateTimeContinuousAxis exposes APIs (MajorStep and MajorStepUnit properties), which should allow you to achieve the desired result, but I am afraid due to a bug, they will not be functional at the moment. The workaround would be to implement a custom renderer. In this case, it would be a simple one:


    public class MyChartRenderer : CartesianChartRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Telerik.XamarinForms.Chart.RadCartesianChart> e)
        {
            base.OnElementChanged(e);
            DateTimeContinuousAxis axis = this.Control.HorizontalAxis as DateTimeContinuousAxis;
            axis.MajorStep = 1;
            axis.MajorStepUnit = TimeInterval.Minute;
     
        }
    }

    You will also need to register it, using the ExportRenderer attribute:
    [assembly: ExportRenderer(typeof(Telerik.XamarinForms.Chart.RadCartesianChart), typeof(MyChartRenderer))]


    Best regards,
    Ves
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
Back to Top