Commit 382ad5e2 authored by Yong Liu's avatar Yong Liu

This commit fixes #2729, spiderwidget will handle missing points.

parent c3aa434d
......@@ -131,15 +131,20 @@ var Chart = (function (Highcharts, $, _) {
item = {
'name': memberLabel,
'pointPlacement': 'on'
},
counter = 0;
item.data = _.map(valueObject.value, function (datum) {
var referenceValue = referenceValueObject.value[counter].value,
difference = calculateDifference(datum.value, referenceValue),
hash = {'y': difference, 'value': datum.value};
counter += 1;
};
item.data = _.map(referenceValueObject.value, function (ref) {
var referenceValue = ref.value,
difference,
hash,
datum = _.first(_.filter(valueObject.value, function (value) {
return value.id === ref.id;
}));
if (datum === undefined) {
return null;
}
difference = calculateDifference(datum.value, referenceValue);
hash = {'y': difference, 'value': datum.value};
return hash;
});
return item;
......
......@@ -26,12 +26,16 @@ var Table = (function (_) {
buildSingleRow = function (data, valueIndex) {
var rowLabelCell = {'label': getLabelForCurrentRow(data, valueIndex)},
cells = _.map(data.values, function (item) {
var cell = {};
cell.label = item.value[valueIndex].value;
return cell;
});
cells = _.chain(data.values).map(function (item) {
return _.filter(item.value, function (subitem) {
return subitem.id === data.measures[valueIndex].id;
});
}).map(function (item) {
if (item.length > 0) {
return {label : item[0].value };
}
return {label : ""};
}).value();
cells.unshift(rowLabelCell);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment