Drawing with smile

Smile has the great ability of allowinh us making to make drawings, could someone explain me how to fill a given area?

I can assure you that this day I wasn’t drinking :=), anyway, here is the answer to my question (thanks to Emmanuel)

The following code wil display an histogram an d will save it as a PDf on your desktop. It requires Smile and Satimage.osax


set red to {1, 0, 0, 1}
set gree to {0, 1, 0, 1}
set blue to {0, 0, 1, 1}
set grey to {0.5, 0.5, 0.5, 0.5}
set white to {1, 1, 1, 1}
set transparent to {1, 1, 1, 0}
set black to {0, 0, 0, 1}

set fillColors to {blue, gree, red, black, grey, blue, gree, red, blue, gree, red, black, grey, blue, gree, red, blue, gree, red, black, grey, blue, gree, red, blue, gree, red, black, grey, blue, gree, red}
set penColors to black
set theDatas to {1, 4, 8, 3, 7, 5, 6, 7, 1, 4, 8, 3, 7, 5, 6, 7, 1, 4, 8, 3, 7, 5, 6, 7, 1, 4, 8, 3, 7, 5, 6, 7}

makeBarHistogram(theDatas, penColors, fillColors, "test")
makeCamembertPlot(theDatas)


on makeBarHistogram(thooseDatas, penColors, fillColors, ThisTitle)
	set nb to count thooseDatas
	set {max, min} to {getListMaximum(thooseDatas), getListMinimum(thooseDatas) - 1}
	set theGW to make new graphic window with properties {name:ThisTitle}
	set theCurvePlot to make new curveplot at the end of theGW with properties {limits:{0, nb + 1, min, max}}
	repeat with x from 1 to nb
		set currentItem to item x of thooseDatas
		set tempPlot to make new curve at the end of theCurvePlot
		set tempPlot's xdata to {x - 1, x}
		set tempPlot's ydata to {min, currentItem}
		set tempPlot's pattern style to 10
		set tempPlot's line style to 0
		set tempPlot's pen color to getColors(penColors, x)
		set tempPlot's fill color to getColors(fillColors, x)
	end repeat
	save theGW in (((path to desktop) as text) & ThisTitle&".pdf")
	return theGW
end makeBarHistogram


on alertUser(thisMessage, abort)
	display dialog thisMessage
	if abort = true then
		quit
	end if
end alertUser

on getColors(thisObject, thisOffset)
	if (class of item 1 of thisObject is list) then
		set myColor to item thisOffset of thisObject
	else
		set myColor to thisObject
	end if
	if (count of myColor) is not 4 then alertUser("You've a specified a color with a wrong format, it should be as follow : (r,g,b,z)", true)
	return myColor
end getColors

on getListMaximum(thisList)
	
	return maximum of (statlist thisList)
	
end getListMaximum

on getListMinimum(thisList)
	
	return minimum of (statlist thisList)
	
end getListMinimum

hey, where is the “makeCamembertPlot”? :smiley:

i forgot to remove this plot, I’m working on it :lol: