increasing/decreasing percentage - pie chart/ circular graph

Matt Paffel mpaffel at gmail.com
Tue May 4 19:13:39 UTC 2010


Hello,

I’m trying to develop a behavioral choice task in which a participant
will be able to increase or decrease a percentage of pie dependent
upon the contingency of the experiment. I’ve attached the code that I
was planning on using, which I took from the e-basic help file. There
are a couple of lines that I plan on removing from the script such as
the lines referencing “random” and “nCount”. However, overall this is
aesthetically what I want the program to look like. My question is; I
want the participant to be able to increase and decrease the
percentage of pie using the 1 and 2 keys. I’m having trouble finding
lines of script, or references pertaining to, what I’d like to achieve
within the design. Does anyone have any suggestions?

'Create a Canvas
Dim cnvs As Canvas
'Set cnvs as the current, onscreen canvas
Set cnvs = Display.Canvas
'Declare variables used to set the size of the canvas
Dim XRes As Integer, YRes As Integer
'Set the canvas size as the entire screen resolution
XRes = Display.XRes
YRes = Display.YRes

'Declare and initialize variables to be used when drawing the sections
of the circle
Const nRadius As Integer = 100
Dim nStartAngle As Integer, nEndAngle As Integer
Dim nCount As Integer

'Initialize variables
nStartAngle = 90
nEndAngle = 90

'Declare variables to be used to randomly select the delay value
Dim nRandom As Integer
Dim nDelay As Integer
'Select a random number to determine the value of the delay between
the drawing of each section of the circle
nRandom = Random (1, 2)
'If the random number chosen is 1, the nDelay value is set to 500 ms.
'Otherwise, the nDelay value is set to 1000 ms.
If nRandom = 1 Then
nDelay = 500
Else
nDelay = 1000
End If

'Set color of pen for pie slice
cnvs.PenColor = CColor("red")
cnvs.FillColor = CColor("red")
'The For…Next statement repeats a block of statements a specified
number of times
'incrementing a loop counter by a given increment each time through
the loop
'In this sample, the nCount variable is incremented by one each time
through the loop allowing ten pie slices to be drawn.

For nCount = 1 to 10



'Adjust startAngle to specify where to start each section of the
circle each time a pie slice is drawn
nStartAngle = nStartAngle - 36
'Draw a pie slice with center point at x, y and radius r, starting at
startAngle and drawing to endAngle.
cnvs.Pie XRes/2, YRes/2, nRadius, nStartAngle, nEndAngle
'Sleep before drawing next pie slice
Sleep nDelay
Next nCount
'Set fill color to white before clearing canvas
cnvs.FillColor = CColor("white")
'Clear canvas
cnvs.clear
'Set the value of the delay as an attribute in the data file

Thank you.

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list