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

Migrate to Chart.js v3.0.0-beta.7 #203

Merged
merged 27 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
920da1d
migrate to chart.js 3
sgratzl May 23, 2020
59222ae
work on migrating examples
sgratzl May 23, 2020
224cfed
fix interaction
sgratzl May 23, 2020
94dc1e6
fix detection of animation in progress
sgratzl May 23, 2020
5a6605f
fix typo
sgratzl May 23, 2020
293949a
work on fixing tests
sgratzl May 23, 2020
4d79aaf
porting to CHART.JS 3 (dist/master) distribution
stockiNail Oct 24, 2020
fead5bd
fallback using getProps of elements
stockiNail Oct 26, 2020
d17b526
Updated chart.js to 3.0.0-beta.6 (fixes all unit tests)
santam85 Oct 28, 2020
5fdefe2
Address PR comments by @kurkle
santam85 Nov 11, 2020
f91571b
Removed ES6 features from library code
santam85 Nov 12, 2020
6c6abc2
Removed destructuring assignments
santam85 Nov 12, 2020
765840e
Started addressing PR comments
santam85 Nov 16, 2020
7c76d61
Updated chart.js to 3.0.0-beta.6 (fixes all unit tests)
santam85 Oct 28, 2020
1027d73
Address PR comments
santam85 Nov 11, 2020
b527717
Updated package-lock.json
santam85 Nov 17, 2020
df984e8
Avoid using deep imports
santam85 Nov 18, 2020
2159945
More PR comments
santam85 Nov 19, 2020
80a1701
Updated package-lock.json to match target branch.
santam85 Nov 20, 2020
fbc67f3
Reverted unneeded changes from previous PRs
santam85 Nov 23, 2020
f52ba59
Update tooltip configuration
santam85 Dec 2, 2020
d32f102
Updated to beta.7
santam85 Dec 8, 2020
a7db963
Indentation fix
santam85 Dec 8, 2020
4a40ccc
Workaround for legend bug
santam85 Dec 8, 2020
4ca335e
Linting
santam85 Dec 9, 2020
a15f1f9
Fix samples and TS indentation
simonbrunel Dec 9, 2020
cf50dbc
Use `<plugin>.display: false` so it can be overridden in each test
simonbrunel Dec 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.idea
.vscode/
bower.json
cc-test-reporter
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ The [plugin options](options.md) can be changed at 3 different levels and are ev

- per dataset: `dataset.datalabels.*`
- per chart: `options.plugins.datalabels.*`
- or globally: `Chart.defaults.global.plugins.datalabels.*`
- or globally: `Chart.defaults.plugins.datalabels.*`

For example:

