Implementing Range Selectors
NuGet: Syncfusion.Blazor.Charts + Syncfusion.Blazor.Themes (or Syncfusion.Blazor.RangeNavigator for individual package)
Namespace: Syncfusion.Blazor.Charts
A comprehensive skill for implementing Syncfusion Blazor Range Selector (RangeNavigator) components for data range selection and chart navigation. The Range Selector enables users to select a specific range from a large data collection using draggable thumbs, providing an intuitive way to filter and navigate through time-series or numeric data.
When to Use This Skill
Use this skill immediately when you need to:
- Enable range selection in charts with draggable thumbs
- Filter large time-series datasets by date range
- Navigate through financial data or stock prices
- Create chart zoom/pan controls with visual feedback
- Implement dashboard filtering based on data ranges
- Add period selector buttons (1M, 3M, 6M, YTD, 1Y, All) for quick navigation
- Display data trends with area, line, or stepline series
- Build interactive data exploration interfaces
- Filter data for drill-down analysis
- Create responsive range selection controls for Blazor Server, WebAssembly, or Web App
- Enable synchronized filtering across multiple charts
- Implement lightweight chart navigation for performance-critical scenarios
- Provide visual context for selected data ranges
Component Overview
The Syncfusion Blazor Range Selector (SfRangeNavigator) is a specialized control designed for data range selection and navigation. It combines:
- Draggable Thumbs: Left and right handles for selecting range boundaries
- Visual Series: Line, Area, or StepLine visualization of data trends
- Period Selector: Quick preset buttons via
RangeNavigatorPeriodSelectorSettings, RangeNavigatorPeriods, and RangeNavigatorPeriod
- Value Types: Support for DateTime, Numeric, and Logarithmic data
- Interactive Selection: Click labels or drag thumbs to update range
- Data Binding: Local and remote data source integration
- Customization: Extensive styling, theming, and formatting options using
RangeNavigatorBorder, RangeNavigatorMargin, RangeNavigatorStyleSettings, RangeNavigatorThumbSettings, and tooltip settings
Key Capabilities:
- Range Selection Methods: Drag thumbs, tap labels, or set programmatically
- Series Types: Line (default), Area, StepLine
- Value Binding: One-way and two-way binding support
- Integration: Works with period selectors and other charts
- Export: PNG, JPEG, SVG, PDF export functionality
- Accessibility: WCAG compliant with keyboard navigation
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
Start here for installation, setup, and your first range selector. Covers:
- Installing Syncfusion.Blazor.RangeNavigator NuGet package
- Blazor Server, WebAssembly, and Web App setup
- Service registration and theme configuration
- Basic SfRangeNavigator implementation with sample data
- Project structure and script references
- Troubleshooting common setup issues
Core Configuration
Range Selection and Values
📄 Read: references/range-configuration.md
Configure range selection behavior and value binding:
- Value property for start and end values
- One-way and two-way binding patterns
- Value types (DateTime, Numeric, Logarithmic)
- Thumb dragging for range selection
- Label tapping for quick selection
- Programmatic range updates and validation
Series Types
📄 Read: references/series-types.md
Choose and customize series visualization:
- Line series for trend lines
- Area series for filled regions
- StepLine series for discrete data
- Series customization (colors, width, fill)
- Multiple series support
Data and Integration
Data Binding
📄 Read: references/data-binding.md
Configure data sources for the range selector:
- Local data sources (List, Array, ExpandoObject)
- Remote data binding with SfDataManager
- DateTime data handling and formatting
- Numeric and logarithmic scale data
- Data refresh and dynamic updates
Period Selector Integration
📄 Read: references/period-selector-integration.md
Add period selector buttons for quick navigation:
- Predefined period buttons (1M, 3M, 6M, YTD, 1Y, All)
- Custom period configuration
- Integration with range changes
- Event handling for period selection
- Styling and positioning
Customization and Styling
Axis Customization
📄 Read: references/axis-customization.md
Customize axis, grid, and labels:
- Grid line configuration (major and minor)
- Tick customization (size, color, position)
- Label formatting and rotation
- Interval types (Years, Months, Days, Hours, Minutes)
- Logarithmic axis support
- RTL (Right-to-Left) support
Visual Customization
📄 Read: references/visual-customization.md
Control appearance, themes, and layout:
- Chart dimensions (Width, Height, Margin)
- Theme selection (Material, Bootstrap, Fluent, Tailwind, Fabric, Highcontrast)
- Tooltip configuration and templates
- Lightweight rendering mode for performance
- Custom styling and color schemes
- Responsive design patterns
Advanced Features
Export, Events, and Accessibility
📄 Read: references/export-events-accessibility.md
Handle exports, events, and ensure accessibility:
- Export: PNG, JPEG, SVG, PDF export functionality
- Events: Changed, Loaded, TooltipRender event handling
- Accessibility: WCAG compliance, keyboard navigation, screen readers, high contrast themes
- ARIA attributes and testing checklist
Quick Start Example
Here's a minimal range selector for time-series data filtering with event handling:
@using Syncfusion.Blazor.Charts
@{
DateTime[] range = SelectedRange as DateTime[] ?? new DateTime[] { DateTime.Now, DateTime.Now };
}
<h3>Stock Price Range Selector</h3>
<p>Selected Range: @range[0].ToShortDateString() to @range[1].ToShortDateString()</p>
<SfRangeNavigator @bind-Value="@SelectedRange"
ValueType="RangeValueType.DateTime"
LabelFormat="MMM-yy"
IntervalType="RangeIntervalType.Months">
<RangeNavigatorEvents Changed="OnRangeChanged"></RangeNavigatorEvents>
<RangeNavigatorRangeTooltipSettings Enable="true"></RangeNavigatorRangeTooltipSettings>
<RangeNavigatorSeriesCollection>
<RangeNavigatorSeries DataSource="@StockData"
XName="Date"
YName="Close"
Type="RangeNavigatorType.Area"
Fill="#3F51B5">
</RangeNavigatorSeries>
</RangeNavigatorSeriesCollection>
</SfRangeNavigator>
@code {
public class StockInfo
{
public DateTime Date { get; set; }
public double Close { get; set; }
}
public object SelectedRange = new DateTime[]
{
new DateTime(2020, 01, 01),
new DateTime(2021, 01, 01)
};
public List<StockInfo> StockData = new List<StockInfo>
{
new StockInfo { Date = new DateTime(2018, 01, 01), Close = 35 },
new StockInfo { Date = new DateTime(2019, 01, 01), Close = 42 },
new StockInfo { Date = new DateTime(2020, 01, 01), Close = 48 },
new StockInfo { Date = new DateTime(2021, 01, 01), Close = 56 },
new StockInfo { Date = new DateTime(2022, 01, 01), Close = 62 }
};
private void OnRangeChanged(ChangedEventArgs args)
{
// Handle range change event
Console.WriteLine($"Range changed: {args.Start} to {args.End}");
}
}
What this creates:
- Area chart showing stock price trend with blue fill (#3F51B5)
- Draggable thumbs for range selection
- Initially selected range: Jan 2020 to Jan 2021
- Month labels with "MMM-yy" format
- Tooltip showing values on hover
- Event handler responding to range changes
- Two-way binding with @bind-Value directive
Common Use Cases
1. Stock Price Filtering with Period Selector
Filter stock data with quick period buttons:
@using Syncfusion.Blazor.Charts
<SfRangeNavigator @bind-Value="@SelectedRange"
ValueType="RangeValueType.DateTime"
IntervalType="RangeIntervalType.Months"
LabelFormat="MMM yy">
<RangeNavigatorRangeTooltipSettings Enable="true" DisplayMode="TooltipDisplayMode.Always">
</RangeNavigatorRangeTooltipSettings>
<RangeNavigatorPeriodSelectorSettings>
<RangeNavigatorPeriods>
<RangeNavigatorPeriod Text="1M" Interval="1" IntervalType="RangeIntervalType.Months"></RangeNavigatorPeriod>
<RangeNavigatorPeriod Text="3M" Interval="3" IntervalType="RangeIntervalType.Months"></RangeNavigatorPeriod>
<RangeNavigatorPeriod Text="6M" Interval="6" IntervalType="RangeIntervalType.Months"></RangeNavigatorPeriod>
<RangeNavigatorPeriod Text="YTD"></RangeNavigatorPeriod>
<RangeNavigatorPeriod Text="1Y" Interval="1" IntervalType="RangeIntervalType.Years"></RangeNavigatorPeriod>
<RangeNavigatorPeriod Text="All"></RangeNavigatorPeriod>
</RangeNavigatorPeriods>
</RangeNavigatorPeriodSelectorSettings>
<RangeNavigatorSeriesCollection>
<RangeNavigatorSeries DataSource="@StockData" XName="Date" YName="Close" Type="RangeNavigatorType.Area">
</RangeNavigatorSeries>
</RangeNavigatorSeriesCollection>
</SfRangeNavigator>
@{
DateTime[] range = SelectedRange as DateTime[] ?? new DateTime[] { DateTime.Now, DateTime.Now };
}
<p>Selected Range: @range[0].ToShortDateString() to @range[1].ToShortDateString()</p>
@code {
public object SelectedRange = new DateTime[]
{
new DateTime(2022, 01, 01),
new DateTime(2023, 01, 01)
};
public List<StockInfo> StockData = GetStockData();
private static List<StockInfo> GetStockData()
{
// Sample data generation
var data = new List<StockInfo>();
var startDate = new DateTime(2020, 01, 01);
var random = new Random();
for (int i = 0; i < 100; i++)
{
data.Add(new StockInfo
{
Date = startDate.AddDays(i * 10),
Close = 100 + random.Next(-20, 20)
});
}
return data;
}
public class StockInfo
{
public DateTime Date { get; set; }
public double Close { get; set; }
}
}
2. Dashboard with Range-Based Filtering
Synchronize chart data with range selector:
@using Syncfusion.Blazor.Charts
<div class="dashboard-container">
<h3>Sales Dashboard</h3>
<SfRangeNavigator Value="@SelectedRange"
ValueType="RangeValueType.DateTime"
Height="140px">
<RangeNavigatorEvents Changed="OnRangeChanged" />
<RangeNavigatorSeriesCollection>
<RangeNavigatorSeries DataSource="@SalesDetails"
XName="Date"
YName="Revenue"
Type="RangeNavigatorType.Area" />
</RangeNavigatorSeriesCollection>
</SfRangeNavigator>
<SfChart Height="300px">
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime"
Minimum="@SelectedRange[0]"
Maximum="@SelectedRange[1]" />
<ChartSeriesCollection>
<ChartSeries DataSource="@FilteredData"
XName="Date"
YName="Revenue"
Type="ChartSeriesType.Column" />
</ChartSeriesCollection>
</SfChart>
</div>
@code {
public DateTime[] SelectedRange =
{
new DateTime(2023, 01, 01),
new DateTime(2023, 06, 30)
};
public List<SalesData> SalesDetails = new();
public List<SalesData> FilteredData = new();
protected override void OnInitialized()
{
SalesDetails = GetSalesData();
ApplyFilter();
}
private void OnRangeChanged(ChangedEventArgs args)
{
if (args.Start is DateTime start && args.End is DateTime end)
{
SelectedRange = new[] { start, end };
ApplyFilter();
}
}
private void ApplyFilter()
{
FilteredData = SalesDetails
.Where(d => d.Date >= SelectedRange[0] && d.Date <= SelectedRange[1])
.ToList();
}
private List<SalesData> GetSalesData()
{
var data = new List<SalesData>();
var random = new Random();
var start = new DateTime(2023, 01, 01);
decimal revenue = 15000;
for (int i = 0; i < 180; i++)
{
revenue += random.Next(-1500, 2000);
data.Add(new SalesData
{
Date = start.AddDays(i),
Revenue = Math.Max(revenue, 5000)
});
}
return data;
}
public class SalesData
{
public DateTime Date { get; set; }
public decimal Revenue { get; set; }
}
}
3. Lightweight Mode for Performance
Optimize for large datasets:
@using Syncfusion.Blazor.Charts
<SfRangeNavigator Value="@SelectedRange"
ValueType="RangeValueType.DateTime"
EnableGrouping="true"
GroupBy="RangeIntervalType.Months"
AllowSnapping="true">
<RangeNavigatorRangeTooltipSettings Enable="true"></RangeNavigatorRangeTooltipSettings>
<RangeNavigatorSeriesCollection>
<RangeNavigatorSeries DataSource="@LargeDataset"
XName="Timestamp"
YName="Value"
Type="RangeNavigatorType.Line">
</RangeNavigatorSeries>
</RangeNavigatorSeriesCollection>
</SfRangeNavigator>
@code {
public DateTime[] SelectedRange;
public List<DataPoint> LargeDataset = GenerateLargeDataset(10000);
public class DataPoint
{
public DateTime Timestamp { get; set; }
public double Value { get; set; }
}
private static List<DataPoint> GenerateLargeDataset(int count)
{
// Generate large dataset efficiently
return Enumerable.Range(0, count)
.Select(i => new DataPoint
{
Timestamp = DateTime.Now.AddHours(-count + i),
Value = Math.Sin(i * 0.1) * 100
})
.ToList();
}
}
Key Properties Reference
Essential Properties
| Property |
Type |
Description |
Default |
Value |
DateTime[] / double[] |
Selected range [start, end] |
null |
ValueType |
RangeValueType |
Data type (DateTime, Double, Logarithmic) |
Double |
DataSource |
object |
Data collection for series |
null |
IntervalType |
RangeIntervalType |
Axis interval (Auto, Years, Months, Days, etc.) |
Auto |
LabelFormat |
string |
Label display format |
null |
Width |
string |
Component width |
"100%" |
Height |
string |
Component height |
"80px" |
Theme |
Theme |
Visual theme (Material, Bootstrap5, Fluent, Tailwind, Fabric, HighContrast) |
Material |
Interval |
int |
Axis interval value |
1 |
LogBase |
double |
Base for logarithmic axis |
10 |
Orientation |
Orientation |
Horizontal or Vertical |
Horizontal |
Series Configuration
| Property |
Type |
Description |
Default |
Type |
RangeNavigatorType |
Series type (Line, Area, StepLine) |
Line |
XName |
string |
X-axis data field name |
null |
YName |
string |
Y-axis data field name |
null |
Fill |
string |
Series fill color |
null |
Width |
double |
Series line width |
1 |
Opacity |
double |
Series opacity (0-1) |
1 |
Name |
string |
Series name/label |
null |
Visual Properties
| Property |
Type |
Description |
Default |
EnableGrouping |
bool |
Enable data grouping |
false |
AllowSnapping |
bool |
Snap thumbs to data points |
false |
EnableRtl |
bool |
Right-to-Left support |
false |
TabIndex |
int |
Tab index for keyboard navigation |
0 |
Period Selector
| Property |
Type |
Description |
RangeNavigatorPeriodSelectorSettings |
Component |
Period selector configuration (Enabled, Height, Position) |
RangeNavigatorPeriods |
Collection |
Period button collection container |
RangeNavigatorPeriod |
Item |
Individual period selector button (Text, Interval, IntervalType, Selected) |
Tooltip Configuration
| Property |
Type |
Description |
Default |
RangeNavigatorRangeTooltipSettings.Enable |
bool |
Enable/disable tooltip |
true |
RangeNavigatorRangeTooltipSettings.DisplayMode |
TooltipDisplayMode |
Display mode (OnDemand, Always) |
OnDemand |
RangeNavigatorRangeTooltipSettings.Format |
string |
Tooltip content format template |
null |
Axis Customization
| Property |
Type |
Description |
RangeNavigatorMargin |
Component |
Margin (Left, Right, Top, Bottom) |
RangeNavigatorBorder |
Component |
Border (Color, Width, DashArray) |
RangeNavigatorMajorGridLines |
Component |
Gridlines (Width, Color, DashArray) |
RangeNavigatorMajorTickLines |
Component |
Tick lines (Width, Color, Height) |
RangeNavigatorLabelStyle |
Component |
Label styling (Color, FontFamily, Size, FontWeight) |
Thumb Configuration
| Property |
Type |
Description |
Default |
RangeNavigatorThumbSettings.Type |
ThumbType |
Thumb shape (Circle, Rectangle) |
Circle |
RangeNavigatorThumbSettings.Fill |
string |
Thumb fill color |
"#f3f3f3" |
RangeNavigatorThumbSettings.Size |
double |
Thumb size in pixels |
15 |
Events Reference
Key events for handling Range Navigator interactions:
| Event |
Event Args |
Description |
Changed |
ChangedEventArgs |
Fires when range selection changes (start, end, value) |
Loaded |
RangeLoadedEventArgs |
Fires after component loads completely |
Resizing |
RangeResizeEventArgs |
Fires while dragging thumbs |
Resized |
RangeResizeEventArgs |
Fires after thumb drag completes |
Rendering |
RangeSelectorRenderEventArgs |
Fires before selector renders |
TooltipRender |
RangeTooltipRenderEventArgs |
Fires before tooltip renders |
LabelRender |
RangeLabelRenderEventArgs |
Fires when labels render |
Example Event Handler:
private void OnRangeChanged(ChangedEventArgs args)
{
var startValue = args.Start; // DateTime or double
var endValue = args.End; // DateTime or double
var selectedData = args.SelectedData; // Filtered data
StateHasChanged();
}
Methods Reference
Key methods for programmatic control:
| Method |
Return Type |
Description |
ExportAsync(ExportType, string) |
Task |
Export as PNG, JPEG, SVG, or PDF |
Print() |
Task |
Print the Range Navigator |
Refresh() |
Task |
Refresh/redraw component |
GetVisibleRangeModel() |
VisibleRangeModel |
Get current visible range |
Implementation Workflow
When implementing a range selector, follow this sequence:
- Start with Getting Started for installation and basic setup
- Configure range values from Range Configuration for selection behavior
- Choose series type using Series Types for visualization
- Set up data binding from Data Binding for your data structure — when using remote data prefer trusted/internal APIs or mocked data; see Data Binding - Security Considerations
- Add period selector (optional) with Period Selector Integration
- Customize axis with Axis Customization for proper labeling
- Apply visual styling from Visual Customization
- Add export and events using Export, Events, and Accessibility
- Review API Reference for complete API documentation with all classes, properties, and enums
For questions or issues, refer to the troubleshooting sections in each reference file or consult Export, Events, and Accessibility for event handling patterns and accessibility requirements.
1---
2name: syncfusion-blazor-range-selectors
3description: Implement Syncfusion Blazor RangeNavigator for interactive data range selection and chart navigation. Trigger when users mention range selector, range navigator, SfRangeNavigator, Syncfusion.Blazor.Charts.RangeNavigator, time-series filtering, date range picker for charts, data zooming, slider navigation, thumb-based range selection, period selector, or chart data range selection for large data.
4metadata:
5 author: "Syncfusion Inc"
6 version: "34.1.29"
7 category: "Data Visualization"
8---
9
10# Implementing Range Selectors
11
12**NuGet:** `Syncfusion.Blazor.Charts` + `Syncfusion.Blazor.Themes` (or `Syncfusion.Blazor.RangeNavigator` for individual package)
13**Namespace:** `Syncfusion.Blazor.Charts`
14
15A comprehensive skill for implementing Syncfusion Blazor Range Selector (RangeNavigator) components for data range selection and chart navigation. The Range Selector enables users to select a specific range from a large data collection using draggable thumbs, providing an intuitive way to filter and navigate through time-series or numeric data.
16
17## When to Use This Skill
18
19Use this skill immediately when you need to:
20- Enable range selection in charts with draggable thumbs
21- Filter large time-series datasets by date range
22- Navigate through financial data or stock prices
23- Create chart zoom/pan controls with visual feedback
24- Implement dashboard filtering based on data ranges
25- Add period selector buttons (1M, 3M, 6M, YTD, 1Y, All) for quick navigation
26- Display data trends with area, line, or stepline series
27- Build interactive data exploration interfaces
28- Filter data for drill-down analysis
29- Create responsive range selection controls for Blazor Server, WebAssembly, or Web App
30- Enable synchronized filtering across multiple charts
31- Implement lightweight chart navigation for performance-critical scenarios
32- Provide visual context for selected data ranges
33
34## Component Overview
35
36The **Syncfusion Blazor Range Selector** (`SfRangeNavigator`) is a specialized control designed for data range selection and navigation. It combines:
37
38- **Draggable Thumbs**: Left and right handles for selecting range boundaries
39- **Visual Series**: Line, Area, or StepLine visualization of data trends
40- **Period Selector**: Quick preset buttons via `RangeNavigatorPeriodSelectorSettings`, `RangeNavigatorPeriods`, and `RangeNavigatorPeriod`
41- **Value Types**: Support for DateTime, Numeric, and Logarithmic data
42- **Interactive Selection**: Click labels or drag thumbs to update range
43- **Data Binding**: Local and remote data source integration
44- **Customization**: Extensive styling, theming, and formatting options using `RangeNavigatorBorder`, `RangeNavigatorMargin`, `RangeNavigatorStyleSettings`, `RangeNavigatorThumbSettings`, and tooltip settings
45
46**Key Capabilities:**
47- **Range Selection Methods**: Drag thumbs, tap labels, or set programmatically
48- **Series Types**: Line (default), Area, StepLine
49- **Value Binding**: One-way and two-way binding support
50- **Integration**: Works with period selectors and other charts
51- **Export**: PNG, JPEG, SVG, PDF export functionality
52- **Accessibility**: WCAG compliant with keyboard navigation
53
54## Documentation and Navigation Guide
55
56### Getting Started
57
58📄 **Read:** [references/getting-started.md](references/getting-started.md)
59
60Start here for installation, setup, and your first range selector. Covers:
61- Installing Syncfusion.Blazor.RangeNavigator NuGet package
62- Blazor Server, WebAssembly, and Web App setup
63- Service registration and theme configuration
64- Basic SfRangeNavigator implementation with sample data
65- Project structure and script references
66- Troubleshooting common setup issues
67
68### Core Configuration
69
70#### Range Selection and Values
71
72📄 **Read:** [references/range-configuration.md](references/range-configuration.md)
73
74Configure range selection behavior and value binding:
75- Value property for start and end values
76- One-way and two-way binding patterns
77- Value types (DateTime, Numeric, Logarithmic)
78- Thumb dragging for range selection
79- Label tapping for quick selection
80- Programmatic range updates and validation
81
82#### Series Types
83
84📄 **Read:** [references/series-types.md](references/series-types.md)
85
86Choose and customize series visualization:
87- Line series for trend lines
88- Area series for filled regions
89- StepLine series for discrete data
90- Series customization (colors, width, fill)
91- Multiple series support
92
93### Data and Integration
94
95#### Data Binding
96
97📄 **Read:** [references/data-binding.md](references/data-binding.md)
98
99Configure data sources for the range selector:
100- Local data sources (List, Array, ExpandoObject)
101- Remote data binding with SfDataManager
102- DateTime data handling and formatting
103- Numeric and logarithmic scale data
104- Data refresh and dynamic updates
105
106#### Period Selector Integration
107
108📄 **Read:** [references/period-selector-integration.md](references/period-selector-integration.md)
109
110Add period selector buttons for quick navigation:
111- Predefined period buttons (1M, 3M, 6M, YTD, 1Y, All)
112- Custom period configuration
113- Integration with range changes
114- Event handling for period selection
115- Styling and positioning
116
117### Customization and Styling
118
119#### Axis Customization
120
121📄 **Read:** [references/axis-customization.md](references/axis-customization.md)
122
123Customize axis, grid, and labels:
124- Grid line configuration (major and minor)
125- Tick customization (size, color, position)
126- Label formatting and rotation
127- Interval types (Years, Months, Days, Hours, Minutes)
128- Logarithmic axis support
129- RTL (Right-to-Left) support
130
131#### Visual Customization
132
133📄 **Read:** [references/visual-customization.md](references/visual-customization.md)
134
135Control appearance, themes, and layout:
136- Chart dimensions (Width, Height, Margin)
137- Theme selection (Material, Bootstrap, Fluent, Tailwind, Fabric, Highcontrast)
138- Tooltip configuration and templates
139- Lightweight rendering mode for performance
140- Custom styling and color schemes
141- Responsive design patterns
142
143### Advanced Features
144
145#### Export, Events, and Accessibility
146
147📄 **Read:** [references/export-events-accessibility.md](references/export-events-accessibility.md)
148
149Handle exports, events, and ensure accessibility:
150- **Export**: PNG, JPEG, SVG, PDF export functionality
151- **Events**: Changed, Loaded, TooltipRender event handling
152- **Accessibility**: WCAG compliance, keyboard navigation, screen readers, high contrast themes
153- ARIA attributes and testing checklist
154
155## Quick Start Example
156
157Here's a minimal range selector for time-series data filtering with event handling:
158
159```razor
160@using Syncfusion.Blazor.Charts
161
162@{
163 DateTime[] range = SelectedRange as DateTime[] ?? new DateTime[] { DateTime.Now, DateTime.Now };
164}
165<h3>Stock Price Range Selector</h3>
166<p>Selected Range: @range[0].ToShortDateString() to @range[1].ToShortDateString()</p>
167
168<SfRangeNavigator @bind-Value="@SelectedRange"
169 ValueType="RangeValueType.DateTime"
170 LabelFormat="MMM-yy"
171 IntervalType="RangeIntervalType.Months">
172 <RangeNavigatorEvents Changed="OnRangeChanged"></RangeNavigatorEvents>
173 <RangeNavigatorRangeTooltipSettings Enable="true"></RangeNavigatorRangeTooltipSettings>
174 <RangeNavigatorSeriesCollection>
175 <RangeNavigatorSeries DataSource="@StockData"
176 XName="Date"
177 YName="Close"
178 Type="RangeNavigatorType.Area"
179 Fill="#3F51B5">
180 </RangeNavigatorSeries>
181 </RangeNavigatorSeriesCollection>
182</SfRangeNavigator>
183
184@code {
185 public class StockInfo
186 {
187 public DateTime Date { get; set; }
188 public double Close { get; set; }
189 }
190
191 public object SelectedRange = new DateTime[]
192 {
193 new DateTime(2020, 01, 01),
194 new DateTime(2021, 01, 01)
195 };
196
197 public List<StockInfo> StockData = new List<StockInfo>
198 {
199 new StockInfo { Date = new DateTime(2018, 01, 01), Close = 35 },
200 new StockInfo { Date = new DateTime(2019, 01, 01), Close = 42 },
201 new StockInfo { Date = new DateTime(2020, 01, 01), Close = 48 },
202 new StockInfo { Date = new DateTime(2021, 01, 01), Close = 56 },
203 new StockInfo { Date = new DateTime(2022, 01, 01), Close = 62 }
204 };
205
206 private void OnRangeChanged(ChangedEventArgs args)
207 {
208 // Handle range change event
209 Console.WriteLine($"Range changed: {args.Start} to {args.End}");
210 }
211}
212```
213
214**What this creates:**
215- Area chart showing stock price trend with blue fill (#3F51B5)
216- Draggable thumbs for range selection
217- Initially selected range: Jan 2020 to Jan 2021
218- Month labels with "MMM-yy" format
219- Tooltip showing values on hover
220- Event handler responding to range changes
221- Two-way binding with @bind-Value directive
222
223## Common Use Cases
224
225### 1. Stock Price Filtering with Period Selector
226
227Filter stock data with quick period buttons:
228
229```razor
230@using Syncfusion.Blazor.Charts
231
232<SfRangeNavigator @bind-Value="@SelectedRange"
233 ValueType="RangeValueType.DateTime"
234 IntervalType="RangeIntervalType.Months"
235 LabelFormat="MMM yy">
236 <RangeNavigatorRangeTooltipSettings Enable="true" DisplayMode="TooltipDisplayMode.Always">
237 </RangeNavigatorRangeTooltipSettings>
238 <RangeNavigatorPeriodSelectorSettings>
239 <RangeNavigatorPeriods>
240 <RangeNavigatorPeriod Text="1M" Interval="1" IntervalType="RangeIntervalType.Months"></RangeNavigatorPeriod>
241 <RangeNavigatorPeriod Text="3M" Interval="3" IntervalType="RangeIntervalType.Months"></RangeNavigatorPeriod>
242 <RangeNavigatorPeriod Text="6M" Interval="6" IntervalType="RangeIntervalType.Months"></RangeNavigatorPeriod>
243 <RangeNavigatorPeriod Text="YTD"></RangeNavigatorPeriod>
244 <RangeNavigatorPeriod Text="1Y" Interval="1" IntervalType="RangeIntervalType.Years"></RangeNavigatorPeriod>
245 <RangeNavigatorPeriod Text="All"></RangeNavigatorPeriod>
246 </RangeNavigatorPeriods>
247 </RangeNavigatorPeriodSelectorSettings>
248 <RangeNavigatorSeriesCollection>
249 <RangeNavigatorSeries DataSource="@StockData" XName="Date" YName="Close" Type="RangeNavigatorType.Area">
250 </RangeNavigatorSeries>
251 </RangeNavigatorSeriesCollection>
252</SfRangeNavigator>
253
254@{
255 DateTime[] range = SelectedRange as DateTime[] ?? new DateTime[] { DateTime.Now, DateTime.Now };
256}
257<p>Selected Range: @range[0].ToShortDateString() to @range[1].ToShortDateString()</p>
258
259@code {
260 public object SelectedRange = new DateTime[]
261 {
262 new DateTime(2022, 01, 01),
263 new DateTime(2023, 01, 01)
264 };
265
266 public List<StockInfo> StockData = GetStockData();
267
268 private static List<StockInfo> GetStockData()
269 {
270 // Sample data generation
271 var data = new List<StockInfo>();
272 var startDate = new DateTime(2020, 01, 01);
273 var random = new Random();
274
275 for (int i = 0; i < 100; i++)
276 {
277 data.Add(new StockInfo
278 {
279 Date = startDate.AddDays(i * 10),
280 Close = 100 + random.Next(-20, 20)
281 });
282 }
283
284 return data;
285 }
286
287 public class StockInfo
288 {
289 public DateTime Date { get; set; }
290 public double Close { get; set; }
291 }
292}
293```
294
295### 2. Dashboard with Range-Based Filtering
296
297Synchronize chart data with range selector:
298
299```razor
300@using Syncfusion.Blazor.Charts
301
302<div class="dashboard-container">
303 <h3>Sales Dashboard</h3>
304 <SfRangeNavigator Value="@SelectedRange"
305 ValueType="RangeValueType.DateTime"
306 Height="140px">
307
308 <RangeNavigatorEvents Changed="OnRangeChanged" />
309
310 <RangeNavigatorSeriesCollection>
311 <RangeNavigatorSeries DataSource="@SalesDetails"
312 XName="Date"
313 YName="Revenue"
314 Type="RangeNavigatorType.Area" />
315 </RangeNavigatorSeriesCollection>
316
317 </SfRangeNavigator>
318 <SfChart Height="300px">
319 <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime"
320 Minimum="@SelectedRange[0]"
321 Maximum="@SelectedRange[1]" />
322
323 <ChartSeriesCollection>
324 <ChartSeries DataSource="@FilteredData"
325 XName="Date"
326 YName="Revenue"
327 Type="ChartSeriesType.Column" />
328 </ChartSeriesCollection>
329 </SfChart>
330</div>
331
332@code {
333 public DateTime[] SelectedRange =
334 {
335 new DateTime(2023, 01, 01),
336 new DateTime(2023, 06, 30)
337 };
338
339 public List<SalesData> SalesDetails = new();
340 public List<SalesData> FilteredData = new();
341
342 protected override void OnInitialized()
343 {
344 SalesDetails = GetSalesData();
345 ApplyFilter();
346 }
347
348 private void OnRangeChanged(ChangedEventArgs args)
349 {
350 if (args.Start is DateTime start && args.End is DateTime end)
351 {
352 SelectedRange = new[] { start, end };
353 ApplyFilter();
354 }
355 }
356
357 private void ApplyFilter()
358 {
359 FilteredData = SalesDetails
360 .Where(d => d.Date >= SelectedRange[0] && d.Date <= SelectedRange[1])
361 .ToList();
362 }
363
364 private List<SalesData> GetSalesData()
365 {
366 var data = new List<SalesData>();
367 var random = new Random();
368 var start = new DateTime(2023, 01, 01);
369 decimal revenue = 15000;
370
371 for (int i = 0; i < 180; i++)
372 {
373 revenue += random.Next(-1500, 2000);
374
375 data.Add(new SalesData
376 {
377 Date = start.AddDays(i),
378 Revenue = Math.Max(revenue, 5000)
379 });
380 }
381
382 return data;
383 }
384
385 public class SalesData
386 {
387 public DateTime Date { get; set; }
388 public decimal Revenue { get; set; }
389 }
390}
391```
392
393### 3. Lightweight Mode for Performance
394
395Optimize for large datasets:
396
397```razor
398@using Syncfusion.Blazor.Charts
399
400<SfRangeNavigator Value="@SelectedRange"
401 ValueType="RangeValueType.DateTime"
402 EnableGrouping="true"
403 GroupBy="RangeIntervalType.Months"
404 AllowSnapping="true">
405 <RangeNavigatorRangeTooltipSettings Enable="true"></RangeNavigatorRangeTooltipSettings>
406 <RangeNavigatorSeriesCollection>
407 <RangeNavigatorSeries DataSource="@LargeDataset"
408 XName="Timestamp"
409 YName="Value"
410 Type="RangeNavigatorType.Line">
411 </RangeNavigatorSeries>
412 </RangeNavigatorSeriesCollection>
413</SfRangeNavigator>
414
415@code {
416 public DateTime[] SelectedRange;
417 public List<DataPoint> LargeDataset = GenerateLargeDataset(10000);
418
419 public class DataPoint
420 {
421 public DateTime Timestamp { get; set; }
422 public double Value { get; set; }
423 }
424
425 private static List<DataPoint> GenerateLargeDataset(int count)
426 {
427 // Generate large dataset efficiently
428 return Enumerable.Range(0, count)
429 .Select(i => new DataPoint
430 {
431 Timestamp = DateTime.Now.AddHours(-count + i),
432 Value = Math.Sin(i * 0.1) * 100
433 })
434 .ToList();
435 }
436}
437```
438
439## Key Properties Reference
440
441### Essential Properties
442
443| Property | Type | Description | Default |
444|----------|------|-------------|---------|
445| `Value` | DateTime[] / double[] | Selected range [start, end] | null |
446| `ValueType` | RangeValueType | Data type (DateTime, Double, Logarithmic) | Double |
447| `DataSource` | object | Data collection for series | null |
448| `IntervalType` | RangeIntervalType | Axis interval (Auto, Years, Months, Days, etc.) | Auto |
449| `LabelFormat` | string | Label display format | null |
450| `Width` | string | Component width | "100%" |
451| `Height` | string | Component height | "80px" |
452| `Theme` | Theme | Visual theme (Material, Bootstrap5, Fluent, Tailwind, Fabric, HighContrast) | Material |
453| `Interval` | int | Axis interval value | 1 |
454| `LogBase` | double | Base for logarithmic axis | 10 |
455| `Orientation` | Orientation | Horizontal or Vertical | Horizontal |
456
457### Series Configuration
458
459| Property | Type | Description | Default |
460|----------|------|-------------|---------|
461| `Type` | RangeNavigatorType | Series type (Line, Area, StepLine) | Line |
462| `XName` | string | X-axis data field name | null |
463| `YName` | string | Y-axis data field name | null |
464| `Fill` | string | Series fill color | null |
465| `Width` | double | Series line width | 1 |
466| `Opacity` | double | Series opacity (0-1) | 1 |
467| `Name` | string | Series name/label | null |
468
469### Visual Properties
470
471| Property | Type | Description | Default |
472|----------|------|-------------|---------|
473| `EnableGrouping` | bool | Enable data grouping | false |
474| `AllowSnapping` | bool | Snap thumbs to data points | false |
475| `EnableRtl` | bool | Right-to-Left support | false |
476| `TabIndex` | int | Tab index for keyboard navigation | 0 |
477
478### Period Selector
479
480| Property | Type | Description |
481|----------|------|-------------|
482| `RangeNavigatorPeriodSelectorSettings` | Component | Period selector configuration (Enabled, Height, Position) |
483| `RangeNavigatorPeriods` | Collection | Period button collection container |
484| `RangeNavigatorPeriod` | Item | Individual period selector button (Text, Interval, IntervalType, Selected) |
485
486### Tooltip Configuration
487
488| Property | Type | Description | Default |
489|----------|------|-------------|---------|
490| `RangeNavigatorRangeTooltipSettings.Enable` | bool | Enable/disable tooltip | true |
491| `RangeNavigatorRangeTooltipSettings.DisplayMode` | TooltipDisplayMode | Display mode (OnDemand, Always) | OnDemand |
492| `RangeNavigatorRangeTooltipSettings.Format` | string | Tooltip content format template | null |
493
494### Axis Customization
495
496| Property | Type | Description |
497|----------|------|-------------|
498| `RangeNavigatorMargin` | Component | Margin (Left, Right, Top, Bottom) |
499| `RangeNavigatorBorder` | Component | Border (Color, Width, DashArray) |
500| `RangeNavigatorMajorGridLines` | Component | Gridlines (Width, Color, DashArray) |
501| `RangeNavigatorMajorTickLines` | Component | Tick lines (Width, Color, Height) |
502| `RangeNavigatorLabelStyle` | Component | Label styling (Color, FontFamily, Size, FontWeight) |
503
504### Thumb Configuration
505
506| Property | Type | Description | Default |
507|----------|------|-------------|---------|
508| `RangeNavigatorThumbSettings.Type` | ThumbType | Thumb shape (Circle, Rectangle) | Circle |
509| `RangeNavigatorThumbSettings.Fill` | string | Thumb fill color | "#f3f3f3" |
510| `RangeNavigatorThumbSettings.Size` | double | Thumb size in pixels | 15 |
511
512## Events Reference
513
514Key events for handling Range Navigator interactions:
515
516| Event | Event Args | Description |
517|-------|-----------|-------------|
518| `Changed` | `ChangedEventArgs` | Fires when range selection changes (start, end, value) |
519| `Loaded` | `RangeLoadedEventArgs` | Fires after component loads completely |
520| `Resizing` | `RangeResizeEventArgs` | Fires while dragging thumbs |
521| `Resized` | `RangeResizeEventArgs` | Fires after thumb drag completes |
522| `Rendering` | `RangeSelectorRenderEventArgs` | Fires before selector renders |
523| `TooltipRender` | `RangeTooltipRenderEventArgs` | Fires before tooltip renders |
524| `LabelRender` | `RangeLabelRenderEventArgs` | Fires when labels render |
525
526**Example Event Handler:**
527```csharp
528private void OnRangeChanged(ChangedEventArgs args)
529{
530 var startValue = args.Start; // DateTime or double
531 var endValue = args.End; // DateTime or double
532 var selectedData = args.SelectedData; // Filtered data
533 StateHasChanged();
534}
535```
536
537## Methods Reference
538
539Key methods for programmatic control:
540
541| Method | Return Type | Description |
542|--------|------------|-------------|
543| `ExportAsync(ExportType, string)` | `Task` | Export as PNG, JPEG, SVG, or PDF |
544| `Print()` | `Task` | Print the Range Navigator |
545| `Refresh()` | `Task` | Refresh/redraw component |
546| `GetVisibleRangeModel()` | `VisibleRangeModel` | Get current visible range |
547
548## Implementation Workflow
549
550When implementing a range selector, follow this sequence:
551
5521. **Start with [Getting Started](references/getting-started.md)** for installation and basic setup
5532. **Configure range values** from [Range Configuration](references/range-configuration.md) for selection behavior
5543. **Choose series type** using [Series Types](references/series-types.md) for visualization
5554. **Set up data binding** from [Data Binding](references/data-binding.md) for your data structure — when using remote data prefer trusted/internal APIs or mocked data; see [Data Binding - Security Considerations](references/data-binding.md)
5565. **Add period selector** (optional) with [Period Selector Integration](references/period-selector-integration.md)
5576. **Customize axis** with [Axis Customization](references/axis-customization.md) for proper labeling
5587. **Apply visual styling** from [Visual Customization](references/visual-customization.md)
5598. **Add export and events** using [Export, Events, and Accessibility](references/export-events-accessibility.md)
5609. **Review [API Reference](references/api-reference.md)** for complete API documentation with all classes, properties, and enums
561
562For questions or issues, refer to the troubleshooting sections in each reference file or consult [Export, Events, and Accessibility](references/export-events-accessibility.md) for event handling patterns and accessibility requirements.