[#151,view/graph,bugfix][xs]: parse string as numbers if we can when plotting them - fixes #151.

This commit is contained in:
Rufus Pollock
2012-06-08 21:00:29 +01:00
parent 20191bf9fa
commit 1e65468f33

View File

@@ -260,8 +260,11 @@ my.Graph = Backbone.View.extend({
var yfield = self.model.fields.get(field); var yfield = self.model.fields.get(field);
var y = doc.getFieldValue(yfield); var y = doc.getFieldValue(yfield);
if (typeof x === 'string') { if (typeof x === 'string') {
x = parseFloat(x);
if (isNaN(x)) {
x = index; x = index;
} }
}
// horizontal bar chart // horizontal bar chart
if (self.state.attributes.graphType == 'bars') { if (self.state.attributes.graphType == 'bars') {
points.push([y, x]); points.push([y, x]);