Commit 4ad81818 authored by charitha.p's avatar charitha.p

added front end files

parent ce5d6851
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events*.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db
# AppA
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.2.
## Development server
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.
## Code scaffolding
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`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"App-A": {
"projectType": "application",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
},
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/App-A",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "5mb",
"maximumError": "10mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2mb",
"maximumError": "10mb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "App-A:build:production"
},
"development": {
"browserTarget": "App-A:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "App-A:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.scss"
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js"
]
}
}
}
}
},
"defaultProject": "App-A"
}
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/App-A'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
This source diff could not be displayed because it is too large. You can view the blob instead.
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
const routes: Routes = [];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
<ng-container *ngIf="pageMode === 'config' && widgetInfo">
<app-design-tab *ngIf="activetab === 'chartProp'" [(widgetInfo)]="widgetInfo" [base_proxy]="base_proxy"
(widgetInfoChange)="widgetInfoChange.emit(widgetInfo)">
</app-design-tab>
</ng-container>
<ng-container *ngIf="pageMode === 'display' && widgetInfo">
<app-chart-display [widgetInfo]="widgetInfo" [base_proxy]="base_proxy"> </app-chart-display>
</ng-container>
\ No newline at end of file
import { TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule
],
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'App-A'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('App-A');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('App-A app is running!');
});
});
import { Component, EventEmitter, Output, Input } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
@Input() widgetInfo: any;
@Output() widgetInfoChange = new EventEmitter();
@Input() pageMode: 'config' | 'display' = 'config';
@Input() activetab: 'chartProp' | 'tools' = 'chartProp';
@Input() base_proxy: string = '';
}
\ No newline at end of file
import { Injector, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { createCustomElement } from '@angular/elements';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule } from '@angular/forms';
import { NgSelectModule } from '@ng-select/ng-select';
import { SwitchInputComponent } from './switch-input/switch-input.component';
import { TagInputModule } from 'ngx-chips';
import { DesignTabComponent } from './chart-config/design-tab/design-tab.component';
import { ChartDisplayComponent } from './chart-display/chart-display.component';
@NgModule({
declarations: [
AppComponent,
SwitchInputComponent,
DesignTabComponent,
ChartDisplayComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
FormsModule,
NgSelectModule,
TagInputModule,
],
providers: [],
bootstrap: []
})
export class AppModule {
constructor(private injector: Injector) { }
ngDoBootstrap() {
if (!customElements.get('app-candle')) {
const el = createCustomElement(AppComponent, { injector: this.injector })
customElements.define('app-candle', el);
}
}
}
<div class="general-tab">
<div class="row eachTemplate" [ngClass]="eachTemplate['class']"
*ngFor='let eachTemplate of chartComponentTemplates'>
<div class="col templateLabel">{{eachTemplate.label}}</div>
<div class="col templateContent">
<div class="row m-0">
<ng-container [ngSwitch]="eachTemplate.value">
<ng-container *ngSwitchCase="'placement'">
<ng-container *ngTemplateOutlet="placementTemplate"></ng-container>
</ng-container>
<ng-container *ngSwitchCase="'dataTooltip'">
<ng-container *ngTemplateOutlet="dataTooltipTemplate"></ng-container>
</ng-container>
<ng-container *ngSwitchCase="'dataZooming'">
<ng-container *ngTemplateOutlet="dataZoomingTemplate"></ng-container>
</ng-container>
<ng-container *ngSwitchCase="'visualMap'">
<ng-container *ngTemplateOutlet="visualMapTemplate"></ng-container>
</ng-container>
</ng-container>
</div>
</div>
</div>
</div>
<ng-template #placementTemplate>
<div class="form-group col-md-4">
<label class="control-label"><span>Widget Position</span><span class="color-red">&nbsp;*</span></label>
<ng-select bindValue="value" bindLabel="label" [(ngModel)]="widgetInfo.widgetPosition" placeholder="position"
[clearable]="false"
(ngModelChange)="widgetInfo.w = widgetInfo.widgetPosition === 'flexible' ? 400 : '4';emitChanges()">
<ng-option *ngFor="let eachOption of chartOptions.widgetPosition"
[value]="eachOption.value">{{eachOption.label}}</ng-option>
</ng-select>
</div>
<div class="form-group col-md-2">
<kl-switch-input [(inputModel)]="widgetInfo['background']" [label]="'Background'"
(inputModelChange)="emitChanges()">
</kl-switch-input>
</div>
<div class="form-group col-md-2" *ngIf="widgetInfo.widgetPosition === 'flexible'">
<label class="control-label"><span>Width (px)</span><span class="color-red">&nbsp;*</span></label>
<input type="number" class="form-control mb-2 mr-sm-2" placeholder="Width" [(ngModel)]="widgetInfo.w"
(ngModelChange)="emitChanges()">
</div>
<div class="form-group col-md-2" *ngIf="widgetInfo.widgetPosition !== 'flexible'">
<label class="control-label"><span>Width</span><span class="color-red">&nbsp;*</span></label>
<ng-select bindValue="value" bindLabel="label" [(ngModel)]="widgetInfo.w" (ngModelChange)="emitChanges()"
[items]="chartOptions.colWidth" placeholder="width" [clearable]="false" [dropdownPosition]="'auto'">
</ng-select>
</div>
<div class="form-group col-md-2">
<label class="control-label"><span>Height</span><span class="color-red">&nbsp;*</span></label>
<input type="number" class="form-control mb-2 mr-sm-2" placeholder="Height" [(ngModel)]="widgetInfo.h"
(ngModelChange)="emitChanges()">
</div>
</ng-template>
<ng-template #dataTooltipTemplate>
<ng-container *ngIf="_chartConfig['tooltip']">
<div class="form-group col-md-4">
<kl-switch-input [(inputModel)]="_chartConfig['tooltip']['show']" [label]="'Show Data Tooltip on hover'"
(inputModelChange)="emitChanges()">
</kl-switch-input>
</div>
<ng-container *ngIf="_chartConfig?.tooltip?.show">
<div class="form-group col-md-4">
<label class="control-label"><span>Trigger Type</span></label>
<ng-select bindValue="value" bindLabel="label" [items]="chartOptions.tooltip.triggerTypes"
[(ngModel)]="_chartConfig['tooltip']['trigger']" placeholder="Trigger Type" [clearable]="false"
(ngModelChange)="emitChanges()">
</ng-select>
</div>
<div class="form-group col-md-4">
<label class="control-label"><span>Axis Pointer</span></label>
<ng-select bindValue="value" bindLabel="label" [items]="chartOptions.tooltip.axisPointerTypes"
[(ngModel)]="_chartConfig['tooltip']['axisPointer']['type']" placeholder="Axis Pointer"
[clearable]="false" (ngModelChange)="emitChanges()">
</ng-select>
</div>
<div class="form-group col-md-4">
<label class="control-label d-block">Text color</label>
<ng-container
*ngTemplateOutlet="colorPickerTemplate;context:{inputModel:'color',header: _chartConfig['tooltip']['textStyle']}">
</ng-container>
</div>
<div class="form-group col-md-2">
<label class="control-label d-block">Background color</label>
<ng-container
*ngTemplateOutlet="colorPickerTemplate;context:{inputModel:'backgroundColor',header: _chartConfig['tooltip']}">
</ng-container>
</div>
<div class="form-group col-md-2">
<label class="control-label d-block">Border color</label>
<ng-container
*ngTemplateOutlet="colorPickerTemplate;context:{inputModel:'borderColor',header: _chartConfig['tooltip']}">
</ng-container>
</div>
<div class="form-group col-md-4">
<label class="control-label"><span>Border Size </span></label>
<input type="number" class="form-control" [(ngModel)]="_chartConfig.tooltip.borderWidth">
</div>
</ng-container>
</ng-container>
</ng-template>
<ng-template #visualMapTemplate>
<ng-container *ngIf="_chartConfig?.visualMap">
<div class="form-group col-md-2">
<kl-switch-input [(inputModel)]="_chartConfig.visualMap.show" [label]="'Show'"
(inputModelChange)="emitChanges();">
</kl-switch-input>
</div>
<div class="form-group col-md-2" *ngIf="_chartConfig.visualMap.show">
<label class="control-label">Type</label>
<ng-select bindValue="value" bindLabel="label" [items]="chartOptions.visualMapTypes"
[(ngModel)]="_chartConfig.visualMap.type" placeholder="Type" [clearable]="false"
(ngModelChange)="emitChanges()">
</ng-select>
</div>
<div class="form-group col-md-2"
*ngIf="_chartConfig.visualMap.show && _chartConfig.visualMap.type === 'piecewise'">
<label class="control-label">Out of Range Color</label>
<input type="color" class="form-control" [(ngModel)]="_chartConfig.visualMap['outOfRangeColor']">
</div>
<div class="form-group col-md-6"
*ngIf="_chartConfig.visualMap.show && _chartConfig.visualMap.type === 'piecewise'">
<span class="float-right actionBtn" (click)=addVisualMapRange();><em class="elm-plus"></em>Add Range</span>
</div>
<ng-container *ngIf="_chartConfig.visualMap.show && _chartConfig.visualMap.type !== 'piecewise'">
<div class="col-md-12 row">
<div class="form-group col-md-2">
<label class="control-label"><span>Min</span></label>
<input type="number" name="rowHeight" [(ngModel)]="_chartConfig.visualMap.min"
(ngModelChange)="emitChanges()" class="form-control" placeholder="Enter Min">
</div>
<div class="form-group col-md-2" *ngIf="_chartConfig.visualMap.show">
<label class="control-label"><span>Max</span></label>
<input type="number" name="rowHeight" [(ngModel)]="_chartConfig.visualMap.max"
(ngModelChange)="emitChanges()" class="form-control" placeholder="Enter Max">
</div>
<div class="col-md-6" *ngIf="_chartConfig.visualMap.show">
<label class="control-label">In Range Colors <span class="pl-2"
ngbTooltip="Enter a valid color (string, hexcode or RGB format) and hit enter."
placement="top">
<em class="fa fa-info-circle"></em>
</span></label>
<tag-input [(ngModel)]='_chartConfig.visualMap.inRangeColors' [placeholder]="'Add Colors'" #input
[secondaryPlaceholder]="'Add Colors'" [separatorKeyCodes]="[13]" [modelAsStrings]="true"
[editable]="true" [addOnPaste]="true" [addOnBlur]="true">
</tag-input>
</div>
</div>
</ng-container>
<ng-container *ngIf="_chartConfig.visualMap.show && _chartConfig.visualMap.type === 'piecewise'">
<div class="col-md-12 row" *ngFor="let piece of (_chartConfig.visualMap.pieces || []);let i = index;">
<div class="form-group col-md-2">
<label class="control-label"><span>Min</span></label>
<input type="number" name="rowHeight" [(ngModel)]="piece.gt" class="form-control"
placeholder="Enter Min">
</div>
<div class="form-group col-md-2" *ngIf="_chartConfig.visualMap.show">
<label class="control-label"><span>Max</span></label>
<input type="number" name="rowHeight" [(ngModel)]="piece.lte" class="form-control"
placeholder="Enter Max">
</div>
<div class="form-group col-md-2">
<label class="control-label">Range Color</label>
<input type="color" [(ngModel)]="piece.color" class="form-control">
</div>
<div class="form-group col-md-1">
<em class="fa fa-trash mt-5 mx-4 btn btn-link" (click)="deleteChartLimit(i);">Delete</em>
</div>
</div>
</ng-container>
</ng-container>
</ng-template>
<ng-template #dataZoomingTemplate>
<ng-container *ngIf="_chartConfig['dataZoom']">
<div class="form-group col-md-2">
<kl-switch-input [(inputModel)]="_chartConfig['dataZoom']['insideZoom']" [label]="'Inside Zooming'"
(inputModelChange)="emitChanges()">
</kl-switch-input>
</div>
<div class="form-group col-md-2">
<kl-switch-input [(inputModel)]="_chartConfig['dataZoom']['xAxis']" [label]="'X Axis Zoom Slider'"
(inputModelChange)="emitChanges()">
</kl-switch-input>
</div>
<div class="form-group col-md-2" *ngIf="_chartConfig['dataZoom']['xAxis']">
<label class="control-label">X Axis Zoom Slider Position</label>
<ng-select bindValue="value" bindLabel="label" [items]="chartOptions.dataZoom.xAxisPos"
[(ngModel)]="_chartConfig.dataZoom.xAxisPos" placeholder="Position" [clearable]="false"
(ngModelChange)="emitChanges()">
</ng-select>
</div>
<div class="form-group col-md-2">
<kl-switch-input [(inputModel)]="_chartConfig['dataZoom']['yAxis']" [label]="'Y Axis Zoom Slider'"
(inputModelChange)="emitChanges()">
</kl-switch-input>
</div>
<div class="form-group col-md-2" *ngIf="_chartConfig['dataZoom']['yAxis']">
<label class="control-label">Y Axis Zoom Slider Position</label>
<ng-select bindValue="value" bindLabel="label" [items]="chartOptions.dataZoom.yAxisPos"
[(ngModel)]="_chartConfig.dataZoom.yAxisPos" placeholder="Position" [clearable]="false"
(ngModelChange)="emitChanges()">
</ng-select>
</div>
</ng-container>
</ng-template>
<ng-template #colorPickerTemplate let-inputModel="inputModel" let-header="header">
<input type="color" [(ngModel)]="header[inputModel]" class="form-control">
</ng-template>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DesignTabComponent } from './design-tab.component';
describe('DesignTabComponent', () => {
let component: DesignTabComponent;
let fixture: ComponentFixture<DesignTabComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ DesignTabComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(DesignTabComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
@Component({
selector: 'app-design-tab',
templateUrl: './design-tab.component.html',
styleUrls: ['./design-tab.component.scss']
})
export class DesignTabComponent implements OnInit {
@Input() widgetInfo: any;
@Output() widgetInfoChange = new EventEmitter();
@Input() base_proxy: any;
public baseOptions: any = {
visualMap: {
show: false,
inRangeColors: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8',
'#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026'],
},
tooltip: {
show: true,
backgroundColor: '#ffffff',
borderColor: '#000000',
borderWidth: 1,
trigger: 'axis',
axisPointer: {
type: 'cross',
},
textStyle: {
color: '#000000',
},
},
dataZoom: {
insideZoom: true,
xAxis: false,
yAxis: false,
yAxisPos: 'left',
xAxisPos: 'top',
},
}
get _chartConfig() {
return this.widgetInfo?.cData?.chartOptions ? this.widgetInfo.cData.chartOptions : this.baseOptions
}
set _chartConfig(value) {
this.widgetInfo.cData.chartOptions = value;
this.widgetInfoChange.emit(this.widgetInfo);
}
public chartComponentTemplates: any = [
{
label: 'Placement',
value: 'placement',
class: 'addYaxisAction'
},
{
label: 'Data Tooltip',
value: 'dataTooltip',
},
{
label: 'Visual Map',
value: 'visualMap',
},
{
label: 'Data Zooming',
value: 'dataZooming',
},
]
public chartOptions = {
widgetPosition: [
{
label: 'Standard',
value: 'standard',
},
{
label: 'Flexible',
value: 'flexible',
},
],
colWidth: [
{
label: '2',
value: '2',
},
{
label: '3',
value: 3,
},
{
label: '4',
value: 4,
},
{
label: '5',
value: 5,
},
{
label: '6',
value: 6,
},
{
label: '7',
value: 7,
},
{
label: '8',
value: 8,
},
{
label: '9',
value: 9,
},
{
label: '10',
value: 10,
},
{
label: '11',
value: 11,
},
{
label: '12',
value: 12,
},
],
dataZoom: {
yAxisPos: [
{ value: 'left', label: 'Left' },
{ value: 'right', label: 'Right' },
],
xAxisPos: [
{ value: 'top', label: 'Top' },
{ value: 'bottom', label: 'Bottom' },
],
},
visualMapTypes: [
{
label: 'Continuous',
value: 'continuous',
},
{
label: 'Piece Wise',
value: 'piecewise',
},
],
tooltip: {
axisPointerTypes: [
{
label: 'Cross',
value: 'cross',
},
{
label: 'Line',
value: 'line',
},
{
label: 'Shadow',
value: 'shadow',
},
{
label: 'None',
value: 'none',
},
],
triggerTypes: [
{
label: 'Item',
value: 'item',
},
{
label: 'Axis',
value: 'axis',
},
],
},
}
constructor() { }
ngOnInit() {
for (const item of ['tooltip', 'dataZoom', 'visualMap']) {
this._chartConfig[item] ??= this.baseOptions[item];
}
}
emitChanges() { }
addVisualMapRange() {
try {
this._chartConfig.visualMap.pieces ??= [];
this._chartConfig.visualMap.pieces.push({ gt: '', lte: '', color: '' });
} catch (error) {
console.log(error);
}
}
deleteChartLimit(index: any) {
try {
if (!this._chartConfig.visualMap.pieces || !this._chartConfig.visualMap.pieces[index]) {
return;
}
this._chartConfig.visualMap.pieces.splice(index, 1);
} catch (error) {
console.log(error);
}
}
isAttributeShow(a: any) {
return true;
}
}
<div #ehartsTemplate *ngIf="widgetInfo" [style.height.px]="widgetInfo.h"></div>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ChartDisplayComponent } from './chart-display.component';
describe('ChartDisplayComponent', () => {
let component: ChartDisplayComponent;
let fixture: ComponentFixture<ChartDisplayComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ ChartDisplayComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ChartDisplayComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { HttpClient } from '@angular/common/http';
import { Component, Input, ViewChild } from '@angular/core';
import * as echarts from 'echarts';
@Component({
selector: 'app-chart-display',
templateUrl: './chart-display.component.html',
styleUrls: ['./chart-display.component.scss']
})
export class ChartDisplayComponent {
@Input() widgetInfo: any;
@Input() base_proxy: any;
@ViewChild('ehartsTemplate') ehartsTemplate: any;
public chartInstance: any;
public chartOption: any;
get _chartConfig() {
return this.widgetInfo?.cData?.chartOptions;
}
constructor(private http: HttpClient) { }
ngAfterViewInit() {
setTimeout(() => {
if (this.widgetInfo) {
this.setChartOptions();
}
}, 2000);
}
setChartOptions() {
if (!this.ehartsTemplate) { return; }
this.chartInstance = echarts.init(this.ehartsTemplate.nativeElement);
const url = this.base_proxy + 'widget/preview';
this.http.get<any>(url).subscribe(res => {
const chartOptions = res['option'];
chartOptions['tooltip'] = this._chartConfig.tooltip || { show: false };
if (this._chartConfig && this._chartConfig['dataZoom']) {
chartOptions['dataZoom'] = [];
if (this._chartConfig.dataZoom.insideZoom) {
chartOptions['dataZoom'].push({ type: 'inside' });
}
if (this._chartConfig.dataZoom.xAxis) {
chartOptions['dataZoom'].push({
type: 'slider',
[this._chartConfig.dataZoom.xAxisPos === 'bottom' ? 'bottom' : 'top']: 0,
xAxisIndex: [0],
filterMode: 'none',
});
}
if (this._chartConfig.dataZoom.yAxis) {
chartOptions['dataZoom'].push({
type: 'slider',
top: 'center',
[this._chartConfig.dataZoom.yAxisPos === 'right' ? 'right' : 'left']: this._chartConfig.dataZoom.yAxisPos === 'right' ? 30 : 0,
yAxisIndex: 0,
filterMode: 'none',
});
}
}
const chartConfig = this._chartConfig;
if (chartConfig.visualMap && chartConfig.visualMap.show && chartConfig.visualMap.type === 'piecewise') {
chartOptions['visualMap'] = {
top: 'center',
right: '25',
pieces: chartConfig.visualMap.pieces,
outOfRange: { color: chartConfig.visualMap.outOfRangeColor ? chartConfig.visualMap.outOfRangeColor : '#000000' },
};
} else if (chartConfig.visualMap && chartConfig.visualMap.show && ['', null, undefined, 'continuous'].indexOf(chartConfig.visualMap.continuous) > -1 && chartOptions.series && chartOptions.series.length) {
const dataMin = 0;
const dataMax = 1500;
chartOptions['visualMap'] = {
top: 'center',
right: '25',
calculable: true,
title: ['High', 'Low'],
min: [null, undefined, ''].indexOf(chartConfig.visualMap.min) === -1 ? chartConfig.visualMap.min : Math.floor(dataMin || 0),
max: [null, undefined, ''].indexOf(chartConfig.visualMap.max) === -1 ? chartConfig.visualMap.max : Math.ceil(dataMax || 200),
inRange: {
color: chartConfig.visualMap.inRangeColors && chartConfig.visualMap.inRangeColors.length ? chartConfig.visualMap.inRangeColors : ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffbf', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026'],
},
};
} else {
delete chartOptions['visualMap'];
}
this.chartInstance.setOption(chartOptions);
});
} catch(error: any) {
console.log(error)
}
}
<ng-container *ngIf="!labelPosition || labelPosition === 'top'">
<div class="mb-2 input-label">{{label}}</div>
<div class="pretty p-switch p-fill">
<input type="checkbox" [checked]="inputModel" name="thresholdShow" [(ngModel)]="inputModel"
(ngModelChange)="inputModelChange.emit(inputModel)">
<div class="state">
<label></label>
</div>
</div>
</ng-container>
<ng-container *ngIf="labelPosition === 'left'">
<span class="pr-2 input-label">{{label}}</span>
<div class="pretty p-switch p-fill">
<input type="checkbox" [checked]="inputModel" name="thresholdShow" [(ngModel)]="inputModel"
(ngModelChange)="inputModelChange.emit(inputModel)">
<div class="state">
<label></label>
</div>
</div>
</ng-container>
<ng-container *ngIf="labelPosition === 'right'">
<div class="pretty p-switch p-fill">
<input type="checkbox" [checked]="inputModel" name="thresholdShow" [(ngModel)]="inputModel"
(ngModelChange)="inputModelChange.emit(inputModel)">
<div class="state">
<label></label>
</div>
</div>
<span class="pl-4 input-label">{{label}}</span>
</ng-container>
\ No newline at end of file
.input-label{
font-family: 'Roboto-Medium', Sans-serif !important;
}
// tslint:disable:component-selector no-input-rename ter-indent ter-arrow-parens align max-line-length no-this-assignment prefer-template no-increment-decrement no-inferrable-types
import { Component, EventEmitter, Input, Output } from '@angular/core';
@Component({
selector: 'kl-switch-input',
templateUrl: './switch-input.component.html',
styleUrls: ['./switch-input.component.scss']
})
export class SwitchInputComponent {
@Input() inputModel: any = false;
@Input() label: any = '';
@Input() labelPosition: any = 'top';
@Input() info: string = '';
@Output() inputModelChange = new EventEmitter<any>();
}
<svg xmlns="http://www.w3.org/2000/svg" width="54" height="66.66899871826172" viewBox="0 0 54 66.669">
<g id="Group_11331" data-name="Group 11331" transform="translate(-818 -47.355)">
<g id="ilens-logo">
<path id="Path_10233" data-name="Path 10233" d="M-.131-.544,52.785,16.738v30.29L-.131,64.717Z" transform="translate(819 49)" fill="#00349a" class="svg-elem-1"></path>
<text id="i" transform="translate(843 94)" fill="#fff" font-size="38" font-family="ProductSans-Bold, Product Sans" font-weight="700" letter-spacing="0.009em"><tspan x="0" y="0">i</tspan></text>
</g>
<path id="Path_10234" data-name="Path 10234" d="M53,47V17.054L0-.453V64.829L53,47" transform="translate(818.5 48.5)" fill="none" stroke="#00349a" stroke-width="1" class="svg-elem-2"></path>
</g>
</svg>
\ No newline at end of file
{ "selector": "app-candle", "settings": { "config_tabs": { "general": true, "chartProp": true } } }
\ No newline at end of file
export const environment = {
production: true
};
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` 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/plugins/zone-error'; // Included with Angular CLI.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Candle Stick</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
\ No newline at end of file
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));
/**
* 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
*/
/**
* 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'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
import 'document-register-element';
/* You can add global styles to this file, and also import other style files */
body {
height: 100vh;
width : 100vw;
margin: 0 !important;
}
\ No newline at end of file
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
{ teardown: { destroyAfterEach: true }},
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
"es2018",
"dom"
],
"types": ["jquery"]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment