Skip to content

Commit a99044e

Browse files
committed
Fix elements
1 parent d3a5e93 commit a99044e

File tree

5 files changed

+52
-13
lines changed

5 files changed

+52
-13
lines changed

src/core/core.element.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import {isNumber} from '../helpers/helpers.math';
55

66
class Element {
77

8-
constructor(configuration) {
9-
if (configuration) {
10-
extend(this, configuration);
11-
}
8+
constructor(cfg) {
9+
this.x = undefined;
10+
this.y = undefined;
11+
this.hidden = undefined;
1212

13-
// this.hidden = false; we assume Element has an attribute called hidden, but do not initialize to save memory
13+
if (cfg) {
14+
extend(this, cfg);
15+
}
1416
}
1517

1618
tooltipPosition() {

src/elements/element.arc.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import defaults from '../core/core.defaults';
44
import Element from '../core/core.element';
5+
import {extend} from '../helpers/helpers.core';
56
import {getAngleFromPoint} from '../helpers/helpers.math';
67
const TAU = Math.PI * 2;
78

@@ -92,8 +93,19 @@ function drawBorder(ctx, vm, arc) {
9293

9394
class Arc extends Element {
9495

95-
constructor(props) {
96-
super(props);
96+
constructor(cfg) {
97+
super();
98+
99+
this.options = undefined;
100+
this.circumference = undefined;
101+
this.startAngle = undefined;
102+
this.endAngle = undefined;
103+
this.innerRadius = undefined;
104+
this.outerRadius = undefined;
105+
106+
if (cfg) {
107+
extend(this, cfg);
108+
}
97109
}
98110

99111
inRange(chartX, chartY) {

src/elements/element.line.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import defaults from '../core/core.defaults';
44
import Element from '../core/core.element';
5+
import {extend} from '../helpers/helpers.core';
56
import {_bezierInterpolation, _pointInLine, _steppedInterpolation} from '../helpers/helpers.interpolation';
67
import {_computeSegments, _boundSegments} from '../helpers/helpers.segment';
78
import {_steppedLineTo, _bezierCurveTo} from '../helpers/helpers.canvas';
@@ -192,8 +193,15 @@ function _getInterpolationMethod(options) {
192193

193194
class Line extends Element {
194195

195-
constructor(props) {
196-
super(props);
196+
constructor(cfg) {
197+
super();
198+
199+
this.options = undefined;
200+
this._loop = undefined;
201+
202+
if (cfg) {
203+
extend(this, cfg);
204+
}
197205
}
198206

199207
updateControlPoints(chartArea) {

src/elements/element.point.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,15 @@ defaults._set('elements', {
2222

2323
class Point extends Element {
2424

25-
constructor(props) {
26-
super(props);
25+
constructor(cfg) {
26+
super();
27+
28+
this.options = undefined;
29+
this.skip = undefined;
30+
31+
if (cfg) {
32+
helpers.extend(this, cfg);
33+
}
2734
}
2835

2936
inRange(mouseX, mouseY) {

src/elements/element.rectangle.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,18 @@ function inRange(bar, x, y) {
130130

131131
class Rectangle extends Element {
132132

133-
constructor(props) {
134-
super(props);
133+
constructor(cfg) {
134+
super();
135+
136+
this.options = undefined;
137+
this.horizontal = undefined;
138+
this.base = undefined;
139+
this.width = undefined;
140+
this.height = undefined;
141+
142+
if (cfg) {
143+
helpers.extend(this, cfg);
144+
}
135145
}
136146

137147
draw(ctx) {

0 commit comments

Comments
 (0)