Created
January 2, 2020 15:49
-
-
Save nautilytics/f0656f261749be4a42d4d75ae8493d83 to your computer and use it in GitHub Desktop.
An example of creating an axis using Angular
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<svg:g class="axis--x"></svg:g> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderXAxis(): void { | |
const elem = this.element.nativeElement.querySelector('.axis--x'); | |
const xAxis = select(elem); | |
this.zone.runOutsideAngular(() => { | |
xAxis | |
.call(axisBottom(this.item.xScale)); | |
}); | |
} | |
ngOnChanges() { | |
this.renderXAxis(); | |
} | |
ngOnInit() { | |
this.renderXAxis(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment