[Gambas-user] Floodfill / pie chart
Jussi Lahtinen
jussi.lahtinen at ...626...
Sat Mar 28 16:40:18 CET 2009
Hi!
I noticed Start and End options to make sector (also in circle), but
how to fill them with color?
Fabien, here it is, but I think it is not very useful.
It is made only for my special case. It has fixed sizes, and it is
limited to 8 sectors.
Notice that Part() array have to sum up 100% to make this code to work.
Vb6 code:
Sub PieChart()
Dim Angle As Single
Dim prevAngle As Single
Dim ii As Long
With PieChartPic
.Cls
PieChartPic.Circle (104, 104), 104, vbBlack' Bug in vb6, can't use
just .Line(... etc.
PieChartPic.Line (104, 104)-(104, 104 + 105), vbBlack
For ii = 0 To 7
Angle = (Part(ii) * 0.062831853) + prevAngle
PieChartPic.Line (104, 104)-(104 + ((Sin(Angle)) * 105), 104 +
((Cos(Angle)) * 105)), vbBlack
SelectObject .hdc, mBrush(ii)' Just for the colors.
Call ExtFloodFill(.hdc, (104 + Sin((Angle + prevAngle) / 2) * 100),
(104 + Cos((Angle + prevAngle) / 2) * 100), 13160660, 1)
prevAngle = Angle
Next ii
.Refresh
End With
End Sub
Jussi
On Fri, Mar 27, 2009 at 13:22, Fabien Bodard <gambas.fr at ...626...> wrote:
> hi jussi, can you send me the vb code ?
>
> i'm working on gb.chart component... it may interest me just to
> complete my component
>
> (this component work fine only on svn version)
>
>
> thanks
> Le 27 mars 2009 11:31, Benoît Minisini <gambas at ...1...> a écrit :
>>> Hi!
>>>
>>> I need pie chart in my application, and I have old vb6 code that does
>>> what I need, but it is based on floodfill.
>>> Do Gambas have any equivalent function? Or alternatively, method to
>>> draw filled sectors?
>>> I'm using Gambas3.
>>> Thanks!
>>>
>>>
>>> Jussi
>>>
>>
>> I think that Draw.Ellipse() will draw what you need by using its last two
>> optional arguments.
>>
>> Regards,
>>
>> --
>> Benoît
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list