From 1e65468f33ae01a76db67e03fc9ee11cf57bf093 Mon Sep 17 00:00:00 2001 From: Rufus Pollock Date: Fri, 8 Jun 2012 21:00:29 +0100 Subject: [PATCH] [#151,view/graph,bugfix][xs]: parse string as numbers if we can when plotting them - fixes #151. --- src/view.graph.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/view.graph.js b/src/view.graph.js index c67dc293..9199be0c 100644 --- a/src/view.graph.js +++ b/src/view.graph.js @@ -260,7 +260,10 @@ my.Graph = Backbone.View.extend({ var yfield = self.model.fields.get(field); var y = doc.getFieldValue(yfield); if (typeof x === 'string') { - x = index; + x = parseFloat(x); + if (isNaN(x)) { + x = index; + } } // horizontal bar chart if (self.state.attributes.graphType == 'bars') {