Skip to content

Commit 3b855c5

Browse files
committed
Criando o projects/demo
1 parent 0b7adee commit 3b855c5

17 files changed

+346
-2
lines changed

angular.json

Lines changed: 103 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,109 @@
4242
}
4343
}
4444
}
45-
}},
45+
},
46+
"demo": {
47+
"projectType": "application",
48+
"schematics": {
49+
"@schematics/angular:component": {
50+
"inlineTemplate": true,
51+
"inlineStyle": true,
52+
"skipTests": true
53+
},
54+
"@schematics/angular:class": {
55+
"skipTests": true
56+
},
57+
"@schematics/angular:directive": {
58+
"skipTests": true
59+
},
60+
"@schematics/angular:guard": {
61+
"skipTests": true
62+
},
63+
"@schematics/angular:interceptor": {
64+
"skipTests": true
65+
},
66+
"@schematics/angular:module": {
67+
"skipTests": true
68+
},
69+
"@schematics/angular:pipe": {
70+
"skipTests": true
71+
},
72+
"@schematics/angular:service": {
73+
"skipTests": true
74+
}
75+
},
76+
"root": "projects/demo",
77+
"sourceRoot": "projects/demo/src",
78+
"prefix": "app",
79+
"architect": {
80+
"build": {
81+
"builder": "@angular-devkit/build-angular:browser",
82+
"options": {
83+
"outputPath": "dist/demo",
84+
"index": "projects/demo/src/index.html",
85+
"main": "projects/demo/src/main.ts",
86+
"polyfills": "projects/demo/src/polyfills.ts",
87+
"tsConfig": "projects/demo/tsconfig.app.json",
88+
"aot": true,
89+
"assets": [
90+
"projects/demo/src/favicon.ico",
91+
"projects/demo/src/assets"
92+
],
93+
"styles": [
94+
"projects/demo/src/styles.css"
95+
],
96+
"scripts": []
97+
},
98+
"configurations": {
99+
"production": {
100+
"fileReplacements": [
101+
{
102+
"replace": "projects/demo/src/environments/environment.ts",
103+
"with": "projects/demo/src/environments/environment.prod.ts"
104+
}
105+
],
106+
"optimization": true,
107+
"outputHashing": "all",
108+
"sourceMap": false,
109+
"extractCss": true,
110+
"namedChunks": false,
111+
"extractLicenses": true,
112+
"vendorChunk": false,
113+
"buildOptimizer": true,
114+
"budgets": [
115+
{
116+
"type": "initial",
117+
"maximumWarning": "2mb",
118+
"maximumError": "5mb"
119+
},
120+
{
121+
"type": "anyComponentStyle",
122+
"maximumWarning": "6kb",
123+
"maximumError": "10kb"
124+
}
125+
]
126+
}
127+
}
128+
},
129+
"serve": {
130+
"builder": "@angular-devkit/build-angular:dev-server",
131+
"options": {
132+
"browserTarget": "demo:build"
133+
},
134+
"configurations": {
135+
"production": {
136+
"browserTarget": "demo:build:production"
137+
}
138+
}
139+
},
140+
"extract-i18n": {
141+
"builder": "@angular-devkit/build-angular:extract-i18n",
142+
"options": {
143+
"browserTarget": "demo:build"
144+
}
145+
}
146+
}
147+
}},
46148
"cli": {
47149
"analytics": false
48150
},

projects/demo/.browserslistrc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2+
# For additional information regarding the format and rule options, please see:
3+
# https://github.com/browserslist/browserslist#queries
4+
5+
# For the full list of supported browsers by the Angular framework, please see:
6+
# https://angular.io/guide/browser-support
7+
8+
# You can see what browsers were selected by your queries by running:
9+
# npx browserslist
10+
11+
last 1 Chrome version
12+
last 1 Firefox version
13+
last 2 Edge major versions
14+
last 2 Safari major versions
15+
last 2 iOS major versions
16+
Firefox ESR
17+
not IE 9-10 # Angular support for IE 9-10 has been deprecated and will be removed as of Angular v11. To opt-in, remove the 'not' prefix on this line.
18+
not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-root',
5+
template: `
6+
<router-outlet></router-outlet>
7+
`,
8+
styles: []
9+
})
10+
export class AppComponent {
11+
title = 'demo';
12+
}

projects/demo/src/app/app.module.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { BrowserModule } from '@angular/platform-browser';
2+
import { NgModule } from '@angular/core';
3+
import { Routes, RouterModule } from '@angular/router';
4+
5+
import { AppComponent } from './app.component';
6+
import { PlotlyViaCDNModule } from 'plotly';
7+
import { HomeComponent } from './home/home.component';
8+
9+
10+
PlotlyViaCDNModule.setPlotlyVersion('1.58.2');
11+
PlotlyViaCDNModule.setPlotlyBundle('basic');
12+
13+
14+
const routes: Routes = [
15+
{ path: 'home', component: HomeComponent, data: { title: "Home" } },
16+
{ path: '', redirectTo: '/home', pathMatch: 'full' },
17+
];
18+
19+
20+
@NgModule({
21+
declarations: [
22+
AppComponent,
23+
HomeComponent,
24+
],
25+
imports: [
26+
BrowserModule,
27+
PlotlyViaCDNModule,
28+
RouterModule.forRoot(routes),
29+
],
30+
providers: [],
31+
bootstrap: [AppComponent]
32+
})
33+
export class AppModule { }
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<h1>Examples for angular-plotly.js</h1>
2+
3+
4+
<plotly-plot [data]="graph.data" [layout]="graph.layout" [revision]="version" ></plotly-plot>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { PlotlyService } from 'plotly';
3+
4+
5+
@Component({
6+
selector: 'demo-home',
7+
templateUrl: './home.component.html',
8+
})
9+
export class HomeComponent implements OnInit {
10+
11+
public graph: any;
12+
public x: number[] = [1, 2, 3, 4, 5, 6, 7, 9];
13+
public y: number[] = [1, 2, 3, 4, 5, 6, 7, 9];
14+
public version = 0;
15+
16+
constructor(private plotlyService: PlotlyService) {
17+
}
18+
19+
ngOnInit() {
20+
this.graph = {
21+
data: [
22+
{ x: this.x, y: this.y, type: 'scatter', mode: 'lines+markers' },
23+
],
24+
layout: {
25+
autosize: true,
26+
title: 'Live Plot',
27+
font: { family: 'Roboto, "Helvetica Neue", sans-serif' },
28+
margin: { t: 50, b: 20, l: 40, r: 40 },
29+
}
30+
};
31+
32+
setTimeout(() => this.startUpdate(), 3000);
33+
}
34+
35+
startUpdate() {
36+
this.x.push(10 + this.version);
37+
this.y.push(10 + this.version);
38+
this.version += 1;
39+
40+
41+
this.graph.data = [
42+
{ x: this.x.slice(), y: this.y.slice(), type: 'scatter', mode: 'lines+markers' }
43+
];
44+
45+
setTimeout(() => this.startUpdate(), 3000);
46+
}
47+
48+
}

projects/demo/src/assets/.gitkeep

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true
3+
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// This file can be replaced during build by using the `fileReplacements` array.
2+
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3+
// The list of file replacements can be found in `angular.json`.
4+
5+
export const environment = {
6+
production: false
7+
};
8+
9+
/*
10+
* For easier debugging in development mode, you can import the following file
11+
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12+
*
13+
* This import should be commented out in production mode because it will have a negative impact
14+
* on performance if an error is thrown.
15+
*/
16+
// import 'zone.js/dist/zone-error'; // Included with Angular CLI.

projects/demo/src/favicon.ico

948 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)