Index | OAT homepage | OpenLink Software

# OATDOCpiechart

- OATDOCpiechart
- _ _ piechart.js
- _ _ _ _ Objects
- _ _ _ _ _ _ OAT.PieChart(div, options)
- _ _ _ _ Methods
- _ _ _ _ _ _ OAT.PieChart::attachData(dataArray)
- _ _ _ _ _ _ OAT.PieChart::attachText(textArray)
- _ _ _ _ _ _ OAT.PieChart::attachColors(colorArray)
- _ _ _ _ _ _ OAT.PieChart::draw()

## piechart.js

Library for drawing Pie charts using SVG.

### Objects

#### OAT.PieChart(div, options)

Creates a Pie Chart inside specified `div` . You can specify the following `options` :

- `radius` - int; if 0, then radius is computed automatically
- `depth` - int; height of pie
- `width` - int; if 0, then width is computed automatically
- `height` - int; if 0, then height is computed automatically
- `legend` - bool; should we draw the legend? default `true`
- ToBeDone
  (this has the wrong option name) `ycoef` - float; how much skewing should be applied?
- `left` , `top` - position, default `30, 40`
- `ycoef` - coefficient for the y axis (default `0.7` )

### Methods

#### OAT.PieChart::attachData(dataArray)

Adds data to chart.

#### OAT.PieChart::attachText(textArray)

Adds legend labels.

#### OAT.PieChart::attachColors(colorArray)

Adds colors.

#### OAT.PieChart::draw()

Draws the chart.

    var chart = new OAT.PieChart("myDiv",{});
    chart.attachData([1,3,2]);
    chart.attachText(["a","b","c"]);
    chart.attachColors(["#f00","#0f0","#00f"]);
    chart.draw();

Copyright (C) 2005-2008 OpenLink Software