diff --git a/angular.json b/angular.json
index 9a95794..39fda1e 100644
--- a/angular.json
+++ b/angular.json
@@ -42,7 +42,109 @@
}
}
}
- }},
+ },
+ "demo": {
+ "projectType": "application",
+ "schematics": {
+ "@schematics/angular:component": {
+ "inlineTemplate": true,
+ "inlineStyle": true,
+ "skipTests": true
+ },
+ "@schematics/angular:class": {
+ "skipTests": true
+ },
+ "@schematics/angular:directive": {
+ "skipTests": true
+ },
+ "@schematics/angular:guard": {
+ "skipTests": true
+ },
+ "@schematics/angular:interceptor": {
+ "skipTests": true
+ },
+ "@schematics/angular:module": {
+ "skipTests": true
+ },
+ "@schematics/angular:pipe": {
+ "skipTests": true
+ },
+ "@schematics/angular:service": {
+ "skipTests": true
+ }
+ },
+ "root": "projects/demo",
+ "sourceRoot": "projects/demo/src",
+ "prefix": "app",
+ "architect": {
+ "build": {
+ "builder": "@angular-devkit/build-angular:browser",
+ "options": {
+ "outputPath": "dist/demo",
+ "index": "projects/demo/src/index.html",
+ "main": "projects/demo/src/main.ts",
+ "polyfills": "projects/demo/src/polyfills.ts",
+ "tsConfig": "projects/demo/tsconfig.app.json",
+ "aot": true,
+ "assets": [
+ "projects/demo/src/favicon.ico",
+ "projects/demo/src/assets"
+ ],
+ "styles": [
+ "projects/demo/src/styles.css"
+ ],
+ "scripts": []
+ },
+ "configurations": {
+ "production": {
+ "fileReplacements": [
+ {
+ "replace": "projects/demo/src/environments/environment.ts",
+ "with": "projects/demo/src/environments/environment.prod.ts"
+ }
+ ],
+ "optimization": true,
+ "outputHashing": "all",
+ "sourceMap": false,
+ "extractCss": true,
+ "namedChunks": false,
+ "extractLicenses": true,
+ "vendorChunk": false,
+ "buildOptimizer": true,
+ "budgets": [
+ {
+ "type": "initial",
+ "maximumWarning": "2mb",
+ "maximumError": "5mb"
+ },
+ {
+ "type": "anyComponentStyle",
+ "maximumWarning": "6kb",
+ "maximumError": "10kb"
+ }
+ ]
+ }
+ }
+ },
+ "serve": {
+ "builder": "@angular-devkit/build-angular:dev-server",
+ "options": {
+ "browserTarget": "demo:build"
+ },
+ "configurations": {
+ "production": {
+ "browserTarget": "demo:build:production"
+ }
+ }
+ },
+ "extract-i18n": {
+ "builder": "@angular-devkit/build-angular:extract-i18n",
+ "options": {
+ "browserTarget": "demo:build"
+ }
+ }
+ }
+ }},
"cli": {
"analytics": false
},
diff --git a/projects/demo/.browserslistrc b/projects/demo/.browserslistrc
new file mode 100644
index 0000000..0ccadaf
--- /dev/null
+++ b/projects/demo/.browserslistrc
@@ -0,0 +1,18 @@
+# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
+# For additional information regarding the format and rule options, please see:
+# https://github.com/browserslist/browserslist#queries
+
+# For the full list of supported browsers by the Angular framework, please see:
+# https://angular.io/guide/browser-support
+
+# You can see what browsers were selected by your queries by running:
+# npx browserslist
+
+last 1 Chrome version
+last 1 Firefox version
+last 2 Edge major versions
+last 2 Safari major versions
+last 2 iOS major versions
+Firefox ESR
+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.
+not IE 11 # Angular supports IE 11 only as an opt-in. To opt-in, remove the 'not' prefix on this line.
diff --git a/projects/demo/src/app/app.component.ts b/projects/demo/src/app/app.component.ts
new file mode 100644
index 0000000..5ae8587
--- /dev/null
+++ b/projects/demo/src/app/app.component.ts
@@ -0,0 +1,12 @@
+import { Component } from '@angular/core';
+
+@Component({
+ selector: 'app-root',
+ template: `
+
+ `,
+ styles: []
+})
+export class AppComponent {
+ title = 'demo';
+}
diff --git a/projects/demo/src/app/app.module.ts b/projects/demo/src/app/app.module.ts
new file mode 100644
index 0000000..e6078f4
--- /dev/null
+++ b/projects/demo/src/app/app.module.ts
@@ -0,0 +1,33 @@
+import { BrowserModule } from '@angular/platform-browser';
+import { NgModule } from '@angular/core';
+import { Routes, RouterModule } from '@angular/router';
+
+import { AppComponent } from './app.component';
+import { PlotlyViaCDNModule } from 'plotly';
+import { HomeComponent } from './home/home.component';
+
+
+PlotlyViaCDNModule.setPlotlyVersion('1.58.2');
+PlotlyViaCDNModule.setPlotlyBundle('basic');
+
+
+const routes: Routes = [
+ { path: 'home', component: HomeComponent, data: { title: "Home" } },
+ { path: '', redirectTo: '/home', pathMatch: 'full' },
+];
+
+
+@NgModule({
+ declarations: [
+ AppComponent,
+ HomeComponent,
+ ],
+ imports: [
+ BrowserModule,
+ PlotlyViaCDNModule,
+ RouterModule.forRoot(routes),
+ ],
+ providers: [],
+ bootstrap: [AppComponent]
+})
+export class AppModule { }
diff --git a/projects/demo/src/app/home/home.component.html b/projects/demo/src/app/home/home.component.html
new file mode 100644
index 0000000..5f083b2
--- /dev/null
+++ b/projects/demo/src/app/home/home.component.html
@@ -0,0 +1,4 @@
+
Examples for angular-plotly.js
+
+
+
diff --git a/projects/demo/src/app/home/home.component.ts b/projects/demo/src/app/home/home.component.ts
new file mode 100644
index 0000000..a17cc62
--- /dev/null
+++ b/projects/demo/src/app/home/home.component.ts
@@ -0,0 +1,48 @@
+import { Component, OnInit } from '@angular/core';
+import { PlotlyService } from 'plotly';
+
+
+@Component({
+ selector: 'demo-home',
+ templateUrl: './home.component.html',
+})
+export class HomeComponent implements OnInit {
+
+ public graph: any;
+ public x: number[] = [1, 2, 3, 4, 5, 6, 7, 9];
+ public y: number[] = [1, 2, 3, 4, 5, 6, 7, 9];
+ public version = 0;
+
+ constructor(private plotlyService: PlotlyService) {
+ }
+
+ ngOnInit() {
+ this.graph = {
+ data: [
+ { x: this.x, y: this.y, type: 'scatter', mode: 'lines+markers' },
+ ],
+ layout: {
+ autosize: true,
+ title: 'Live Plot',
+ font: { family: 'Roboto, "Helvetica Neue", sans-serif' },
+ margin: { t: 50, b: 20, l: 40, r: 40 },
+ }
+ };
+
+ setTimeout(() => this.startUpdate(), 3000);
+ }
+
+ startUpdate() {
+ this.x.push(10 + this.version);
+ this.y.push(10 + this.version);
+ this.version += 1;
+
+
+ this.graph.data = [
+ { x: this.x.slice(), y: this.y.slice(), type: 'scatter', mode: 'lines+markers' }
+ ];
+
+ setTimeout(() => this.startUpdate(), 3000);
+ }
+
+}
diff --git a/projects/demo/src/assets/.gitkeep b/projects/demo/src/assets/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/projects/demo/src/environments/environment.prod.ts b/projects/demo/src/environments/environment.prod.ts
new file mode 100644
index 0000000..3612073
--- /dev/null
+++ b/projects/demo/src/environments/environment.prod.ts
@@ -0,0 +1,3 @@
+export const environment = {
+ production: true
+};
diff --git a/projects/demo/src/environments/environment.ts b/projects/demo/src/environments/environment.ts
new file mode 100644
index 0000000..7b4f817
--- /dev/null
+++ b/projects/demo/src/environments/environment.ts
@@ -0,0 +1,16 @@
+// This file can be replaced during build by using the `fileReplacements` array.
+// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
+// The list of file replacements can be found in `angular.json`.
+
+export const environment = {
+ production: false
+};
+
+/*
+ * For easier debugging in development mode, you can import the following file
+ * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
+ *
+ * This import should be commented out in production mode because it will have a negative impact
+ * on performance if an error is thrown.
+ */
+// import 'zone.js/dist/zone-error'; // Included with Angular CLI.
diff --git a/projects/demo/src/favicon.ico b/projects/demo/src/favicon.ico
new file mode 100644
index 0000000..997406a
Binary files /dev/null and b/projects/demo/src/favicon.ico differ
diff --git a/projects/demo/src/index.html b/projects/demo/src/index.html
new file mode 100644
index 0000000..5ff7637
--- /dev/null
+++ b/projects/demo/src/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+ angular-plotly.js demo site
+
+
+
+
+
+
+
+
diff --git a/projects/demo/src/main.ts b/projects/demo/src/main.ts
new file mode 100644
index 0000000..c7b673c
--- /dev/null
+++ b/projects/demo/src/main.ts
@@ -0,0 +1,12 @@
+import { enableProdMode } from '@angular/core';
+import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
+
+import { AppModule } from './app/app.module';
+import { environment } from './environments/environment';
+
+if (environment.production) {
+ enableProdMode();
+}
+
+platformBrowserDynamic().bootstrapModule(AppModule)
+ .catch(err => console.error(err));
diff --git a/projects/demo/src/polyfills.ts b/projects/demo/src/polyfills.ts
new file mode 100644
index 0000000..03711e5
--- /dev/null
+++ b/projects/demo/src/polyfills.ts
@@ -0,0 +1,63 @@
+/**
+ * This file includes polyfills needed by Angular and is loaded before the app.
+ * You can add your own extra polyfills to this file.
+ *
+ * This file is divided into 2 sections:
+ * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
+ * 2. Application imports. Files imported after ZoneJS that should be loaded before your main
+ * file.
+ *
+ * The current setup is for so-called "evergreen" browsers; the last versions of browsers that
+ * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
+ * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
+ *
+ * Learn more in https://angular.io/guide/browser-support
+ */
+
+/***************************************************************************************************
+ * BROWSER POLYFILLS
+ */
+
+/** IE10 and IE11 requires the following for NgClass support on SVG elements */
+// import 'classlist.js'; // Run `npm install --save classlist.js`.
+
+/**
+ * Web Animations `@angular/platform-browser/animations`
+ * Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
+ * Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
+ */
+// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
+
+/**
+ * By default, zone.js will patch all possible macroTask and DomEvents
+ * user can disable parts of macroTask/DomEvents patch by setting following flags
+ * because those flags need to be set before `zone.js` being loaded, and webpack
+ * will put import in the top of bundle, so user need to create a separate file
+ * in this directory (for example: zone-flags.ts), and put the following flags
+ * into that file, and then add the following code before importing zone.js.
+ * import './zone-flags';
+ *
+ * The flags allowed in zone-flags.ts are listed here.
+ *
+ * The following flags will work for all browsers.
+ *
+ * (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
+ * (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
+ * (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
+ *
+ * in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
+ * with the following flag, it will bypass `zone.js` patch for IE/Edge
+ *
+ * (window as any).__Zone_enable_cross_context_check = true;
+ *
+ */
+
+/***************************************************************************************************
+ * Zone JS is required by default for Angular itself.
+ */
+import 'zone.js/dist/zone'; // Included with Angular CLI.
+
+
+/***************************************************************************************************
+ * APPLICATION IMPORTS
+ */
diff --git a/projects/demo/src/styles.css b/projects/demo/src/styles.css
new file mode 100644
index 0000000..90d4ee0
--- /dev/null
+++ b/projects/demo/src/styles.css
@@ -0,0 +1 @@
+/* You can add global styles to this file, and also import other style files */
diff --git a/projects/demo/tsconfig.app.json b/projects/demo/tsconfig.app.json
new file mode 100644
index 0000000..7a51405
--- /dev/null
+++ b/projects/demo/tsconfig.app.json
@@ -0,0 +1,15 @@
+/* To learn more about this file see: https://angular.io/config/tsconfig. */
+{
+ "extends": "../../tsconfig.base.json",
+ "compilerOptions": {
+ "outDir": "../../out-tsc/app",
+ "types": []
+ },
+ "files": [
+ "src/main.ts",
+ "src/polyfills.ts"
+ ],
+ "include": [
+ "src/**/*.d.ts"
+ ]
+}
diff --git a/projects/plotly/src/public-api.ts b/projects/plotly/src/public-api.ts
index 4409400..600345a 100644
--- a/projects/plotly/src/public-api.ts
+++ b/projects/plotly/src/public-api.ts
@@ -5,6 +5,7 @@
export * from './lib/plotly.module';
export * from './lib/plotly-via-cdn.module';
export * from './lib/plotly-via-window.module';
+export * from './lib/plotly-shared.module';
export * from './lib/plotly.service';
export * from './lib/plotly.component';
diff --git a/tsconfig.json b/tsconfig.json
index 5c82304..4fdde72 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -12,6 +12,9 @@
},
{
"path": "./projects/plotly/tsconfig.spec.json"
- }
+ },
+ {
+ "path": "./projects/demo/tsconfig.app.json"
+ }
]
}