No description, website, or topics provided.
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
d3-raylabel.js

README.md

d3-raylabel

A D3 plugin to position labels at angles within or around pie and donut graphs.

An example of positioning labels inside the slices of donut graph is on bl.ocks.org.

The following methods are available on instances of d3.layout.raylabel:

  • arc Specifies the D3 arc used for making calculations.
  • orient Specifies the orientation of the labels in relation to the slices. Valid values are "inside", "outside", and "middle-or-inside". If "middle-or-inside", labels are placed within slices if the width of the slice at the centroid is large enough for the label; otherwise it is placed to the inside of the slice.
  • orientation Returns the actual orientation of the label, which is usually the specified orientation, unless the orientation is set to "middle-or-inside", in which case it returns the calculated orientation, either "middle" or "inside".
  • offset The distance to offset labels from their anchor point. When the orientation of the label is inside the slice, offsetting a label moves it toward the center of the circle. When the orientation of the label is outside the slice, offsetting a label moves it away from the center of the circle. Offsets have no effect for a label oriented in the middle of the slice.
  • fontSize Specifies the font size to use for labels. Accepts either a constant or a function that will be given individual datapoints. If the function returns null, the default font size will be used.
  • maxFontSize Specifies the maximum font size to use when scaling labels to the size of the slice.
  • minFontSize Specifies the minimum font size to use when scaling labels to the size of the slice.