Pie Chart 100% SuperTalk

SuperCard 4.5 & 4.6 projects (.zip archives only please).

Pie Chart 100% SuperTalk

Postby sctell » Tue Apr 19, 2011 9:48 am

Hi,

Those reading the forum will be aware I have been messing about with charts recently.

Following the external route I have now created a SuperTalk based Pie Chart without the use of any externals.

Clearly it does have some limitations which I would be grateful for any suggestions.

The jaggies at the edges of segments.

Overcoming coordinates based on integers which result in rounding errors. For example the centre of the pie. All segments don't finish in exactly the same place.

For the segment labels I have used a fixed size cd fld. Is there a way to work out the size of the fld ( w x h) for the text that is to be placed in it at a font and size.

The speed of display is rather slow on my Macbook Pro.

Please see the attachment

PieChart.sc45.zip
(4.16 KiB) Downloaded 210 times
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Pie Chart 100% SuperTalk

Postby LorenzT » Tue Apr 19, 2011 9:50 pm

For the segment labels I have used a fixed size cd fld. Is there a way to work out the size of the fld ( w x h) for the text that is to be placed in it at a font and size?


Yes, for the height you can use the font size and in SC 4.7 you can use the textWidthMax function for the width. From the SLG: The textWidthMax function returns the width of the widest line of text in a field or draw text graphic, in pixels.
LorenzT
 
Posts: 176
Joined: Thu Dec 02, 2010 2:32 am
Location: Switzerland

Re: Pie Chart 100% SuperTalk

Postby sctell » Tue Apr 19, 2011 10:21 pm

Hi Lorenz,

Unfortunately I am stuck on 4.6.3.

Any ideas?
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am

Re: Pie Chart 100% SuperTalk

Postby sctell » Tue Apr 19, 2011 10:47 pm

The only other approximation is to use one of the built in externals


get stringWidth(<theString>,<font>,<size>,<style>)

I then don't know the dimensions from the end of the text to calculate the field width.

Perhaps a little trial and error may come in but I am sure the dimension changes depending on the font,size and style.
sctell
 
Posts: 1128
Joined: Sun Jul 06, 2008 10:41 am


Return to Sample & Demo Projects

Who is online

Users browsing this forum: No registered users and 1 guest