Example of Legend Template in ASP.NET MVC Chart Control
This sample demonstrates customizable legend templates using all-time Summer Olympic medal data. It displays Gold, Silver, and Bronze medal counts for five countries — Argentina, Austria, Ethiopia, Iran, and India. Each legend entry features a medal icon rendered through a custom legend template to enhance visual clarity and data interpretation.
This sample shows how to render and configure a custom legend template in a Column chart.
The legend items are customized using the
template
property of
LegendSettings,
which allows embedding custom HTML content such as medal images and styled text into each legend item.
The legendRender event is used to dynamically update the template content for each series — setting the medal icon image and
label text per series.
Tooltip is enabled in this example. To see a tooltip in action, hover over or tap on the chart.
More information on chart legends can be found in the documentation.