Only create variables if we need them.
This commit is contained in:
@@ -313,8 +313,6 @@ my.Flot = Backbone.View.extend({
|
|||||||
var points = [];
|
var points = [];
|
||||||
var fieldLabel = self.model.fields.get(field).get('label');
|
var fieldLabel = self.model.fields.get(field).get('label');
|
||||||
|
|
||||||
var raw = _.map(self.model.records.models, function(doc, index){ return doc.getFieldValueUnrendered(xfield) });
|
|
||||||
|
|
||||||
if (isDateTime){
|
if (isDateTime){
|
||||||
var cast = function(x){
|
var cast = function(x){
|
||||||
var _date = moment(String(x));
|
var _date = moment(String(x));
|
||||||
@@ -323,10 +321,17 @@ my.Flot = Backbone.View.extend({
|
|||||||
}
|
}
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
} else if (_.all(raw, function(x){ return !isNaN(parseFloat(x)) })){
|
|
||||||
var cast = function(x){ return parseFloat(x) }
|
|
||||||
} else {
|
} else {
|
||||||
self.xvaluesAreIndex = true
|
var raw = _.map(self.model.records.models,
|
||||||
|
function(doc, index){
|
||||||
|
return doc.getFieldValueUnrendered(xfield)
|
||||||
|
});
|
||||||
|
|
||||||
|
if (_.all(raw, function(x){ return !isNaN(parseFloat(x)) })){
|
||||||
|
var cast = function(x){ return parseFloat(x) }
|
||||||
|
} else {
|
||||||
|
self.xvaluesAreIndex = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(self.model.records.models, function(doc, index) {
|
_.each(self.model.records.models, function(doc, index) {
|
||||||
|
|||||||
Reference in New Issue
Block a user