Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for empty data series in multiline chart #483

Merged
merged 1 commit into from
Aug 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/js/misc/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function process_line(args) {
) {
for (var i = 0; i < args.data.length; i++) {
//we need to have a dataset of length > 2, so if it's less than that, skip
if (args.data[i].length == 1) {
if (args.data[i].length <= 1) {
continue;
}

Expand Down
16 changes: 15 additions & 1 deletion tests/charts/line_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,18 @@ test('Only one line legend is added on multiple calls to the same target element
MG.data_graphic(MG.clone(params));

equal(document.querySelectorAll('.mg-line-legend').length, 1, 'We only have one mg-line-legend');
});
});

test('When 1 data series is empty (out of 2) and missing_is_zero is true, remaining line is rendered', function() {
var data = [];
data[0] = [];
data[1] = [{'date': new Date('2015-03-07'), 'value': 23000},{'date': new Date('2015-03-08'), 'value': 20000}];

MG.data_graphic({
target: '#qunit-fixture',
data: data,
missing_is_zero: true
});

equal(document.querySelectorAll('.mg-main-line').length, 1, 'Line for non-empty data series is still rendered');
});