Step by 1 without decimals

Hello !! :)

Im trying configure SfRangeNavigator to set my range with int values, but I can't make it. I set the Interval property, but... It seems is not the solution.

    <SfRangeNavigator ValueType="Syncfusion.Blazor.Charts.RangeValueType.Double" LabelIntersectAction="RangeLabelIntersectAction.Hide" Height="50" Interval="1">
        <RangeNavigatorEvents Changed="SliderChanged"></RangeNavigatorEvents>
        <RangeNavigatorSeriesCollection>
            <RangeNavigatorSeries DataSource="@DataSource" XName="MinPeriod" YName="MaxPeriod" Type="RangeNavigatorType.Area" Width="2"></RangeNavigatorSeries>
        </RangeNavigatorSeriesCollection>
    </SfRangeNavigator>


@code{
    double[] RangeValue = new double[] { 7f, 10f };
    System.Collections.Generic.List<PeriodData> DataSource = new System.Collections.Generic.List<PeriodData>
    {
        new PeriodData(5f, 1f),
        new PeriodData(6f, 1f),
        new PeriodData(7f, 1f),
        new PeriodData(8f, 1f),
        new PeriodData(9f, 1f),
        new PeriodData(10f, 1f),
        new PeriodData(11f, 1f),
        new PeriodData(12f, 1f),
        new PeriodData(13f, 1f),
        new PeriodData(14f, 1f),
        new PeriodData(15f, 1f)
    };
    public void SliderChanged(IChangedEventArgs args)
    {
        RangeValue[0] = Convert.ToSingle(args.Start);
        RangeValue[1] = Convert.ToSingle(args.End);
    }

    class PeriodData
    {
        PeriodData() { }
        public PeriodData(float minPeriod, float maxPeriod)
        {
            MinPeriod = minPeriod;
            MaxPeriod = maxPeriod;
        }
        public float MinPeriod { get; set; }
        public float MaxPeriod { get; set; }
    }
}

Attachment: BlazorSyncFusion_3eecc8f4.rar

3 Replies

DG Durga Gopalakrishnan Syncfusion Team December 9, 2020 02:33 PM UTC

Hi Carlos,

We suggest you specifyValuefor range navigator in sample. We have modified sample and attached for your reference. 

 <SfRangeNavigator Value="@RangeValue">
 </SfRangeNavigator>





Please revert us if you have any concerns.

Regards,
Durga G



CA Carlos December 10, 2020 08:44 AM UTC

Sorry for explaining myself wrong. Indeed in the example I did not make the binding with the Value property. However, my question is how to make the steps integers (2-4, 3-7, etc ..) avoiding the intermediate decimals.

Is it possible to configure the control to not allow intermediate decimal values, only integers?





DG Durga Gopalakrishnan Syncfusion Team December 11, 2020 03:20 PM UTC

Hi Carlos,

We suggest you convert the floating-point value to integer value in RangeChanged event to display integers. You can also enable AllowSnapping to place slider exactly to nearest interval. We have modified sample and attached for your reference.


Please revert us if you have any questions.

Regards,
Durga G


Loader.
Up arrow icon