Skip to content

Pie charts don't always seem to fit labels to a constrained space #75

Closed
@tlrdstd

Description

@tlrdstd

Maybe it's just me, but I keep ending up with pie chart labels that look like this: http://codepen.io/tlrdstd/pen/QyWybK

image

It happens when I assign a fixed size to the pie chart, either by passing it in the layout hash, or in style attributes on the div. The pie chart always grows to fit the space, regardless of whether there is room to fit the labels. With a 300x300 square in this example, both the title and the text are cut off. If I increase to a 500x500 square, the title fits, but the text is still cut off because the pie chart grows to match.

Converting the square to a rectangle solves the problem, but that doesn't fit my design space.

I haven't dug into this in the code yet...after trying to solve variations on the same problem in other libraries (flot, d3pie, and uvcharts come to mind), I'm just assuming it ain't easy. d3pie does the best job of plotting labels of anything I've seen, though it too forgets to check the edges of the box.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions