• Pie chart - how to display a legend?

    By Patrick Kwintensson 1 decade ago
    • displaying a legend

      By Julian Buss 1 decade ago

      Hi Patrick,

       

      please see the attached file for response because this web editor cannot handle HTML code :-( 

      Hi Partrick,
      
       
      
      I just wrote an article for THE VIEW (www.eview.com) about charting and the xCharting control, and in that article I described how to enable a legend for a chart, too.Hi Partrick,
      
       
      
      I just wrote an article for THE VIEW (www.eview.com) about charting and the xCharting control, and in that article I described how to enable a legend for a chart, too. 
      
       
      
      In case you don't have a THE VIEW subscription, here is the short version:
      
       
      
      - open the xCharting control 
      
       
      
      - below the xp:div id="ynchartcontainer" add another div:
      
       
      
      ---
      
       
      
      <xp:div id="ynchartlegend"></xp:div>"
      
       
      
      ---
      
       
      
      and find the xp:scriptBlock tag
      
       
      
      - edit the javascript code, after line 8 add the following:
      
       
      
      ---
      
       
      
      var legendid = getClientId("ynchartlegend");
      
       
      
      ---
      
       
      
      - find the line "yn_charts_render()" at the bottom of the code. Before that line, add:
      
       
      
      ---
      
       
      
      r += ' var ynchartlegend = new dojox.charting.widget.Legend({chart: ynchart}, "'+legendid+'");'+@NewLine();
      
       
      
      ---
      
       
      
       
      
       
      
      that should do the trick.