|
© Efflare Systems website : e-mail |
<cfx_imageflare source="
include( '#expandpath('.\drawWeekGrid.fs')#' )
b = Bitmap(7*8*10+1,300+1)
b.fill( Color('white') )
drawWeekGrid( b )
b.save( '#expandpath('.\example07a.png')#' )
">
function drawWeekGrid( bitmap )
// week hilights
for x=0, bitmap.width, 140 do
bitmap.rect( x, 0, x+70, bitmap.height, Color(250,250,250), Color(250,250,250) )
end
// dense light grid
for x=0, bitmap.width, 10 do
bitmap.line( x, 0, x, bitmap.height, Color(240,240,240) )
end
for y=bitmap.height-1, 0, -10 do
bitmap.line( 0, y, bitmap.width, y, Color(240,240,240) )
end
// sparse dark grid
for x=0, bitmap.width, 70 do
bitmap.line( x, 0, x, bitmap.height, Color(120,120,120) )
end
for y=bitmap.height-1, 0, -100 do
bitmap.line( 0, y, bitmap.width, y, Color(120,120,120) )
end
end

<cfinclude template="example07data.cfm">
<cfx_imageflare query=dataQ source="
include( '#expandpath('.\drawWeekGrid.fs')#' )
b = Bitmap(7*8*10+1,300+1)
b.fill( Color('white') )
drawWeekGrid( b )
// graph table stores Shapes data
graphs = {}
sitecount = 0
sitenames = {}
colors = {}
colors[1] = 'red'
colors[2] = 'darkgreen'
colors[3] = 'blue'
// build graph shapes from data
for row=1, cf.query.rowcount do
site = cf.query.get( row, 2 )
week = cf.query.get( row, 3 )
count = cf.query.get( row, 4 )
if graphs[site] == nil then
sitecount = sitecount + 1
sitenames[sitecount] = site
graphs[site] = Shape()
end
graphs[site].plot( (week-1)*7*10, b.height-count )
end
// draw the lines
for i=1, sitecount do
b.shape( graphs[sitenames[i]], Color('white',0), Color(colors[i]), 8 )
end
b.save( '#expandpath('.\example07b.png')#' )">
