(Finally) deprecate continuousLine option.

This commit is contained in:
Olly Smith 2014-05-05 21:38:29 +01:00
parent 64e5adf0b4
commit 8f8aa35e3b
5 changed files with 5 additions and 27 deletions

View File

@ -11,7 +11,7 @@
</head>
<body>
<h1>Non-continuous data</h1>
<p>Null or missing series values will be skipped when rendering.</p>
<p>Null series values will break the line when rendering, missing values will be skipped</p>
<div id="graph"></div>
<pre id="code" class="prettyprint linenums">
/* data stolen from http://howmanyleft.co.uk/vehicle/jaguar_'e'_type */

View File

@ -34,7 +34,6 @@ class Morris.Line extends Morris.Grid
xLabels: 'auto'
xLabelFormat: null
xLabelMargin: 24
continuousLine: true
hideHover: false
# Do any size-related calculations
@ -120,7 +119,6 @@ class Morris.Line extends Morris.Grid
@paths = for i in [0...@options.ykeys.length]
smooth = if typeof @options.smooth is "boolean" then @options.smooth else @options.ykeys[i] in @options.smooth
coords = ({x: r._x, y: r._y[i]} for r in @data when r._y[i] isnt undefined)
coords = (c for c in coords when c.y isnt null) if @options.continuousLine
if coords.length > 1
Morris.Line.createPath coords, smooth, @bottom

View File

@ -744,7 +744,6 @@ Licensed under the BSD-2-Clause License.
xLabels: 'auto',
xLabelFormat: null,
xLabelMargin: 24,
continuousLine: true,
hideHover: false
};
@ -850,7 +849,7 @@ Licensed under the BSD-2-Clause License.
};
Line.prototype.generatePaths = function() {
var c, coords, i, r, smooth;
var coords, i, r, smooth;
return this.paths = (function() {
var _i, _ref, _ref1, _results;
_results = [];
@ -871,19 +870,6 @@ Licensed under the BSD-2-Clause License.
}
return _results1;
}).call(this);
if (this.options.continuousLine) {
coords = (function() {
var _j, _len, _results1;
_results1 = [];
for (_j = 0, _len = coords.length; _j < _len; _j++) {
c = coords[_j];
if (c.y !== null) {
_results1.push(c);
}
}
return _results1;
})();
}
if (coords.length > 1) {
_results.push(Morris.Line.createPath(coords, smooth, this.bottom));
} else {

4
morris.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -77,7 +77,6 @@ describe 'Morris.Line', ->
labels: ['y', 'z']
lineColors: ['#abcdef', '#fedcba']
smooth: true
continuousLine: false
shouldHavePath = (regex, color = '#abcdef') ->
# Matches an SVG path element within the rendered chart.
@ -104,12 +103,7 @@ describe 'Morris.Line', ->
Morris.Line @defaults
shouldHavePath /M[\d\.]+,[\d\.]+(C[\d\.]+(,[\d\.]+){5}){3}/
it 'should ignore null values when options.continuousLine is true', ->
@defaults.data[2].y = null
Morris.Line $.extend(@defaults, continuousLine: true)
shouldHavePath /M[\d\.]+,[\d\.]+(C[\d\.]+(,[\d\.]+){5}){3}/
it 'should break the line at null values when options.continuousLine is false', ->
it 'should break the line at null values', ->
@defaults.data[2].y = null
Morris.Line @defaults
shouldHavePath /(M[\d\.]+,[\d\.]+C[\d\.]+(,[\d\.]+){5}){2}/