package archimedes

  1. Overview
  2. Docs
type style =
  1. | Flat
    (*

    A simple circle separated in regions

    *)
  2. | Highlight of string list
    (*

    The named region is separated by a gap, and so highlighted toward the others

    *)
  3. | Relief
    (*

    A simple 3D pie

    *)
type colorscheme =
  1. | Default
    (*

    A set of colors that should render good for any data.

    *)
  2. | Monochrome
    (*

    A gradient from black to white.

    *)
  3. | Black
    (*

    No colors other than black, the Overpie or Outer keyscheme should then be used.

    *)
  4. | CustomColors of (string * Color.t) list
    (*

    A color scheme associating a custom color to each data.

    *)
  5. | ValueDependant of float -> Color.t
    (*

    Sometimes it is desirable to use color to express something on the piechart depending on the data values, this color scheme permits it.

    *)
  6. | LevelValueDependant of int -> int -> float -> Color.t -> float -> Color.t
    (*

    For multi-levels pie charts, the color may depend of the level, the position (in the parent children's list), the parent data value/color and the actual value of the data to draw. The level 0 is the first level with at least two elements.

    *)
type keyplacement =
  1. | NoKey
    (*

    No key at all

    *)
  2. | Rectangle
    (*

    A rectangle containing the color followed by the label of each data

    *)
  3. | OverPie
    (*

    The labels are drawn directly over the data

    *)
  4. | Outer
    (*

    The labels are drawn around the pie, next to the data they point out

    *)
  5. | Selective of float
    (*

    Outer when the angle formed by a region is lower than the given angle (in radians).

    *)
type keylabels =
  1. | Label
    (*

    Just the name of the data

    *)
  2. | WithValues
    (*

    The name followed by the value between parentheses

    *)
  3. | WithPercents
    (*

    The name followed by the percentage among all data between parentheses

    *)
  4. | OnlyValues
    (*

    Only the value

    *)
  5. | OnlyPercents
    (*

    Only the percentage

    *)
  6. | CustomLabels of string -> float -> float -> string
    (*

    A custom label made of the name, the value and the percentage.

    *)
val simple : ?style:style -> ?colorscheme:colorscheme -> ?keyplacement:keyplacement -> ?keylabels:keylabels -> ?x0:float -> ?y0:float -> ?xend:float -> ?yend:float -> Viewport.t -> (string * float) list -> unit

simple vp data draws a pie chart on vp.

  • parameter style

    the style, default is Relief

  • parameter colorscheme

    the color scheme, default is Default

  • parameter keyplacement

    where to place the key, default is Rectangle

  • parameter keylabels

    what are the labels, default is WithValues

  • parameter x0

    the x-coordinate of the center (default: 0.).

  • parameter y0

    the y-coordinate of the center (default: 0.).

  • parameter xend

    (default: 1.).

  • parameter yend

    these parameters delimits the area of the pie chart over the viewport. They are given in Graph coordinates (i.e. from 0 to 1). By default, some space is left on the top for a title for the pie chart

type multidata = {
  1. name : string;
  2. value : float;
  3. children : multidata list;
}
val multilevel : ?style:style -> ?colorscheme:colorscheme -> ?keylabels:keylabels -> ?x0:float -> ?y0:float -> ?xend:float -> ?yend:float -> Viewport.t -> multidata list -> unit

multilevel vp data draws a multilevel pie chart on vp. The default options are tuned for a multilevel pie chart

  • parameter style

    default is flat (better visualisation because there is usualy lots of data)

  • parameter colorscheme

    default is LevelValueDependant, colors of the first level to contain more than one data (= level 0) are chosen in the "Default" way, children colors are derived from their parent color and their value. Inner levels (those who contains only one data) are filled with blank

  • parameter keylabels

    default is Key, because the color scheme gives an idea of the values, it is preferable to save space by hiding the values / percentages of the data

  • parameter x0

    the x-coordinate of the center (default: 0.).

  • parameter y0

    the y-coordinate of the center (default: 0.).

  • parameter xend

    (default: 1.).

  • parameter yend

    by default, space is left for the title, as for the simple pie charts

OCaml

Innovation. Community. Security.