@using Radzen.Blazor
@if (Chart?.Legend?.Visible == true)
{
    <div class="@Class">
        <div class="rz-legend-items">
        @if (Chart?.Series != null)
        {
            @foreach (var series in Chart.Series)
            {
                @if (series.ShowInLegend)
                {
                    @series.RenderLegendItem()
                }
            }
        }
        </div>
    </div>
}
@code {
    [CascadingParameter]
    public RadzenChart? Chart { get; set; }

    string Class => ClassList.Create("rz-legend")
        .Add($"rz-legend-{Chart?.EffectiveLegendPosition ?? LegendPosition.Right}".ToLowerInvariant())
        .ToString();
}
