ref 12119:AccountingDashboard - Create a new Accounting Dashboard

https://support.d4science.org/issues/12119

Updated colors palette

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/accounting-dashboard@169946 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2018-07-25 10:17:12 +00:00
parent 4a082c602c
commit 4bcee624d3
2 changed files with 41 additions and 22 deletions

View File

@ -262,7 +262,7 @@ public class Chart extends HTMLPanel {
'#8B4513', '#9ACD32', '#FA8072', '#F5FFFA', '#D8BFD8',
'#DB7093', '#5F9EA0', '#A0522D', '#6B8E23', '#FFA07A',
'#778899', '#E6E6FA', '#C71585' ];
seedPalette = (seedPalette) % 112;
seedPalette = (seedPalette) % palette.length;
var color = palette[seedPalette];
seedPalette += 1;
return color;

View File

@ -23,38 +23,40 @@ public class ColorTest extends TestCase {
try {
String[] blue = new String[] { "#87CEEB", "#1E90FF", "#4B0082", "#663399", "#00008B", "#0000CD",
"#0000FF", "#4169E1", "#00BFFF", "#6495ED", "#87CEFA", "#B0E0E6", "#ADD8E6", "#B0C4DE",
"#4682B4", "#5F9EA0" };
"#0000FF", "#4169E1", "#00BFFF", "#6495ED", "#87CEFA", "#B0E0E6", "#B0C4DE", "#4682B4",
"#5F9EA0" };
String[] brown = new String[] { "#DAA520", "#D2B48C", "#FFF8DC", "#FFEBCD", "#FFE4C4", "#FFDEAD",
"#F5DEB3", "#DEB887", "#BC8F8F", "#F4A460", "#B8860B", "#CD853F", "#D2691E", "#808000",
"#8B4513", "#A0522D" };
String[] brown = new String[] { "#DAA520", "#D2B48C", "#FFEBCD", "#FFE4C4", "#FFDEAD", "#F5DEB3",
"#DEB887", "#BC8F8F", "#F4A460", "#B8860B", "#CD853F", "#D2691E", "#808000", "#8B4513",
"#A0522D" };
String[] green = new String[] { "#3CB371", "#90EE90", "#ADFF2F", "#7FFF00", "#7CFC00", "#00FF00",
"#32CD32", "#98FB98", "#00FA9A", "#00FF7F", "#2E8B57", "#228B22", "#008000", "#006400",
"#9ACD32", "#6B8E23" };
"#32CD32", "#98FB98", "#00FA9A", "#2E8B57", "#228B22", "#008000", "#006400", "#9ACD32",
"#6B8E23" };
String[] red = new String[] { "#FF4500", "#B22222", "#FF0000", "#FF6347", "#FF7F50", "#FF8C00",
"#FFA500", "#8B0000", "#800000", "#FFD700", "#DC143C", "#CD5C5C", "#F08080", "#E9967A",
"#FA8072", "#FFA07A" };
"#FFA500", "#8B0000", "#800000", "#FFD700", "#DC143C", "#CD5C5C", "#F08080", "#FA8072",
"#FFA07A" };
String[] cyan = new String[] { "#8FBC8F", "#00CED1", "#00FFFF", "#E0FFFF", "#AFEEEE", "#7FFFD4",
"#40E0D0", "#48D1CC", "#556B2F", "#66CDAA", "#20B2AA", "#008B8B", "#008080", "#F0FFF0",
"#F5FFFA", "#778899" };
"#40E0D0", "#48D1CC", "#556B2F", "#66CDAA", "#20B2AA", "#008B8B", "#008080", "#778899",
"#696969" };
String[] purple = new String[] { "#FF00FF", "#9400D3", "#483D8B", "#6A5ACD", "#7B68EE", "#9370DB",
"#800080", "#8A2BE2", "#9932CC", "#BA55D3", "#FF00FF", "#EE82EE", "#DA70D6", "#DDA0DD",
"#D8BFD8", "#E6E6FA" };
"#D8BFD8" };
String[] yellow = new String[] { "#BDB76B", "#FFDAB9", "#FFFF00", "#FFFFE0", "#FFFACD", "#FAFAD2",
"#FFEFD5", "#FFE4B5", "#EEE8AA", "#F0E68C", "#FFC0CB", "#FFB6C1", "#FF69B4", "#FF1493",
"#DB7093", "#C71585" };
String[] yellow = new String[] { "#BDB76B", "#FFDAB9", "#FFFF00", "#FFFACD", "#FAFAD2", "#FFEFD5",
"#FFE4B5", "#EEE8AA", "#F0E68C", "#FFC0CB", "#FFB6C1", "#FF69B4", "#FF1493", "#DB7093",
"#C71585" };
logger.debug("Dimension: red=" + red.length + ", cyan=" + cyan.length + ", purple=" + purple.length
+ ", yellow=" + yellow.length + ", blue=" + blue.length + ", brown=" + brown.length + ", green="
+ green.length);
int average = (red.length + cyan.length + purple.length + yellow.length + blue.length + brown.length
+ green.length) / 7;
int total=(red.length + cyan.length + purple.length + yellow.length + blue.length + brown.length
+ green.length);
int average = total/ 7;
logger.debug("Total: " + total);
logger.debug("Average: " + average);
/*
@ -65,9 +67,9 @@ public class ColorTest extends TestCase {
* System.out.print("]"); System.out.println("");
*/
String[] palette = new String[112];
String[] palette = new String[total];
int j = 0;
for (int i = 0; i < 16; i++) {
for (int i = 0; i < 14; i++) {
j = i * 7;
palette[j] = blue[i];
palette[j + 1] = brown[i];
@ -103,14 +105,31 @@ public class ColorTest extends TestCase {
htmlBuilder.append("<div><h2>Colors: " + k + "</h2></div>");
}
htmlBuilder
.append("<div style='height:30px;width:100px;background-color:" + palette[i] + ";'></div>");
htmlBuilder.append("<div style='height:30px;width:100px;background-color:" + palette[i] + ";'>"
+ palette[i] + "</div>");
}
htmlBuilder.append("</body></html>");
logger.debug("HTML: " + htmlBuilder.toString());
StringBuilder htmlSingleColorBuilder = new StringBuilder();
htmlSingleColorBuilder.append("<html><head></head><body>");
int v = 0;
for (int i = 0; i < green.length; i++) {
if (i % 7 == 0) {
v++;
htmlSingleColorBuilder.append("<div><h2>Colors: " + v + "</h2></div>");
}
htmlSingleColorBuilder.append("<div style='height:30px;width:100px;background-color:" + green[i]
+ ";'>" + green[i] + "</div>");
}
htmlSingleColorBuilder.append("</body></html>");
logger.debug("HTML Color green: " + htmlSingleColorBuilder.toString());
assertTrue("Success", true);
} catch (Throwable e) {
logger.error(e.getLocalizedMessage(), e);