Repository navigation
Expand file tree
/
Copy pathapp.component.html
More file actions
71 lines (71 loc) · 2.88 KB
/
Copy pathapp.component.html
File metadata and controls
71 lines (71 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<h1>
<img height="48" alt="Angular Logo" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
Plotly.js for Angular
</h1>
</div>
<mat-tab-group>
<mat-tab label="Basic">
<!-- lazy-loading tab fixes initial Plotly sizing issue -->
<ng-template matTabContent>
<section>
<p>
Default layout and config
</p>
<div class="buttons">
<button mat-raised-button color="primary"
(click)="addRandomY()">
Add Point
</button>
<button mat-raised-button color="primary"
(click)="addTrace()">
Add Trace
</button>
<button mat-raised-button color="primary"
(click)="plotly.purge()">
purge()
</button>
<button mat-raised-button color="primary"
(click)="plotly.react()">
react()
</button>
</div>
<!-- needs ref in order to be discoverable by @ViewChild? -->
<!-- style width needed because tab switch has width layout issues -->
<plotly #plotly [data]="traces" [resize$]="resize$"
style="height: 500px; width: calc(100vw - 44px);"></plotly>
</section>
</ng-template>
</mat-tab>
<mat-tab label="Selection Event">
<ng-template matTabContent>
<section>
<p>
<b>config</b> hides some Plotly buttons, <b>layout</b> with reduced margins.
<em>plotly_selected</em> and <em>plotly_click</em> event example.
</p>
<div class="event-example">
<plotly [data]="traces2"
[layout]="layout"
[config]="config"
[resize$]="resize$"
[events]="['selected', 'plotly_click']"
(plotlyEvent)="onPlotlyEvent($event)">
</plotly>
<div>
<h3>Click or Select</h3>
<ng-container *ngIf="lastEvent">
<b>{{lastEvent.event}}</b>
<div *ngIf="lastEvent.data?.points as points">
<div *ngFor="let p of points">
[{{p.pointIndex}}]: ({{ p.x | number:'0.0-1' }}, {{ p.y | number:'0.0-1' }})
</div>
</div>
</ng-container>
</div>
</div>
</section>
</ng-template>
</mat-tab>
</mat-tab-group>