1 | if (oldValue == null) {↵ | | 1 | if (oldValue == null) {↵
|
2 | if (greenForIncrease) {↵ | | 2 | if (greenForIncrease) {↵
|
3 | plot.setSectionPaint(key, Color.green);↵ | | 3 | plot.setSectionPaint(key, Color.green);↵
|
4 | } ↵ | | 4 | } ↵
|
5 | else {↵ | | 5 | else {↵
|
6 | plot.setSectionPaint(key, Color.red);↵ | | 6 | plot.setSectionPaint(key, Color.red);↵
|
7 | }↵ | | 7 | }↵
|
8 | if (showDifference) {↵ | | 8 | if (showDifference) {↵
|
9 | series.setValue(key + " (+100%)", newValue);↵ | | 9 | series.setValue(key + " (+100%)", newValue);↵
|
10 | }↵ | | 10 | }↵
|
11 | }↵ | | 11 | }↵
|
12 | else {↵ | | 12 | else {↵
|
13 | double percentChange = (newValue.doubleValue() ↵ | | 13 | double percentChange = (newValue.doubleValue() ↵
|
14 | / oldValue.doubleValue() - 1.0) * 100.0;↵ | | 14 | / oldValue.doubleValue() - 1.0) * 100.0;↵
|
15 | double shade↵ | | 15 | double shade↵
|
16 | = (Math.abs(percentChange) >= percentDiffForMaxScale ? 255↵ | | 16 | = (Math.abs(percentChange) >= percentDiffForMaxScale ? 255↵
|
17 | : Math.abs(percentChange) * colorPerPercent);↵ | | 17 | : Math.abs(percentChange) * colorPerPercent);↵
|
18 | if (greenForIncrease ↵ | | 18 | if (greenForIncrease ↵
|
19 | && newValue.doubleValue() > oldValue.doubleValue()↵ | | 19 | && newValue.doubleValue() > oldValue.doubleValue()↵
|
20 | || !greenForIncrease && newValue.doubleValue() ↵ | | 20 | || !greenForIncrease && newValue.doubleValue() ↵
|
21 | < oldValue.doubleValue()) {↵ | | 21 | < oldValue.doubleValue()) {↵
|
22 | plot.setSectionPaint(key, new Color(0, (int) shade, 0));↵ | | 22 | plot.setSectionPaint(key, new Color(0, (int) shade, 0));↵
|
23 | }↵ | | 23 | }↵
|
24 | else {↵ | | 24 | else {↵
|
25 | plot.setSectionPaint(key, new Color((int) shade, 0, 0));↵ | | 25 | plot.setSectionPaint(key, new Color((int) shade, 0, 0));↵
|
26 | }↵ | | 26 | }↵
|
27 | if (showDifference) {↵ | | 27 | if (showDifference) {↵
|
28 | | | 28 |
|