I am looking to improve both on the concept as well as the user interface for code used to produce visual progress charts. The figure represents activities and progress for the construction of high-rise developments. A white square means the activity has not started, a green square an activity is completed and a red square an activity that is constrained for some reason and cannot be completed.

The user interface is as follows:
\floor{Level 47}{0}{0}{0}{0}{2}
\floor{Level 46}{0}{0}{0}{2}{2}
...
\floor{Level 08}{0}{0}{1}{1}{1}
This is highly repetitive, but as progress has to be reported on a floor basis I couldn't think of anything simpler and would welcome alternative solutions (0=white, 1=done, 2=constrained).
A MWE is shown below:
\documentclass[a4paper, oneside, justified=true, sfsidenotes]{tufte-book} % for a
\usepackage[utf8]{inputenc} % set input encoding to utf8
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{pgfplots}
%% Define some colors
\definecolor{activity1}{rgb}{0,1.0,0}
\definecolor{activity2}{rgb}{0,0.9,0}
\definecolor{activity3}{rgb}{0,0.85,0}
\definecolor{activity4}{rgb}{0,0.75,0}
\definecolor{activity5}{rgb}{0,0.65,0}
%% Color helper routine
\def\getcolor#1#2{%
\def\zero{0}\def\one{1}\def\two{2}
\if\zero#1 \gdef\statuscolor{white} \else \gdef\statuscolor{#2}\fi
\if\two#1 \gdef\statuscolor{red} \fi
}
\gdef\ascale{0.8}
\gdef\floor#1#2#3#4#5#6{%
\centering
\parindent0pt
\tikzpicture[scale=\ascale]
\def\posx{0.6}
\getcolor{#2}{activity1}
\draw node [anchor=south east ]{#1};
\draw[fill=\statuscolor] (0,0) rectangle (0.5,0.5);
\getcolor{#3}{activity2}
\draw[fill=\statuscolor] (\posx,0.0) rectangle (1.1,0.5);
\getcolor{#4}{activity3}
\draw[fill=\statuscolor] (2*\posx,0.0) rectangle (1.7,0.5);
\getcolor{#5}{activity4}
\draw[fill=\statuscolor] (3*\posx,0.0) rectangle (2.3,0.5);
\getcolor{#6}{activity5}
\draw[fill=\statuscolor] (4*\posx,0.0) rectangle (2.9,0.5);
\endtikzpicture
}
\begin{document}
\input{planning}
\end{document}
The input document is:
\chapter{Planning}
\begin{marginfigure}
The Tower can be represented by a series of squares, which denote an activity. Green
is done and white is not done. There is no need to use intermediate colors as they
would add to the visual clutter.
\vspace{1cm}
\floor{Level 47}{0}{0}{0}{0}{2}
\floor{Level 46}{0}{0}{0}{2}{2}
\floor{Level 45}{0}{0}{1}{1}{1}
\floor{Level 44}{0}{0}{1}{1}{1}
\floor{Level 43}{1}{1}{1}{1}{1}
\floor{Level 42}{1}{1}{1}{1}{1}
\floor{Level 41}{0}{1}{1}{0}{1}
\floor{Level 40}{0}{1}{1}{1}{1}
\floor{Level 39}{0}{1}{1}{1}{1}
\floor{Level 38}{0}{1}{1}{1}{1}
\floor{Level 37}{0}{0}{1}{1}{1}
\floor{Level 36}{0}{0}{0}{1}{1}
\floor{Level 35}{0}{0}{0}{1}{1}
\floor{Level 34}{0}{0}{0}{1}{1}
\floor{Level 33}{0}{0}{0}{1}{1}
\floor{Level 32}{0}{0}{0}{1}{1}
\floor{Level 31}{0}{0}{0}{1}{1}
\floor{Level 30}{0}{0}{0}{1}{1}
\floor{Level 29}{1}{1}{1}{1}{1}
\floor{Level 28}{1}{1}{1}{1}{1}
\floor{Level 27}{0}{1}{1}{1}{1}
\floor{Level 26}{0}{1}{1}{1}{1}
\floor{Level 25}{0}{0}{1}{1}{1}
\floor{Level 24}{0}{0}{1}{1}{1}
\floor{Level 23}{0}{0}{1}{1}{1}
\floor{Level 22}{0}{0}{1}{1}{1}
\floor{Level 21}{0}{0}{1}{1}{1}
\floor{Level 20}{0}{0}{1}{1}{1}
\floor{Level 19}{0}{0}{1}{1}{1}
\floor{Level 18}{0}{0}{1}{1}{1}
\floor{Level 17}{0}{0}{1}{1}{1}
\floor{Level 16}{0}{0}{1}{1}{1}
\floor{Level 15}{0}{1}{1}{1}{1}
\floor{Level 14}{0}{1}{1}{1}{1}
\floor{Level 12}{0}{1}{1}{1}{1}
\floor{Level 11}{0}{1}{1}{1}{1}
\floor{Level 10}{1}{1}{1}{1}{1}
\floor{Level 09}{1}{1}{1}{1}{1}
\floor{Level 08}{1}{1}{1}{1}{1}
\caption{Shangri-la Tower Progress, each square represents one separate activity.}
\end{marginfigure}
\lipsum[1-3]
To summarize, are there any better alternatives to the user interface? What changes to the floor routine would you recommend? Where would you suggest a legend be positioned and how?

\foreachloop I don't really see much room for improvement, since the status boxes of the levels are quite random. Or are there any constraints that might be expressed algorithmically? – Count Zero Oct 01 '11 at 19:42\foreachcannot be applied, since the user will still need to input the progress. All statuses are inputted by the user - as is - is error prone and hence my question here. – yannisl Oct 01 '11 at 19:53\floorshould always be increasing (ie, that saying\floor{Level 47}{1}{0}{0}{0}{2}would not be valid), you could put a check in the code to ensure that. And you could also put in check to make sure that all the floor numbers were valid and all were specified. – Peter Grill Oct 01 '11 at 21:25