Loading...
Loading...
Implement Syncfusion Blazor Sparkline Charts for compact, inline trend visualizations in Blazor applications. Use this when creating mini charts, KPI indicators, dashboard sparklines, or word-sized data visualizations. This skill covers line, area, column, WinLoss, and pie sparklines, including data labels, markers, special points (high/low/negative), range bands, tooltips, and appearance customization. Ideal for dashboards, data tables with inline trends, email reports, and mobile data visualization scenarios requiring compact trend indicators.
npx skill4agent add syncfusion/blazor-ui-components-skills syncfusion-blazor-sparkline-chartsSfSparklineOnLoadedOnPointRenderingOnSeriesRenderingOnMarkerRenderingOnDataLabelRenderingOnPointRegionMouseClickOnResizingOnAxisRenderingRefreshAsync()@page "/sparkline-demo"
@using Syncfusion.Blazor.Charts
<h3>Monthly Sales Trend</h3>
<SfSparkline DataSource="@SalesData"
XName="Month"
YName="Sales"
Type="SparklineType.Line"
Height="50px"
Width="200px"
Fill="#3366cc"
LineWidth="2" TValue="SalesInfo">
<SparklineMarkerSettings Visible="new List<VisibleType> { VisibleType.All }"
Size="4"
Fill="#ffffff"
Border="new SparklineMarkerBorder { Color = "#3366cc", Width = 1 }">
</SparklineMarkerSettings>
<SparklineTooltipSettings TValue="SalesInfo" Visible="true" Format="${Month}: ${Sales}"></SparklineTooltipSettings>
</SfSparkline>
@code {
public class SalesInfo
{
public string Month { get; set; }
public double Sales { get; set; }
}
public List<SalesInfo> SalesData = new List<SalesInfo>
{
new SalesInfo { Month = "Jan", Sales = 35000 },
new SalesInfo { Month = "Feb", Sales = 28000 },
new SalesInfo { Month = "Mar", Sales = 34000 },
new SalesInfo { Month = "Apr", Sales = 32000 },
new SalesInfo { Month = "May", Sales = 40000 },
new SalesInfo { Month = "Jun", Sales = 32000 },
new SalesInfo { Month = "Jul", Sales = 35000 }
};
}@page "/sparkline-demo"
@using Syncfusion.Blazor.Charts
<div class="kpi-grid">
<div class="kpi-card">
<h4>Revenue</h4>
<p class="value">$1.2M <span class="change positive">+15%</span></p>
<SfSparkline DataSource="@RevenueData" Type="SparklineType.Area" Height="40px" Width="150px" Fill="#28a745">
</SfSparkline>
</div>
<div class="kpi-card">
<h4>Orders</h4>
<p class="value">5,432 <span class="change negative">-3%</span></p>
<SfSparkline DataSource="@OrdersData" Type="SparklineType.Column" Height="40px" Width="150px" Fill="#dc3545">
</SfSparkline>
</div>
</div>
@code {
public List<double> RevenueData { get; set; } = new()
{
820000, 900000, 870000, 960000, 1100000, 1200000
};
public List<double> OrdersData { get; set; } = new()
{
5200, 5400, 5600, 5300, 5500, 5432
};
}@page "/sparkline-demo"
@using Syncfusion.Blazor.Charts
<table class="data-table">
<thead>
<tr>
<th>Product</th>
<th>Current</th>
<th>Trend (7 days)</th>
</tr>
</thead>
<tbody>
@foreach (var product in Products)
{
<tr>
<td>@product.Name</td>
<td>@product.CurrentValue.ToString("C")</td>
<td>
<SfSparkline DataSource="@product.TrendData"
Type="SparklineType.Line"
Height="30px"
Width="100px"
LineWidth="1">
</SfSparkline>
</td>
</tr>
}
</tbody>
</table>
@code {
public class ProductInfo
{
public string Name { get; set; }
public decimal CurrentValue { get; set; }
public List<double> TrendData { get; set; } = new();
}
public List<ProductInfo> Products { get; set; } = new()
{
new ProductInfo
{
Name = "Product A",
CurrentValue = 1250.75m,
TrendData = new List<double> { 1200, 1220, 1235, 1240, 1245, 1250, 1251 }
},
new ProductInfo
{
Name = "Product B",
CurrentValue = 980.30m,
TrendData = new List<double> { 950, 955, 960, 970, 975, 980, 980 }
}
};
}@page "/sparkline-demo"
@using Syncfusion.Blazor.Charts
<SfSparkline DataSource="@WinLossData"
Type="SparklineType.WinLoss"
Height="50px"
Width="300px"
TiePointColor="#ffc107">
<SparklineAxisSettings MinY="-1" MaxY="1"></SparklineAxisSettings>
</SfSparkline>@using Syncfusion.Blazor.Charts
<SfSparkline DataSource="@TemperatureData"
Type="SparklineType.Line"
Height="60px"
Width="250px">
<SparklineMarkerSettings Visible="new List<VisibleType> { VisibleType.High, VisibleType.Low }">
</SparklineMarkerSettings>
<SparklineHighPointColor>#28a745</SparklineHighPointColor>
<SparklineLowPointColor>#dc3545</SparklineLowPointColor>
</SfSparkline>
@code {
public List<int> WinLossData { get; set; } = new()
{
1, 1, -1, 0, 1, -1, 1, 1, 0, -1
};
}SfSparklineDataSourceEnableGroupingSeparatorEnableRtlEndPointColorFillFormatHeightHighPointColorIDLineWidthLowPointColorNegativePointColorOpacityPaletteQueryRangePaddingStartPointColorThemeTiePointColorTypeValueTypeWidthXNameYNameRefreshAsync()OnAxisRenderingOnDataLabelRenderingOnLoadedOnMarkerRenderingOnPointRegionMouseClickOnPointRenderingOnResizingOnSeriesRenderingSparklineAxisLineSettingsSparklineAxisSettingsSparklineBorderSparklineContainerAreaSparklineContainerAreaBorderSparklineDataLabelBorderSparklineDataLabelOffsetSparklineDataLabelSettingsSparklineEventsSparklineFontSparklineMarkerBorderSparklineMarkerSettingsSparklinePaddingSparklineRangeBandSparklineRangeBandSettingsSparklineTooltipBorderSparklineTooltipSettingsSparklineTooltipTextStyleSparklineTrackLineSettingsSparklineRangePaddingSparklineTypeSparklineValueTypeVisibleType