Merge pull request #128 from EverythingMe/fix_visualizations_issues

Several visualizations related fixes.
This commit is contained in:
Arik Fraimovich 2014-03-06 22:09:43 +02:00
commit 5e72cc61b6
4 changed files with 14 additions and 5 deletions

View File

@ -124,7 +124,7 @@
enabled: true,
color: '#000000',
connectorColor: '#000000',
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
format: '<b>{point.name}</b>: {point.y} ({point.percentage:.1f} %)'
}
},
scatter: {

View File

@ -16,7 +16,10 @@ renderers.directive('pivotTableRenderer', function () {
if ($scope.queryResult.getData() == null) {
} else {
$(element).pivotUI($scope.queryResult.getData(), {
// We need to give the pivot table its own copy of the data, because its change
// it which interferes with other visualizations.
var data = $.extend(true, [], $scope.queryResult.getData());
$(element).pivotUI(data, {
renderers: $.pivotUtilities.renderers
}, true);
}

View File

@ -112,9 +112,9 @@
}, true);
}
scope.$watch('visualization.type', function (type) {
scope.$watch('visualization.type', function (type, oldType) {
// if not edited by user, set name to match type
if (type && scope.visualization && !scope.visForm.name.$dirty) {
if (type && oldType != type && scope.visualization && !scope.visForm.name.$dirty) {
// poor man's titlecase
scope.visualization.name = scope.visualization.type[0] + scope.visualization.type.slice(1).toLowerCase();
}

View File

@ -63,8 +63,14 @@
columnDefinition['formatParameter'] = 2;
} else if (moment.isMoment(exampleData)) {
columnDefinition['formatFunction'] = function(value) {
// TODO: this is very hackish way to determine if we need
// to show the value as a time or date only. Better solution
// is to complete #70 and use the information it returns.
if (value._i.match(/^\d{4}-\d{2}-\d{2}T/)) {
return value.format("DD/MM/YY HH:mm");
}
return value.format("DD/MM/YY");
}
}
}