Home
Analytics
How to add value to legend in pie chart
eric2000
<p>In pie chart, I want to add the values in legend instead of in or next to Pie chart. how to do it?</p>
<p> </p>
<p>Attached please find the example.</p>
<p> </p>
<p>Thanks in advance</p>
Find more posts tagged with
Comments
mwilliams
Meaning you'd like to see:<br><br>HB1, 10%, 1<br>HB2, 30%, 3<br>HB3, 30%, 3<br>HB4, 30%, 3<br><br>in the legend?
eric2000
<p>Thanks for your reply.</p>
<p>I want </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB1, 10%, 1</span><br><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB2, 30%, 3</span><br><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB3, 30%, 3</span><br><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB4, 30%, 3</span></p>
<p> </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">It'll be better if we can choose different font for each values in </span><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB1, 10%, 1</span></p>
mwilliams
Okay. We can figure out the values to fill in the legend. I'm assuming you don't want to show the values on the slices because it shrinks the pie size? If that's not it, I think we can do this easier by copying the slice labels and then hiding them and using their value in the legend. If you're worried about the size of the pie, we'll just have to compute the values ourselves, which is not a big deal. Let me know.
eric2000
<p>Thanks for your reply.</p>
<p>I like to put the percentage in/out pie and value in legend. like</p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB1 (1)</span><br><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB2 (3)</span><br><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB3 (3)</span><br><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HB4 (3)</span></p>
<p> </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">HBx is legend and (x) is value(Number). y% will live inside or next to pie.</span></p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">Any script will be appreciated.</span></p>
mwilliams
Take a look at this design. I added " (value)" to the category series in the chart to make room in the legend label for the actual value. In the chart script, I grab the category and slice values and use those in the legend script to replace the "value" portion of the label with the actual numerical value. Hope this helps. Let me know if you have questions.
eric2000
<p>It's working nicely. Thank you very much.</p>
mwilliams
You're welcome. Glad to help. Let us know whenever you have questions!