Skip to content

Commit aab1079

Browse files
committed
chore: refactor
1 parent 0797c77 commit aab1079

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/ui-chart/charts/Chart.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export abstract class Chart<U extends Entry, D extends IDataSet<U>, T extends Ch
202202
this.invalidate();
203203
});
204204

205-
this.xAxis = new XAxis();
205+
this.xAxis = new XAxis(new WeakRef(this));
206206

207207
if (Trace.isEnabled()) {
208208
CLog(CLogTypes.log, this.constructor.name, 'init()');

src/ui-chart/components/XAxis.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { AxisBase } from './AxisBase';
22
import { Utils } from '../utils/Utils';
3+
import { Chart } from '../charts/Chart';
34

45
/**
56
* enum for the position of the x-labels relative to the chart
@@ -60,8 +61,8 @@ export class XAxis extends AxisBase {
6061
*/
6162
position = XAxisPosition.TOP;
6263

63-
constructor() {
64-
super();
65-
this.yOffset = 4; // -3
64+
constructor(chart: WeakRef<Chart<any, any, any>>) {
65+
super(chart);
66+
this.yOffset = 4;
6667
}
6768
}

0 commit comments

Comments
 (0)