Skip to content

Commit 388796b

Browse files
committed
fix: restore chart visibility and responsive layout
- Resolve rendering bug that caused Line, Bar, and Radar charts to appear blank. - Update integration test snapshots to reflect the corrected and visible charts.
1 parent 94f3f92 commit 388796b

11 files changed

Lines changed: 256 additions & 521 deletions

package-lock.json

Lines changed: 240 additions & 491 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"gulp-rimraf": "^1.0.0",
6464
"gulp-shell": "^0.8.0",
6565
"gulp-sourcemaps": "^3.0.0",
66-
"gulp-tar": "^5.0.0",
66+
"gulp-tar": "^3.1.0",
6767
"gulp-uglify": "^3.0.2",
6868
"karma": "^6.4.4",
6969
"karma-chai": "^0.1.0",

src/angular-chart.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import angular from 'angular';
22
import Chart from 'chart.js';
33

4-
Chart.defaults.global.multiTooltipTemplate =
5-
'<%if (datasetLabel){%><%=datasetLabel%>: <%}%><%= value %>';
6-
Chart.defaults.global.tooltips.mode = 'label';
4+
5+
Chart.defaults.global.tooltips = Chart.defaults.global.tooltips || {};
6+
Chart.defaults.global.tooltips.mode = 'index';
7+
Chart.defaults.global.elements = Chart.defaults.global.elements || {};
8+
Chart.defaults.global.elements.line = Chart.defaults.global.elements.line || {};
79
Chart.defaults.global.elements.line.borderWidth = 2;
10+
Chart.defaults.global.elements.rectangle =
11+
Chart.defaults.global.elements.rectangle || {};
812
Chart.defaults.global.elements.rectangle.borderWidth = 2;
13+
Chart.defaults.global.legend = Chart.defaults.global.legend || {};
914
Chart.defaults.global.legend.display = false;
1015
Chart.defaults.global.colors = [
1116
'#97BBCD', // blue

test/fixtures/29-tabs.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
'use strict';
22

33
const app = angular.module('examples', ['chart.js', 'ui.bootstrap']);
4-
Chart.defaults.global.legend = {
5-
display: false,
6-
};
7-
4+
Chart.defaults.global.legend.display = false;
85
app.controller('TabsCtrl', function($scope) {
96
$scope.labels = [
107
'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',

test/fixtures/51-pie-update-colours.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
'use strict';
22

33
const app = angular.module('pie', ['chart.js']);
4-
Chart.defaults.global.legend = {
5-
display: false,
6-
};
7-
4+
Chart.defaults.global.legend.display = false;
85
app.controller('PieCtrl', ['$scope', '$timeout', function($scope, $timeout) {
96
$scope.labels = ['Series A', 'Series B'];
107
$scope.data = [65, 59];

test/fixtures/54-not-enough-colours.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
'use strict';
22

33
const app = angular.module('pie', ['chart.js']);
4-
Chart.defaults.global.legend = {
5-
display: false,
6-
};
7-
4+
Chart.defaults.global.legend.display = false;
85
app.controller('PieCtrl', ['$scope', function($scope) {
96
let cnt = 0;
107
$scope.colors = [];

test/fixtures/57-hex-colours.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
'use strict';
22

33
const app = angular.module('pie', ['chart.js']);
4-
Chart.defaults.global.legend = {
5-
display: false,
6-
};
7-
4+
Chart.defaults.global.legend.display = false;
85
app.controller('PieCtrl', ['$scope', function($scope) {
96
$scope.labels = ['Series A', 'Series B'];
107
$scope.colors = ['#9AFEFF', '#D1D0CE'];

test/fixtures/charts.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
'use strict';
22

33
const app = angular.module('charts', ['chart.js']);
4-
Chart.defaults.global.legend = {
5-
display: false,
6-
};
4+
Chart.defaults.global.legend.display = false;
75

86
app.controller('LineCtrl', ['$scope', '$timeout', function($scope, $timeout) {
97
$scope.labels = [

test/fixtures/custom-directive.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
'use strict';
22

33
const app = angular.module('pie', ['chart.js']);
4-
Chart.defaults.global.legend = {
5-
display: false,
6-
};
7-
4+
Chart.defaults.global.legend.display = false;
85
app.directive('mySpecialPie', function(ChartJsFactory) {
96
return new ChartJsFactory('pie');
107
});

test/fixtures/horizontal-bar-chart.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
'use strict';
22

33
const app = angular.module('horizontal', ['chart.js']);
4-
Chart.defaults.global.legend = {
5-
display: false,
6-
};
4+
Chart.defaults.global.legend.display = false;
75

86
app.controller('HorizontalBarCtrl', function($scope) {
97
$scope.labels = [

0 commit comments

Comments
 (0)