@@ -693,22 +693,39 @@ To use, add a `LegendItemTemplate` inside any [ChartSeries](https://help.syncfus
693693 <ChartSeriesCollection>
694694 <ChartSeries DataSource="@MedalDetails" Name="Gold" XName="Country" Width="2" Opacity="1" YName="Gold" Fill="#FFD700" Type="ChartSeriesType.Column">
695695 <LegendItemTemplate>
696- <div style="font-family:'Segoe UI'; font-size:14px; font-weight:600; padding-right: 5px; color: #FFD700">
697- <span>Gold</span>
696+ <div style="display:flex; align-items:center; gap:10px; padding:4px 0;">
697+ <span style="font-size:18px;">🥇</span>
698+ <div style="display:flex; flex-direction:column; line-height:1.15;">
699+ <span style="font-family:'Segoe UI'; font-size:14px; font-weight:700; color:#FFD700;">Gold</span>
700+ <span style="font-size:12px; opacity:0.85;">Awarded for first place finishes</span>
701+ <span style="font-size:12px; opacity:0.75;">Total: @GoldTotal</span>
702+ </div>
698703 </div>
699704 </LegendItemTemplate>
700705 </ChartSeries>
701- <ChartSeries DataSource="@MedalDetails" Name="Silver" XName="Country" Width="2" Opacity="1" YName="Silver" Fill="#666666" Type="ChartSeriesType.Column">
706+
707+ <ChartSeries DataSource="@MedalDetails" Name="Silver" XName="Country" Width="2" Opacity="1" YName="Silver" Fill="#898989" Type="ChartSeriesType.Column">
702708 <LegendItemTemplate>
703- <div style="font-family:'Segoe UI'; font-size:14px; font-weight:600; padding-right: 5px; color: #666666">
704- <span>Silver</span>
709+ <div style="display:flex; align-items:center; gap:10px; padding:4px 0;">
710+ <span style="font-size:18px;">🥈</span>
711+ <div style="display:flex; flex-direction:column; line-height:1.15;">
712+ <span style="font-family:'Segoe UI'; font-size:14px; font-weight:700; color:#898989;">Silver</span>
713+ <span style="font-size:12px; opacity:0.85;">Awarded for second place finishes</span>
714+ <span style="font-size:12px; opacity:0.75;">Total: @SilverTotal</span>
715+ </div>
705716 </div>
706717 </LegendItemTemplate>
707718 </ChartSeries>
719+
708720 <ChartSeries DataSource="@MedalDetails" Name="Bronze" XName="Country" Width="2" Opacity="1" YName="Bronze" Fill="#CD7F32" Type="ChartSeriesType.Column">
709721 <LegendItemTemplate>
710- <div style="font-family:'Segoe UI'; font-size:14px; font-weight:600; padding-right: 5px; color: #CD7F32">
711- <span>Bronze</span>
722+ <div style="display:flex; align-items:center; gap:10px; padding:4px 0;">
723+ <span style="font-size:18px;">🥉</span>
724+ <div style="display:flex; flex-direction:column; line-height:1.15;">
725+ <span style="font-family:'Segoe UI'; font-size:14px; font-weight:700; color:#CD7F32;">Bronze</span>
726+ <span style="font-size:12px; opacity:0.85;">Awarded for third place finishes</span>
727+ <span style="font-size:12px; opacity:0.75;">Total: @BronzeTotal</span>
728+ </div>
712729 </div>
713730 </LegendItemTemplate>
714731 </ChartSeries>
@@ -727,17 +744,21 @@ To use, add a `LegendItemTemplate` inside any [ChartSeries](https://help.syncfus
727744 public double Bronze { get; set; }
728745 }
729746
730- public List<ChartData> MedalDetails = new List<ChartData>
747+ public List<ChartData> MedalDetails = new()
731748 {
732- new ChartData{ Country= "USA", Gold=50, Silver=70, Bronze=45 },
733- new ChartData{ Country="China", Gold=40, Silver= 60, Bronze=55 },
734- new ChartData{ Country= "Japan", Gold=70, Silver= 60, Bronze=50 },
735- new ChartData{ Country= "Australia", Gold=60, Silver= 56, Bronze=40 },
736- new ChartData{ Country= "France", Gold=50, Silver= 45, Bronze=35 },
737- new ChartData{ Country= "Germany", Gold=40, Silver=30, Bronze=22 },
738- new ChartData{ Country= "Italy", Gold=40, Silver=35, Bronze=37 },
739- new ChartData{ Country= "Sweden", Gold=30, Silver=25, Bronze=27 }
749+ new ChartData{ Country= "USA", Gold=50, Silver=70, Bronze=45 },
750+ new ChartData{ Country= "China", Gold=40, Silver=60, Bronze=55 },
751+ new ChartData{ Country= "Japan", Gold=70, Silver=60, Bronze=50 },
752+ new ChartData{ Country= "Australia",Gold=60, Silver=56, Bronze=40 },
753+ new ChartData{ Country= "France", Gold=50, Silver=45, Bronze=35 },
754+ new ChartData{ Country= "Germany", Gold=40, Silver=30, Bronze=22 },
755+ new ChartData{ Country= "Italy", Gold=40, Silver=35, Bronze=37 },
756+ new ChartData{ Country= "Sweden", Gold=30, Silver=25, Bronze=27 }
740757 };
758+
759+ public int GoldTotal => (int)MedalDetails.Sum(m => m.Gold);
760+ public int SilverTotal => (int)MedalDetails.Sum(m => m.Silver);
761+ public int BronzeTotal => (int)MedalDetails.Sum(m => m.Bronze);
741762}
742763```
743764![ Legend Template in Blazor Column Chart] ( images/legend/blazor-column-chart-legend-template.png )
0 commit comments