-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
365 additions
and
309 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Empty file.
81 changes: 81 additions & 0 deletions
81
examples/angular/src/app/who-graphs/head-circumference/head-circumference.component.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { AfterViewInit, Component, ElementRef, ViewChild } from '@angular/core'; | ||
import { LineGraphDrawing } from '@ekisa-cdk/graph-drawing'; | ||
|
||
@Component({ | ||
selector: 'app-head-circumference', | ||
template: ` | ||
<div #graphContainer></div> | ||
<button (click)="clearNodes()">Clear nodes</button> | ||
<button (click)="loadCoordinates()">Load coordinates</button> | ||
<button (click)="getCoordinates()">Get coordinates</button> | ||
`, | ||
styleUrls: ['./head-circumference.component.css'], | ||
}) | ||
export class HeadCircumferenceComponent implements AfterViewInit { | ||
@ViewChild('graphContainer') graphContainer!: ElementRef<HTMLDivElement>; | ||
|
||
private _graphApi!: LineGraphDrawing; | ||
|
||
private _initialized = false; | ||
|
||
ngAfterViewInit(): void { | ||
this._renderGraph(); | ||
} | ||
|
||
clearNodes() { | ||
if (this._initialized) { | ||
this._graphApi.getNodes()?.forEach((node) => { | ||
node.remove(); | ||
this._graphApi.redraw(); | ||
}); | ||
} | ||
} | ||
|
||
getCoordinates() { | ||
const coordinates = this._graphApi.getCoordinates(); | ||
console.log(coordinates); | ||
alert('Check the console'); | ||
} | ||
|
||
loadCoordinates() { | ||
const coordinates = [ | ||
{ x: 172, y: 366, order: 2 }, | ||
{ x: 291, y: 31, order: 3 }, | ||
{ x: 426, y: 364, order: 4 }, | ||
{ x: 99, y: 156, order: 5 }, | ||
]; | ||
|
||
this._graphApi.loadCoordinates(coordinates); | ||
} | ||
|
||
private _renderGraph() { | ||
this._graphApi = new LineGraphDrawing({ | ||
canDrawLines: false, | ||
canRemoveNodes: true, | ||
}) | ||
.mountScopedFrame({ | ||
image: { | ||
src: 'https://media.cheggcdn.com/media/3bc/3bc5fc99-47c7-44a9-aadb-1f778be80537/phpCYM9Kd.png', | ||
alt: 'Head circumference for age chart', | ||
objectFit: 'fill', | ||
}, | ||
svg: { | ||
width: '962px', | ||
heigth: '589px', | ||
top: '115px', | ||
left: '104px', | ||
}, | ||
style: { | ||
width: '1200px', | ||
heigth: '800px', | ||
}, | ||
}) | ||
.startProcess(); | ||
|
||
const container = this._graphApi.getContainerElement(); | ||
this._initialized = true; | ||
|
||
container && this.graphContainer.nativeElement.append(container); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
examples/angular/src/app/who-graphs/who-graphs-routing.module.ts
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
import { HeadCircumferenceComponent } from './head-circumference/head-circumference.component'; | ||
import { WhoGraphsComponent } from './who-graphs.component'; | ||
|
||
const routes: Routes = [ | ||
{ path: '', component: WhoGraphsComponent }, | ||
{ path: 'head-circumference', component: HeadCircumferenceComponent }, | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule], | ||
}) | ||
export class WhoGraphsRoutingModule {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
template: ` <a [routerLink]="['head-circumference']">Head circumference</a> `, | ||
}) | ||
export class WhoGraphsComponent {} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { NgModule } from '@angular/core'; | ||
import { HeadCircumferenceComponent } from './head-circumference/head-circumference.component'; | ||
import { WhoGraphsRoutingModule } from './who-graphs-routing.module'; | ||
import { WhoGraphsComponent } from './who-graphs.component'; | ||
|
||
@NgModule({ | ||
declarations: [WhoGraphsComponent, HeadCircumferenceComponent], | ||
imports: [CommonModule, WhoGraphsRoutingModule], | ||
}) | ||
export class WhoGraphsModule {} |
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
2 changes: 1 addition & 1 deletion
2
...lib/graph-drawing/graph-drawing.config.ts → ...src/graph-drawing/graph-drawing.config.ts
This file contains 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
This file contains 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
This file contains 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
File renamed without changes.
Oops, something went wrong.