Skip to content

Commit

Permalink
Upgrade to Chart.js 3.0.0-beta.7
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Dec 23, 2020
1 parent b5d7bf7 commit 512df12
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 29 deletions.
26 changes: 14 additions & 12 deletions docs/chartjs-chart-financial.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,22 @@ Chart.defaults.financial = {
}
},

tooltips: {
intersect: false,
mode: 'index',
callbacks: {
label(ctx) {
const point = ctx.dataPoint;

if (!isNullOrUndef(point.y)) {
return Chart.Chart.defaults.tooltips.callbacks.label(ctx);
}
plugins: {
tooltip: {
intersect: false,
mode: 'index',
callbacks: {
label(ctx) {
const point = ctx.dataPoint;

if (!isNullOrUndef(point.y)) {
return Chart.Chart.defaults.interaction.callbacks.label(ctx);
}

const {o, h, l, c} = point;
const {o, h, l, c} = point;

return `O: ${o} H: ${h} L: ${l} C: ${c}`;
return `O: ${o} H: ${h} L: ${l} C: ${c}`;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Financial | Chart.js</title>
<script src="https://cdn.jsdelivr.net/npm/luxon@1.24.1"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0-beta.6/dist/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chart.js@3.0.0-beta.7/dist/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-luxon@0.2.1"></script>
<script src="./chartjs-chart-financial.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="style.css">
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"chartjs-adapter-luxon": "^0.2.2",
"chart.js": "^3.0.0-beta.6",
"chart.js": "^3.0.0-beta.7",
"eslint": "^7.16.0",
"eslint-config-chartjs": "^0.2.0",
"eslint-plugin-es": "^3.0.1",
Expand Down
26 changes: 14 additions & 12 deletions src/controller.financial.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,22 @@ defaults.financial = {
}
},

tooltips: {
intersect: false,
mode: 'index',
callbacks: {
label(ctx) {
const point = ctx.dataPoint;

if (!isNullOrUndef(point.y)) {
return Chart.defaults.tooltips.callbacks.label(ctx);
}
plugins: {
tooltip: {
intersect: false,
mode: 'index',
callbacks: {
label(ctx) {
const point = ctx.dataPoint;

if (!isNullOrUndef(point.y)) {
return Chart.defaults.interaction.callbacks.label(ctx);
}

const {o, h, l, c} = point;
const {o, h, l, c} = point;

return `O: ${o} H: ${h} L: ${l} C: ${c}`;
return `O: ${o} H: ${h} L: ${l} C: ${c}`;
}
}
}
}
Expand Down

0 comments on commit 512df12

Please sign in to comment.