Menu

#49 Piechart labels - alternating ScalePosition (labels overlap) and connecting line

None
open
nobody
None
1
None
2013-02-07
2012-11-18
sinni800
No

I have a piechart with labels that also show the the name combined with the percentage, but however I do it, either the labels get too far away (looks bad) or they soemtimes overlap (looks bad).

Is there some possibility to have the labels "dodge" each other using a, for example, alternating ScalePosition at the easiest or even a detection that knows when labels overlap and only then moves them?

Also if I put them further away, the user might have a hard time identifying which label belongs to which slice. I suggest a optional line that connects the label to the actual slice.

Discussion

  • sinni800

    sinni800 - 2012-11-18

    Here's an example, by the way:

    http://sinni.slayerduck.com/std/comment.png

     
  • lbayuk

    lbayuk - 2012-11-27

    Yes, this is a problem, ever since support was added for custom labels, which can be longer than the default percentage labels.

    Your second proposed solution, having PHPlot specifically place the labels to avoid overlap, is ideal, but a general solution is very hard to do.

    Alternating or varying ScalePosition is an interesting idea, but I'm not sure how often it will actually help. Also I think it might make it harder to visually associate the labels with the correct slices.

    I use an application (not open source) that can produce pie charts, and they do a great job with labels. The labels are well outside the pie, and connected by a gently curved line to the outer part of the slice. The labels never overlap and it is easy to tell which slice is being labeled. I would like to do something like that, if I can figure out exactly what they are doing.

    I'm leaving this open... I would like to implement this, but it is going to have to be after the current efforts to fix overall plot scaling and range.

     
  • daan

    daan - 2013-02-06

    This program moves the legend dependent on its width and the absence or presence of a title:

    $labellength=0;
    for ($index=0;$index<$nofrows;$index++)
    if (strlen($rowlabels[$index])>$labellength) $labellength=strlen($rowlabels[$index]);

    $data=array();
    for ($index=0;$index<$nofrows;$index++)
    array_push($data,array($rowlabels[$index],$data1[$index]));

    if ($legend) {$labellength*=6; $width+=$labellength+16; $labellength+=22;}
    $plot = new PHPlot($width,$height);
    $plot->SetImageBorderType('none');
    $plot->SetDataType('text-data-single');
    $plot->SetDataValues($data);
    $plot->SetPlotType('pie');
    if (!$d3) $plot->SetShading(0);
    $plot->SetLabelScalePosition(0.2);
    if ($title) {$plot->SetTitle($title); $x=25;} else $x=5;
    if ($legend)
    {foreach ($data as $row)
    $plot->SetLegend($row[0]);
    $plot->SetMarginsPixels(NULL, $labellength); $plot->SetLegendPosition(1, 0, 'image', 1,0,-1, $x); }
    $plot->DrawGraph();

     
  • lbayuk

    lbayuk - 2013-02-07

    This program moves the legend...

    This has nothing to do with this feature request. Did you mean to post this somewhere else?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.