In my real-life working program the logic is fairly simple. The data is stored in an SQL type database. When I designed the database records, I included a field called “Tier”. So now when I add records to the planner and its database, I simply run a couple of SQL scripts that check for any records that have a period that overlaps the period for the record that is about to be added. If there are records, they get counted, then 1 gets added to the total number of records found, and that then gives me the tier number for the new record.
Using the dimensions that I settled on for the planner, this “layering” system caters for 6 tiers, where each bar is 2 pixels high. I decided that’s enough for me. If you’re dealing with more than 6 different PLANNED events a day, then you’ve definitely got a problem.
Now to get the Y co-ordinate, simply take the bottom co-ordinate for the cell (previously stored), and subtract a predetermined number of pixels from it. The source code includes an array which has been set up for the planners present size. It is called “ArrTierCoord” and it has 6 values: 0, 3, 6, 9, 12, 15. This means that to arrive at tier 1, nothing will be subtracted from the cells bottom Y value, tier 2 will lie at cell bottom – 3 ... etc. So to determine the Y co-ordinate for the bar :
Y := ArrRectCoord[month, day].fBottom – ArrTierCoord[TierNumber];
Having determined the the X and Y co-ordinates of the bar, set the canvas pen width to 2 (“YP.Canvas.Pen.Width := 2), move to the beginning (“YP.Canvas.MoveTo[Xs. Ys]”), and draw the bar (“YP.Canvas.LineTo[Xe, Ye]”). Xs = start X co-ordinate, Xe = end X co-ordinate...

