picasso.chart({
element: document.querySelector('#container'),
data,
settings: {
scales: {
c: { data: { extract: { field: 'Year' } }, type: 'color' },
radius: { data: { field: 'Budget' } }
},
components: [
{
key: 'p',
type: 'pie',
data: {
extract: {
field: 'Year',
props: {
num: { field: 'Sales' },
rad: { field: 'Budget' }
}
}
},
settings: {
padAngle: 0.01,
slice: {
innerRadius: 0.1,
outerRadius(d) {
return 0.4 + 0.6 * d.resources.scale('radius')(d.datum.rad.value);
},
arc: { ref: 'num' },
fill: { scale: 'c' },
strokeWidth: 1,
stroke: 'rgba(255, 255, 255, 0.5)'
}
}
},
{
type: 'labels',
settings: {
sources: [
{
component: 'p',
selector: 'path',
strategy: {
type: 'slice',
settings: {
direction: 'horizontal',
labels: [
{
label: d => d.data.label,
fill: '#444',
placements: [{ position: 'into' }]
}
]
}
}
}
]
}
}
]
}
})