Example of Pie with Legend Template in ASP.NET Core Chart Control
This sample demonstrates custom legend templates in a pie chart visualizing the world's top 5 oil-producing countries — United States, Saudi Arabia, Russia, Canada, and China. Each pie segment reflects the percentage share of production, and the legend displays country flags and daily output in millions of barrels.
DEMO
SOURCE
This sample uses the template property of
legendSettings
to fully customize legend items.
The legendRender event dynamically injects country-specific data — including flag images, color-matched labels, and production volumes — into the legend template at render time.
More information on legend customization in accumulation charts can be found in the documentation.