├── deploy.sh ├── npm info ├── projects └── ngx-dashboard-echarts │ ├── ng-package.json │ ├── src │ ├── lib │ │ ├── ngx-dashboard-echarts.service.ts │ │ ├── ngx-dashboard-echarts.module.ts │ │ └── ngx-dashboard-echarts.component.ts │ ├── public-api.ts │ └── test.ts │ ├── tslint.json │ ├── tsconfig.spec.json │ ├── tsconfig.lib.json │ ├── README.md │ ├── karma.conf.js │ └── package.json ├── .editorconfig ├── .gitignore ├── tsconfig.json ├── README.md ├── angular.json ├── package.json └── tslint.json /deploy.sh: -------------------------------------------------------------------------------- 1 | ng build; 2 | -------------------------------------------------------------------------------- /npm info: -------------------------------------------------------------------------------- 1 | cd dist/ngx-dashboard-echarts 2 | npm publish --access public 3 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/ng-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "../../node_modules/ng-packagr/ng-package.schema.json", 3 | "dest": "../../dist/ngx-dashboard-echarts", 4 | "lib": { 5 | "entryFile": "src/public-api.ts" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/src/lib/ngx-dashboard-echarts.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | 3 | @Injectable({ 4 | providedIn: 'root' 5 | }) 6 | export class NgxDashboardEchartsService { 7 | 8 | constructor() { } 9 | } 10 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/src/public-api.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Public API Surface of echarts 3 | */ 4 | 5 | export * from './lib/ngx-dashboard-echarts.service'; 6 | export * from './lib/ngx-dashboard-echarts.component'; 7 | export * from './lib/ngx-dashboard-echarts.module'; 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tslint.json", 3 | "rules": { 4 | "directive-selector": [ 5 | true, 6 | "attribute", 7 | "lib", 8 | "camelCase" 9 | ], 10 | "component-selector": [ 11 | true, 12 | "element", 13 | "lib", 14 | "kebab-case" 15 | ] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/spec", 5 | "types": [ 6 | "jasmine", 7 | "node" 8 | ] 9 | }, 10 | "files": [ 11 | "src/test.ts" 12 | ], 13 | "include": [ 14 | "**/*.spec.ts", 15 | "**/*.d.ts" 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/src/lib/ngx-dashboard-echarts.module.ts: -------------------------------------------------------------------------------- 1 | import { CommonModule } from '@angular/common'; 2 | import { NgModule } from '@angular/core'; 3 | import { FormsModule } from '@angular/forms'; 4 | import { NgxDashboardEchartsComponent } from './ngx-dashboard-echarts.component'; 5 | import { NgxEchartsModule } from 'ngx-echarts'; 6 | 7 | 8 | @NgModule({ 9 | declarations: [NgxDashboardEchartsComponent], 10 | imports: [ 11 | CommonModule, 12 | FormsModule, 13 | NgxEchartsModule 14 | ], 15 | exports: [NgxDashboardEchartsComponent] 16 | }) 17 | export class NgxDashboardEchartsModule { } 18 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/tsconfig.lib.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../../out-tsc/lib", 5 | "target": "es2015", 6 | "declaration": true, 7 | "inlineSources": true, 8 | "types": [], 9 | "lib": [ 10 | "dom", 11 | "es2018" 12 | ] 13 | }, 14 | "angularCompilerOptions": { 15 | "annotateForClosureCompiler": true, 16 | "skipTemplateCodegen": true, 17 | "strictMetadataEmit": true, 18 | "fullTemplateTypeCheck": true, 19 | "strictInjectionParameters": true, 20 | "enableResourceInlining": true 21 | }, 22 | "exclude": [ 23 | "src/test.ts", 24 | "**/*.spec.ts" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/zone'; 4 | import 'zone.js/dist/zone-testing'; 5 | import { getTestBed } from '@angular/core/testing'; 6 | import { 7 | BrowserDynamicTestingModule, 8 | platformBrowserDynamicTesting 9 | } from '@angular/platform-browser-dynamic/testing'; 10 | 11 | declare const require: any; 12 | 13 | // First, initialize the Angular testing environment. 14 | getTestBed().initTestEnvironment( 15 | BrowserDynamicTestingModule, 16 | platformBrowserDynamicTesting() 17 | ); 18 | // Then we find all the tests. 19 | const context = require.context('./', true, /\.spec\.ts$/); 20 | // And load the modules. 21 | context.keys().map(context); 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | # Only exists if Bazel was run 8 | /bazel-out 9 | 10 | # dependencies 11 | /node_modules 12 | 13 | # profiling files 14 | chrome-profiler-events*.json 15 | speed-measure-plugin*.json 16 | 17 | # IDEs and editors 18 | /.idea 19 | .project 20 | .classpath 21 | .c9/ 22 | *.launch 23 | .settings/ 24 | *.sublime-workspace 25 | 26 | # IDE - VSCode 27 | .vscode/* 28 | !.vscode/settings.json 29 | !.vscode/tasks.json 30 | !.vscode/launch.json 31 | !.vscode/extensions.json 32 | .history/* 33 | 34 | # misc 35 | /.sass-cache 36 | /connect.lock 37 | /coverage 38 | /libpeerconnection.log 39 | npm-debug.log 40 | yarn-error.log 41 | testem.log 42 | /typings 43 | 44 | # System Files 45 | .DS_Store 46 | Thumbs.db 47 | 48 | dist 49 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "baseUrl": "./", 5 | "outDir": "./dist/out-tsc", 6 | "sourceMap": true, 7 | "declaration": false, 8 | "downlevelIteration": true, 9 | "experimentalDecorators": true, 10 | "module": "esnext", 11 | "moduleResolution": "node", 12 | "importHelpers": true, 13 | "target": "es2015", 14 | "typeRoots": [ 15 | "node_modules/@types" 16 | ], 17 | "lib": [ 18 | "es2018", 19 | "dom" 20 | ], 21 | "paths": { 22 | "ngx-dashboard-echarts": [ 23 | "dist/ngx-dashboard-echarts" 24 | ], 25 | "ngx-dashboard-echarts/*": [ 26 | "dist/ngx-dashboard-echarts/*" 27 | ] 28 | } 29 | }, 30 | "angularCompilerOptions": { 31 | "fullTemplateTypeCheck": true, 32 | "strictInjectionParameters": true 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/README.md: -------------------------------------------------------------------------------- 1 | # Echarts 2 | 3 | This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.14. 4 | 5 | ## Code scaffolding 6 | 7 | Run `ng generate component component-name --project echarts` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project echarts`. 8 | > Note: Don't forget to add `--project echarts` or else it will be added to the default project in your `angular.json` file. 9 | 10 | ## Build 11 | 12 | Run `ng build echarts` to build the project. The build artifacts will be stored in the `dist/` directory. 13 | 14 | ## Publishing 15 | 16 | After building your library with `ng build echarts`, go to the dist folder `cd dist/echarts` and run `npm publish`. 17 | 18 | ## Running unit tests 19 | 20 | Run `ng test echarts` to execute the unit tests via [Karma](https://karma-runner.github.io). 21 | 22 | ## Further help 23 | 24 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EchartsDashboardLib 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.3.4. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | 25 | ## Further help 26 | 27 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 28 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client: { 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, '../../coverage/echarts'), 20 | reports: ['html', 'lcovonly', 'text-summary'], 21 | fixWebpackSourcePaths: true 22 | }, 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false, 30 | restartOnFileChange: true 31 | }); 32 | }; 33 | -------------------------------------------------------------------------------- /angular.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@angular/cli/lib/config/schema.json", 3 | "version": 1, 4 | "newProjectRoot": "projects", 5 | "projects": { 6 | "ngx-dashboard-echarts": { 7 | "projectType": "library", 8 | "root": "projects/ngx-dashboard-echarts", 9 | "sourceRoot": "projects/ngx-dashboard-echarts/src", 10 | "prefix": "lib", 11 | "architect": { 12 | "build": { 13 | "builder": "@angular-devkit/build-ng-packagr:build", 14 | "options": { 15 | "tsConfig": "projects/ngx-dashboard-echarts/tsconfig.lib.json", 16 | "project": "projects/ngx-dashboard-echarts/ng-package.json" 17 | } 18 | }, 19 | "test": { 20 | "builder": "@angular-devkit/build-angular:karma", 21 | "options": { 22 | "main": "projects/ngx-dashboard-echarts/src/test.ts", 23 | "tsConfig": "projects/ngx-dashboard-echarts/tsconfig.spec.json", 24 | "karmaConfig": "projects/ngx-dashboard-echarts/karma.conf.js" 25 | } 26 | }, 27 | "lint": { 28 | "builder": "@angular-devkit/build-angular:tslint", 29 | "options": { 30 | "tsConfig": [ 31 | "projects/ngx-dashboard-echarts/tsconfig.lib.json", 32 | "projects/ngx-dashboard-echarts/tsconfig.spec.json" 33 | ], 34 | "exclude": [ 35 | "**/node_modules/**" 36 | ] 37 | } 38 | } 39 | } 40 | }}, 41 | "defaultProject": "ngx-dashboard-echarts" 42 | } 43 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bolt-analytics/ngx-dashboard-echarts", 3 | "version": "0.0.1", 4 | "peerDependencies": { 5 | "@angular/common": "^8.2.14", 6 | "@angular/core": "^8.2.14", 7 | "bootstrap": "^3.3.7", 8 | "echarts": "^4.8.0", 9 | "ngx-echarts": "^5.2.2" 10 | }, 11 | "main": "bundles/ngx-dashboard-echarts.umd.js", 12 | "module": "fesm5/ngx-dashboard-echarts.js", 13 | "es2015": "fesm2015/ngx-dashboard-echarts.js", 14 | "esm5": "esm5/ngx-dashboard-echarts.js", 15 | "esm2015": "esm2015/ngx-dashboard-echarts.js", 16 | "fesm5": "fesm5/ngx-dashboard-echarts.js", 17 | "fesm2015": "fesm2015/ngx-dashboard-echarts.js", 18 | "typings": "ngx-dashboard-echarts.d.ts", 19 | "metadata": "ngx-dashboard-echarts.metadata.json", 20 | "sideEffects": false, 21 | "dependencies": { 22 | "tslib": "^1.9.0" 23 | }, 24 | "description": "This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.14.", 25 | "directories": { 26 | "lib": "lib" 27 | }, 28 | "scripts": { 29 | "test": "echo \"Error: no test specified\" && exit 1" 30 | }, 31 | "repository": { 32 | "type": "git", 33 | "url": "git+https://github.com/PT10/echarts-dashboard-lib.git" 34 | }, 35 | "keywords": [ 36 | "echarts", 37 | "ngx-dashboard" 38 | ], 39 | "author": "Prasad Tendulkar", 40 | "license": "ISC", 41 | "bugs": { 42 | "url": "https://github.com/PT10/echarts-dashboard-lib/issues" 43 | }, 44 | "homepage": "https://github.com/PT10/echarts-dashboard-lib#readme" 45 | } 46 | 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "echarts-dashboard-lib", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "ng": "ng", 6 | "start": "ng serve", 7 | "build": "ng build", 8 | "test": "ng test", 9 | "lint": "ng lint", 10 | "e2e": "ng e2e" 11 | }, 12 | "private": true, 13 | "dependencies": { 14 | "@angular/animations": "~8.2.5", 15 | "@angular/common": "~8.2.5", 16 | "@angular/compiler": "~8.2.5", 17 | "@angular/core": "~8.2.5", 18 | "@angular/forms": "~8.2.5", 19 | "@angular/platform-browser": "~8.2.5", 20 | "@angular/platform-browser-dynamic": "~8.2.5", 21 | "@angular/router": "~8.2.5", 22 | "bootstrap": "^3.3.7", 23 | "echarts": "^4.8.0", 24 | "ngx-echarts": "^5.2.2", 25 | "rxjs": "~6.4.0", 26 | "tslib": "^1.10.0", 27 | "zone.js": "~0.9.1" 28 | }, 29 | "devDependencies": { 30 | "@angular-devkit/build-angular": "~0.803.29", 31 | "@angular-devkit/build-ng-packagr": "~0.803.29", 32 | "@angular/cli": "~8.3.4", 33 | "@angular/compiler-cli": "~8.2.5", 34 | "@angular/language-service": "~8.2.5", 35 | "@types/node": "~8.9.4", 36 | "@types/jasmine": "~3.3.8", 37 | "@types/jasminewd2": "~2.0.3", 38 | "codelyzer": "^5.0.0", 39 | "jasmine-core": "~3.4.0", 40 | "jasmine-spec-reporter": "~4.2.1", 41 | "karma": "~4.1.0", 42 | "karma-chrome-launcher": "~2.2.0", 43 | "karma-coverage-istanbul-reporter": "~2.0.1", 44 | "karma-jasmine": "~2.0.1", 45 | "karma-jasmine-html-reporter": "^1.4.0", 46 | "ng-packagr": "^5.4.0", 47 | "protractor": "~5.4.0", 48 | "ts-node": "~7.0.0", 49 | "tsickle": "^0.37.0", 50 | "tslint": "~5.15.0", 51 | "typescript": "~3.5.3" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "tslint:recommended", 3 | "rulesDirectory": [ 4 | "codelyzer" 5 | ], 6 | "rules": { 7 | "array-type": false, 8 | "arrow-parens": false, 9 | "deprecation": { 10 | "severity": "warning" 11 | }, 12 | "import-blacklist": [ 13 | true, 14 | "rxjs/Rx" 15 | ], 16 | "interface-name": false, 17 | "max-classes-per-file": false, 18 | "max-line-length": [ 19 | true, 20 | 140 21 | ], 22 | "member-access": false, 23 | "member-ordering": [ 24 | true, 25 | { 26 | "order": [ 27 | "static-field", 28 | "instance-field", 29 | "static-method", 30 | "instance-method" 31 | ] 32 | } 33 | ], 34 | "no-consecutive-blank-lines": false, 35 | "no-console": [ 36 | true, 37 | "debug", 38 | "info", 39 | "time", 40 | "timeEnd", 41 | "trace" 42 | ], 43 | "no-empty": false, 44 | "no-inferrable-types": [ 45 | true, 46 | "ignore-params" 47 | ], 48 | "no-non-null-assertion": true, 49 | "no-redundant-jsdoc": true, 50 | "no-switch-case-fall-through": true, 51 | "no-use-before-declare": true, 52 | "no-var-requires": false, 53 | "object-literal-key-quotes": [ 54 | true, 55 | "as-needed" 56 | ], 57 | "object-literal-sort-keys": false, 58 | "ordered-imports": false, 59 | "quotemark": [ 60 | true, 61 | "single" 62 | ], 63 | "trailing-comma": false, 64 | "component-class-suffix": true, 65 | "contextual-lifecycle": true, 66 | "directive-class-suffix": true, 67 | "no-conflicting-lifecycle": true, 68 | "no-host-metadata-property": true, 69 | "no-input-rename": true, 70 | "no-inputs-metadata-property": true, 71 | "no-output-native": true, 72 | "no-output-on-prefix": true, 73 | "no-output-rename": true, 74 | "no-outputs-metadata-property": true, 75 | "template-banana-in-box": true, 76 | "template-no-negated-async": true, 77 | "use-lifecycle-interface": true, 78 | "use-pipe-transform-interface": true 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /projects/ngx-dashboard-echarts/src/lib/ngx-dashboard-echarts.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, DoCheck, Input, IterableDiffers, OnChanges, OnInit } from '@angular/core'; 2 | 3 | @Component({ 4 | selector: 'lib-dashboard-echarts', 5 | template: ` 6 | 16 | Chart is not configured 17 |
18 | `, 19 | styles: [] 20 | }) 21 | export class NgxDashboardEchartsComponent implements OnInit, OnChanges, DoCheck { 22 | 23 | //@Input() 24 | chartOptions: any; 25 | 26 | //editMode: boolean 27 | 28 | @Input() 29 | dataset: any[] 30 | 31 | @Input() 32 | chartConfig: any; 33 | 34 | sourceTypes: any[] = []; 35 | sources: any[] = []; 36 | 37 | echartsObj: any; 38 | iterableDiffer: any; 39 | markedForChange = false; 40 | 41 | constructor(private iterableDiffers: IterableDiffers) { 42 | this.iterableDiffer = this.iterableDiffers.find([]).create(null); 43 | } 44 | 45 | ngOnInit() { 46 | this.setOption(); 47 | } 48 | 49 | ngDoCheck() { 50 | if (!this.echartsObj || !this.chartOptions || !this.chartOptions.dataset || !this.chartOptions.dataset.source) { 51 | return; 52 | } 53 | let changes = this.iterableDiffer.diff(this.chartOptions.dataset.source); 54 | if (changes) { 55 | this.markedForChange = true; 56 | // this.echartsObj.setOption({ 57 | // dataset: { 58 | // source: this.chartOptions.dataset.source 59 | // } 60 | // }) 61 | } 62 | } 63 | 64 | setOption() { 65 | setInterval(() => { 66 | if (this.markedForChange) { 67 | let noData = this.chartOptions.dataset.source.length === 0; 68 | if (this.chartOptions.dataset.source.length === 1) { 69 | noData = Object.keys(this.chartOptions.dataset.source[0]).length === 0; 70 | } 71 | this.echartsObj.setOption({ 72 | title: {show: noData, text: noData ? 'No Data' : ''}, 73 | dataset: { 74 | source: this.chartOptions.dataset.source 75 | } 76 | }); 77 | 78 | this.markedForChange = false; 79 | } 80 | }, 1000) 81 | } 82 | 83 | ngOnChanges() { 84 | this.chartOptions = this.chartConfig; 85 | this.chartOptions['dataset'] = this.dataset; 86 | } 87 | 88 | onChartInit(ec: any) { 89 | this.echartsObj = ec; 90 | setTimeout(() => { 91 | this.echartsObj.setOption({title: { 92 | show: this.chartOptions.dataset.source.length === 0, 93 | textStyle: { 94 | color: "black", 95 | fontSize: 14 96 | }, 97 | text: "Loading..", 98 | left: "center", 99 | top: "center" 100 | }}); 101 | 102 | this.echartsObj.on('datazoom', (params) => { 103 | console.log(params); 104 | }) 105 | }, 200) 106 | } 107 | 108 | } 109 | --------------------------------------------------------------------------------