Skip to content

Commit 72462dd

Browse files
committed
View Bubbles - account for no grouping fields.
1 parent a490827 commit 72462dd

2 files changed

Lines changed: 36 additions & 33 deletions

File tree

js/i18n/EN.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Evol.i18n = {
8888
none: 'None',
8989
na: 'N/A', // 'not available'
9090
nodata: 'No data available.',
91+
notEnoughdata: 'Not enough data available.',
9192
nopix: 'No picture.',
9293
nochart: 'No charts available.',
9394
badchart: 'Not enough information provided to draw charts.',

js/view-many/many-bubbles.js

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ Evol.ViewMany.Bubbles = Evol.ViewMany.extend({
4040
width:1200,
4141
height:700,
4242
fields: flds,
43-
colorFieldId: flds[0].id,
44-
groupFieldId: flds[0].id,
43+
colorFieldId: flds.length?flds[0].id:null,
44+
groupFieldId: flds.length?flds[0].id:null,
4545
sizeFieldId: null,
4646
uiModel: this.uiModel,
4747
tooltip: function(d){
@@ -76,41 +76,43 @@ Evol.ViewMany.Bubbles = Evol.ViewMany.extend({
7676
//h+=this._HTMLbody(this.getFields(), pSize, this.uiModel.icon, 0, this.selectable);
7777

7878
h+='<div class="bubbles-opts '+this.style+'">';
79-
// --- Group ---
80-
h+='<label>'+i18nTools.vizGroupBy+': </label>';
81-
if(fs2.length>5){
79+
if(fs2.length){
80+
// --- Group ---
81+
h+='<label>'+i18nTools.vizGroupBy+': </label>';
82+
if(fs2.length>5){
83+
fo=_.map(fs2, function(f, idx){
84+
return hOpt(f.id, f.label, idx===0);
85+
});
86+
h+='<select class="form-control bubble-group">'+hOptNull + fo.join('')+'</select>';
87+
}else{
88+
h+='<div class="btn-group" data-toggle="buttons">'+
89+
_.map(fs2, function(f, idx){
90+
if(_.isUndefined(f.groupable) || f.groupable){
91+
return '<label class="btn btn-default'+(idx===0?' active':'')+'" id="'+f.id+'">'+
92+
'<input type="radio" name="options"'+(idx===0?' checked':'')+'>'+f.label+'</label>';
93+
}
94+
}).join('')+
95+
'</div>';
96+
}
97+
// --- Color ---
8298
fo=_.map(fs2, function(f, idx){
83-
return hOpt(f.id, f.label, idx===0);
99+
return (_.isUndefined(f.colorable) || f.colorable) ? hOpt(f.id, f.label, idx===0) : '';
84100
});
85-
h+='<select class="form-control bubble-group">'+hOptNull + fo.join('')+'</select>';
86-
}else{
87-
h+='<div class="btn-group" data-toggle="buttons">'+
88-
_.map(fs2, function(f, idx){
89-
if(_.isUndefined(f.groupable) || f.groupable){
90-
return '<label class="btn btn-default'+(idx===0?' active':'')+'" id="'+f.id+'">'+
91-
'<input type="radio" name="options"'+(idx===0?' checked':'')+'>'+f.label+'</label>';
92-
}
93-
}).join('')+'</div>';
94-
}
95-
96-
97-
98-
// --- Color ---
99-
fo=_.map(fs2, function(f, idx){
100-
return (_.isUndefined(f.colorable) || f.colorable) ? hOpt(f.id, f.label, idx===0) : '';
101+
h+='<label>'+i18nTools.vizColorBy+': </label><select class="form-control bubble-color">'+hOptNull + fo.join('')+'</select>';
102+
// --- Size ---
103+
fs2=_.filter(fs2, function(f){
104+
return (_.isUndefined(f.sizable) || f.sizable) ? Evol.Dico.isNumberType(f.type) : '';
105+
});
106+
fo=_.map(fs2, function(f, idx){
107+
return hOpt(f.id, f.label);
101108
});
102-
h+='<label>'+i18nTools.vizColorBy+': </label><select class="form-control bubble-color">'+hOptNull + fo.join('')+'</select>';
103-
// --- Size ---
104-
fs2=_.filter(fs2, function(f){
105-
return (_.isUndefined(f.sizable) || f.sizable) ? Evol.Dico.isNumberType(f.type) : '';
106-
});
107-
fo=_.map(fs2, function(f, idx){
108-
return hOpt(f.id, f.label);
109-
});
110-
if(fo.length){
111-
h+='<label>'+i18nTools.vizSizeBy+': </label><select class="form-control bubble-size">'+hOptNull+fo.join('')+'</select>';
109+
if(fo.length){
110+
h+='<label>'+i18nTools.vizSizeBy+': </label><select class="form-control bubble-size">'+hOptNull+fo.join('')+'</select>';
111+
}
112+
//h+=Evol.UI.html.clearer;
113+
}else{
114+
h+=Evol.i18n.notEnoughdata;
112115
}
113-
//h+=Evol.UI.html.clearer;
114116
h+='</div></div></div>';
115117
this.$el.html(h);
116118
this.setupBubbles();

0 commit comments

Comments
 (0)