How to create spline in Blazor Chart?
This article explains how to create a spline chart in Blazor Chart Component.
Creating spline chart in Blazor Chart
Blazor Chart has various chart types which includes Spline Chart. It connects the data points with smooth curves. To render a spline chart, set the series Type as Spline.
The following code example illustrates this.
Index.razor
@using Syncfusion.Blazor.Charts
<SfChart Title="Sales History of Product X">
<ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.Category"></ChartPrimaryXAxis>
<ChartSeriesCollection>
<ChartSeries DataSource="@SalesReports" XName="X" YName="YValue" Type="ChartSeriesType.Spline"></ChartSeries>
</ChartSeriesCollection>
</SfChart>
@code {
public class ChartData
{
public string X { get; set; }
public double YValue { get; set; }
}
public List<ChartData> SalesReports = new List<ChartData>
{
new ChartData { X= "USA", YValue= 20 },
new ChartData { X= "GBR", YValue= 27 },
new ChartData { X= "CHN", YValue= 26 },
new ChartData { X= "UK", YValue= 40 },
new ChartData { X= "AUS", YValue= 26 },
new ChartData { X= "IND", YValue= 10 },
new ChartData { X= "DEN", YValue= 26 },
new ChartData { X= "MEX", YValue= 35 },
};
}
The following image screenshot illustrates this.
Output:
Conclusion
I hope you enjoyed learning how to create spline chart in Blazor Chart component.
You can refer to our Blazor Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Blazor Chart example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, support portal, or feedback portal. We are always happy to assist you!