Crystal Reports 2008を使用したクロスタブを除いて、Excelの「カラースケール」機能と同様の簡略化された結果、つまり最小値(赤)から最大値(緑)に基づくグラデーションカラーリングを実現したいと思います。クロスタブは次のようになります。このような少し:
HOURS L1 L2 L3 L4 Total
1 hours | 5 | 0 | 1 | 16 | 22 |
2 hours | 0 | 1 | 0 | 10 | 11 |
3 hours | 8 | 2 | 6 | 12 | 28 |
TOTAL |13 | 3 | 7 | 38 | 61 |
私の関数の原理は、クロステーブルで最大値を見つけ、20%、40%、60%、80%の値を使用して背景を着色することです。機能は次のとおりです(形式>背景セクション):
if currentfieldvalue < ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.2) then color(255,0,0)
else if (currentfieldvalue >= ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.2) and
currentfieldvalue < ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.4)) then color(255,192,0)
else if (currentfieldvalue >= ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.4) and
currentfieldvalue < ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.6)) then color(255,255,0)
else if (currentfieldvalue >= ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.6) and
currentfieldvalue < ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.8)) then color(146,208,80)
else if (currentfieldvalue >= ((Maximum (MakeArray (CurrentColumnIndex, CurrentRowIndex, 1)))*0.8)) then color(0,176,80)
それはエレガントではなく、適切に機能しません。どんな援助/提案も大歓迎です。「CurrentFieldValue」がフィールドではないことを教えてくれることを除いて、元々は機能すると仮定して以下で作業していたほど複雑になるとは思っていませんでした。
if CurrentFieldValue < ((Maximum (CurrentFieldValue))*0.2) then color(255,0,0)
else if ... etc.