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

+103-1
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

+18
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.
+12
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

+33
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 { }
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>
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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const environment = {
2+
production: true
3+
};
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.

projects/demo/src/index.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>angular-plotly.js demo site</title>
6+
<base href="/">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
<link rel="icon" type="image/x-icon" href="favicon.ico">
9+
</head>
10+
<body>
11+
<app-root></app-root>
12+
</body>
13+
</html>

projects/demo/src/main.ts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { enableProdMode } from '@angular/core';
2+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3+
4+
import { AppModule } from './app/app.module';
5+
import { environment } from './environments/environment';
6+
7+
if (environment.production) {
8+
enableProdMode();
9+
}
10+
11+
platformBrowserDynamic().bootstrapModule(AppModule)
12+
.catch(err => console.error(err));

projects/demo/src/polyfills.ts

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
* This file includes polyfills needed by Angular and is loaded before the app.
3+
* You can add your own extra polyfills to this file.
4+
*
5+
* This file is divided into 2 sections:
6+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
7+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
8+
* file.
9+
*
10+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
11+
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
12+
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
13+
*
14+
* Learn more in https://angular.io/guide/browser-support
15+
*/
16+
17+
/***************************************************************************************************
18+
* BROWSER POLYFILLS
19+
*/
20+
21+
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
22+
// import 'classlist.js'; // Run `npm install --save classlist.js`.
23+
24+
/**
25+
* Web Animations `@angular/platform-browser/animations`
26+
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
27+
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
28+
*/
29+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
30+
31+
/**
32+
* By default, zone.js will patch all possible macroTask and DomEvents
33+
* user can disable parts of macroTask/DomEvents patch by setting following flags
34+
* because those flags need to be set before `zone.js` being loaded, and webpack
35+
* will put import in the top of bundle, so user need to create a separate file
36+
* in this directory (for example: zone-flags.ts), and put the following flags
37+
* into that file, and then add the following code before importing zone.js.
38+
* import './zone-flags';
39+
*
40+
* The flags allowed in zone-flags.ts are listed here.
41+
*
42+
* The following flags will work for all browsers.
43+
*
44+
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
45+
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
46+
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
47+
*
48+
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
49+
* with the following flag, it will bypass `zone.js` patch for IE/Edge
50+
*
51+
* (window as any).__Zone_enable_cross_context_check = true;
52+
*
53+
*/
54+
55+
/***************************************************************************************************
56+
* Zone JS is required by default for Angular itself.
57+
*/
58+
import 'zone.js/dist/zone'; // Included with Angular CLI.
59+
60+
61+
/***************************************************************************************************
62+
* APPLICATION IMPORTS
63+
*/

projects/demo/src/styles.css

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* You can add global styles to this file, and also import other style files */

projects/demo/tsconfig.app.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* To learn more about this file see: https://angular.io/config/tsconfig. */
2+
{
3+
"extends": "../../tsconfig.base.json",
4+
"compilerOptions": {
5+
"outDir": "../../out-tsc/app",
6+
"types": []
7+
},
8+
"files": [
9+
"src/main.ts",
10+
"src/polyfills.ts"
11+
],
12+
"include": [
13+
"src/**/*.d.ts"
14+
]
15+
}

projects/plotly/src/public-api.ts

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
export * from './lib/plotly.module';
66
export * from './lib/plotly-via-cdn.module';
77
export * from './lib/plotly-via-window.module';
8+
export * from './lib/plotly-shared.module';
89

910
export * from './lib/plotly.service';
1011
export * from './lib/plotly.component';

tsconfig.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
},
1313
{
1414
"path": "./projects/plotly/tsconfig.spec.json"
15-
}
15+
},
16+
{
17+
"path": "./projects/demo/tsconfig.app.json"
18+
}
1619
]
1720
}

0 commit comments

Comments
 (0)