Skip to content

Commit

Permalink
Merge pull request #2 from kingcocomango/master
Browse files Browse the repository at this point in the history
Disables label tooltip for innerlabels, and added minlabel count
  • Loading branch information
face authored Jul 27, 2018
2 parents affbd81 + 513452b commit e72848f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/classes.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export default {

this.update = function(view, elements, max) {
let innerLabel = el._model.circumference > 0.5;
this.isInner = innerLabel;
this.center = positioners.center(view, this.stretch, innerLabel);
this.moveLabelToOffset();

Expand Down
4 changes: 2 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Chart.plugins.register({
x: event.x,
y: event.y,
});
if (within) {
if (within && !elems[i].$outlabels.isInner) {
center = elems[i].$outlabels.center;
const index = elems[i]._index;
data = chart.data.labels[index];
Expand Down Expand Up @@ -93,7 +93,7 @@ Chart.plugins.register({
percent = dataset.data[i] / args.meta.total;
newLabel = null;

if (display && el && !el.hidden && el._model.circumference > options.tooltipCutoff) {
if (display && el && !el.hidden && (el._model.circumference > options.tooltipCutoff || i < options.minLabels)) {
try {
context = {
chart: chart,
Expand Down

0 comments on commit e72848f

Please sign in to comment.