Range Step Area in Blazor Charts Component
11 Aug 20234 minutes to read
Range Step Area
Range Step Area Chart is used to display continuous data points as a series of steps that vary between high and low values over an interval of time for different categories. To render a Range Step Area Chart, set the series Type as RangeStepArea.
@using Syncfusion.Blazor.Charts
@inject NavigationManager NavigationManager
@inject HttpClient Http
@using System.Net.Http.Json
<SfChart>
<ChartArea>
<ChartAreaBorder Width="0"></ChartAreaBorder>
</ChartArea>
<ChartTooltipSettings Enable="true" Format="Temperature : <b>${point.low} - ${point.high}</b>" Shared="true"></ChartTooltipSettings>
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime" Format="dd MMM">
<ChartAxisMajorGridLines Width="0"/>
</ChartPrimaryXAxis>
<ChartPrimaryYAxis LabelFormat="{value}˚C" Interval="5" Minimum="-5" Maximum="25">
<ChartAxisLineStyle Width="0"></ChartAxisLineStyle>
<ChartAxisMajorTickLines Width="0"/>
</ChartPrimaryYAxis>
<ChartSeriesCollection>
<ChartSeries DataSource="@ChartPoints" XName="X" High="High" Low="Low" Opacity="0.5" Type="ChartSeriesType.RangeStepArea">
<ChartMarker Visible="false"></ChartMarker>
</ChartSeries>
</ChartSeriesCollection>
<ChartLegendSettings Visible="false"/>
</SfChart>
@code{
public string BorderColor { get; set; }
public ChartData[] ChartPoints { get; set; }
protected async override Task OnInitializedAsync()
{
ChartPoints = new ChartData[] { };
ChartPoints = await Http.GetFromJsonAsync<ChartData[]>(NavigationManager.BaseUri + "./range-data.json");
}
public class ChartData
{
public string X { get; set; }
public double High { get; set; }
public double Low { get; set; }
}
}
Refer to our Blazor Range Step Area Chart feature tour page to know about its other groundbreaking feature representations. Explore our Blazor Range Step Area Chart Example to know how to show variations in the data values for a given time.
Series customization
The following properties can be used to customize the Range Step Area series.
- Fill – Specifies the color of the series.
- Opacity – Specifies the opacity of the fill color.
- DashArray – Specifies the dashes of series border.
- ChartSeriesBorder – Specifies the Color and Width of series border.
@using Syncfusion.Blazor.Charts
<SfChart>
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category" />
<ChartSeriesCollection>
<ChartSeries DataSource="@WeatherReports" XName="X" High="High" Low="Low" Opacity="0.5"
DashArray="5,5" Fill="blue" Type="ChartSeriesType.RangeStepArea">
<ChartSeriesBorder Width="2" Color="red"></ChartSeriesBorder>
</ChartSeries>
</ChartSeriesCollection>
</SfChart>
@code{
public class ChartData
{
public string X { get; set; }
public double Low { get; set; }
public double High { get; set; }
}
public List<ChartData> WeatherReports = new List<ChartData>
{
new ChartData { X= "Sun", Low= 4.7, High= 9.8 },
new ChartData { X= "Mon", Low= 4.7, High= 11.4 },
new ChartData { X= "Tue", Low= 6.4, High= 14.4 },
new ChartData { X= "Wed", Low= 9.6, High= 17.2 },
new ChartData { X= "Thu", Low= 7.5, High= 15.1 },
new ChartData { X= "Fri", Low= 3.0, High= 10.5 },
new ChartData { X= "Sat", Low= 1.2, High= 10.5 }
};
}
Refer to our Blazor Charts feature tour page for its groundbreaking feature representations and also explore our Blazor Chart Example to know various chart types and how to represent time-dependent data, showing trends at equal intervals.