Skip to content

Commit fae6e80

Browse files
Merge pull request #73 from dtaylor113/issue72
This fixes #61 and fixes #72
2 parents 3dc3b6f + 3d824a7 commit fae6e80

File tree

8 files changed

+21
-19
lines changed

8 files changed

+21
-19
lines changed

dist/angular-patternfly.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ angular.module('patternfly.charts').directive('pfDonutPctChart', ["c3ChartDefaul
787787
$scope.config.tooltip = donutTooltip(scope);
788788
};
789789

790-
$scope.config = $.extend(true, c3ChartDefaults.getDefaultDonutConfig(), $scope.config);
790+
$scope.config = angular.merge({}, c3ChartDefaults.getDefaultDonutConfig(), $scope.config);
791791
$scope.updateAll($scope);
792792
}
793793
],
@@ -867,6 +867,7 @@ angular.module('patternfly.charts').directive('pfDonutPctChart', ["c3ChartDefaul
867867
* <ul style='list-style-type: none'>
868868
* <li>.xData - Array, X values for the data points, first element must be the name of the data
869869
* <li>.yData - Array, Y Values for the data points, first element must be the name of the data
870+
* <li>.total - (optional) The Total amount, used when determining percentages
870871
* </ul>
871872
*
872873
* @param {int=} chartHeight height of the sparkline chart
@@ -1121,7 +1122,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
11211122
$scope.defaultConfig.units = '';
11221123

11231124
// Override defaults with callers specifications
1124-
$scope.config = $.extend(true, angular.copy($scope.defaultConfig), $scope.config);
1125+
$scope.config = angular.merge({},$scope.defaultConfig, $scope.config);
11251126

11261127
// Convert the given data to C3 chart format
11271128
$scope.config.data = $scope.getSparklineData($scope.chartData);
@@ -1130,7 +1131,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', ["c3ChartDefau
11301131

11311132
link: function (scope) {
11321133
scope.$watch('config', function () {
1133-
scope.config = $.extend(true, angular.copy(scope.defaultConfig), scope.config);
1134+
scope.config = angular.merge({}, scope.defaultConfig, scope.config);
11341135
}, true);
11351136
scope.$watch('chartHeight', function () {
11361137
scope.config.size.height = scope.chartHeight;
@@ -1674,7 +1675,7 @@ angular.module('patternfly.filters').directive('pfSimpleFilter',
16741675
};
16751676

16761677
$scope.setupConfig = function () {
1677-
$scope.config = $.extend(true, angular.copy(defaultConfig), $scope.config);
1678+
$scope.config = angular.merge({}, defaultConfig, $scope.config);
16781679

16791680
if (!$scope.currentField) {
16801681
$scope.currentField = $scope.config.fields[0];
@@ -2998,7 +2999,7 @@ angular.module('patternfly.views').directive('pfDataList', [
29982999
onDblClick: null
29993000
};
30003001

3001-
$scope.config = $.extend(true, angular.copy($scope.defaultConfig), $scope.config);
3002+
$scope.config = angular.merge({}, $scope.defaultConfig, $scope.config);
30023003
if ($scope.config.selectItems && $scope.config.showSelectBox) {
30033004
throw new Error('pfDataList - ' +
30043005
'Illegal use of pfDataList directive! ' +
@@ -3009,7 +3010,7 @@ angular.module('patternfly.views').directive('pfDataList', [
30093010

30103011
link: function (scope, element, attrs) {
30113012
attrs.$observe('config', function () {
3012-
scope.config = $.extend(true, angular.copy(scope.defaultConfig), scope.config);
3013+
scope.config = angular.merge({}, scope.defaultConfig, scope.config);
30133014
if (!scope.config.selectItems) {
30143015
scope.config.selectedItems = [];
30153016
}
@@ -3324,7 +3325,7 @@ angular.module('patternfly.views').directive('pfDataTiles', [
33243325
onDblClick: null
33253326
};
33263327

3327-
$scope.config = $.extend(true, angular.copy($scope.defaultConfig), $scope.config);
3328+
$scope.config = angular.merge({}, $scope.defaultConfig, $scope.config);
33283329
if ($scope.config.selectItems && $scope.config.showSelectBox) {
33293330
throw new Error('pfDataTiles - ' +
33303331
'Illegal use of pfDataTiles directive! ' +
@@ -3333,7 +3334,7 @@ angular.module('patternfly.views').directive('pfDataTiles', [
33333334
}],
33343335
link: function (scope, element, attrs) {
33353336
attrs.$observe('config', function () {
3336-
scope.config = $.extend(true, angular.copy(scope.defaultConfig), scope.config);
3337+
scope.config = angular.merge({}, scope.defaultConfig, scope.config);
33373338
if (!scope.config.selectItems) {
33383339
scope.config.selectedItems = [];
33393340
}

dist/angular-patternfly.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/charts/donut/donut-pct-chart-directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ angular.module('patternfly.charts').directive('pfDonutPctChart', function (c3Cha
331331
$scope.config.tooltip = donutTooltip(scope);
332332
};
333333

334-
$scope.config = $.extend(true, c3ChartDefaults.getDefaultDonutConfig(), $scope.config);
334+
$scope.config = angular.merge({}, c3ChartDefaults.getDefaultDonutConfig(), $scope.config);
335335
$scope.updateAll($scope);
336336
}
337337
],

src/charts/sparkline/sparkline-chart.directive.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
* <ul style='list-style-type: none'>
3333
* <li>.xData - Array, X values for the data points, first element must be the name of the data
3434
* <li>.yData - Array, Y Values for the data points, first element must be the name of the data
35+
* <li>.total - (optional) The Total amount, used when determining percentages
3536
* </ul>
3637
*
3738
* @param {int=} chartHeight height of the sparkline chart
@@ -286,7 +287,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', function (c3Ch
286287
$scope.defaultConfig.units = '';
287288

288289
// Override defaults with callers specifications
289-
$scope.config = $.extend(true, angular.copy($scope.defaultConfig), $scope.config);
290+
$scope.config = angular.merge({},$scope.defaultConfig, $scope.config);
290291

291292
// Convert the given data to C3 chart format
292293
$scope.config.data = $scope.getSparklineData($scope.chartData);
@@ -295,7 +296,7 @@ angular.module('patternfly.charts').directive('pfSparklineChart', function (c3Ch
295296

296297
link: function (scope) {
297298
scope.$watch('config', function () {
298-
scope.config = $.extend(true, angular.copy(scope.defaultConfig), scope.config);
299+
scope.config = angular.merge({}, scope.defaultConfig, scope.config);
299300
}, true);
300301
scope.$watch('chartHeight', function () {
301302
scope.config.size.height = scope.chartHeight;

src/filters/simple-filter-directive.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ angular.module('patternfly.filters').directive('pfSimpleFilter',
186186
};
187187

188188
$scope.setupConfig = function () {
189-
$scope.config = $.extend(true, angular.copy(defaultConfig), $scope.config);
189+
$scope.config = angular.merge({}, defaultConfig, $scope.config);
190190

191191
if (!$scope.currentField) {
192192
$scope.currentField = $scope.config.fields[0];

src/views/datalist/data-list-directive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ angular.module('patternfly.views').directive('pfDataList', [
222222
onDblClick: null
223223
};
224224

225-
$scope.config = $.extend(true, angular.copy($scope.defaultConfig), $scope.config);
225+
$scope.config = angular.merge({}, $scope.defaultConfig, $scope.config);
226226
if ($scope.config.selectItems && $scope.config.showSelectBox) {
227227
throw new Error('pfDataList - ' +
228228
'Illegal use of pfDataList directive! ' +
@@ -233,7 +233,7 @@ angular.module('patternfly.views').directive('pfDataList', [
233233

234234
link: function (scope, element, attrs) {
235235
attrs.$observe('config', function () {
236-
scope.config = $.extend(true, angular.copy(scope.defaultConfig), scope.config);
236+
scope.config = angular.merge({}, scope.defaultConfig, scope.config);
237237
if (!scope.config.selectItems) {
238238
scope.config.selectedItems = [];
239239
}

src/views/datatiles/data-tiles-directive.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ angular.module('patternfly.views').directive('pfDataTiles', [
219219
onDblClick: null
220220
};
221221

222-
$scope.config = $.extend(true, angular.copy($scope.defaultConfig), $scope.config);
222+
$scope.config = angular.merge({}, $scope.defaultConfig, $scope.config);
223223
if ($scope.config.selectItems && $scope.config.showSelectBox) {
224224
throw new Error('pfDataTiles - ' +
225225
'Illegal use of pfDataTiles directive! ' +
@@ -228,7 +228,7 @@ angular.module('patternfly.views').directive('pfDataTiles', [
228228
},
229229
link: function (scope, element, attrs) {
230230
attrs.$observe('config', function () {
231-
scope.config = $.extend(true, angular.copy(scope.defaultConfig), scope.config);
231+
scope.config = angular.merge({}, scope.defaultConfig, scope.config);
232232
if (!scope.config.selectItems) {
233233
scope.config.selectedItems = [];
234234
}

test/charts/sparkline/sparkline-chart.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('Directive: pfSparklineChart', function() {
105105

106106
expect(isolateScope.config.data.x).toBe("dates");
107107
expect(isolateScope.config.data.columns.length).toBe(2);
108-
expect(isolateScope.config.data.columns[0][1]).toBe($scope.data.xData[1]);
108+
expect(isolateScope.config.data.columns[0][1].toString()).toBe($scope.data.xData[1].toString());
109109
expect(isolateScope.config.data.columns[1][1]).toBe('10');
110110

111111
var now = new Date();
@@ -114,7 +114,7 @@ describe('Directive: pfSparklineChart', function() {
114114

115115
$scope.$digest();
116116

117-
expect(isolateScope.config.data.columns[0][1]).toBe(now);
117+
expect(isolateScope.config.data.columns[0][1].toString()).toBe(now.toString());
118118
expect(isolateScope.config.data.columns[1][1]).toBe('1000');
119119
});
120120

0 commit comments

Comments
 (0)