mirror of
https://github.com/morrisjs/morris.js.git
synced 2024-11-10 21:36:34 +01:00
Fix string values.
This commit is contained in:
parent
aa67b1a305
commit
79575dce97
@ -87,7 +87,10 @@ class Morris.Line
|
||||
for ykey in @options.ykeys
|
||||
series_data = []
|
||||
for d in @options.data
|
||||
series_data.push(if typeof d[ykey] == 'number' then d[ykey] else null)
|
||||
series_data.push switch typeof d[ykey]
|
||||
when 'number' then d[ykey]
|
||||
when 'string' then parseFloat(d[ykey])
|
||||
else null
|
||||
@series.push(series_data)
|
||||
|
||||
# translate x labels into nominal dates
|
||||
|
11
morris.js
11
morris.js
@ -97,7 +97,16 @@
|
||||
_ref1 = this.options.data;
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
d = _ref1[_j];
|
||||
series_data.push(typeof d[ykey] === 'number' ? d[ykey] : null);
|
||||
series_data.push((function() {
|
||||
switch (typeof d[ykey]) {
|
||||
case 'number':
|
||||
return d[ykey];
|
||||
case 'string':
|
||||
return parseFloat(d[ykey]);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
})());
|
||||
}
|
||||
this.series.push(series_data);
|
||||
}
|
||||
|
2
morris.min.js
vendored
2
morris.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user