```javascript
// Change default options for ALL charts
Chart.helpers.merge(Chart.defaults.global.plugins.datalabels, {
Chart.defaults.set('plugins.datalabels', {
color: '#FE777B'
});

Expand Down
8 changes: 4 additions & 4 deletions docs/guide/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ The following table lists all available options:
| `borderWidth` | `number` | Yes | Yes | `0`
| [`clamp`](positioning.md#clamping) | `boolean` | Yes | Yes | `false`
| [`clip`](positioning.md#clipping) | `boolean` | Yes | Yes | `false`
| `color` | [`Style`](#style-options) | Yes | Yes | [`defaultFontColor`](http://www.chartjs.org/docs/latest/general/fonts.html)
| `color` | [`Style`](#style-options) | Yes | Yes | [`color`](http://www.chartjs.org/docs/latest/general/fonts.html)
| [`display`](positioning.md#visibility) | `boolean` \| `string` | Yes | Yes | `true`
| `font` | `object` | Yes | Yes | -
| `font.family` | `string` | - | - | [`defaultFontFamily`](http://www.chartjs.org/docs/latest/general/fonts.html)
| `font.size` | `string` | - | - | [`defaultFontSize`](http://www.chartjs.org/docs/latest/general/fonts.html)
| `font.style` | `string` | - | - | [`defaultFontStyle`](http://www.chartjs.org/docs/latest/general/fonts.html)
| `font.family` | `string` | - | - | [`font.family`](http://www.chartjs.org/docs/latest/general/fonts.html)
| `font.size` | `string` | - | - | [`font.size`](http://www.chartjs.org/docs/latest/general/fonts.html)
| `font.style` | `string` | - | - | [`font.style`](http://www.chartjs.org/docs/latest/general/fonts.html)
| `font.weight` | `string` | - | - | `'normal'`
| [`font.lineHeight`](formatting.md#multiline-labels) | `number` \| `string` | - | - | `1.2`
| [`formatter`](formatting.md#data-transformation) | `function` \| `null` | - | - | -
Expand Down
2 changes: 1 addition & 1 deletion karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = function(karma) {
files: [
{pattern: './test/fixtures/**/*.js', included: false},
{pattern: './test/fixtures/**/*.png', included: false},
'node_modules/chart.js/dist/Chart.js',
'node_modules/chart.js/dist/chart.js',
'test/index.js',
'src/plugin.js'
].concat(args.inputs),
Expand Down
52 changes: 4 additions & 48 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
"types/*.d.ts"
],
"devDependencies": {
"@types/chart.js": "^2.9.27",
"@vuepress/plugin-google-analytics": "^1.7.1",
"chart.js": "~2.8.0",
"chart.js": "^3.0.0-beta.7",
"eslint-config-chartjs": "^0.1.0",
"eslint-plugin-es": "^3.0.1",
"eslint-plugin-html": "^6.1.1",
Expand Down Expand Up @@ -53,6 +52,6 @@
"yargs": "^16.1.0"
},
"peerDependencies": {
"chart.js": ">= 2.7.0 < 3"
"chart.js": "^3.0.0-beta.7"
}
}
23 changes: 11 additions & 12 deletions samples/advanced/custom-labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../style.css">
<link rel="icon" type="image/ico" href="../favicon.ico">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0-beta.7"></script>
<script src="../../dist/chartjs-plugin-datalabels.js"></script>
<script src="../utils.js"></script>
</head>
Expand Down Expand Up @@ -44,22 +44,23 @@

Samples.srand(0);

Chart.helpers.merge(Chart.defaults.global, {
Chart.defaults.set({
aspectRatio: 4 / 3,
tooltips: false,
layout: {
padding: {
top: 32
}
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
simonbrunel marked this conversation as resolved.
Show resolved Hide resolved
}
},
plugins: {
legend: false,
title: false
title: false,
tooltip: false
}
});
</script>
Expand Down Expand Up @@ -98,15 +99,13 @@
}
},
scales: {
xAxes: [{
x: {
display: false,
offset: true
}],
yAxes: [{
ticks: {
beginAtZero: true
}
}]
},
y: {
beginAtZero: true
}
}
}
});
Expand Down
11 changes: 6 additions & 5 deletions samples/advanced/multiple-labels.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../style.css">
<link rel="icon" type="image/ico" href="../favicon.ico">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.7.0/dist/Chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0-beta.7"></script>
<script src="../../dist/chartjs-plugin-datalabels.js"></script>
<script src="../utils.js"></script>
</head>
Expand Down Expand Up @@ -43,9 +43,8 @@

Samples.srand(4);

Chart.helpers.merge(Chart.defaults.global, {
Chart.defaults.set({
aspectRatio: 4 / 3,
tooltips: false,
layout: {
padding: {
top: 42,
Expand All @@ -56,7 +55,8 @@
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
},
point: {
hoverRadius: 7,
Expand All @@ -65,7 +65,8 @@
},
plugins: {
legend: false,
title: false
title: false,
tooltip: false
}
});
</script>
Expand Down
16 changes: 8 additions & 8 deletions samples/charts/bar.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../style.css">
<link rel="icon" type="image/ico" href="../favicon.ico">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0-beta.7"></script>
<script src="../../dist/chartjs-plugin-datalabels.js"></script>
<script src="../utils.js"></script>
</head>
Expand Down Expand Up @@ -41,9 +41,8 @@
labels.push('' + i);
}

Chart.helpers.merge(Chart.defaults.global, {
Chart.defaults.set({
aspectRatio: 4 / 3,
tooltips: false,
layout: {
padding: {
top: 42,
Expand All @@ -63,7 +62,8 @@
},
plugins: {
legend: false,
title: false
title: false,
tooltip: false
}
});
</script>
Expand Down Expand Up @@ -122,12 +122,12 @@
}
},
scales: {
xAxes: [{
x: {
stacked: true
}],
yAxes: [{
},
y: {
stacked: true
}]
}
}
}
});
Expand Down
8 changes: 4 additions & 4 deletions samples/charts/bubble.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../style.css">
<link rel="icon" type="image/ico" href="../favicon.ico">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0-beta.7"></script>
<script src="../../dist/chartjs-plugin-datalabels.js"></script>
<script src="../utils.js"></script>
</head>
Expand Down Expand Up @@ -53,9 +53,8 @@
return data;
}

Chart.helpers.merge(Chart.defaults.global, {
Chart.defaults.set({
aspectRatio: 1,
tooltips: false,
layout: {
padding: {
top: 42,
Expand All @@ -76,7 +75,8 @@
},
plugins: {
legend: false,
title: false
title: false,
tooltip: false
}
});
</script>
Expand Down
8 changes: 4 additions & 4 deletions samples/charts/doughnut.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../style.css">
<link rel="icon" type="image/ico" href="../favicon.ico">
<script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0-beta.7"></script>
<script src="../../dist/chartjs-plugin-datalabels.js"></script>
<script src="../utils.js"></script>
</head>
Expand Down Expand Up @@ -41,9 +41,8 @@
labels.push('' + i);
}

Chart.helpers.merge(Chart.defaults.global, {
Chart.defaults.set({
maintainAspectRatio: false,
tooltips: false,
layout: {
padding: 32
},
Expand All @@ -58,7 +57,8 @@
},
plugins: {
legend: false,
title: false
title: false,
tooltip: false
}
});
</script>
Expand Down
Loading