fix graphs colors

This commit is contained in:
Yuri Kuznetsov
2014-09-12 17:26:19 +03:00
parent 1a9e03d540
commit 322d4cffcf
4 changed files with 20 additions and 9 deletions
@@ -29,7 +29,9 @@ Espo.define('Crm:Views.Dashlets.Abstract.Chart', ['Views.Dashlets.Abstract.Base'
thousandSeparator: ',',
colors: ['#6FA8D6', '#4E6CAD', '#EDC555', '#ED8F42', '#5ABD37', '#DE6666', '#7CC4A4', '#8A7CC2', '#D4729B'],
colors: ['#6FA8D6', '#4E6CAD', '#EDC555', '#ED8F42', '#DE6666', '#7CC4A4', '#8A7CC2', '#D4729B'],
successColor: '#5ABD37',
init: function () {
Dep.prototype.init.call(this);
@@ -64,10 +64,14 @@ Espo.define('Crm:Views.Dashlets.OpportunitiesByStage', 'Crm:Views.Dashlets.Abstr
var data = [];
var i = 0;
d.forEach(function (item) {
data.push({
var o = {
data: [[item.value, d.length - i]],
label: this.getLanguage().translateOption(item.stage, 'stage', 'Opportunity'),
});
}
if (item.stage == 'Closed Won') {
o.color = this.successColor;
}
data.push(o);
this.stageList.push(this.getLanguage().translateOption(item.stage, 'stage', 'Opportunity'));
i++;
}, this);
@@ -70,7 +70,7 @@ Espo.define('Crm:Views.Dashlets.SalesByMonth', 'Crm:Views.Dashlets.Abstract.Char
values.forEach(function (value, i) {
data.push({
data: [[i, value]],
color: (value >= mid) ? this.colorGood : this.colorBad
color: (value >= mid) ? this.successColor : this.colorBad
});
}, this);
@@ -81,8 +81,7 @@ Espo.define('Crm:Views.Dashlets.SalesByMonth', 'Crm:Views.Dashlets.Abstract.Char
this.currency = this.getConfig().get('defaultCurrency');
this.currencySymbol = '';
this.colorGood = '#5ABD37';
this.colorBad = '#5ABD37';
this.colorBad = this.successColor;
},
drow: function () {
@@ -125,10 +125,12 @@ Espo.define('Crm:Views.Dashlets.SalesPipeline', 'Crm:Views.Dashlets.Abstract.Cha
var item = data[i];
var value = item.value;
var nextValue = ((i + 1) < data.length) ? data[i + 1].value : value;
this.chartData.push({
var o = {
data: [[i, value], [i + 1, nextValue]],
label: item.stage
});
};
this.chartData.push(o);
}
this.maxY = 1000;
@@ -139,8 +141,12 @@ Espo.define('Crm:Views.Dashlets.SalesPipeline', 'Crm:Views.Dashlets.Abstract.Cha
drow: function () {
var self = this;
var colors = Espo.Utils.clone(this.colors);
colors[colors.length - 1] = this.successColor;
this.flotr.draw(this.$container.get(0), this.chartData, {
colors: this.colors,
colors: colors,
shadowSize: false,
lines: {
show: true,