Search results

Getting Started

This section briefly explains about how to include a RangeNavigator in your Blazor client-side application. You can refer Getting Started with Syncfusion Blazor for Client-Side in Visual Studio 2019 Preview page for the introduction and configuring the common specifications.

Importing Syncfusion Blazor component in the application

  1. Install Syncfusion.EJ2.Blazor NuGet package to the application by using the NuGet Package Manager. Please ensure to check the Include prerelease option.
  2. You can add the client-side resources through CDN in the <head> element of the ~/wwwroot/index.html page.
<head>
    <script src="https://cdn.syncfusion.com/ej2/17.2.34/dist/ej2.min.js"></script>
</head>

Adding component package to the application

Open **~/_Imports.razor file and import the Syncfusion.EJ2.Blazor.**

@using Syncfusion.EJ2.Blazor
@using Syncfusion.EJ2.Blazor.Charts

Adding RangeNavigator component to the application

Now, add the Syncfusion Blazor components in any web page (razor) in the Pages folder. For example, the Range navigator component is added in the ~/Pages/Index.razor page.

<EjsRangeNavigator></EjsRangeNavigator>

Populate Range Navigator with Data

To bind data for the Range Navigator component, you can assign a IEnumerable object to the DataSource property. The list can also be provided as an instance of the DataManager.

public class StockPrice
{
    public DateTime Date;
    public double Close;
}
public List<Data> StockDetails = new List<Data>
        {
            new StockPrice { Date = new DateTime(2005, 01, 01), Close = 21 },
            new StockPrice { Date = new DateTime(2006, 01, 01), Close = 24 },
            new StockPrice { Date = new DateTime(2007, 01, 01), Close = 36 },
            new StockPrice { Date = new DateTime(2008, 01, 01), Close = 38 },
            new StockPrice { Date = new DateTime(2009, 01, 01), Close = 54 },
            new StockPrice { Date = new DateTime(2010, 01, 01), Close = 57 },
            new StockPrice { Date = new DateTime(2011, 01, 01), Close = 62 }
        };

Now map the field names Date and Close in the data to the XName and YName properties of the range navigator series, then set the StockDetails to DataSource property.

<EjsRangeNavigator Value="@Value" ValueType="Syncfusion.EJ2.Blazor.Charts.RangeValueType.DateTime" IntervalType="RangeIntervalType.Years" LabelFormat="yyyy">
    <RangeNavigatorSeriesCollection>
        <RangeNavigatorSeries DataSource="@StockDetails" XName="Date" Type="RangeNavigatorType.Area" YName="Close"></RangeNavigatorSeries>
    </RangeNavigatorSeriesCollection>
</EjsRangeNavigator>

Run the application

After successful compilation of your application, the Syncfusion Blazor Range Navigator component will render in the web browser.

range navigator

See also