Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Center value label text in pie (donut) chart
Lynxfox
<p>Hi,</p>
<p> </p>
<p>I'm trying to figure out if it's possible to center the label of one slice in a pie chart, no matter how big the slice is, so it produces something close to attached example.</p>
<p>At the moment I can see it's possible to offset the label but this is not the correct solution since it produces different results if the slice is smaller or bigger based on values.</p>
<p> </p>
<p>Follow up question, is it possible to hide a slice label based on what category it belongs to?</p>
<p> </p>
<p>Thanks in advance,</p>
<p> </p>
<p>L</p>
Find more posts tagged with
Comments
DQM
<p>hi,</p>
<p>you can add a short clientscript to your chart:</p>
<p> </p>
<p><span style="font-size:14.666666666666666px;color:rgb(0,0,0);background-color:transparent;">beforeGeneration: </span><span style="font-size:14.666666666666666px;color:rgb(127,0,85);background-color:transparent;font-weight:700;">function</span><span style="font-size:14.666666666666666px;color:rgb(0,0,0);background-color:transparent;">(options, chart)</span></p>
<p><span><span style="font-size:14.666666666666666px;color:rgb(0,0,0);background-color:transparent;">{</span></span></p>
<p><span><span style="font-size:14.666666666666666px;color:rgb(0,0,0);background-color:transparent;">options.title.verticalAlign = </span><span style="font-size:14.666666666666666px;color:rgb(42,0,255);background-color:transparent;">'middle'</span><span style="font-size:14.666666666666666px;color:rgb(0,0,0);background-color:transparent;">;</span></span></p>
<p><span><span style="font-size:14.666666666666666px;color:rgb(0,0,0);background-color:transparent;">},</span></span></p>
<p> </p>
<div>this works fine on shorter titles.</div>
<div>you can use a break tag <br> in the title field of the chart itself when you'd like the title to run over multiple lines.</div>
Lynxfox
<p>Are chart clientscripts a feature of Birt Pro only? I'm currently running the free version (4.5) and can't seem to find clientscripts for charts, only onRender which doesn't provide the "options" argument in it's beforeGeneration function. </p>
DQM
<p>you don't have a script tab in your chart options?</p>
<p>I attached a screenshot.</p>
<p>I'm running (free) Birt Designer Pro v4.4</p>
<p> </p>
<p> </p>
Lynxfox
<p>No, our charts are PNG/SVG only, since HTML5 is not an option in open source Birt.</p>