Skip to content
This repository was archived by the owner on Nov 25, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions src/plugin/hierarchical.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,20 @@ const HierarchicalPlugin = {

_isValidScaleType(chart, scale) {
const scales = chart.config.options.scales;
if (!scales.hasOwnProperty(scale)) {
if (!Object.hasOwnProperty.call(scales, scale)) {
return false;
}
if (!Array.isArray(scales[scale])) {
return false;
}
return scales[scale][0].hasOwnProperty('type');
return Object.hasOwnProperty.call(scales[scale][0], 'type');
},

/**
* checks whether this plugin needs ot be enabled based on wehther one is a hierarchical axis
*/
_enabled(chart) {
if (!chart.config.options.hasOwnProperty('scales')) {
if (!Object.hasOwnProperty.call(chart.config.options, 'scales')) {
return null;
}
if (this._isValidScaleType(chart, 'xAxes') && chart.config.options.scales.xAxes[0].type === 'hierarchical') {
Expand Down Expand Up @@ -134,7 +134,7 @@ const HierarchicalPlugin = {
chart.data.datasets.forEach((d) => {
const v = nodes.map((n) => {
while (n) {
if (n.hasOwnProperty(attr)) {
if (Object.hasOwnProperty.call(n, attr)) {
return n[attr];
}
// walk up the hierarchy
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export function resolve(label, flat, dataTree) {

const value = dataParents[dataParents.length - 1];
// convert to value
if (typeof value !== 'number' && value.hasOwnProperty('value')) {
if (typeof value !== 'number' && Object.hasOwnProperty.call(value, 'value')) {
return value.value;
}
return value;
Expand Down