@eqproject/eqp-dynamic-module 2.4.12 → 2.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import * as i2$2 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Injectable, EventEmitter, Component, Input, ViewChild, Output, ViewChildren, NgModule, Inject } from '@angular/core';
4
+ import { Injectable, EventEmitter, Component, Input, ViewChild, Output, ViewChildren, HostListener, NgModule, Inject } from '@angular/core';
5
5
  import * as i5 from '@angular/forms';
6
6
  import { Validators, UntypedFormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
7
7
  import Swal from 'sweetalert2';
@@ -51,6 +51,7 @@ import { MatNativeDateModule } from '@angular/material/core';
51
51
  import * as i5$3 from '@angular/material/select';
52
52
  import { MatSelectModule } from '@angular/material/select';
53
53
  import * as i2$5 from '@angular/platform-browser';
54
+ import * as ss from 'simple-statistics';
54
55
  import * as i2$6 from '@canvasjs/angular-stockcharts';
55
56
  import { CanvasJSAngularStockChartsModule, CanvasJSChart, CanvasJSStockChart } from '@canvasjs/angular-stockcharts';
56
57
  import * as i8 from '@angular/material/autocomplete';
@@ -3181,7 +3182,8 @@ class ImageFieldSelectorTemplateComponent {
3181
3182
  this.recordChange = new EventEmitter();
3182
3183
  }
3183
3184
  ngOnInit() {
3184
- console.log("RECORD ngOnInit()", this.record[this.field.Name], this.field);
3185
+ GlobalService.debugLog("ImageFieldSelectorTemplateComponent - RECORD ngOnInit() - record", this.record[this.field.Name]);
3186
+ GlobalService.debugLog("ImageFieldSelectorTemplateComponent - RECORD ngOnInit() - field", this.field);
3185
3187
  this.initStyles();
3186
3188
  this.initializeAttachments();
3187
3189
  }
@@ -4770,10 +4772,16 @@ class Coords {
4770
4772
  }
4771
4773
 
4772
4774
  class GraphComponent {
4775
+ onResize() {
4776
+ this.loaded = false;
4777
+ this.loadGraph(Math.floor(window.innerWidth / 2));
4778
+ }
4773
4779
  constructor(datePipe) {
4774
4780
  this.datePipe = datePipe;
4775
4781
  this.data = new Array();
4776
4782
  this.title = "";
4783
+ this.trendColor = '#EB0102';
4784
+ this.mainColor = '#006cad';
4777
4785
  this.loaded = false;
4778
4786
  this.counter = 0;
4779
4787
  }
@@ -4781,48 +4789,97 @@ class GraphComponent {
4781
4789
  var self = this;
4782
4790
  // Aggiustamento e scrittura dati
4783
4791
  if (this.data.length > 0) {
4784
- var lastvalue = this.data[0];
4785
- var firstvalue = this.data[this.data.length - 1];
4786
- var stockChartMinimum = new Date(firstvalue.x);
4787
- var stockChartMaximum = new Date(lastvalue.x);
4788
- var stockChartTitleText = this.title;
4789
- var stockChartdataPoints = this.data;
4790
- this.stockChartOptions = {
4791
- theme: 'light2',
4792
- animationEnabled: true,
4793
- width: 1000,
4794
- height: 500,
4795
- creditText: "",
4796
- creditHref: "",
4797
- title: {
4798
- text: stockChartTitleText
4799
- },
4800
- charts: [{
4801
- axisX: {
4802
- labelFormatter: this.labelFormatterFunction,
4792
+ this.loadGraph(Math.floor(window.innerWidth / 2));
4793
+ }
4794
+ }
4795
+ loadGraph(width) {
4796
+ var lastvalue = this.data[0];
4797
+ var firstvalue = this.data[this.data.length - 1];
4798
+ var stockChartMinimum = new Date(firstvalue.x);
4799
+ var stockChartMaximum = new Date(lastvalue.x);
4800
+ var stockChartTitleText = this.title;
4801
+ var stockChartdataPoints = this.data;
4802
+ this.linearRegression = new Array();
4803
+ this.trend = "";
4804
+ stockChartdataPoints.reverse();
4805
+ if (stockChartdataPoints.length > 2) {
4806
+ let x = [];
4807
+ for (let i = 0; i < stockChartdataPoints.length; i++) {
4808
+ x.push([i, stockChartdataPoints[i].y]);
4809
+ }
4810
+ let parameters = ss.linearRegression(x);
4811
+ this.m = parameters.m;
4812
+ this.q = parameters.b;
4813
+ if (this.m > 0) {
4814
+ this.trend += " ↗";
4815
+ }
4816
+ else if (this.m < 0) {
4817
+ this.trend += " ↘";
4818
+ }
4819
+ // console.log(x);
4820
+ // console.log(stockChartdataPoints);
4821
+ for (let i = 0; i < stockChartdataPoints.length; i++) {
4822
+ if (i == 0 || i == stockChartdataPoints.length - 1) {
4823
+ this.linearRegression.push({ x: stockChartdataPoints[i].x,
4824
+ y: this.m * i + this.q,
4825
+ label: stockChartdataPoints[i].label,
4826
+ name: stockChartdataPoints[i].name
4827
+ });
4828
+ }
4829
+ }
4830
+ //this.linearRegression.reverse();
4831
+ // console.log(this.linearRegression);
4832
+ // console.log(this.m);
4833
+ // console.log(this.q);
4834
+ }
4835
+ this.stockChartOptions = {
4836
+ theme: 'light2',
4837
+ animationEnabled: true,
4838
+ width: width,
4839
+ height: 500,
4840
+ creditText: "",
4841
+ creditHref: "",
4842
+ title: {
4843
+ text: stockChartTitleText
4844
+ },
4845
+ charts: [{
4846
+ axisX: {
4847
+ labelFormatter: this.labelFormatterFunction,
4848
+ },
4849
+ data: [
4850
+ {
4851
+ toolTipContent: null,
4852
+ type: 'line',
4853
+ color: this.trendColor,
4854
+ showInLegend: true,
4855
+ legendMarkerType: "none",
4856
+ markerType: "none",
4857
+ legendText: "Trend" + this.trend,
4858
+ dataPoints: this.linearRegression
4803
4859
  },
4804
- data: [{
4805
- type: "line",
4806
- dataPoints: stockChartdataPoints
4807
- }],
4808
- culture: "it"
4809
- }],
4810
- rangeSelector: {
4811
- enabled: false
4812
- },
4813
- navigator: {
4814
- slider: {
4815
- minimum: stockChartMinimum,
4816
- maximum: stockChartMaximum
4817
- }
4818
- },
4819
- options: {
4820
- responsive: true,
4821
- maintainAspectRatio: false
4860
+ {
4861
+ type: "spline",
4862
+ dataPoints: stockChartdataPoints,
4863
+ color: this.mainColor,
4864
+ }
4865
+ ],
4866
+ culture: "it"
4867
+ }],
4868
+ rangeSelector: {
4869
+ enabled: false
4870
+ },
4871
+ navigator: {
4872
+ slider: {
4873
+ minimum: stockChartMinimum,
4874
+ maximum: stockChartMaximum
4822
4875
  }
4823
- };
4824
- this.loaded = true;
4825
- }
4876
+ },
4877
+ options: {
4878
+ responsive: true,
4879
+ maintainAspectRatio: false
4880
+ }
4881
+ };
4882
+ this.loaded = true;
4826
4883
  }
4827
4884
  labelFormatterFunction(e) {
4828
4885
  let label = "";
@@ -4874,11 +4931,14 @@ class GraphComponent {
4874
4931
  }
4875
4932
  }
4876
4933
  GraphComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GraphComponent, deps: [{ token: i2$2.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
4877
- GraphComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GraphComponent, selector: "graph", inputs: { data: "data", title: "title" }, ngImport: i0, template: "<canvasjs-stockchart *ngIf=\"loaded\" [options]=\"stockChartOptions\"></canvasjs-stockchart>\r\n<div class=\"error\" *ngIf=\"!loaded\"><b>{{title}}:</b> Nessun dato trovato nell'intervallo specificato!</div>", styles: [""], dependencies: [{ kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$6.CanvasJSStockChart, selector: "canvasjs-stockchart", inputs: ["options", "styles"], outputs: ["stockChartInstance"] }] });
4934
+ GraphComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: GraphComponent, selector: "graph", inputs: { data: "data", title: "title" }, host: { listeners: { "window:resize": "onResize($event)" } }, ngImport: i0, template: "<canvasjs-stockchart *ngIf=\"loaded\" [options]=\"stockChartOptions\"></canvasjs-stockchart>\r\n<div class=\"error\" *ngIf=\"!loaded\"><b>{{title}}:</b> Nessun dato trovato nell'intervallo specificato!</div>", styles: [""], dependencies: [{ kind: "directive", type: i2$2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i2$6.CanvasJSStockChart, selector: "canvasjs-stockchart", inputs: ["options", "styles"], outputs: ["stockChartInstance"] }] });
4878
4935
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: GraphComponent, decorators: [{
4879
4936
  type: Component,
4880
4937
  args: [{ selector: 'graph', template: "<canvasjs-stockchart *ngIf=\"loaded\" [options]=\"stockChartOptions\"></canvasjs-stockchart>\r\n<div class=\"error\" *ngIf=\"!loaded\"><b>{{title}}:</b> Nessun dato trovato nell'intervallo specificato!</div>" }]
4881
- }], ctorParameters: function () { return [{ type: i2$2.DatePipe }]; }, propDecorators: { data: [{
4938
+ }], ctorParameters: function () { return [{ type: i2$2.DatePipe }]; }, propDecorators: { onResize: [{
4939
+ type: HostListener,
4940
+ args: ['window:resize', ['$event']]
4941
+ }], data: [{
4882
4942
  type: Input,
4883
4943
  args: ["data"]
4884
4944
  }], title: [{