You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Legend templates allow you to replace default legend icons and text with custom HTML or Blazor markup for each series. This enables branded styles, richer content (icons, multi-line text, badges), improved readability, and localization.
395
+
396
+
To use, add a `LegendItemTemplate` inside any [AccumulationChartSeries](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.AccumulationChartSeries.html) you want to customize. The rendered content becomes the legend item and can be styled with CSS. Legend interactions (click to toggle series) remain unless [ToggleVisibility](https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Charts.AccumulationChartLegendSettings.html#Syncfusion_Blazor_Charts_AccumulationChartLegendSettings_ToggleVisibility) is set to false. Templates work with all legend positions, alignments, and paging.
397
+
398
+
**Text** : Gets or sets the text to render for the current legend item in the template. Defaults to the value from the field mapped by AccumulationChartSeries.XName.
399
+
400
+
**Data** : Gets the data item from AccumulationChartSeries.DataSource bound to the current legend item. Use this to access additional fields (for example, images, badges, or localized text) inside the template.
401
+
402
+
```
403
+
@using Syncfusion.Blazor.Charts
404
+
405
+
@* Initialize the accumulation chart component and configure its essential features *@
<span style="font-size:12px; opacity:0.8;"><b>@users million</b> people use @browser</span>
426
+
</div>
427
+
</div>
428
+
</LegendItemTemplate>
429
+
</AccumulationChartSeries>
430
+
</AccumulationChartSeriesCollection>
431
+
432
+
</SfAccumulationChart>
433
+
434
+
@code {
435
+
public class Statistics
436
+
{
437
+
public string Browser { get; set; }
438
+
public double Users { get; set; }
439
+
public string Color { get; set; }
440
+
}
441
+
442
+
public List<Statistics> StatisticsDetails = new()
443
+
{
444
+
new Statistics { Browser = "Chrome", Users = 37, Color = "#a16ee5" },
445
+
new Statistics { Browser = "UC Browser", Users = 17, Color = "#f7ce69" },
446
+
new Statistics { Browser = "iPhone", Users = 19, Color = "#55a5c2" },
447
+
new Statistics { Browser = "Others", Users = 4, Color = "#7ddf1e" },
448
+
new Statistics { Browser = "Opera", Users = 11, Color = "#ff6ea6" },
449
+
new Statistics { Browser = "Android", Users = 12, Color = "#7953ac" },
450
+
};
451
+
452
+
}
453
+
```
454
+

455
+
392
456
N> Refer to the [Blazor Charts](https://www.syncfusion.com/blazor-components/blazor-charts) feature tour page for its groundbreaking feature representations and also explore the [Blazor Accumulation Chart Example](https://blazor.syncfusion.com/demos/chart/pie?theme=bootstrap5) to know about the various features of accumulation charts and how it is used to represent numeric proportional data.
0 commit comments