This graph comes from application Downtime. At the beginning there was a problem how to display long time interval on limited screen area and keep transparent layout of events. In the end I picked out monthly calendar paradigma.
Graph example here is cut short by legend, by links to daily report printing, by links to detail description of downtime and by navigation for month and production line selecting. To preserve some dynamic of graph function onMouseOver() is kept running. Instead of legend, short explanation: green marks technological downtime, orange marks maintenance downtime, blue is job change, white means that production line is not used, dark gray is for all others types of downtime events.
Drawing area is defined by class .area, which serves as global container for whole graph. Global container can be filled up by background picture with help of class .back. Into global container partial containers .graf and .desc are inserted with help of tag <div>. In fact, there can be more these partial containers (legend, navigation). That makes easy to tune mutual position of partial conteiners. Global container has assigned position relative, partial containers have position absolute.
HTML code for graph drawing is based on tags <div>. At first global graph container area, picture for graph background back and subcontainer graf are defined. Shorten code for few days as example follows. First day (1.4.2006) is without any downtime, in the second example day (13.4.2006) are two downtime events. Each day begins with code for date display followed by internal container code for drawing of graphic lines. Here is picture of day line, separated to shifts. If there is downtime event in a given day, than code for color bar display is added.
According to type of downtime corresponding picture (colour) is determined. From origin time of downtime value left is calculated and from duration of downtime value width is calculated. When downtime has only limited influence on manufacturing and production line continues running e.g .. on 60%, than also values top and height are calculated. These values are used for inline style bar definition. In the end, downtime date, time and description are inserted into function onMouseOver(...) for DHTML handling.
Database is organized so, that long downtime events have to be terminated at the end of every shift. On next shift that downtime have to be entered again. Because of shift change, new date in graph begins at 6:00 and ends 5:59 on the following day.
Shifts are separated by 2 pixels spacer for better orientation. Therefore graphic scale is not continual and value left of colour bar picture have to be adjusted according to shift in which downtime came into existence.