Skip to content
Snippets Groups Projects
Commit 38b9bd0b authored by Eduardo L. Buratti's avatar Eduardo L. Buratti
Browse files

web: Change os distros colors


Signed-off-by: default avatarEduardo L. Buratti <elb09@c3sl.ufpr.br>
parent a49aa23f
No related branches found
No related tags found
No related merge requests found
......@@ -139,6 +139,36 @@ var Charts = {
var colors = Highcharts.getOptions().colors;
var categories = {
le: {
name: 'Linux Educacional',
color: '#437600'
},
windows: {
name: 'Windows',
color: '#18537D'
},
others: {
name: 'Outros',
color: '#8F1111',
}
};
var distros = {
'Linux Educacional 5.0': {color: '#437600', category: categories.le},
'Linux Educacional 4.0': {color: '#68950A', category: categories.le},
'Linux Educacional 3.0': {color: '#8DB414', category: categories.le},
'Linux Educacional 2.0': {color: '#B2D31D', category: categories.le},
'Linux Educacional 1.0': {color: '#D7F227', category: categories.le},
'Windows 7': {color: '#18537D', category: categories.windows},
'Windows MultiPoint Server':{color: '#73A0B4', category: categories.windows},
'Ubuntu': {color: '#8F1111', category: categories.others},
'Debian': {color: '#C25147', category: categories.others},
'Outros': {color: '#F5917D', category: categories.others},
};
var DEFAULT_DISTRO = {color: '#FFFEDE', category: categories.others};
/* PIE CHART */
jsRoutes.controllers.Data.os().ajax({
contentType: "application/json",
......@@ -146,63 +176,52 @@ var Charts = {
success: function(data) {
var total = 0;
var categories = [
{
name: 'Windows',
y: 0,
color: colors[2],
sub: []
},
{
name: 'Linux Educacional',
y: 0,
color: colors[4],
sub: []
},
{
name: 'Outros',
y: 0,
color: colors[8],
sub: []
}
];
categories.le.y = 0;
categories.windows.y = 0;
categories.others.y = 0;
for (d in distros) {
distros[d].y = 0;
}
var distrosArray = [];
$.each(data, function (key, value) {
var val = parseInt(value[0][1]);
var distro = distros[key];
/*if (key === "Linux Educacional 4.0") {
val = 1;
}*/
if (typeof distro === 'undefined') {
distro = DEFAULT_DISTRO;
}
distro.category.y += val;
distro.name = key;
distro.y += val;
total += val;
});
var les = [],
windows = [],
others = [];
if (key.substring(0,7) == 'Windows') {
categories[0].y += val;
categories[0].sub.push({name: key, y: val});
for (d in distros) {
if (distros[d].category === categories.le) {
les.push(distros[d]);
}
else if (key.substring(0,17) == 'Linux Educacional') {
categories[1].y += val;
categories[1].sub.push({name: key, y: val});
else if (distros[d].category === categories.le) {
windows.push(distros[d]);
}
else {
categories[2].y += val;
categories[2].sub.push({name: key, y: val});
others.push(distros[d]);
}
});
var merge = [];
$.each(categories, function(key, val) {
var baseColor = this.color,
len = this.sub.length,
j = 0;
$.each(this.sub, function () {
var brightness = 0.2 - (j / len) / 5 ;
this.color = Highcharts.Color(baseColor).brighten(brightness).get()
merge.push(this);
j++;
});
});
}
Charts.pieChart.addSeries({
name: 'Sistemas Operacionais',
data: categories,
data: [ categories.le, categories.windows, categories.others ],
size: '60%',
dataLabels: {
formatter: function() {
......@@ -216,7 +235,7 @@ var Charts = {
Charts.pieChart.addSeries({
name: 'Versões',
data: merge,
data: les.concat(windows, others),
size: '80%',
innerSize: '60%',
dataLabels: {
......@@ -241,15 +260,20 @@ var Charts = {
data: '{"type": "historical", "project": "'+project+'"}',
success: function(data) {
$.each(data, function (key, value) {
var distro = distros[key];
if (typeof distro === 'undefined') {
distro = DEFAULT_DISTRO;
}
for (var i=0; i<value.length; i++) {
value[i][0] = parseInt(value[i][0]);
value[i][1] = parseInt(value[i][1]);
};
Charts.histChart.addSeries({
name: key,
data: value
data: value,
color: distro.color
}, false);
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment