[
{DrawDiagCirc = DrawDiagCirc([valeurs],[centre, rayon])}
$L:=%1,
if %2=Nil then
$centre:=0,
$r:=3
else $centre:=%2[1],
$r:=%2[2],
fi,
$ColorList:=[purple, blue, green, yellow, orange, red, crimson],
Langle:=[for $k in L do k*360/sum(L) od],
for $j from 1 to Nops(L)-1 do
for $k from j+1 to Nops(L) do
replace(Langle,k,Langle[k]+L[j]*360/sum(L))
od,
od,
Insert(Langle,0,1),
for k from 1 to Nops(Langle)-1 do
ColorAngle:=mod(k,7),
$c:=ColorList[ColorAngle],
draw("path", [centre+r*exp(i*pi*Langle[k]/180), centre,
centre+r*exp(i*pi*Langle[k+1]/180), r, arc,
centre+r*exp(i*pi*Langle[k+1]/180), centre,
centre+r*exp(i*pi*Langle[k]/180), line,closepath],
[FillStyle:=full, FillColor:=ColorList[ColorAngle]]),
od,
]
[
{DrawSemiDiagCirc = DrawDiagSemiCirc([valeurs],[centre, rayon])}
$L:=%1,
if %2=Nil then
$centre:=0,
$r:=3
else $centre:=%2[1],
$r:=%2[2],
fi,
$ColorList:=[purple, blue, green, yellow, orange, red, crimson],
Langle:=[for $k in L do k*180/sum(L) od],
for $j from 1 to Nops(L)-1 do
for $k from j+1 to Nops(L) do
replace(Langle,k,Langle[k]+L[j]*180/sum(L))
od,
od,
Insert(Langle,0,1),
for k from 1 to Nops(Langle)-1 do
ColorAngle:=mod(k,7),
$c:=ColorList[ColorAngle],
draw("path", [centre+r*exp(i*pi*Langle[k]/180), centre,
centre+r*exp(i*pi*Langle[k+1]/180), r, arc,
centre+r*exp(i*pi*Langle[k+1]/180), centre,
centre+r*exp(i*pi*Langle[k]/180), line,closepath],
[FillStyle:=full, FillColor:=ColorList[ColorAngle]]),
od,
]
[
{DrawDiagCirc( <valeurs>,[ options ])}
centre:=0, rayon:=3, palette:=[purple,blue,green,yellow,orange,red,crimson],
SaveAttr(), $options:=%2, $L:=%1, $total:=0,
Langle:=for $k in L do Inc(total,k), total+i*k od,
Sort(L), $min:=L[1], $max:=L[-1], $first:=0,
for $z in Langle do
$k:=2*pi*Re(z)/total,
ColorAngle:=Palette( palette, (Im(z)-min)/(max-min)),
draw("path", [centre+exp(i*first), centre, centre+exp(i*k), rayon, arc,
centre, line,closepath],
[%2, FillColor:=ColorAngle, LineStyle:=noline]),
draw("line",[centre,centre+rayon*exp(i*first)],[%2]),
first:=k,
od,
draw("path", [rayon,centre,circle],[FillStyle:=none]),
RestoreAttr()
]
[
view(-3.5,3.5,-3.5,3.5), Marges(0,0,0,0), size(9),
DrawDiagCirc([2,1,11,5], [FillStyle:=full, Width:=8])
]
[
{DrawDiagCirc( <valeurs>,[ options ])}
centre:=0, rayon:=3,
palette:=[purple,blue,green,yellow,orange,red,crimson],
SaveAttr(), $options:=%2, StrListCopy(%1,templist),
$L:=for k from 1 to templist(0) do Eval(@templist(k)) od,
Langle:=for $k in L do Inc(total,k), total+i*k od,
Sort(L), $min:=L[1], $max:=L[-1], $first:=0, $index:=0,
for $z in Langle do
$k:=2*pi*Re(z)/total, Inc(index,2),
ColorAngle:=Palette( palette, (Im(z)-min)/(max-min)),
draw("path", [centre+exp(i*first), centre, centre+exp(i*k), rayon, arc,
centre, line,closepath],
[%2, FillColor:=ColorAngle, LineStyle:=noline]),
draw("line",[centre,centre+rayon*exp(i*first)],[%2]),
draw("label", @templist(index),
[anchor:=centre+(rayon+0.5)*exp(i*(k+first)/2), Color:=ColorAngle]),
first:=k,
od,
draw("path", [rayon,centre,circle],[FillStyle:=none]),
RestoreAttr(), StrListKill(templist)
]
[
view(-4,4,-4,4), Marges(0,0,0,0), size(9),
StrListInit(serie1, 2,"Janvier",1,"Février",11,"Mars",5,"Avril"),
DrawDiagCirc( serie1, [FillStyle:=full, Width:=8])
]
Revenir vers Propositions - Discussions
Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 17 invités