Subin Thomas

Subin Thomas

  • NA
  • 4.9k
  • 125.9k

i am getting an chart error: chart element already exists

Apr 5 2019 5:56 AM
my chart code
  1. <asp:Chart ID="Chart3" runat="server" Height="316px" align="left"   
  2.                                   Width="431px"  >  
  3.   
  4.                                 <Series>  
  5.                                        <asp:Series Name="Series3" ChartType="Pie"   IsValueShownAsLabel="True"   
  6.                                         Font="Microsoft Sans Serif, 8pt, style=Bold"   
  7.                                         LabelBorderWidth="2" YValuesPerPoint="1" ChartArea="ChartArea1"   
  8.                                         Legend="Default"  LegendToolTip="#VAL( #PERCENT{P})" LabelToolTip="#VALX"   
  9.                                            Label="#TOTAL">  
  10.                                        </asp:Series>  
  11.                   
  12.   
  13.                                        </Series>  
  14.                  
  15.                                        <ChartAreas >  
  16.                                            <asp:ChartArea Name="ChartArea1">  
  17.                                                <Area3DStyle Enable3D="True" />  
  18.                                                <Area3DStyle Enable3D="True"></Area3DStyle>  
  19.                                            </asp:ChartArea>  
  20.                                        </ChartAreas>  
  21.                                          <legends>  
  22.                                              <asp:Legend Alignment="Center" Name="Default" TableStyle="Wide"   
  23.                                                  TitleSeparator="DoubleLine" Title="Scheme"   
  24.                                                  TitleFont="Microsoft Sans Serif, 10pt, style=Bold" TitleForeColor="Blue">  
  25.                                              </asp:Legend>  
  26.                        
  27.                                          </legends>  
  28.                    
  29.                                    </asp:Chart>   
 and my code behind is throwing an error at
  1. this.Chart3.Legends.Add("Default"); 
 its saying the chart element 'default' already exists in legendcollection

Answers (3)