Skip to content

Commit

Permalink
Add tsconfig and plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
benmccann committed Feb 1, 2020
1 parent 9701fac commit 5adf5ea
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 14 deletions.
32 changes: 27 additions & 5 deletions src/plugins/plugin.legend.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,41 @@ class Legend extends Element {
constructor(config) {
super();

const me = this;
helpers.extend(me, config);
helpers.extend(this, config);

// Contains hit boxes for each dataset (in dataset order)
me.legendHitBoxes = [];
this.legendHitBoxes = [];

/**
* @private
*/
me._hoveredItem = null;
this._hoveredItem = null;

// Are we in doughnut mode which has a different data type
me.doughnutMode = false;
this.doughnutMode = false;

this.chart = undefined;
this.options = undefined;
this.ctx = undefined;
this.legendItems = undefined;
this.columnWidths = undefined;
this.columnHeights = undefined;
this.lineWidths = undefined;
this._minSize = undefined;
this.minSize = undefined;
this.maxHeight = undefined;
this.maxWidth = undefined;
this.top = undefined;
this.bottom = undefined;
this.left = undefined;
this.right = undefined;
this.height = undefined;
this.width = undefined;
this.margins = undefined;
this.paddingTop = undefined;
this.paddingBottom = undefined;
this.paddingLeft = undefined;
this.paddingRight = undefined;
}

// These methods are ordered by lifecycle. Utilities then follow.
Expand Down
20 changes: 15 additions & 5 deletions src/plugins/plugin.title.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ class Title extends Element {
constructor(config) {
super();

var me = this;
helpers.extend(me, config);

// Contains hit boxes for each dataset (in dataset order)
me.legendHitBoxes = [];
helpers.extend(this, config);

this.options = undefined;
this.ctx = undefined;
this.margins = undefined;
this._padding = undefined;
this.legendHitBoxes = []; // Contains hit boxes for each dataset (in dataset order)
this.top = undefined;
this.bottom = undefined;
this.left = undefined;
this.right = undefined;
this.width = undefined;
this.height = undefined;
this.maxWidth = undefined;
this.maxHeight = undefined;
}

// These methods are ordered by lifecycle. Utilities then follow.
Expand Down
29 changes: 25 additions & 4 deletions src/plugins/plugin.tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,31 @@ class Tooltip extends Element {
constructor(config) {
super(config);

const me = this;
me.opacity = 0;
me._active = [];
me.initialize();
this.opacity = 0;
this._active = [];
this._chart = undefined;
this._eventPosition = undefined;
this._size = undefined;
this._cachedAnimations = undefined;
this.$animations = undefined;
this.options = undefined;
this.dataPoints = undefined;
this.title = undefined;
this.beforeBody = undefined;
this.body = undefined;
this.afterBody = undefined;
this.footer = undefined;
this.xAlign = undefined;
this.yAlign = undefined;
this.x = undefined;
this.y = undefined;
this.height = undefined;
this.width = undefined;
this.caretX = undefined;
this.labelColors = undefined;
this.labelTextColors = undefined;

this.initialize();
}

initialize() {
Expand Down
12 changes: 12 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES6",
"allowJs": true,
"checkJs": true,
"noEmit": true,
"outDir": "./dist"
},
"include": [
"./src/**/*.js"
]
}

0 comments on commit 5adf5ea

Please sign in to comment.