Skip to content

Commit 12858c3

Browse files
committed
Creating the responsiveness demo
1 parent 1dd2553 commit 12858c3

File tree

5 files changed

+30
-0
lines changed

5 files changed

+30
-0
lines changed

src/app/demo/demo.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ <h5>Angular Plotly</h5>
1717
<li><a [routerLink]="['/timeout-update']">Timeout Update</a></li>
1818
<li><a [routerLink]="['/huge-memory-usage']">Huge Memory Usage</a></li>
1919
<li><a [routerLink]="['/slow-example']">Slow Example</a></li>
20+
<li><a [routerLink]="['/responsiveness']">Responsiveness</a></li>
2021
</ul>
2122
</div>
2223
</div>

src/app/demo/demo.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { FramesComponent } from './frames/frames.component';
2323
import { TimeoutUpdateComponent } from './timeout-update/timeout-update.component';
2424
import { HugeMemoryUsageComponent } from './huge-memory-usage/huge-memory-usage.component';
2525
import { SlowExampleComponent } from './slow-example/slow-example.component';
26+
import { ResponsivenessComponent } from './responsiveness/responsiveness.component';
2627

2728

2829
const demoRoutes: Routes = [
@@ -37,6 +38,7 @@ const demoRoutes: Routes = [
3738
{ path: 'timeout-update', component: TimeoutUpdateComponent, data: { title: 'Timeout Update' } },
3839
{ path: 'huge-memory-usage', component: HugeMemoryUsageComponent, data: { title: 'Huge Memory Usage' } },
3940
{ path: 'slow-example', component: SlowExampleComponent, data: { title: 'Slow example' } },
41+
{ path: 'responsiveness', component: ResponsivenessComponent, data: { title: 'Responsiveness' } },
4042

4143
{ path: '', redirectTo: '/home', pathMatch: 'full' },
4244
];
@@ -68,6 +70,7 @@ PlotlyViaCDNModule.plotlyVersion = '1.49.4';
6870
TimeoutUpdateComponent,
6971
HugeMemoryUsageComponent,
7072
SlowExampleComponent,
73+
ResponsivenessComponent,
7174
],
7275
exports: [DemoComponent],
7376
})

src/app/demo/responsiveness/responsiveness.component.css

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<plotly-plot [data]="graph.data" [layout]="graph.layout" [config]="{resize: true}" [useResizeHandler]="true" [style]="{position: 'relative', width: '100%', height: '100%'}">
2+
</plotly-plot>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'plotly-responsiveness',
5+
templateUrl: './responsiveness.component.html',
6+
styleUrls: ['./responsiveness.component.css']
7+
})
8+
export class ResponsivenessComponent implements OnInit {
9+
10+
public graph = {
11+
data: [
12+
{ x: [1, 2, 3], y: [2, 6, 3], type: 'scattergl', mode: 'lines+points', marker: { color: 'red' } },
13+
{ x: [1, 2, 3], y: [1, 2, 3], type: 'markers' },
14+
{ x: [1, 2, 3], y: [2, 5, 3], type: 'bar' },
15+
],
16+
layout: { width: 320, height: 240, title: 'A Fancy Plot' }
17+
};
18+
19+
constructor() { }
20+
21+
ngOnInit() {
22+
}
23+
24+
}

0 commit comments

Comments
 (0)