-
Notifications
You must be signed in to change notification settings - Fork 0
pie
XING Yun edited this page Mar 27, 2018
·
2 revisions
import { pie } from 'vizart-basic';
import 'vizart-basic/dist/vizart-basic.css';
const options = {
chart: {
height: 420,
margin: { left: 30, right: 30, top: 10, bottom: 30 }
},
data: {
x: { accessor: 'age', type: 'number', name: 'Age' },
y: [ { accessor: 'income', type: 'number', name: 'Monthly Income' } ]
},
};
const fakeData = [
{ age: 19, income: 9 }
]
const chart = new pie('#chart', options);
chart.render(fakeData);
Default options:
{
chart: {
type: 'pie'
},
plots: {
othersTitle: 'Others',
isDonut: false,
opacity: 0.8,
innerRadiusRatio: 0.4,
outerRadiusMargin: 30,
labelOffset: 20,
labelControlPointRadius: 6,
labelPosition: 'auto',
labelMinPercentage: 0.01,
},
}
Slices that have very small percentages will be displayed together as 'Others', the label text is determined by this attribute
Display a donut or pie?
Slice opacity
inner radius of donut. Will take effect when donut is true
outer radius of donut. Will take effect when donut is true
Label offset against outer edge of pie
Radius of control points
Label position, 'auto' by default, can changed to 'top'
threshold of determining when to bundle slices into a 'others' slice