Skip to content

Commit

Permalink
(Finally) deprecate continuousLine option.
Browse files Browse the repository at this point in the history
  • Loading branch information
oesmith committed May 5, 2014
1 parent 64e5adf commit 8f8aa35
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 27 deletions.
2 changes: 1 addition & 1 deletion examples/non-continuous.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 0 additions & 2 deletions lib/morris.line.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 1 addition & 15 deletions morris.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,6 @@ Licensed under the BSD-2-Clause License.
xLabels: 'auto',
xLabelFormat: null,
xLabelMargin: 24,
continuousLine: true,
hideHover: false
};

Expand Down Expand Up @@ -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 = [];
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions morris.min.js

Large diffs are not rendered by default.

8 changes: 1 addition & 7 deletions spec/lib/line/line_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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}/
Expand Down

0 comments on commit 8f8aa35

Please sign in to comment.