Skip to content

Commit

Permalink
Migrate to Chart.js v3.0.0-beta.13 (#203, #214, #220, #222)
Browse files Browse the repository at this point in the history
  • Loading branch information
santam85 authored and simonbrunel committed Apr 12, 2021
1 parent 31aa84b commit 4ded4d0
Show file tree
Hide file tree
Showing 67 changed files with 369 additions and 460 deletions.
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
6 changes: 3 additions & 3 deletions docs/guide/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Once loaded, the plugin, available under the global `ChartDataLabels` property,
### Module

```javascript
import Chart from 'chart.js';
import {Chart} from 'chart.js';
import ChartDataLabels from 'chartjs-plugin-datalabels';
```

Expand Down 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
15 changes: 7 additions & 8 deletions docs/samples/advanced/custom-labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,18 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
}
},
scales: {
xAxes: [{
x: {
display: false,
offset: true
}],
yAxes: [{
ticks: {
beginAtZero: true
}
}]
},
y: {
beginAtZero: true
}
}
}
} /* </block:config> */;
Expand Down
3 changes: 2 additions & 1 deletion docs/samples/advanced/multiple-labels.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
},
point: {
hoverRadius: 7,
Expand Down
8 changes: 4 additions & 4 deletions docs/samples/charts/bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ var config = /* <block:config:0> */ {
}
},
scales: {
xAxes: [{
x: {
stacked: true
}],
yAxes: [{
},
y: {
stacked: true
}]
}
}
}
} /* </block:config> */;
Expand Down
7 changes: 4 additions & 3 deletions docs/samples/charts/line.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
}
},
scales: {
yAxes: [{
y: {
stacked: true
}]
}
}
}
} /* </block:config> */;
Expand Down
24 changes: 12 additions & 12 deletions docs/samples/defaults.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import {defaults, helpers} from 'chart.js';
import {defaults} from 'chart.js';

const {merge} = helpers;

merge(defaults.global, {
legend: {
display: false
},
title: {
display: false
},
tooltips: {
enabled: false
defaults.set({
plugins: {
legend: {
display: false
},
title: {
display: false
},
tooltip: {
enabled: false
}
}
});
7 changes: 4 additions & 3 deletions docs/samples/events/highlight.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
}
},
scales: {
yAxes: [{
y: {
stacked: true
}]
}
}
}
} /* </block:config> */;
Expand Down
7 changes: 4 additions & 3 deletions docs/samples/events/listeners.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
}
},
scales: {
yAxes: [{
y: {
stacked: true
}]
}
}
}
} /* </block:config> */;
Expand Down
7 changes: 4 additions & 3 deletions docs/samples/events/selection.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,14 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
}
},
scales: {
yAxes: [{
y: {
stacked: true
}]
}
}
}
} /* </block:config> */;
Expand Down
4 changes: 2 additions & 2 deletions docs/samples/register.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {plugins} from 'chart.js';
import {Chart} from 'chart.js';
import plugin from '../../dist/chartjs-plugin-datalabels.js';

plugins.register(plugin);
Chart.register(plugin);
3 changes: 2 additions & 1 deletion docs/samples/scriptable/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
}
},
}
Expand Down
3 changes: 2 additions & 1 deletion docs/samples/scriptable/dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ var config = /* <block:config:0> */ {
elements: {
line: {
borderWidth: 2,
fill: false
fill: false,
tension: 0.4
}
},
}
Expand Down
3 changes: 2 additions & 1 deletion docs/samples/scriptable/indices.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
}
},
}
Expand Down
7 changes: 4 additions & 3 deletions docs/samples/scriptable/interactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
}
},
scales: {
yAxes: [{
y: {
stacked: true
}]
}
}
}
} // </block:config>
Expand Down
3 changes: 2 additions & 1 deletion docs/samples/scriptable/mirror.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ var config = /* <block:config:0> */ {
},
elements: {
line: {
fill: false
fill: false,
tension: 0.4
},
point: {
hoverRadius: 7,
Expand Down
6 changes: 4 additions & 2 deletions docs/samples/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ function fallback(/* values ... */) {
}
}

var Color = typeof window !== 'undefined' ? window.Color : {};
var Color = typeof window !== 'undefined' && window.Chart !== undefined ?
window.Chart.helpers.color :
function() {};

export var COLORS = [
'#FF3784',
Expand Down Expand Up @@ -75,7 +77,7 @@ export function colors(config) {
var cfg = config || {};
var c = cfg.color || color(0);
var count = cfg.count !== undefined ? cfg.count : 8;
var method = cfg.mode ? Color.prototype[cfg.mode] : null;
var method = cfg.mode ? Color(color)[cfg.mode] : null;
var values = [];
var i, f, v;

Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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',
specs
Expand Down
63 changes: 4 additions & 59 deletions package-lock.json

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

Loading

0 comments on commit 4ded4d0

Please sign in to comment.