Create a pie chart
Mathematica, 186 183 164 bytes
Graphics[{Hue@#,Disk[{0,0},{1,1},a=2Pi{##}],Black,Text[ToString@Round[100(#2-#)]<>"%",5Through@{Cos,Sin}@Mean@a/4]}&@@@Partition[Accumulate[#/Tr@#]~Prepend~0,2,1]]&
Could be golfed further. Currently generates a Graphics
object. Test cases:
JavaScript (ES6), 311 310 302 298 bytes
a=>{with(Math)document.write(`<svg height=300>`+a.map(n=>`<path fill=#${(p*4e3|0).toString(16)} d=M135,150L${c(o=100,v=0)}A${[o,o,0,(v=n/=s)+.5|0,0,c(o)]}Z /><text x=${(z=c(135,v/=2))[0]} y=${z[p+=n,1]}>${n*o+.5|0}%</text>`,c=r=>[sin(d=PI*2*(v+p))*r+135,cos(d)*r+150],p=s=0,a.map(n=>s+=n)).join``)}
Saved a byte with help from @Neil!
Explanation
Writes some SVG to the HTML of the current page. Builds the chart with centre point 135 x 150
of radius 100px
and text at a radius of 135px
from the centre.
var solution =
a=>{
with(Math)
document.write( // write to HTML body
`<svg height=300>`+ // create 300px x 300px SVG canvas (width defaults to 300px)
a.map(n=> // for each number
// Get the hex colour by multiplying the current position by (roughly) 0xfff
`<path fill=#${(p*4e3|0).toString(16)
// Calculate the path of the pie slice
} d=M135,150L${c(o=100,v=0)}A${[o,o,0,(v=n/=s)+.5|0,0,c(o)]
// Text
}Z /><text x=${(z=c(135,v/=2))[0]} y=${z[p+=n,1]}>${n*o+.5|0}%</text>`,
// Returns [ x, y ] for a certain radius at position v around the pie
c=r=>[sin(d=PI*2*(v+p))*r+135,cos(d)*r+150],
p=s=0, // p = current position around pie (0 - 1)
a.map(n=>s+=n) // s = sum of all numbers
).join``
+`</svg>` // <- this is just here for the test, so multiple charts can be displayed
)
}
// Test
;[
[0.3, 1.2],
[3, 6, 2, 10],
[0.4387, 0.3816, 0.7655, 0.7952, 0.1869, 0.4898, 0.4456, 0.6463, 0.7094, 0.7547]
].map(c=>solution(c));
Python + PIL, 365 355
from math import*;from random import*
from PIL import Image,ImageDraw
L,a,r=256,0,0.8;l,p,c=L/2,L/6,(L,L,L);I=Image.new('RGB',(L,L),c);D=ImageDraw.Draw(I)
x=input()
for i in x:b=a+ceil(360.0*i/sum(x));D.pieslice((p,p,L-p,L-p),int(a),int(b),tuple(map(randrange,c)));t=(a+b)*0.00872;D.text((l+cos(t)*l*r,l+sin(t)*l*r),str(int((b-a)/3.6))+'%',0);a=b
I.show()
Result for the largest example list :