@esfaenza/es-charts 15.2.2 → 15.2.3
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,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ContentChild, InjectionToken, Inject,
|
|
2
|
+
import { Injectable, EventEmitter, Component, ChangeDetectionStrategy, Input, Output, ContentChild, InjectionToken, Inject, PLATFORM_ID, NgModule, Directive } from '@angular/core';
|
|
3
3
|
import * as i5 from '@angular/common';
|
|
4
|
-
import {
|
|
4
|
+
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import * as am4core from '@amcharts/amcharts4/core';
|
|
6
6
|
import * as am4charts from '@amcharts/amcharts4/charts';
|
|
7
|
-
import * as
|
|
8
|
-
import * as i4 from '@esfaenza/localizations';
|
|
7
|
+
import * as i4 from '@esfaenza/extensions';
|
|
8
|
+
import * as i4$1 from '@esfaenza/localizations';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Adapter Base da reimplementare per trasformare i dati da una libreria di grafici a questa per evitare di riscrivere tutto il codice di
|
|
@@ -459,887 +459,594 @@ const ESC_THEME = new InjectionToken('ESC_THEME');
|
|
|
459
459
|
const ESC_LOGS = new InjectionToken('ESC_LOGS');
|
|
460
460
|
|
|
461
461
|
/**
|
|
462
|
-
* Classe
|
|
463
|
-
*
|
|
464
|
-
* Essenzialmente ogni volta che viene creato un grafico, questo acquisisce il tema e il locale applicato IN QUEL MOMENTO,
|
|
465
|
-
* questo significa che per creare due grafici con temi diversi bisogna fare:
|
|
466
|
-
*
|
|
467
|
-
* 1) Caricamento tema 1
|
|
468
|
-
*
|
|
469
|
-
* 2) Creazione grafico 1
|
|
470
|
-
*
|
|
471
|
-
* 3) Scaricamento tema 1
|
|
472
|
-
*
|
|
473
|
-
* 3) Caricamento tema 2
|
|
474
|
-
*
|
|
475
|
-
* 4) Creazione grafico 2
|
|
476
|
-
*
|
|
462
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un LineChart
|
|
477
463
|
*/
|
|
478
|
-
class
|
|
479
|
-
/**
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
this.themeCache = {};
|
|
496
|
-
/**
|
|
497
|
-
* Cache delle localizzazioni (moduli caricati dinamicamente)
|
|
498
|
-
*/
|
|
499
|
-
this.localizationCache = {};
|
|
464
|
+
class LineChartService {
|
|
465
|
+
/** @ignore */
|
|
466
|
+
constructor(Adapter, dateExts) {
|
|
467
|
+
this.Adapter = Adapter;
|
|
468
|
+
this.dateExts = dateExts;
|
|
469
|
+
/** @ignore */
|
|
470
|
+
this.DataGroupBucketSize = 1500;
|
|
471
|
+
/** @ignore */
|
|
472
|
+
this.OpacityOnSelected = 0.3;
|
|
473
|
+
/** @ignore */
|
|
474
|
+
this.OpacityOnFill = 0.75;
|
|
475
|
+
/** @ignore */
|
|
476
|
+
this.singleDataSet = false;
|
|
477
|
+
//******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
478
|
+
//TODO: spostarla in un metodo di utilità (esfaenza/extensions)
|
|
479
|
+
/** @ignore */
|
|
480
|
+
this.executionTimers = {};
|
|
500
481
|
}
|
|
501
482
|
/**
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
* @param {Object} chartsCore Istanza globale di amCharts
|
|
505
|
-
* @returns {Promise} Promise che identifica la fine del caricamento
|
|
483
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un LineChart
|
|
506
484
|
*/
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
485
|
+
graphicate(data, settings) {
|
|
486
|
+
let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
|
|
487
|
+
let threshold = settings.DataGroupingThreshold ?? 3000;
|
|
488
|
+
this.singleDataSet = settings.MergeDatasets ?? false;
|
|
489
|
+
let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
|
|
490
|
+
let dataShouldBeGrouped = Math.max(...dataConverted.series.map(t => t.values.length)) > threshold;
|
|
491
|
+
let showTimeline = settings.Timeline || dataShouldBeGrouped;
|
|
492
|
+
let seriesWithInterval = dataConverted.series.some(t => t.interval);
|
|
493
|
+
let interval = seriesWithInterval ? dataConverted.series.find(t => t.interval).interval : null;
|
|
494
|
+
let gapsAllowed = settings?.AllowGaps == null ? seriesWithInterval : settings?.AllowGaps;
|
|
495
|
+
let finalInstant = settings?.FinalInstants ?? true;
|
|
496
|
+
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
497
|
+
am4core.options.autoDispose = true;
|
|
498
|
+
this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
|
|
499
|
+
let ChartInstanceCasted = this.ChartInstance;
|
|
500
|
+
let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
|
|
501
|
+
if (settings.YAxisTitle) {
|
|
502
|
+
yAxis.title.text = settings.YAxisTitle;
|
|
503
|
+
yAxis.title.fontWeight = "bold";
|
|
514
504
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
505
|
+
if (settings.Min)
|
|
506
|
+
yAxis.min = settings.Min;
|
|
507
|
+
if (settings.Max)
|
|
508
|
+
yAxis.max = settings.Max;
|
|
509
|
+
let limitNullOrUndef = dataConverted.limit == null || dataConverted.limit == undefined;
|
|
510
|
+
let limits = limitNullOrUndef ? [] : !dataConverted.limit.length ? [dataConverted.limit] : dataConverted.limit;
|
|
511
|
+
if (limits.length > 0) {
|
|
512
|
+
for (let i = 0; i < limits.length; i++) {
|
|
513
|
+
let limit = limits[i];
|
|
514
|
+
if (limit.upper != null && limit.upper != undefined && limit.lower != null && limit.lower != undefined) {
|
|
515
|
+
let range = yAxis.axisRanges.create();
|
|
516
|
+
range.value = limit.lower;
|
|
517
|
+
range.endValue = limit.upper;
|
|
518
|
+
if (limit.fillColor) {
|
|
519
|
+
range.contents.stroke = am4core.color(limit.fillColor);
|
|
520
|
+
range.contents.fill = range.contents.stroke;
|
|
521
|
+
}
|
|
522
|
+
range.label.inside = true;
|
|
523
|
+
range.label.text = limit.upperlabel;
|
|
524
|
+
range.label.fill = range.grid.stroke;
|
|
525
|
+
range.label.verticalCenter = "bottom";
|
|
526
|
+
range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
|
|
527
|
+
range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
|
|
528
|
+
range.grid.strokeWidth = 2;
|
|
529
|
+
range.grid.strokeOpacity = 1;
|
|
530
|
+
}
|
|
531
|
+
else if ((limit.lower == null || limit.lower == undefined) && limit.upper != null && limit.upper != undefined) {
|
|
532
|
+
let range = yAxis.axisRanges.create();
|
|
533
|
+
range.value = limit.upper;
|
|
534
|
+
range.label.inside = true;
|
|
535
|
+
range.label.text = limit.upperlabel;
|
|
536
|
+
range.label.fill = range.grid.stroke;
|
|
537
|
+
range.label.verticalCenter = "bottom";
|
|
538
|
+
range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
|
|
539
|
+
range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
|
|
540
|
+
range.grid.strokeWidth = 2;
|
|
541
|
+
range.grid.strokeOpacity = 1;
|
|
542
|
+
}
|
|
543
|
+
else if ((limit.upper == null || limit.upper == undefined) && limit.lower != null && limit.lower != undefined) {
|
|
544
|
+
let range = yAxis.axisRanges.create();
|
|
545
|
+
range.value = limit.lower;
|
|
546
|
+
range.label.inside = true;
|
|
547
|
+
range.label.text = limit.lowerlabel;
|
|
548
|
+
range.label.fill = range.grid.stroke;
|
|
549
|
+
range.label.verticalCenter = "bottom";
|
|
550
|
+
range.label.stroke = am4core.color(limit.lowercolor || "#F92200");
|
|
551
|
+
range.grid.stroke = am4core.color(limit.lowercolor || "#F92200");
|
|
552
|
+
range.grid.strokeWidth = 2;
|
|
553
|
+
range.grid.strokeOpacity = 1;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
518
556
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
*/
|
|
526
|
-
unapplyAnimations(chartsCore) {
|
|
527
|
-
if (this.AnimationsAreLoaded) {
|
|
528
|
-
this.log("CORE: Animations in use, unapplying theme " + ChartThemes.animated);
|
|
529
|
-
chartsCore.unuseTheme(this.themeCache[ChartThemes.animated]);
|
|
530
|
-
this.AnimationsAreLoaded = false;
|
|
557
|
+
this.dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
|
|
558
|
+
// Per comatibilità col codice scritto quando non era a livello globale, mi scoccia sostituire
|
|
559
|
+
let dateAxis = this.dateAxis;
|
|
560
|
+
if (settings.XAxisTitle) {
|
|
561
|
+
dateAxis.title.text = settings.XAxisTitle;
|
|
562
|
+
dateAxis.title.fontWeight = "bold";
|
|
531
563
|
}
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
* @param {Object} chartsCore Istanza globale di amCharts
|
|
540
|
-
* @param {'spiritedaway' | 'moonrisekingdom' | 'frozen' | 'dark' | 'kelly' | 'material' | 'dataviz' | 'none'} theme Tema da applicare
|
|
541
|
-
* @returns {Promise} Promise che identifica la fine del caricamento
|
|
542
|
-
*/
|
|
543
|
-
applyTheme(chartsCore, theme) {
|
|
544
|
-
// Ultimo tema applicato è lo stesso che mi è stato richiesto di applicare --> NO-OP
|
|
545
|
-
if (this.LastLoadedTheme == theme) {
|
|
546
|
-
this.log("CORE: theme already applied " + theme);
|
|
547
|
-
return new Promise((resolve) => { resolve(true); });
|
|
564
|
+
if (showTicks) {
|
|
565
|
+
dateAxis.renderer.ticks.template.disabled = false;
|
|
566
|
+
dateAxis.renderer.ticks.template.strokeOpacity = 1;
|
|
567
|
+
dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
|
|
568
|
+
dateAxis.renderer.ticks.template.strokeWidth = 2;
|
|
569
|
+
dateAxis.renderer.ticks.template.length = 10;
|
|
570
|
+
dateAxis.renderer.ticks.template.location = 0;
|
|
548
571
|
}
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
572
|
+
dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
|
|
573
|
+
dateAxis.renderer.grid.template.location = 0;
|
|
574
|
+
dateAxis.minZoomCount = 5;
|
|
575
|
+
dateAxis.groupData = dataShouldBeGrouped;
|
|
576
|
+
dateAxis.groupCount = settings.DataGroupBucketSize ?? this.DataGroupBucketSize;
|
|
577
|
+
//Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
|
|
578
|
+
if (gapsAllowed) {
|
|
579
|
+
if (!seriesWithInterval) {
|
|
580
|
+
console.error("Per utilizzare la funzionalità dei gap è obbligatorio definire un intervallo nelle serie del grafico");
|
|
581
|
+
return null;
|
|
582
|
+
}
|
|
583
|
+
dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
|
|
555
584
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
* @returns {Promise} Promise che identifica la fine del caricamento
|
|
580
|
-
*/
|
|
581
|
-
applyLocale(chart, locale) {
|
|
582
|
-
return this.importIfNeeded('lang', locale).then(() => {
|
|
583
|
-
this.log("Chart " + chart.htmlContainer.id + ": applying locale " + locale);
|
|
584
|
-
chart.language.locale = this.localizationCache[locale];
|
|
585
|
+
if (showTimeline)
|
|
586
|
+
ChartInstanceCasted.scrollbarX = new am4charts.XYChartScrollbar();
|
|
587
|
+
let seriesToPush = [];
|
|
588
|
+
let seriesColors = [];
|
|
589
|
+
let defaultIndex = 0;
|
|
590
|
+
// Ordinamento dei dati se serve
|
|
591
|
+
dataConverted.series.forEach((s) => {
|
|
592
|
+
if (s.values[0] && !(s.values[0].d instanceof Date)) {
|
|
593
|
+
for (let v = 0; v < s.values.length; v++)
|
|
594
|
+
s.values[v].d = new Date(s.values[v].d);
|
|
595
|
+
}
|
|
596
|
+
var correctOrder = true;
|
|
597
|
+
var prevDate = null;
|
|
598
|
+
for (let v = 0; v < s.values.length; v++) {
|
|
599
|
+
if (!prevDate)
|
|
600
|
+
prevDate = s.values[v].d;
|
|
601
|
+
else if (s.values[v].d < prevDate) {
|
|
602
|
+
correctOrder = false;
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
if (!correctOrder)
|
|
607
|
+
s.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
|
|
585
608
|
});
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
* @param {string} item Chiave dell'oggetto da importare
|
|
592
|
-
*
|
|
593
|
-
* @returns {Promise} Promise che identifica la fine del caricamento
|
|
594
|
-
*/
|
|
595
|
-
importIfNeeded(what, item) {
|
|
596
|
-
// Se sto cercando di caricare qualcosa di già caricato non faccio nulla
|
|
597
|
-
if (!(what == 'themes' && !this.themeCache[item]) && !(what == 'lang' && !this.localizationCache[item])) {
|
|
598
|
-
this.log("CORE: " + (what == 'lang' ? "Language " : "Theme ") + item + " already loaded");
|
|
599
|
-
return new Promise((resolve) => { resolve(true); });
|
|
609
|
+
// Generazione di un unico dataset invece che N, per poter gestire un unico tooltip
|
|
610
|
+
if (this.singleDataSet) {
|
|
611
|
+
this.ChartInstance.data = this.generateSingleDataset(dataConverted);
|
|
612
|
+
;
|
|
613
|
+
dateAxis.cursorTooltipEnabled = false;
|
|
600
614
|
}
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
return
|
|
647
|
-
}
|
|
615
|
+
dataConverted.series.forEach((s, index) => {
|
|
616
|
+
let stacked = s.stacked != null && s.stacked != undefined ? s.stacked : (settings?.Stacked ?? false);
|
|
617
|
+
let fill = stacked || (s.fill != null && s.fill != undefined ? s.fill : (settings?.Fill ?? false));
|
|
618
|
+
let series = settings?.Step ? new am4charts.StepLineSeries() : new am4charts.LineSeries();
|
|
619
|
+
series.dataFields.valueY = "v" + (this.singleDataSet ? index : "");
|
|
620
|
+
series.dataFields.dateX = "d";
|
|
621
|
+
series.measureUnit = s.uom;
|
|
622
|
+
series.name = s.name;
|
|
623
|
+
series.strokeWidth = settings?.StrokeSize ?? 1;
|
|
624
|
+
series.connect = !gapsAllowed;
|
|
625
|
+
series.minBulletDistance = 10;
|
|
626
|
+
series.tooltipText = this.singleDataSet ? "" : s.name ? "{name}: [bold]{valueY}[/]" : "[bold]{valueY}[/]";
|
|
627
|
+
series.tooltip.pointerOrientation = "vertical";
|
|
628
|
+
series.tooltip.background.fillOpacity = 0.5;
|
|
629
|
+
series.tooltip.label.padding(12, 12, 12, 12);
|
|
630
|
+
series.fillOpacity = fill ? this.OpacityOnFill : 0.0001;
|
|
631
|
+
series.stacked = stacked;
|
|
632
|
+
series.hidden = s.hidden;
|
|
633
|
+
//Dataset singolo, i dati sono registrati a livello di chart, creo il tooltip che permette di vederli tutti insieme
|
|
634
|
+
//altrimenti assegno i dati della serie direttamente alla serie
|
|
635
|
+
if (this.singleDataSet) {
|
|
636
|
+
series.tooltip.getFillFromObject = false;
|
|
637
|
+
series.tooltip.background.fill = am4core.color("#eee");
|
|
638
|
+
series.tooltip.label.fill = am4core.color("#00");
|
|
639
|
+
series.tooltip.defaultState.transitionDuration = 0;
|
|
640
|
+
series.tooltip.hiddenState.transitionDuration = 0;
|
|
641
|
+
//Utilizzo il mio dateService per la formattazione della data in modo che non debba mai gestire n formati fra n librerie... bellissimo
|
|
642
|
+
series.dateFormatter.format = (source) => {
|
|
643
|
+
if (interval && finalInstant && ["hour", "minute", "second"].includes(interval.timeunit)) {
|
|
644
|
+
let timepart = null;
|
|
645
|
+
switch (interval.timeunit) {
|
|
646
|
+
case "hour":
|
|
647
|
+
timepart = 'day';
|
|
648
|
+
break;
|
|
649
|
+
case "minute":
|
|
650
|
+
timepart = 'hour';
|
|
651
|
+
break;
|
|
652
|
+
case "second":
|
|
653
|
+
timepart = 'minute';
|
|
654
|
+
break;
|
|
655
|
+
}
|
|
656
|
+
if (timepart)
|
|
657
|
+
return this.dateExts.adjustDateToFinalInstant(source, timepart, interval ? interval.timeunit == "second" : false);
|
|
658
|
+
}
|
|
659
|
+
else
|
|
660
|
+
return this.dateExts.getFormatted(source, interval ? ["day", "week", "month", "year"].includes(interval.timeunit) : false, interval ? interval.timeunit == "second" : false);
|
|
661
|
+
};
|
|
662
|
+
series.adapter.add("tooltipText", () => {
|
|
663
|
+
var text = "[bold]{dateX.formatDate()}[/]\n";
|
|
664
|
+
this.ChartInstance.series.each((item) => {
|
|
665
|
+
let uom = " [font-style: italic]" + series.measureUnit || "" + "[/]";
|
|
666
|
+
text += "[" + item.stroke.hex + "]●[/] " + (item.name ? (item.name + ": ") : "") + "[bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
|
|
667
|
+
});
|
|
668
|
+
return text;
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
else
|
|
672
|
+
series.data = s.values;
|
|
673
|
+
let segment = series.segments.template;
|
|
674
|
+
let hoverState = segment.states.create("hover");
|
|
675
|
+
hoverState.properties.strokeWidth = (settings?.StrokeSize ?? 1) + 1;
|
|
676
|
+
let dimmed = segment.states.create("dimmed");
|
|
677
|
+
dimmed.properties.stroke = am4core.color("#dadada");
|
|
678
|
+
//Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
|
|
679
|
+
if (s.color)
|
|
680
|
+
seriesColors.push(am4core.color(s.color));
|
|
681
|
+
else {
|
|
682
|
+
seriesColors.push(ChartInstanceCasted.colors.list[defaultIndex % ChartInstanceCasted.colors.list.length]);
|
|
683
|
+
defaultIndex++;
|
|
684
|
+
}
|
|
685
|
+
seriesToPush.push(series);
|
|
686
|
+
});
|
|
687
|
+
ChartInstanceCasted.colors.list = seriesColors;
|
|
688
|
+
//Scrivo le serie nel grafico
|
|
689
|
+
seriesToPush.forEach(s => {
|
|
690
|
+
ChartInstanceCasted.series.push(s);
|
|
691
|
+
if (showTimeline)
|
|
692
|
+
ChartInstanceCasted.scrollbarX.series.push(s);
|
|
693
|
+
});
|
|
694
|
+
if (settings.Legend) {
|
|
695
|
+
this.ChartInstance.legend = new am4charts.Legend();
|
|
696
|
+
this.ChartInstance.legend.position = settings?.LegendPosition ?? 'right';
|
|
697
|
+
this.ChartInstance.legend.scrollable = true;
|
|
698
|
+
this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
|
|
699
|
+
this.ChartInstance.legend.itemContainers.template.events.on("over", (event) => { this.processOver(event.target.dataItem.dataContext); });
|
|
700
|
+
this.ChartInstance.legend.itemContainers.template.events.on("out", () => { this.processOut(); });
|
|
701
|
+
if (settings.LegendPadding) {
|
|
702
|
+
let template = this.ChartInstance.legend.itemContainers.template;
|
|
703
|
+
template.paddingTop = settings.LegendPadding.top ?? 0;
|
|
704
|
+
template.paddingBottom = settings.LegendPadding.bottom ?? 0;
|
|
705
|
+
template.paddingLeft = settings.LegendPadding.left ?? 0;
|
|
706
|
+
template.paddingRight = settings.LegendPadding.right ?? 0;
|
|
707
|
+
}
|
|
648
708
|
}
|
|
649
|
-
this.
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
* Classe che si occupa del dispatch delle operazioni di rendering dei grafici utilizzando una coda per permettere ad ogni grafico di avere temi e localizzazione custom
|
|
672
|
-
*/
|
|
673
|
-
class ChartDispatcher {
|
|
674
|
-
/**
|
|
675
|
-
* @ignore
|
|
676
|
-
*/
|
|
677
|
-
constructor(logs) {
|
|
678
|
-
this.logs = logs;
|
|
679
|
-
/**
|
|
680
|
-
* Coda di inizializzazioni ancora da eseguire. Quando questa è vuota significa che nessuno sta creando grafici
|
|
681
|
-
*/
|
|
682
|
-
this.Initializations = [];
|
|
683
|
-
/**
|
|
684
|
-
* Lista dei grafici inizializzati e attivi in un dato momento (viene registrata la proprietà **name**). Non è possibile registrare due grafici con lo stesso identificativo
|
|
685
|
-
*/
|
|
686
|
-
this.InitializedGraphs = [];
|
|
709
|
+
this.ChartInstance.cursor = new am4charts.XYCursor();
|
|
710
|
+
//Prove******************************************************************************************************************************
|
|
711
|
+
// this.ChartInstance.cursor.events.on("cursorpositionchanged", (ev) => {
|
|
712
|
+
// //var value = dateAxis.positionToDate(dateAxis.toAxisPosition(ev.target.xPosition));
|
|
713
|
+
// var dt = dateAxis.series.values.find(t => t.dataItem.values.dateX);
|
|
714
|
+
// if (dt && dt.dataItem) {
|
|
715
|
+
// console.log(dt.dataItem.values);
|
|
716
|
+
// // this.ChartInstance.tooltipText = dt;
|
|
717
|
+
// }
|
|
718
|
+
// else {
|
|
719
|
+
// this.ChartInstance.tooltipText = "";
|
|
720
|
+
// }
|
|
721
|
+
// });
|
|
722
|
+
//******************************************************************************************************************************
|
|
723
|
+
this.ChartInstance.cursor.xAxis = dateAxis;
|
|
724
|
+
this.ChartInstance.cursor.yAxis = yAxis;
|
|
725
|
+
if (this.singleDataSet)
|
|
726
|
+
this.ChartInstance.cursor.maxTooltipDistance = -1;
|
|
727
|
+
//TODO: Cercare di capire perché è figlio di puttana......
|
|
728
|
+
dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
|
|
729
|
+
dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
|
|
730
|
+
return this;
|
|
687
731
|
}
|
|
688
|
-
/**
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
*
|
|
692
|
-
* @param {string} name Identificativo del grafico da registrare
|
|
693
|
-
* @param {Function} chartCreationFunction Funzione che fisicamente dovrà occuparsi della creazione del grafico
|
|
694
|
-
*/
|
|
695
|
-
register(name, chartCreationFunction) {
|
|
696
|
-
if (this.InitializedGraphs.indexOf(name) != -1)
|
|
697
|
-
throw "Attempting to register a duplicate chart '" + name + "'. Make sure the 'name' properties of your charts are univoque";
|
|
698
|
-
this.log("DISPATCHER: Registering chart creation function execution for " + name);
|
|
699
|
-
this.Initializations.push({ name: name, function: chartCreationFunction });
|
|
700
|
-
if (this.Initializations.length == 1) {
|
|
701
|
-
this.log("DISPATCHER: Initial drain started");
|
|
702
|
-
this.drainInitQueues();
|
|
703
|
-
}
|
|
732
|
+
/** @ignore */
|
|
733
|
+
setSelection(from, to) {
|
|
734
|
+
this.dateAxis.zoomToDates(from, to, true, true);
|
|
704
735
|
}
|
|
705
|
-
/**
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
let index = this.InitializedGraphs.indexOf(name);
|
|
712
|
-
if (index == -1) {
|
|
713
|
-
//Questo succede quando si cerca di distruggere il grafico mentre sta venendo graficato
|
|
714
|
-
this.log("DISPATCHER: Registration missing for chart " + name + " it was probably destroyed during load");
|
|
736
|
+
/** @ignore */
|
|
737
|
+
refreshData(data) {
|
|
738
|
+
let dataConverted = this.Adapter ? this.Adapter.adaptDataForLineChart(data) : data;
|
|
739
|
+
if (this.singleDataSet) {
|
|
740
|
+
var data = this.generateSingleDataset(dataConverted);
|
|
741
|
+
this.ChartInstance.addData(data);
|
|
715
742
|
return;
|
|
716
743
|
}
|
|
717
|
-
|
|
718
|
-
this.InitializedGraphs.splice(index, 1);
|
|
744
|
+
throw "Impossibile aggiornare i dati senza unire il dataset. Si prega di impostare [MergeDatasets] a true";
|
|
719
745
|
}
|
|
720
|
-
/**
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
this.log("DISPATCHER: initialization for chart " + toExecute.name + " is done");
|
|
731
|
-
this.InitializedGraphs.push(toExecute.name);
|
|
732
|
-
this.Initializations.splice(0, 1);
|
|
733
|
-
if (this.Initializations.length >= 1) {
|
|
734
|
-
this.log("DISPATCHER: Found queued initializations. Continuing");
|
|
735
|
-
this.drainInitQueues();
|
|
746
|
+
/** Partendo da dati divisi per seriue genera un dataset unito con la data come chiave e i vari valori dopo */
|
|
747
|
+
generateSingleDataset(data) {
|
|
748
|
+
let dto = {};
|
|
749
|
+
data.series.forEach((vs, index) => {
|
|
750
|
+
for (let i = 0; i < vs.values.length; i++) {
|
|
751
|
+
var dataitem = vs.values[i];
|
|
752
|
+
var indexer = new Date(dataitem.d).valueOf();
|
|
753
|
+
if (!dto[indexer])
|
|
754
|
+
dto[indexer] = {};
|
|
755
|
+
dto[indexer]['v' + index] = dataitem.v;
|
|
736
756
|
}
|
|
737
|
-
else
|
|
738
|
-
this.log("DISPATCHER: queue is over, nothing more to do");
|
|
739
757
|
});
|
|
758
|
+
var dates = Object.keys(dto);
|
|
759
|
+
var ret = [];
|
|
760
|
+
for (let i = 0; i < dates.length; i++) {
|
|
761
|
+
let values = dto[dates[i]];
|
|
762
|
+
let item = { d: new Date(parseInt(dates[i])) };
|
|
763
|
+
var vals = Object.keys(values);
|
|
764
|
+
for (let ii = 0; ii < vals.length; ii++) {
|
|
765
|
+
let series = vals[ii];
|
|
766
|
+
let singleVal = values[series];
|
|
767
|
+
item[series] = singleVal;
|
|
768
|
+
}
|
|
769
|
+
ret.push(item);
|
|
770
|
+
}
|
|
771
|
+
return ret;
|
|
740
772
|
}
|
|
741
|
-
/**
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, decorators: [{
|
|
752
|
-
type: Injectable,
|
|
753
|
-
args: [{ providedIn: 'root' }]
|
|
754
|
-
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
755
|
-
type: Inject,
|
|
756
|
-
args: [ESC_LOGS]
|
|
757
|
-
}] }]; } });
|
|
758
|
-
|
|
759
|
-
/**
|
|
760
|
-
* Componente Grafico Base che gestisce tutte le cose comuni dei vari grafici istanziabili, come la presenza o menu di una legenda,
|
|
761
|
-
* il tema utilizzato, il locale del singolo grafico, ecc ecc...
|
|
762
|
-
*/
|
|
763
|
-
class BaseChartComponent {
|
|
764
|
-
/**
|
|
765
|
-
* Costruttore
|
|
766
|
-
*
|
|
767
|
-
* @param {ElementRef} el Contenitore all'interno del cui viene creato il grafico. Utilizzato per estrapolarne la **ContainerHeight**
|
|
768
|
-
* @param {Object} platformId piattaforma Angular (browser, ecc...) per essere sicuri che amcharts venga attivato solo lato browser. Non utilizzando SSR nelle applicazioni che consumano questa libreria non è particolarmente significativo, ma non si sa mai
|
|
769
|
-
* @param {NgZone} zone NgZone di default per permettere di inizializzare il grafico all'infuori di Angular per avere qualche prestazione in più
|
|
770
|
-
* @param {ChartLoader} Charter Istanza del Loader che si occuperà di caricare in memoria tutto ciò che serve per il grafico attuale (temi, locale, animazioni, ecc...)
|
|
771
|
-
* @param {ChartDispatcher} Dispatcher Istanza del Dispatcher che si occupa di differire il caricamento dei grafici 1 dopo l'altro in modo che caricamenti pseudo paralleli incasinino tutto
|
|
772
|
-
* @param {boolean} logs Indica se effettuare log a console o meno, iniettato dalle classi specializzate dal token ESC_LOGS
|
|
773
|
-
* @param {boolean} animations Indica se per questo grafico devono essere attive o meno le animazioni. Impostazione generica presa dal token ESC_ANIMATIONS
|
|
774
|
-
* @param {string} locale Indica il locale specifico per questo grafico. Impostazione generica presa dal LocalizationService
|
|
775
|
-
* @param {string} theme Indica il tema specifico per questo grafico. Impostazione generica presa dal token ESC_THEME
|
|
776
|
-
*/
|
|
777
|
-
constructor(el, platformId, zone, Charter, Dispatcher, logs, animations, locale, theme) {
|
|
778
|
-
this.el = el;
|
|
779
|
-
this.platformId = platformId;
|
|
780
|
-
this.zone = zone;
|
|
781
|
-
this.Charter = Charter;
|
|
782
|
-
this.Dispatcher = Dispatcher;
|
|
783
|
-
this.logs = logs;
|
|
784
|
-
this.animations = animations;
|
|
785
|
-
this.locale = locale;
|
|
786
|
-
this.theme = theme;
|
|
787
|
-
/**
|
|
788
|
-
* Nome del grafico, fondamentale assegnarlo per permettere alla libreria di schedularne la creazione
|
|
789
|
-
*/
|
|
790
|
-
this.name = "";
|
|
791
|
-
/**
|
|
792
|
-
* Dopo aver navigato a un nuovo grafico verranno attesi questi millisecondi prima di richiedere i dati attraverso la **DataRetrieve**.
|
|
793
|
-
*
|
|
794
|
-
* Questo per evitare che l'utente cliccando velocemente "avanti" generi tonnellate di richieste inutili
|
|
795
|
-
*/
|
|
796
|
-
this.BrowseDelayMs = 500;
|
|
797
|
-
/**
|
|
798
|
-
* Evento lanciato sulla selezione di un range di dati o dalla timeline o dal grafico. Valido per tutti i grafici che supportano serie basate sulle date
|
|
799
|
-
*/
|
|
800
|
-
this.onSelectionChanged = new EventEmitter();
|
|
801
|
-
/**
|
|
802
|
-
* Evento lanciato dal click di una serie dalla Legenda, a patto che l'Input **HideSeriesOnLabelClick** sia impostato a false
|
|
803
|
-
*/
|
|
804
|
-
this.onSeriesClicked = new EventEmitter();
|
|
805
|
-
/**
|
|
806
|
-
* Evento lanciato all'inizio del caricamento di una nuova pagina del grafico
|
|
807
|
-
*/
|
|
808
|
-
this.onLoadStart = new EventEmitter();
|
|
809
|
-
/**
|
|
810
|
-
* Evento lanciato al termine del caricamento di una nuova pagina del grafico
|
|
811
|
-
*/
|
|
812
|
-
this.onLoadEnd = new EventEmitter();
|
|
813
|
-
/**
|
|
814
|
-
* Evento lanciato al termine della creazione del grafico referenziando l'istanza nativa del grafico creato in modo da poter effettuare modifiche
|
|
815
|
-
* post inizializzazione lato applicativo
|
|
816
|
-
*/
|
|
817
|
-
this.chartLoaded = new EventEmitter();
|
|
818
|
-
/**
|
|
819
|
-
* Serve a decidere se sarà presente l'interfaccia di paginazione
|
|
820
|
-
*/
|
|
821
|
-
this.isPaged = false;
|
|
822
|
-
/**
|
|
823
|
-
* @ignore
|
|
824
|
-
*/
|
|
825
|
-
this.initDone = false;
|
|
826
|
-
}
|
|
827
|
-
/**
|
|
828
|
-
* Metodo di inizializzazione post valorizzazione degli input, utilizzato per valorizzare correttamente le proprietà essenziali del grafico (Animazioni, Tema e Locale)
|
|
829
|
-
*
|
|
830
|
-
* Viene data priorità ai Settings (HTML), priorità secondaria agli Input diretti (Lato HTML), priorità ultima alle impostazioni globali,
|
|
831
|
-
* impostate in fase di import del modulo assegnando valori ai token ESC_ANIMATIONS, ESC_THEME
|
|
832
|
-
*/
|
|
833
|
-
ngOnInit() {
|
|
834
|
-
// Qui servono solo le variabili da conoscere PRE-graficazione per il caricamento dei moduli lazy del grafico
|
|
835
|
-
this.Animations = this.Settings?.Animations != null ? this.Settings?.Animations : (this.Animations != null ? this.Animations : this.animations);
|
|
836
|
-
this.Theme = this.Settings?.Theme != null ? this.Settings?.Theme : (this.Theme != null ? this.Theme : this.theme);
|
|
837
|
-
this.Locale = this.Settings?.Locale != null ? this.Settings?.Locale : (this.Locale != null ? this.Locale : this.locale);
|
|
838
|
-
this.isPaged = (this.DataArray && this.DataArray.length > 0 && !this.Data) || (this.DataDtos && this.DataDtos.length > 0 && !!this.DataRetrieve);
|
|
839
|
-
this.log("Chart " + this.name + ": ngOnInit");
|
|
840
|
-
}
|
|
841
|
-
/**
|
|
842
|
-
* Implementazione utilizzata per controllare eventuali proprietà chiave del grafico e rigraficare tutto qualora si rivelasse necessario
|
|
843
|
-
*
|
|
844
|
-
* @param {SimpleChanges} changes Indicazione dei cambiamenti sulle proprietà del grafico. Vedere documentazione Angular in merito
|
|
845
|
-
*/
|
|
846
|
-
ngOnChanges(changes) {
|
|
847
|
-
if (!this.initDone)
|
|
848
|
-
return;
|
|
849
|
-
this.log("Chart " + this.name + ": ngOnChanges");
|
|
850
|
-
let propsToCheck = ["Timeline", "Legend", "Settings", "Animations", "Theme", "Locale", ...this.getSpecificPropertiesToCheck()];
|
|
851
|
-
this.checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck);
|
|
852
|
-
}
|
|
853
|
-
/**
|
|
854
|
-
* Nel post inizializzazione, a patto che mi trovi in ambiente "browser", proseguo al caricamento del grafico sull'HTML
|
|
855
|
-
*/
|
|
856
|
-
ngAfterViewInit() {
|
|
857
|
-
if (!this.name)
|
|
858
|
-
throw "a Unique name is mandatory to create a chart";
|
|
859
|
-
this.log("Chart " + this.name + ": ngAfterViewInit, graphicating chart outside Angular");
|
|
860
|
-
if (!this.isPaged)
|
|
861
|
-
this.dispatchLoadChart();
|
|
862
|
-
}
|
|
863
|
-
/**
|
|
864
|
-
* All'onDestroy scarico il grafico per liberare memoria
|
|
865
|
-
*/
|
|
866
|
-
ngOnDestroy() {
|
|
867
|
-
if (this.Chart) {
|
|
868
|
-
this.log("Chart " + this.name + ": Unloading destroyed chart");
|
|
869
|
-
this.browserOnly(() => { this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
|
|
773
|
+
/** @ignore */
|
|
774
|
+
emitSelectionChanged(ev, settings) {
|
|
775
|
+
if (settings.OnSelectionChangedCallback) {
|
|
776
|
+
this.throttla("selchange", () => {
|
|
777
|
+
var axis = ev.target;
|
|
778
|
+
var start = new Date(axis.minZoomed);
|
|
779
|
+
var end = new Date(axis.maxZoomed);
|
|
780
|
+
var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
|
|
781
|
+
settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
|
|
782
|
+
}, 150);
|
|
870
783
|
}
|
|
871
|
-
else
|
|
872
|
-
this.log("Chart " + this.name + ": Unloading uncreated chart component. It probably was a duplicated");
|
|
873
784
|
}
|
|
874
|
-
/**
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
785
|
+
/** @ignore */
|
|
786
|
+
processOver(hoveredSeries) {
|
|
787
|
+
hoveredSeries.zIndex = 999;
|
|
788
|
+
let fill = hoveredSeries.fillOpacity == this.OpacityOnFill;
|
|
789
|
+
hoveredSeries.segments.each((segment) => {
|
|
790
|
+
segment.setState("hover");
|
|
791
|
+
if (!fill)
|
|
792
|
+
segment.fillSprite.fillOpacity = this.OpacityOnSelected;
|
|
793
|
+
});
|
|
794
|
+
if (!fill)
|
|
795
|
+
hoveredSeries.legendDataItem.marker.children.getIndex(1).fillOpacity = this.OpacityOnSelected;
|
|
796
|
+
this.ChartInstance.series.each((series) => {
|
|
797
|
+
if (series != hoveredSeries) {
|
|
798
|
+
let fill = series.fillOpacity == this.OpacityOnFill;
|
|
799
|
+
series.segments.each((segment) => {
|
|
800
|
+
segment.setState("dimmed");
|
|
801
|
+
if (!fill)
|
|
802
|
+
segment.fillSprite.fillOpacity = 0;
|
|
803
|
+
});
|
|
804
|
+
}
|
|
880
805
|
});
|
|
881
806
|
}
|
|
882
|
-
/**
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
if (!this.Chart)
|
|
904
|
-
this.log("Chart " + this.name + ": Could not create graph");
|
|
905
|
-
// Unico punto reale in cui viene utilizzato il locale, tehe
|
|
906
|
-
return this.Charter.applyLocale(this.Chart, this.Locale).then(() => { this.initDone = true; this.chartLoaded.emit(this); });
|
|
907
|
-
})
|
|
908
|
-
]);
|
|
807
|
+
/** @ignore */
|
|
808
|
+
processOut() {
|
|
809
|
+
this.ChartInstance.series.each((series, i) => {
|
|
810
|
+
series.zIndex = i;
|
|
811
|
+
let fill = series.fillOpacity == this.OpacityOnFill;
|
|
812
|
+
series.segments.each((segment) => {
|
|
813
|
+
segment.setState("default");
|
|
814
|
+
if (!fill)
|
|
815
|
+
segment.fillSprite.fillOpacity = 0;
|
|
816
|
+
});
|
|
817
|
+
if (!fill)
|
|
818
|
+
series.legendDataItem.marker.children.getIndex(1).fillOpacity = 0;
|
|
819
|
+
});
|
|
820
|
+
}
|
|
821
|
+
/** @ignore */
|
|
822
|
+
throttla(id, func, throttleTime) {
|
|
823
|
+
//Se ho la funzione che vuole eseguire ripulisco quel timeout
|
|
824
|
+
if (this.executionTimers[id])
|
|
825
|
+
clearTimeout(this.executionTimers[id]);
|
|
826
|
+
//Ricreo il timeout per eseguire quella funzione dopo throttleTime millisecondi
|
|
827
|
+
this.executionTimers[id] = setTimeout(() => { func(); this.executionTimers[id] = null; }, throttleTime);
|
|
909
828
|
}
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Classe che si occupa del dispatch delle operazioni di rendering dei grafici utilizzando una coda per permettere ad ogni grafico di avere temi e localizzazione custom
|
|
833
|
+
*/
|
|
834
|
+
class ChartDispatcher {
|
|
910
835
|
/**
|
|
911
|
-
*
|
|
912
|
-
* integrando eventualmente con le proprietà del grafico
|
|
913
|
-
*
|
|
914
|
-
* @param {BaseSettings} settings Impostazioni base ricevute dalla specializzazione del grafico
|
|
836
|
+
* @ignore
|
|
915
837
|
*/
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
settings.YAxisTitle = settings.YAxisTitle ? settings.YAxisTitle : this.YTitle;
|
|
927
|
-
settings.LegendPosition = settings.LegendPosition ? settings.LegendPosition : this.LegendPosition;
|
|
928
|
-
settings.HideSeriesOnLabelClick = settings.HideSeriesOnLabelClick != null ? settings.HideSeriesOnLabelClick : this.HideSeriesOnLabelClick;
|
|
929
|
-
settings.MinGridDistance = settings.MinGridDistance != null ? settings.MinGridDistance : this.MinGridDistance;
|
|
930
|
-
settings.LegendPadding = settings.LegendPadding ? settings.LegendPadding : this.LegendPadding ?? null;
|
|
931
|
-
settings.ContainerHeight = this.el.nativeElement.parentElement.offsetHeight;
|
|
932
|
-
settings.OnSeriesClickCallback = (series) => { this.onSeriesClicked.emit(series); };
|
|
933
|
-
settings.OnSelectionChangedCallback = (event) => { this.onSelectionChanged.emit({ from: event.from, to: event.to, initial: event.initial }); };
|
|
838
|
+
constructor(logs) {
|
|
839
|
+
this.logs = logs;
|
|
840
|
+
/**
|
|
841
|
+
* Coda di inizializzazioni ancora da eseguire. Quando questa è vuota significa che nessuno sta creando grafici
|
|
842
|
+
*/
|
|
843
|
+
this.Initializations = [];
|
|
844
|
+
/**
|
|
845
|
+
* Lista dei grafici inizializzati e attivi in un dato momento (viene registrata la proprietà **name**). Non è possibile registrare due grafici con lo stesso identificativo
|
|
846
|
+
*/
|
|
847
|
+
this.InitializedGraphs = [];
|
|
934
848
|
}
|
|
935
849
|
/**
|
|
936
|
-
*
|
|
850
|
+
* Registra un grafico da visualizzare insieme alla propria funzione di creazione. Quest'ultima sarà differita fino a che tutti i grafici
|
|
851
|
+
* precedentemente registati non hanno finito la fase di inizializzazione
|
|
937
852
|
*
|
|
938
|
-
* @param {
|
|
939
|
-
* @param {
|
|
853
|
+
* @param {string} name Identificativo del grafico da registrare
|
|
854
|
+
* @param {Function} chartCreationFunction Funzione che fisicamente dovrà occuparsi della creazione del grafico
|
|
940
855
|
*/
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
856
|
+
register(name, chartCreationFunction) {
|
|
857
|
+
if (this.InitializedGraphs.indexOf(name) != -1)
|
|
858
|
+
throw "Attempting to register a duplicate chart '" + name + "'. Make sure the 'name' properties of your charts are univoque";
|
|
859
|
+
this.log("DISPATCHER: Registering chart creation function execution for " + name);
|
|
860
|
+
this.Initializations.push({ name: name, function: chartCreationFunction });
|
|
861
|
+
if (this.Initializations.length == 1) {
|
|
862
|
+
this.log("DISPATCHER: Initial drain started");
|
|
863
|
+
this.drainInitQueues();
|
|
864
|
+
}
|
|
947
865
|
}
|
|
948
866
|
/**
|
|
949
|
-
*
|
|
950
|
-
* e anche lato applicativo il DataRetrieve dovrà considerare che l'assenza di valori non è altro che un'indicazione di inizio caricamento
|
|
951
|
-
*
|
|
952
|
-
* Il caricamento di qualsiasi pagina genererà comunque una primo evento con **data** nullo in modo da indicare l'inizio caricamento e
|
|
953
|
-
* in seconda istanza un altro evento in cui **data** sarà sempre valorizzato, o con il Dto da usare per recuperare i dati, o con i dati
|
|
954
|
-
* veri e propri già presenti nel **DataArray**
|
|
955
|
-
*
|
|
956
|
-
* I callback **onLoadStart** e **onLoadEnd** vengono sempre chiamati
|
|
867
|
+
* Deregistra un grafico presente. Chiamata generalmente al dispose del grafico in questione quando non dev'essere più mostrato nella pagina corrente
|
|
957
868
|
*
|
|
958
|
-
* @param {
|
|
869
|
+
* @param {string} name Identificativo del grafico da deregistrare
|
|
959
870
|
*/
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
//
|
|
964
|
-
|
|
965
|
-
if (this.DataRetrieve)
|
|
966
|
-
this.DataRetrieve(null, nd.index);
|
|
967
|
-
this.onLoadStart.emit();
|
|
871
|
+
deregisterGraph(name) {
|
|
872
|
+
let index = this.InitializedGraphs.indexOf(name);
|
|
873
|
+
if (index == -1) {
|
|
874
|
+
//Questo succede quando si cerca di distruggere il grafico mentre sta venendo graficato
|
|
875
|
+
this.log("DISPATCHER: Registration missing for chart " + name + " it was probably destroyed during load");
|
|
968
876
|
return;
|
|
969
877
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
else
|
|
973
|
-
this.changePageDataReceived(nd.data);
|
|
878
|
+
this.log("DISPATCHER: Chart deregistered " + name);
|
|
879
|
+
this.InitializedGraphs.splice(index, 1);
|
|
974
880
|
}
|
|
975
881
|
/**
|
|
976
|
-
*
|
|
882
|
+
* Metodo che esegue in maniera sequenziale le funzioni di inizializzazione dei grafici finché presenti
|
|
883
|
+
* in modo che nessun grafico possa essere inizializzato contemporaneamente ad un altro.
|
|
977
884
|
*
|
|
978
|
-
*
|
|
885
|
+
* Questo è il punto chiave che permette di avere per ogni grafico temi e locale differenti
|
|
979
886
|
*/
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
this.
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
this.
|
|
987
|
-
|
|
988
|
-
|
|
887
|
+
drainInitQueues() {
|
|
888
|
+
let toExecute = this.Initializations[0];
|
|
889
|
+
this.log("DISPATCHER: Executing initialization function for chart " + toExecute.name);
|
|
890
|
+
toExecute.function().then(() => {
|
|
891
|
+
this.log("DISPATCHER: initialization for chart " + toExecute.name + " is done");
|
|
892
|
+
this.InitializedGraphs.push(toExecute.name);
|
|
893
|
+
this.Initializations.splice(0, 1);
|
|
894
|
+
if (this.Initializations.length >= 1) {
|
|
895
|
+
this.log("DISPATCHER: Found queued initializations. Continuing");
|
|
896
|
+
this.drainInitQueues();
|
|
897
|
+
}
|
|
898
|
+
else
|
|
899
|
+
this.log("DISPATCHER: queue is over, nothing more to do");
|
|
900
|
+
});
|
|
989
901
|
}
|
|
990
902
|
/**
|
|
991
|
-
*
|
|
992
|
-
*
|
|
993
|
-
* Le chiamate a questo metodo possono essere trasformate in chiamate al metodo **graphicate** della Service, se solo quel metodo fosse abbastanza intelligente per capire
|
|
994
|
-
* le differenze fra il grafico com'era prima e come deve diventare, in modo da non ricrearlo ma semplicemente modificare quello che già è disegnato
|
|
903
|
+
* @ignore
|
|
995
904
|
*/
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
this.Dispatcher.register(this.name, () => { return this.loadChart(); });
|
|
905
|
+
log(text) {
|
|
906
|
+
if (this.logs)
|
|
907
|
+
console.log("@esfaenza/es-charts: " + text);
|
|
1000
908
|
}
|
|
909
|
+
}
|
|
910
|
+
ChartDispatcher.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, deps: [{ token: ESC_LOGS }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
911
|
+
ChartDispatcher.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, providedIn: 'root' });
|
|
912
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartDispatcher, decorators: [{
|
|
913
|
+
type: Injectable,
|
|
914
|
+
args: [{ providedIn: 'root' }]
|
|
915
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
916
|
+
type: Inject,
|
|
917
|
+
args: [ESC_LOGS]
|
|
918
|
+
}] }]; } });
|
|
919
|
+
|
|
920
|
+
/**
|
|
921
|
+
* Componente specifico per la graficazione di un grafico a Linea su un asse temporale
|
|
922
|
+
*/
|
|
923
|
+
class EsLineChartComponent extends BaseChartComponent {
|
|
1001
924
|
/**
|
|
1002
|
-
*
|
|
925
|
+
* @ignore
|
|
1003
926
|
*/
|
|
1004
|
-
|
|
1005
|
-
|
|
927
|
+
constructor(el, ChartLoader, ChartDispatcher, adapter, dateService, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
|
|
928
|
+
super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
|
|
929
|
+
this.adapter = adapter;
|
|
930
|
+
this.dateService = dateService;
|
|
1006
931
|
}
|
|
1007
|
-
;
|
|
1008
932
|
/**
|
|
1009
|
-
*
|
|
933
|
+
* Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
|
|
1010
934
|
*/
|
|
1011
|
-
|
|
1012
|
-
return
|
|
1013
|
-
this.Charter.applyTheme(am4core, this.Theme).then(() => {
|
|
1014
|
-
return this.Animations ? this.Charter.applyAnimations(am4core) : this.Charter.unapplyAnimations(am4core);
|
|
1015
|
-
})
|
|
1016
|
-
]);
|
|
935
|
+
getSpecificPropertiesToCheck() {
|
|
936
|
+
return ["Data", "DataArray", "Step", "DataGroupBucketSize", "DataGroupingThreshold", "StrokeSize", "Stacked", "AllowGaps", "MergeDatasets", "FinalInstants", "Fill", "Min", "Max"];
|
|
1017
937
|
}
|
|
1018
938
|
/**
|
|
1019
|
-
*
|
|
939
|
+
* Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
|
|
940
|
+
*
|
|
941
|
+
* @returns {LineChartSettings} Settings castati al tipo giusto
|
|
1020
942
|
*/
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
console.log("@esfaenza/es-charts: " + log);
|
|
943
|
+
getCastedSettings() {
|
|
944
|
+
return (this.Settings ?? new LineChartSettings());
|
|
1024
945
|
}
|
|
1025
946
|
/**
|
|
1026
|
-
*
|
|
947
|
+
* Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
|
|
1027
948
|
*
|
|
1028
|
-
* @param {
|
|
1029
|
-
* @param {Date} to Fine dello zoom
|
|
949
|
+
* @param {LineChartSettings} settingsCasted Settings castati al tipo giusto
|
|
1030
950
|
*/
|
|
1031
|
-
|
|
1032
|
-
|
|
951
|
+
fillSpecificSettings(settingsCasted) {
|
|
952
|
+
settingsCasted.Step = settingsCasted.Step != null ? settingsCasted.Step : this.Step;
|
|
953
|
+
settingsCasted.DataGroupBucketSize = settingsCasted.DataGroupBucketSize != null ? settingsCasted.DataGroupBucketSize : this.DataGroupBucketSize;
|
|
954
|
+
settingsCasted.StrokeSize = settingsCasted.StrokeSize != null ? settingsCasted.StrokeSize : this.StrokeSize;
|
|
955
|
+
settingsCasted.DataGroupingThreshold = settingsCasted.DataGroupingThreshold != null ? settingsCasted.DataGroupingThreshold : this.DataGroupingThreshold;
|
|
956
|
+
settingsCasted.AllowGaps = settingsCasted.AllowGaps != null ? settingsCasted.AllowGaps : this.AllowGaps;
|
|
957
|
+
settingsCasted.MergeDatasets = settingsCasted.MergeDatasets != null ? settingsCasted.MergeDatasets : this.MergeDatasets;
|
|
958
|
+
settingsCasted.FinalInstants = settingsCasted.FinalInstants != null ? settingsCasted.FinalInstants : this.FinalInstants;
|
|
959
|
+
settingsCasted.Min = settingsCasted.Min != null ? settingsCasted.Min : this.Min;
|
|
960
|
+
settingsCasted.Max = settingsCasted.Max != null ? settingsCasted.Max : this.Max;
|
|
961
|
+
settingsCasted.Fill = settingsCasted.Fill != null ? settingsCasted.Fill : this.Fill;
|
|
962
|
+
settingsCasted.Stacked = settingsCasted.Stacked != null ? settingsCasted.Stacked : this.Stacked;
|
|
1033
963
|
}
|
|
1034
964
|
/**
|
|
1035
|
-
*
|
|
965
|
+
* Effettua il rendering di questo grafico in base ai Settings
|
|
966
|
+
*
|
|
967
|
+
* @param {LineChartSettings} settingsCasted Impostazioni di graficazione
|
|
968
|
+
* @returns {LineChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
|
|
1036
969
|
*/
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
this.zone.runOutsideAngular(() => {
|
|
1040
|
-
f();
|
|
1041
|
-
});
|
|
1042
|
-
}
|
|
970
|
+
graphicate(settingsCasted) {
|
|
971
|
+
return new LineChartService(this.adapter, this.dateService).graphicate(this.Data, settingsCasted);
|
|
1043
972
|
}
|
|
1044
973
|
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
1048
|
-
type:
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
type:
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
974
|
+
EsLineChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsLineChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i4.DateService }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
975
|
+
EsLineChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsLineChartComponent, selector: "es-line-chart", inputs: { Data: "Data", DataArray: "DataArray", Step: "Step", DataGroupBucketSize: "DataGroupBucketSize", DataGroupingThreshold: "DataGroupingThreshold", StrokeSize: "StrokeSize", AllowGaps: "AllowGaps", MergeDatasets: "MergeDatasets", FinalInstants: "FinalInstants", Min: "Min", Max: "Max", Fill: "Fill", Stacked: "Stacked" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
976
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsLineChartComponent, decorators: [{
|
|
977
|
+
type: Component,
|
|
978
|
+
args: [{ selector: 'es-line-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
979
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i4.DateService }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
980
|
+
type: Inject,
|
|
981
|
+
args: [PLATFORM_ID]
|
|
982
|
+
}] }, { type: undefined, decorators: [{
|
|
983
|
+
type: Inject,
|
|
984
|
+
args: [ESC_LOGS]
|
|
985
|
+
}] }, { type: undefined, decorators: [{
|
|
986
|
+
type: Inject,
|
|
987
|
+
args: [ESC_ANIMATIONS]
|
|
988
|
+
}] }, { type: undefined, decorators: [{
|
|
989
|
+
type: Inject,
|
|
990
|
+
args: [ESC_THEME]
|
|
991
|
+
}] }, { type: i4$1.LocalizationService }]; }, propDecorators: { Data: [{
|
|
1060
992
|
type: Input
|
|
1061
|
-
}],
|
|
993
|
+
}], DataArray: [{
|
|
1062
994
|
type: Input
|
|
1063
|
-
}],
|
|
995
|
+
}], Step: [{
|
|
1064
996
|
type: Input
|
|
1065
|
-
}],
|
|
997
|
+
}], DataGroupBucketSize: [{
|
|
1066
998
|
type: Input
|
|
1067
|
-
}],
|
|
999
|
+
}], DataGroupingThreshold: [{
|
|
1068
1000
|
type: Input
|
|
1069
|
-
}],
|
|
1001
|
+
}], StrokeSize: [{
|
|
1070
1002
|
type: Input
|
|
1071
|
-
}],
|
|
1003
|
+
}], AllowGaps: [{
|
|
1072
1004
|
type: Input
|
|
1073
|
-
}],
|
|
1005
|
+
}], MergeDatasets: [{
|
|
1074
1006
|
type: Input
|
|
1075
|
-
}],
|
|
1007
|
+
}], FinalInstants: [{
|
|
1076
1008
|
type: Input
|
|
1077
|
-
}],
|
|
1009
|
+
}], Min: [{
|
|
1078
1010
|
type: Input
|
|
1079
|
-
}],
|
|
1011
|
+
}], Max: [{
|
|
1080
1012
|
type: Input
|
|
1081
|
-
}],
|
|
1013
|
+
}], Fill: [{
|
|
1082
1014
|
type: Input
|
|
1083
|
-
}],
|
|
1015
|
+
}], Stacked: [{
|
|
1084
1016
|
type: Input
|
|
1085
|
-
}], header_tr: [{
|
|
1086
|
-
type: ContentChild,
|
|
1087
|
-
args: ['header', { static: false }]
|
|
1088
|
-
}], loading_template: [{
|
|
1089
|
-
type: ContentChild,
|
|
1090
|
-
args: ['loading', { static: false }]
|
|
1091
|
-
}], onSelectionChanged: [{
|
|
1092
|
-
type: Output
|
|
1093
|
-
}], onSeriesClicked: [{
|
|
1094
|
-
type: Output
|
|
1095
|
-
}], onLoadStart: [{
|
|
1096
|
-
type: Output
|
|
1097
|
-
}], onLoadEnd: [{
|
|
1098
|
-
type: Output
|
|
1099
|
-
}], chartLoaded: [{
|
|
1100
|
-
type: Output
|
|
1101
1017
|
}] } });
|
|
1102
1018
|
|
|
1103
1019
|
/**
|
|
1104
|
-
* Classe il cui unico scopo è gestire il setup e rendering di un
|
|
1020
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un AreaChart
|
|
1105
1021
|
*/
|
|
1106
|
-
class
|
|
1022
|
+
class AreaChartService {
|
|
1107
1023
|
/** @ignore */
|
|
1108
|
-
constructor(Adapter
|
|
1024
|
+
constructor(Adapter) {
|
|
1109
1025
|
this.Adapter = Adapter;
|
|
1110
|
-
this.dateExts = dateExts;
|
|
1111
|
-
/** @ignore */
|
|
1112
|
-
this.DataGroupBucketSize = 1500;
|
|
1113
|
-
/** @ignore */
|
|
1114
|
-
this.OpacityOnSelected = 0.3;
|
|
1115
|
-
/** @ignore */
|
|
1116
|
-
this.OpacityOnFill = 0.75;
|
|
1117
|
-
/** @ignore */
|
|
1118
|
-
this.singleDataSet = false;
|
|
1119
1026
|
//******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
1120
1027
|
//TODO: spostarla in un metodo di utilità (esfaenza/extensions)
|
|
1121
1028
|
/** @ignore */
|
|
1122
1029
|
this.executionTimers = {};
|
|
1123
1030
|
}
|
|
1124
1031
|
/**
|
|
1125
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un
|
|
1032
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un AreaChart
|
|
1126
1033
|
*/
|
|
1127
1034
|
graphicate(data, settings) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1035
|
+
if (settings.Timeline) {
|
|
1036
|
+
console.error("Timeline not supported for area chart");
|
|
1037
|
+
return null;
|
|
1038
|
+
}
|
|
1039
|
+
let dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
|
|
1131
1040
|
let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
|
|
1132
|
-
let
|
|
1133
|
-
let showTimeline = settings.Timeline || dataShouldBeGrouped;
|
|
1134
|
-
let seriesWithInterval = dataConverted.series.some(t => t.interval);
|
|
1135
|
-
let interval = seriesWithInterval ? dataConverted.series.find(t => t.interval).interval : null;
|
|
1136
|
-
let gapsAllowed = settings?.AllowGaps == null ? seriesWithInterval : settings?.AllowGaps;
|
|
1137
|
-
let finalInstant = settings?.FinalInstants ?? true;
|
|
1041
|
+
let interval = dataConverted.interval;
|
|
1138
1042
|
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
1139
1043
|
am4core.options.autoDispose = true;
|
|
1140
|
-
this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
|
|
1141
|
-
let ChartInstanceCasted = this.ChartInstance;
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
}
|
|
1147
|
-
if (settings.Min)
|
|
1148
|
-
yAxis.min = settings.Min;
|
|
1149
|
-
if (settings.Max)
|
|
1150
|
-
yAxis.max = settings.Max;
|
|
1151
|
-
let limitNullOrUndef = dataConverted.limit == null || dataConverted.limit == undefined;
|
|
1152
|
-
let limits = limitNullOrUndef ? [] : !dataConverted.limit.length ? [dataConverted.limit] : dataConverted.limit;
|
|
1153
|
-
if (limits.length > 0) {
|
|
1154
|
-
for (let i = 0; i < limits.length; i++) {
|
|
1155
|
-
let limit = limits[i];
|
|
1156
|
-
if (limit.upper != null && limit.upper != undefined && limit.lower != null && limit.lower != undefined) {
|
|
1157
|
-
let range = yAxis.axisRanges.create();
|
|
1158
|
-
range.value = limit.lower;
|
|
1159
|
-
range.endValue = limit.upper;
|
|
1160
|
-
if (limit.fillColor) {
|
|
1161
|
-
range.contents.stroke = am4core.color(limit.fillColor);
|
|
1162
|
-
range.contents.fill = range.contents.stroke;
|
|
1163
|
-
}
|
|
1164
|
-
range.label.inside = true;
|
|
1165
|
-
range.label.text = limit.upperlabel;
|
|
1166
|
-
range.label.fill = range.grid.stroke;
|
|
1167
|
-
range.label.verticalCenter = "bottom";
|
|
1168
|
-
range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
|
|
1169
|
-
range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
|
|
1170
|
-
range.grid.strokeWidth = 2;
|
|
1171
|
-
range.grid.strokeOpacity = 1;
|
|
1172
|
-
}
|
|
1173
|
-
else if ((limit.lower == null || limit.lower == undefined) && limit.upper != null && limit.upper != undefined) {
|
|
1174
|
-
let range = yAxis.axisRanges.create();
|
|
1175
|
-
range.value = limit.upper;
|
|
1176
|
-
range.label.inside = true;
|
|
1177
|
-
range.label.text = limit.upperlabel;
|
|
1178
|
-
range.label.fill = range.grid.stroke;
|
|
1179
|
-
range.label.verticalCenter = "bottom";
|
|
1180
|
-
range.label.stroke = am4core.color(limit.uppercolor || "#F92200");
|
|
1181
|
-
range.grid.stroke = am4core.color(limit.uppercolor || "#F92200");
|
|
1182
|
-
range.grid.strokeWidth = 2;
|
|
1183
|
-
range.grid.strokeOpacity = 1;
|
|
1184
|
-
}
|
|
1185
|
-
else if ((limit.upper == null || limit.upper == undefined) && limit.lower != null && limit.lower != undefined) {
|
|
1186
|
-
let range = yAxis.axisRanges.create();
|
|
1187
|
-
range.value = limit.lower;
|
|
1188
|
-
range.label.inside = true;
|
|
1189
|
-
range.label.text = limit.lowerlabel;
|
|
1190
|
-
range.label.fill = range.grid.stroke;
|
|
1191
|
-
range.label.verticalCenter = "bottom";
|
|
1192
|
-
range.label.stroke = am4core.color(limit.lowercolor || "#F92200");
|
|
1193
|
-
range.grid.stroke = am4core.color(limit.lowercolor || "#F92200");
|
|
1194
|
-
range.grid.strokeWidth = 2;
|
|
1195
|
-
range.grid.strokeOpacity = 1;
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
}
|
|
1199
|
-
this.dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
|
|
1200
|
-
// Per comatibilità col codice scritto quando non era a livello globale, mi scoccia sostituire
|
|
1201
|
-
let dateAxis = this.dateAxis;
|
|
1202
|
-
if (settings.XAxisTitle) {
|
|
1203
|
-
dateAxis.title.text = settings.XAxisTitle;
|
|
1204
|
-
dateAxis.title.fontWeight = "bold";
|
|
1205
|
-
}
|
|
1206
|
-
if (showTicks) {
|
|
1207
|
-
dateAxis.renderer.ticks.template.disabled = false;
|
|
1208
|
-
dateAxis.renderer.ticks.template.strokeOpacity = 1;
|
|
1209
|
-
dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
|
|
1210
|
-
dateAxis.renderer.ticks.template.strokeWidth = 2;
|
|
1211
|
-
dateAxis.renderer.ticks.template.length = 10;
|
|
1212
|
-
dateAxis.renderer.ticks.template.location = 0;
|
|
1213
|
-
}
|
|
1214
|
-
dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
|
|
1215
|
-
dateAxis.renderer.grid.template.location = 0;
|
|
1216
|
-
dateAxis.minZoomCount = 5;
|
|
1217
|
-
dateAxis.groupData = dataShouldBeGrouped;
|
|
1218
|
-
dateAxis.groupCount = settings.DataGroupBucketSize ?? this.DataGroupBucketSize;
|
|
1219
|
-
//Se ho almeno una serie ad intervallo e i settings non mi impediscono esplicitamente di usare i gaps, visualizzo i dati col gap
|
|
1220
|
-
if (gapsAllowed) {
|
|
1221
|
-
if (!seriesWithInterval) {
|
|
1222
|
-
console.error("Per utilizzare la funzionalità dei gap è obbligatorio definire un intervallo nelle serie del grafico");
|
|
1223
|
-
return null;
|
|
1224
|
-
}
|
|
1225
|
-
dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
|
|
1226
|
-
}
|
|
1227
|
-
if (showTimeline)
|
|
1228
|
-
ChartInstanceCasted.scrollbarX = new am4charts.XYChartScrollbar();
|
|
1229
|
-
let seriesToPush = [];
|
|
1230
|
-
let seriesColors = [];
|
|
1231
|
-
let defaultIndex = 0;
|
|
1232
|
-
// Ordinamento dei dati se serve
|
|
1233
|
-
dataConverted.series.forEach((s) => {
|
|
1234
|
-
if (s.values[0] && !(s.values[0].d instanceof Date)) {
|
|
1235
|
-
for (let v = 0; v < s.values.length; v++)
|
|
1236
|
-
s.values[v].d = new Date(s.values[v].d);
|
|
1237
|
-
}
|
|
1238
|
-
var correctOrder = true;
|
|
1239
|
-
var prevDate = null;
|
|
1240
|
-
for (let v = 0; v < s.values.length; v++) {
|
|
1241
|
-
if (!prevDate)
|
|
1242
|
-
prevDate = s.values[v].d;
|
|
1243
|
-
else if (s.values[v].d < prevDate) {
|
|
1244
|
-
correctOrder = false;
|
|
1245
|
-
break;
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
if (!correctOrder)
|
|
1249
|
-
s.values.sort((d1, d2) => d1.d.getTime() - d2.d.getTime());
|
|
1250
|
-
});
|
|
1251
|
-
// Generazione di un unico dataset invece che N, per poter gestire un unico tooltip
|
|
1252
|
-
if (this.singleDataSet) {
|
|
1253
|
-
this.ChartInstance.data = this.generateSingleDataset(dataConverted);
|
|
1254
|
-
;
|
|
1255
|
-
dateAxis.cursorTooltipEnabled = false;
|
|
1256
|
-
}
|
|
1257
|
-
dataConverted.series.forEach((s, index) => {
|
|
1258
|
-
let stacked = s.stacked != null && s.stacked != undefined ? s.stacked : (settings?.Stacked ?? false);
|
|
1259
|
-
let fill = stacked || (s.fill != null && s.fill != undefined ? s.fill : (settings?.Fill ?? false));
|
|
1260
|
-
let series = settings?.Step ? new am4charts.StepLineSeries() : new am4charts.LineSeries();
|
|
1261
|
-
series.dataFields.valueY = "v" + (this.singleDataSet ? index : "");
|
|
1262
|
-
series.dataFields.dateX = "d";
|
|
1263
|
-
series.measureUnit = s.uom;
|
|
1264
|
-
series.name = s.name;
|
|
1265
|
-
series.strokeWidth = settings?.StrokeSize ?? 1;
|
|
1266
|
-
series.connect = !gapsAllowed;
|
|
1267
|
-
series.minBulletDistance = 10;
|
|
1268
|
-
series.tooltipText = this.singleDataSet ? "" : s.name ? "{name}: [bold]{valueY}[/]" : "[bold]{valueY}[/]";
|
|
1269
|
-
series.tooltip.pointerOrientation = "vertical";
|
|
1270
|
-
series.tooltip.background.fillOpacity = 0.5;
|
|
1271
|
-
series.tooltip.label.padding(12, 12, 12, 12);
|
|
1272
|
-
series.fillOpacity = fill ? this.OpacityOnFill : 0.0001;
|
|
1273
|
-
series.stacked = stacked;
|
|
1274
|
-
series.hidden = s.hidden;
|
|
1275
|
-
//Dataset singolo, i dati sono registrati a livello di chart, creo il tooltip che permette di vederli tutti insieme
|
|
1276
|
-
//altrimenti assegno i dati della serie direttamente alla serie
|
|
1277
|
-
if (this.singleDataSet) {
|
|
1278
|
-
series.tooltip.getFillFromObject = false;
|
|
1279
|
-
series.tooltip.background.fill = am4core.color("#eee");
|
|
1280
|
-
series.tooltip.label.fill = am4core.color("#00");
|
|
1281
|
-
series.tooltip.defaultState.transitionDuration = 0;
|
|
1282
|
-
series.tooltip.hiddenState.transitionDuration = 0;
|
|
1283
|
-
//Utilizzo il mio dateService per la formattazione della data in modo che non debba mai gestire n formati fra n librerie... bellissimo
|
|
1284
|
-
series.dateFormatter.format = (source) => {
|
|
1285
|
-
if (interval && finalInstant && ["hour", "minute", "second"].includes(interval.timeunit)) {
|
|
1286
|
-
let timepart = null;
|
|
1287
|
-
switch (interval.timeunit) {
|
|
1288
|
-
case "hour":
|
|
1289
|
-
timepart = 'day';
|
|
1290
|
-
break;
|
|
1291
|
-
case "minute":
|
|
1292
|
-
timepart = 'hour';
|
|
1293
|
-
break;
|
|
1294
|
-
case "second":
|
|
1295
|
-
timepart = 'minute';
|
|
1296
|
-
break;
|
|
1297
|
-
}
|
|
1298
|
-
if (timepart)
|
|
1299
|
-
return this.dateExts.adjustDateToFinalInstant(source, timepart, interval ? interval.timeunit == "second" : false);
|
|
1300
|
-
}
|
|
1301
|
-
else
|
|
1302
|
-
return this.dateExts.getFormatted(source, interval ? ["day", "week", "month", "year"].includes(interval.timeunit) : false, interval ? interval.timeunit == "second" : false);
|
|
1303
|
-
};
|
|
1304
|
-
series.adapter.add("tooltipText", () => {
|
|
1305
|
-
var text = "[bold]{dateX.formatDate()}[/]\n";
|
|
1306
|
-
this.ChartInstance.series.each((item) => {
|
|
1307
|
-
let uom = " [font-style: italic]" + series.measureUnit || "" + "[/]";
|
|
1308
|
-
text += "[" + item.stroke.hex + "]●[/] " + (item.name ? (item.name + ": ") : "") + "[bold]{" + item.dataFields.valueY + "}[/]" + uom + "\n";
|
|
1309
|
-
});
|
|
1310
|
-
return text;
|
|
1311
|
-
});
|
|
1312
|
-
}
|
|
1313
|
-
else
|
|
1314
|
-
series.data = s.values;
|
|
1315
|
-
let segment = series.segments.template;
|
|
1316
|
-
let hoverState = segment.states.create("hover");
|
|
1317
|
-
hoverState.properties.strokeWidth = (settings?.StrokeSize ?? 1) + 1;
|
|
1318
|
-
let dimmed = segment.states.create("dimmed");
|
|
1319
|
-
dimmed.properties.stroke = am4core.color("#dadada");
|
|
1320
|
-
//Se la serie ha un colore, uso quello, altrimenti pesco dai colori di default andando in ordine
|
|
1321
|
-
if (s.color)
|
|
1322
|
-
seriesColors.push(am4core.color(s.color));
|
|
1323
|
-
else {
|
|
1324
|
-
seriesColors.push(ChartInstanceCasted.colors.list[defaultIndex % ChartInstanceCasted.colors.list.length]);
|
|
1325
|
-
defaultIndex++;
|
|
1326
|
-
}
|
|
1327
|
-
seriesToPush.push(series);
|
|
1328
|
-
});
|
|
1329
|
-
ChartInstanceCasted.colors.list = seriesColors;
|
|
1330
|
-
//Scrivo le serie nel grafico
|
|
1331
|
-
seriesToPush.forEach(s => {
|
|
1332
|
-
ChartInstanceCasted.series.push(s);
|
|
1333
|
-
if (showTimeline)
|
|
1334
|
-
ChartInstanceCasted.scrollbarX.series.push(s);
|
|
1335
|
-
});
|
|
1336
|
-
if (settings.Legend) {
|
|
1337
|
-
this.ChartInstance.legend = new am4charts.Legend();
|
|
1338
|
-
this.ChartInstance.legend.position = settings?.LegendPosition ?? 'right';
|
|
1339
|
-
this.ChartInstance.legend.scrollable = true;
|
|
1340
|
-
this.ChartInstance.legend.itemContainers.template.tooltipText = "{name}";
|
|
1341
|
-
this.ChartInstance.legend.itemContainers.template.events.on("over", (event) => { this.processOver(event.target.dataItem.dataContext); });
|
|
1342
|
-
this.ChartInstance.legend.itemContainers.template.events.on("out", () => { this.processOut(); });
|
|
1044
|
+
this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
|
|
1045
|
+
let ChartInstanceCasted = this.ChartInstance;
|
|
1046
|
+
if (settings.Legend) {
|
|
1047
|
+
ChartInstanceCasted.legend = new am4charts.Legend();
|
|
1048
|
+
ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
|
|
1049
|
+
ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
|
|
1343
1050
|
if (settings.LegendPadding) {
|
|
1344
1051
|
let template = this.ChartInstance.legend.itemContainers.template;
|
|
1345
1052
|
template.paddingTop = settings.LegendPadding.top ?? 0;
|
|
@@ -1348,69 +1055,63 @@ class LineChartService {
|
|
|
1348
1055
|
template.paddingRight = settings.LegendPadding.right ?? 0;
|
|
1349
1056
|
}
|
|
1350
1057
|
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1058
|
+
let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
|
|
1059
|
+
yAxis.tooltip.disabled = true;
|
|
1060
|
+
if (settings.YAxisTitle) {
|
|
1061
|
+
yAxis.title.text = settings.YAxisTitle;
|
|
1062
|
+
yAxis.title.fontWeight = "bold";
|
|
1063
|
+
}
|
|
1064
|
+
yAxis.min = 0;
|
|
1065
|
+
let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
|
|
1066
|
+
dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
|
|
1067
|
+
dateAxis.startLocation = 0.5;
|
|
1068
|
+
dateAxis.endLocation = 0.5;
|
|
1069
|
+
if (settings.XAxisTitle) {
|
|
1070
|
+
dateAxis.title.text = settings.XAxisTitle;
|
|
1071
|
+
dateAxis.title.fontWeight = "bold";
|
|
1072
|
+
}
|
|
1073
|
+
if (showTicks) {
|
|
1074
|
+
dateAxis.renderer.ticks.template.disabled = false;
|
|
1075
|
+
dateAxis.renderer.ticks.template.strokeOpacity = 1;
|
|
1076
|
+
dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
|
|
1077
|
+
dateAxis.renderer.ticks.template.strokeWidth = 2;
|
|
1078
|
+
dateAxis.renderer.ticks.template.length = 10;
|
|
1079
|
+
dateAxis.renderer.ticks.template.location = 0;
|
|
1080
|
+
}
|
|
1081
|
+
if (!!interval)
|
|
1082
|
+
dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
|
|
1083
|
+
// Unisco il dataset e tiro fuori i dati
|
|
1084
|
+
let chartData = [];
|
|
1085
|
+
let seriesToMakeCache = {};
|
|
1086
|
+
let seriesToMake = [];
|
|
1087
|
+
for (let i = 0; i < dataConverted.groups.length; i++) {
|
|
1088
|
+
let group = dataConverted.groups[i];
|
|
1089
|
+
let dataItem = { date: group.name };
|
|
1090
|
+
for (let ii = 0; ii < group.values.length; ii++) {
|
|
1091
|
+
let val = group.values[ii];
|
|
1092
|
+
dataItem[val.k] = val.v;
|
|
1093
|
+
if (!seriesToMakeCache[val.k]) {
|
|
1094
|
+
seriesToMakeCache[val.k] = true;
|
|
1095
|
+
seriesToMake.push(val.k);
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
chartData.push(dataItem);
|
|
1099
|
+
}
|
|
1100
|
+
ChartInstanceCasted.data = chartData;
|
|
1101
|
+
//---------------------------------------------------------
|
|
1102
|
+
seriesToMake.forEach(s => { this.createSeries(ChartInstanceCasted, s); });
|
|
1103
|
+
ChartInstanceCasted.cursor = new am4charts.XYCursor();
|
|
1104
|
+
ChartInstanceCasted.cursor.xAxis = dateAxis;
|
|
1370
1105
|
dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
|
|
1371
1106
|
dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
|
|
1372
1107
|
return this;
|
|
1373
1108
|
}
|
|
1374
1109
|
/** @ignore */
|
|
1375
1110
|
setSelection(from, to) {
|
|
1376
|
-
this.dateAxis.zoomToDates(from, to, true, true);
|
|
1377
1111
|
}
|
|
1378
1112
|
/** @ignore */
|
|
1379
1113
|
refreshData(data) {
|
|
1380
|
-
|
|
1381
|
-
if (this.singleDataSet) {
|
|
1382
|
-
var data = this.generateSingleDataset(dataConverted);
|
|
1383
|
-
this.ChartInstance.addData(data);
|
|
1384
|
-
return;
|
|
1385
|
-
}
|
|
1386
|
-
throw "Impossibile aggiornare i dati senza unire il dataset. Si prega di impostare [MergeDatasets] a true";
|
|
1387
|
-
}
|
|
1388
|
-
/** Partendo da dati divisi per seriue genera un dataset unito con la data come chiave e i vari valori dopo */
|
|
1389
|
-
generateSingleDataset(data) {
|
|
1390
|
-
let dto = {};
|
|
1391
|
-
data.series.forEach((vs, index) => {
|
|
1392
|
-
for (let i = 0; i < vs.values.length; i++) {
|
|
1393
|
-
var dataitem = vs.values[i];
|
|
1394
|
-
var indexer = new Date(dataitem.d).valueOf();
|
|
1395
|
-
if (!dto[indexer])
|
|
1396
|
-
dto[indexer] = {};
|
|
1397
|
-
dto[indexer]['v' + index] = dataitem.v;
|
|
1398
|
-
}
|
|
1399
|
-
});
|
|
1400
|
-
var dates = Object.keys(dto);
|
|
1401
|
-
var ret = [];
|
|
1402
|
-
for (let i = 0; i < dates.length; i++) {
|
|
1403
|
-
let values = dto[dates[i]];
|
|
1404
|
-
let item = { d: new Date(parseInt(dates[i])) };
|
|
1405
|
-
var vals = Object.keys(values);
|
|
1406
|
-
for (let ii = 0; ii < vals.length; ii++) {
|
|
1407
|
-
let series = vals[ii];
|
|
1408
|
-
let singleVal = values[series];
|
|
1409
|
-
item[series] = singleVal;
|
|
1410
|
-
}
|
|
1411
|
-
ret.push(item);
|
|
1412
|
-
}
|
|
1413
|
-
return ret;
|
|
1114
|
+
//TODO:IMPL
|
|
1414
1115
|
}
|
|
1415
1116
|
/** @ignore */
|
|
1416
1117
|
emitSelectionChanged(ev, settings) {
|
|
@@ -1425,40 +1126,20 @@ class LineChartService {
|
|
|
1425
1126
|
}
|
|
1426
1127
|
}
|
|
1427
1128
|
/** @ignore */
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
segment.setState("dimmed");
|
|
1443
|
-
if (!fill)
|
|
1444
|
-
segment.fillSprite.fillOpacity = 0;
|
|
1445
|
-
});
|
|
1446
|
-
}
|
|
1447
|
-
});
|
|
1448
|
-
}
|
|
1449
|
-
/** @ignore */
|
|
1450
|
-
processOut() {
|
|
1451
|
-
this.ChartInstance.series.each((series, i) => {
|
|
1452
|
-
series.zIndex = i;
|
|
1453
|
-
let fill = series.fillOpacity == this.OpacityOnFill;
|
|
1454
|
-
series.segments.each((segment) => {
|
|
1455
|
-
segment.setState("default");
|
|
1456
|
-
if (!fill)
|
|
1457
|
-
segment.fillSprite.fillOpacity = 0;
|
|
1458
|
-
});
|
|
1459
|
-
if (!fill)
|
|
1460
|
-
series.legendDataItem.marker.children.getIndex(1).fillOpacity = 0;
|
|
1461
|
-
});
|
|
1129
|
+
createSeries(chart, name) {
|
|
1130
|
+
let series = chart.series.push(new am4charts.LineSeries());
|
|
1131
|
+
series.dataFields.dateX = "date";
|
|
1132
|
+
series.name = name[0].toUpperCase() + name.slice(1);
|
|
1133
|
+
series.dataFields.valueY = name;
|
|
1134
|
+
series.tooltipText = "[#000]{valueY.value}[/]";
|
|
1135
|
+
//series.tooltip.background.fill = am4core.color("#FFF");
|
|
1136
|
+
series.tooltip.getStrokeFromObject = true;
|
|
1137
|
+
series.tooltip.background.strokeWidth = 3;
|
|
1138
|
+
series.tooltip.getFillFromObject = false;
|
|
1139
|
+
series.fillOpacity = 0.6;
|
|
1140
|
+
series.strokeWidth = 2;
|
|
1141
|
+
series.stacked = true;
|
|
1142
|
+
return series;
|
|
1462
1143
|
}
|
|
1463
1144
|
/** @ignore */
|
|
1464
1145
|
throttla(id, func, throttleTime) {
|
|
@@ -1470,6 +1151,71 @@ class LineChartService {
|
|
|
1470
1151
|
}
|
|
1471
1152
|
}
|
|
1472
1153
|
|
|
1154
|
+
/**
|
|
1155
|
+
* Componente specifico per la graficazione di un grafico ad Area
|
|
1156
|
+
*/
|
|
1157
|
+
class EsAreaChartComponent extends BaseChartComponent {
|
|
1158
|
+
/**
|
|
1159
|
+
* @ignore
|
|
1160
|
+
*/
|
|
1161
|
+
constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
|
|
1162
|
+
super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
|
|
1163
|
+
this.adapter = adapter;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
|
|
1167
|
+
*/
|
|
1168
|
+
getSpecificPropertiesToCheck() {
|
|
1169
|
+
return ["Data", "DataArray"];
|
|
1170
|
+
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
|
|
1173
|
+
*
|
|
1174
|
+
* @returns {AreaChartSettings} Settings castati al tipo giusto
|
|
1175
|
+
*/
|
|
1176
|
+
getCastedSettings() {
|
|
1177
|
+
return (this.Settings ?? new AreaChartSettings());
|
|
1178
|
+
}
|
|
1179
|
+
/**
|
|
1180
|
+
* Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
|
|
1181
|
+
*
|
|
1182
|
+
* @param {AreaChartSettings} settingsCasted Settings castati al tipo giusto
|
|
1183
|
+
*/
|
|
1184
|
+
fillSpecificSettings(settingsCasted) {
|
|
1185
|
+
}
|
|
1186
|
+
/**
|
|
1187
|
+
* Effettua il rendering di questo grafico in base ai Settings
|
|
1188
|
+
*
|
|
1189
|
+
* @param {AreaChartSettings} settingsCasted Impostazioni di graficazione
|
|
1190
|
+
* @returns {AreaChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
|
|
1191
|
+
*/
|
|
1192
|
+
graphicate(settingsCasted) {
|
|
1193
|
+
return new AreaChartService(this.adapter).graphicate(this.Data, settingsCasted);
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
EsAreaChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsAreaChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1197
|
+
EsAreaChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsAreaChartComponent, selector: "es-area-chart", inputs: { Data: "Data", DataArray: "DataArray" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1198
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsAreaChartComponent, decorators: [{
|
|
1199
|
+
type: Component,
|
|
1200
|
+
args: [{ selector: 'es-area-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
1201
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
1202
|
+
type: Inject,
|
|
1203
|
+
args: [PLATFORM_ID]
|
|
1204
|
+
}] }, { type: undefined, decorators: [{
|
|
1205
|
+
type: Inject,
|
|
1206
|
+
args: [ESC_LOGS]
|
|
1207
|
+
}] }, { type: undefined, decorators: [{
|
|
1208
|
+
type: Inject,
|
|
1209
|
+
args: [ESC_ANIMATIONS]
|
|
1210
|
+
}] }, { type: undefined, decorators: [{
|
|
1211
|
+
type: Inject,
|
|
1212
|
+
args: [ESC_THEME]
|
|
1213
|
+
}] }, { type: i4$1.LocalizationService }]; }, propDecorators: { Data: [{
|
|
1214
|
+
type: Input
|
|
1215
|
+
}], DataArray: [{
|
|
1216
|
+
type: Input
|
|
1217
|
+
}] } });
|
|
1218
|
+
|
|
1473
1219
|
/**
|
|
1474
1220
|
* Classe il cui unico scopo è gestire il setup e rendering di un PieChart
|
|
1475
1221
|
*/
|
|
@@ -1569,27 +1315,115 @@ class PieChartService {
|
|
|
1569
1315
|
/** @ignore */
|
|
1570
1316
|
setSelection(from, to) {
|
|
1571
1317
|
}
|
|
1572
|
-
/** @ignore */
|
|
1573
|
-
refreshData(data) {
|
|
1574
|
-
//TODO:IMPL
|
|
1318
|
+
/** @ignore */
|
|
1319
|
+
refreshData(data) {
|
|
1320
|
+
//TODO:IMPL
|
|
1321
|
+
}
|
|
1322
|
+
/** @ignore */
|
|
1323
|
+
hideZeroes(ev) {
|
|
1324
|
+
if (ev.target.dataItem && (ev.target.dataItem.values.value.percent == 0))
|
|
1325
|
+
ev.target.hide();
|
|
1326
|
+
else
|
|
1327
|
+
ev.target.show();
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
/**
|
|
1332
|
+
* Componente specifico per la graficazione di un grafico a Torta
|
|
1333
|
+
*/
|
|
1334
|
+
class EsPieChartComponent extends BaseChartComponent {
|
|
1335
|
+
/**
|
|
1336
|
+
* @ignore
|
|
1337
|
+
*/
|
|
1338
|
+
constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
|
|
1339
|
+
super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
|
|
1340
|
+
this.adapter = adapter;
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
|
|
1344
|
+
*/
|
|
1345
|
+
getSpecificPropertiesToCheck() {
|
|
1346
|
+
return ["Data", "DataArray", "HideZeroes", "Mode3D", "LabelsWrap", "LabelsTruncate", "LabelsWidth", "LabelsVisible"];
|
|
1347
|
+
}
|
|
1348
|
+
/**
|
|
1349
|
+
* Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
|
|
1350
|
+
*
|
|
1351
|
+
* @returns {PieChartSettings} Settings castati al tipo giusto
|
|
1352
|
+
*/
|
|
1353
|
+
getCastedSettings() {
|
|
1354
|
+
return (this.Settings ?? new PieChartSettings());
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
|
|
1358
|
+
*
|
|
1359
|
+
* @param {PieChartSettings} settingsCasted Settings castati al tipo giusto
|
|
1360
|
+
*/
|
|
1361
|
+
fillSpecificSettings(settingsCasted) {
|
|
1362
|
+
settingsCasted.HideZeroes = settingsCasted.HideZeroes != null ? settingsCasted.HideZeroes : this.HideZeroes;
|
|
1363
|
+
settingsCasted.Mode3D = settingsCasted.Mode3D != null ? settingsCasted.Mode3D : this.Mode3D;
|
|
1364
|
+
settingsCasted.DonutRadiusPercentage = settingsCasted.DonutRadiusPercentage != null ? settingsCasted.DonutRadiusPercentage : this.DonutRadiusPercentage;
|
|
1365
|
+
settingsCasted.LabelsWrap = settingsCasted.LabelsWrap != null ? settingsCasted.LabelsWrap : this.LabelsWrap;
|
|
1366
|
+
settingsCasted.LabelsTruncate = settingsCasted.LabelsTruncate != null ? settingsCasted.LabelsTruncate : this.LabelsTruncate;
|
|
1367
|
+
settingsCasted.LabelsWidth = settingsCasted.LabelsWidth != null ? settingsCasted.LabelsWidth : this.LabelsWidth;
|
|
1368
|
+
settingsCasted.LabelsVisible = settingsCasted.LabelsVisible != null ? settingsCasted.LabelsVisible : this.LabelsVisible;
|
|
1575
1369
|
}
|
|
1576
|
-
/**
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1370
|
+
/**
|
|
1371
|
+
* Effettua il rendering di questo grafico in base ai Settings
|
|
1372
|
+
*
|
|
1373
|
+
* @param {PieChartSettings} settingsCasted Impostazioni di graficazione
|
|
1374
|
+
* @returns {PieChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
|
|
1375
|
+
*/
|
|
1376
|
+
graphicate(settingsCasted) {
|
|
1377
|
+
return new PieChartService(this.adapter).graphicate(this.Data, settingsCasted);
|
|
1582
1378
|
}
|
|
1583
|
-
}
|
|
1379
|
+
}
|
|
1380
|
+
EsPieChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsPieChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1381
|
+
EsPieChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsPieChartComponent, selector: "es-pie-chart", inputs: { Data: "Data", DataArray: "DataArray", HideZeroes: "HideZeroes", Mode3D: "Mode3D", DonutRadiusPercentage: "DonutRadiusPercentage", LabelsWrap: "LabelsWrap", LabelsTruncate: "LabelsTruncate", LabelsWidth: "LabelsWidth", LabelsVisible: "LabelsVisible" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1382
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsPieChartComponent, decorators: [{
|
|
1383
|
+
type: Component,
|
|
1384
|
+
args: [{ selector: 'es-pie-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
1385
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
1386
|
+
type: Inject,
|
|
1387
|
+
args: [PLATFORM_ID]
|
|
1388
|
+
}] }, { type: undefined, decorators: [{
|
|
1389
|
+
type: Inject,
|
|
1390
|
+
args: [ESC_LOGS]
|
|
1391
|
+
}] }, { type: undefined, decorators: [{
|
|
1392
|
+
type: Inject,
|
|
1393
|
+
args: [ESC_ANIMATIONS]
|
|
1394
|
+
}] }, { type: undefined, decorators: [{
|
|
1395
|
+
type: Inject,
|
|
1396
|
+
args: [ESC_THEME]
|
|
1397
|
+
}] }, { type: i4$1.LocalizationService }]; }, propDecorators: { Data: [{
|
|
1398
|
+
type: Input
|
|
1399
|
+
}], DataArray: [{
|
|
1400
|
+
type: Input
|
|
1401
|
+
}], HideZeroes: [{
|
|
1402
|
+
type: Input
|
|
1403
|
+
}], Mode3D: [{
|
|
1404
|
+
type: Input
|
|
1405
|
+
}], DonutRadiusPercentage: [{
|
|
1406
|
+
type: Input
|
|
1407
|
+
}], LabelsWrap: [{
|
|
1408
|
+
type: Input
|
|
1409
|
+
}], LabelsTruncate: [{
|
|
1410
|
+
type: Input
|
|
1411
|
+
}], LabelsWidth: [{
|
|
1412
|
+
type: Input
|
|
1413
|
+
}], LabelsVisible: [{
|
|
1414
|
+
type: Input
|
|
1415
|
+
}] } });
|
|
1584
1416
|
|
|
1585
1417
|
/**
|
|
1586
|
-
* Classe il cui unico scopo è gestire il setup e rendering di un
|
|
1418
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un Vertical2DChart
|
|
1587
1419
|
*/
|
|
1588
|
-
class
|
|
1420
|
+
class Vertical2DChartService {
|
|
1589
1421
|
/** @ignore */
|
|
1590
1422
|
constructor(Adapter) {
|
|
1591
1423
|
this.Adapter = Adapter;
|
|
1592
1424
|
/** @ignore */
|
|
1425
|
+
this.DefaultGroupPaddingPercentage = 5;
|
|
1426
|
+
/** @ignore */
|
|
1593
1427
|
this.dangerZone = 50;
|
|
1594
1428
|
/** @ignore */
|
|
1595
1429
|
this.LabelWidth = 150;
|
|
@@ -1601,7 +1435,7 @@ class VerticalChartService {
|
|
|
1601
1435
|
this.DefaultColumnWidthPercentage = 85;
|
|
1602
1436
|
}
|
|
1603
1437
|
/**
|
|
1604
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un
|
|
1438
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un Vertical2DChart
|
|
1605
1439
|
*/
|
|
1606
1440
|
graphicate(data, settings) {
|
|
1607
1441
|
if (settings.Timeline) {
|
|
@@ -1612,9 +1446,6 @@ class VerticalChartService {
|
|
|
1612
1446
|
am4core.options.autoDispose = true;
|
|
1613
1447
|
this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
|
|
1614
1448
|
let ChartInstanceCasted = this.ChartInstance;
|
|
1615
|
-
let dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
|
|
1616
|
-
ChartInstanceCasted.data = dataConverted.values;
|
|
1617
|
-
let noStrokes = dataConverted.values.some(t => !!t.c);
|
|
1618
1449
|
if (settings.Legend) {
|
|
1619
1450
|
ChartInstanceCasted.legend = new am4charts.Legend();
|
|
1620
1451
|
ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
|
|
@@ -1637,7 +1468,10 @@ class VerticalChartService {
|
|
|
1637
1468
|
categoryAxis.title.text = settings.XAxisTitle;
|
|
1638
1469
|
categoryAxis.title.fontWeight = "bold";
|
|
1639
1470
|
}
|
|
1640
|
-
|
|
1471
|
+
yAxis.min = 0;
|
|
1472
|
+
categoryAxis.dataFields.category = 'key';
|
|
1473
|
+
categoryAxis.renderer.cellStartLocation = am4core.percent(settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage).value;
|
|
1474
|
+
categoryAxis.renderer.cellEndLocation = am4core.percent(100 - (settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage)).value;
|
|
1641
1475
|
categoryAxis.renderer.grid.template.location = 0;
|
|
1642
1476
|
categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
|
|
1643
1477
|
let label = categoryAxis.renderer.labels.template;
|
|
@@ -1665,24 +1499,24 @@ class VerticalChartService {
|
|
|
1665
1499
|
}
|
|
1666
1500
|
});
|
|
1667
1501
|
}
|
|
1668
|
-
|
|
1669
|
-
let
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
columnTemplate.strokeOpacity = 0;
|
|
1679
|
-
columnTemplate.strokeWidth = 0;
|
|
1680
|
-
columnTemplate.adapter.add("fill", (_, target) => am4core.color(target.dataItem.dataContext.c));
|
|
1681
|
-
}
|
|
1682
|
-
else {
|
|
1683
|
-
columnTemplate.strokeWidth = 2;
|
|
1684
|
-
columnTemplate.strokeOpacity = 1;
|
|
1502
|
+
let dataPreConverted = this.Adapter ? this.Adapter.adaptDataForVertical2DChart(data) : data;
|
|
1503
|
+
let dataConverted = [];
|
|
1504
|
+
for (let i = 0; i < dataPreConverted.groups.length; i++) {
|
|
1505
|
+
let item = dataPreConverted.groups[i];
|
|
1506
|
+
let obj = { key: item.name };
|
|
1507
|
+
for (let p = 0; p < item.values.length; p++) {
|
|
1508
|
+
let value = item.values[p];
|
|
1509
|
+
obj[value.k] = value.v;
|
|
1510
|
+
}
|
|
1511
|
+
dataConverted.push(obj);
|
|
1685
1512
|
}
|
|
1513
|
+
ChartInstanceCasted.data = dataConverted;
|
|
1514
|
+
if (dataPreConverted.colorinfos)
|
|
1515
|
+
ChartInstanceCasted.colors.list = dataPreConverted.colorinfos.map(c => am4core.color(c.color));
|
|
1516
|
+
//Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
|
|
1517
|
+
for (let prop in dataConverted[0])
|
|
1518
|
+
if (prop !== "key")
|
|
1519
|
+
this.createSeries(ChartInstanceCasted, settings, prop, prop);
|
|
1686
1520
|
return this;
|
|
1687
1521
|
}
|
|
1688
1522
|
/** @ignore */
|
|
@@ -1692,18 +1526,146 @@ class VerticalChartService {
|
|
|
1692
1526
|
refreshData(data) {
|
|
1693
1527
|
//TODO:IMPL
|
|
1694
1528
|
}
|
|
1529
|
+
/** @ignore */
|
|
1530
|
+
createSeries(chart, settings, value, name) {
|
|
1531
|
+
let series = chart.series.push(new am4charts.ColumnSeries());
|
|
1532
|
+
series.dataFields.valueY = value;
|
|
1533
|
+
series.dataFields.categoryX = 'key';
|
|
1534
|
+
series.name = name;
|
|
1535
|
+
series.columns.template.tooltipText = "{name} {categoryX}: [bold]{valueY}[/]";
|
|
1536
|
+
series.columns.template.fillOpacity = .8;
|
|
1537
|
+
series.columns.template.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
|
|
1538
|
+
series.events.on("hidden", () => this.arrangeColumns);
|
|
1539
|
+
series.events.on("shown", () => this.arrangeColumns);
|
|
1540
|
+
return series;
|
|
1541
|
+
}
|
|
1542
|
+
/** @ignore */
|
|
1543
|
+
arrangeColumns() {
|
|
1544
|
+
let ChartInstanceCasted = this.ChartInstance;
|
|
1545
|
+
let series = ChartInstanceCasted.series.getIndex(0);
|
|
1546
|
+
let xAxis = ChartInstanceCasted.xAxes.getIndex(0);
|
|
1547
|
+
let w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
|
|
1548
|
+
if (series.dataItems.length > 1) {
|
|
1549
|
+
let x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
|
|
1550
|
+
let x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
|
|
1551
|
+
let delta = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
|
|
1552
|
+
if (am4core.isNumber(delta)) {
|
|
1553
|
+
let middle = ChartInstanceCasted.series.length / 2;
|
|
1554
|
+
let newIndex = 0;
|
|
1555
|
+
ChartInstanceCasted.series.each((series) => {
|
|
1556
|
+
if (!series.isHidden && !series.isHiding) {
|
|
1557
|
+
series.dummyData = newIndex;
|
|
1558
|
+
newIndex++;
|
|
1559
|
+
}
|
|
1560
|
+
else {
|
|
1561
|
+
series.dummyData = ChartInstanceCasted.series.indexOf(series);
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
let visibleCount = newIndex;
|
|
1565
|
+
let newMiddle = visibleCount / 2;
|
|
1566
|
+
ChartInstanceCasted.series.each((series) => {
|
|
1567
|
+
let trueIndex = ChartInstanceCasted.series.indexOf(series);
|
|
1568
|
+
let newIndex = series.dummyData;
|
|
1569
|
+
let dx = (newIndex - trueIndex + middle - newMiddle) * delta;
|
|
1570
|
+
series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
|
|
1571
|
+
series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1695
1576
|
}
|
|
1696
1577
|
|
|
1697
1578
|
/**
|
|
1698
|
-
*
|
|
1579
|
+
* Componente specifico per la graficazione di un grafico a Barre con due dimensioni
|
|
1699
1580
|
*/
|
|
1700
|
-
class
|
|
1581
|
+
class EsVertical2DChartComponent extends BaseChartComponent {
|
|
1582
|
+
/**
|
|
1583
|
+
* @ignore
|
|
1584
|
+
*/
|
|
1585
|
+
constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
|
|
1586
|
+
super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
|
|
1587
|
+
this.adapter = adapter;
|
|
1588
|
+
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
|
|
1591
|
+
*/
|
|
1592
|
+
getSpecificPropertiesToCheck() {
|
|
1593
|
+
return ["Data", "DataArray"];
|
|
1594
|
+
}
|
|
1595
|
+
/**
|
|
1596
|
+
* Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
|
|
1597
|
+
*
|
|
1598
|
+
* @returns {Vertical2DChartSettings} Settings castati al tipo giusto
|
|
1599
|
+
*/
|
|
1600
|
+
getCastedSettings() {
|
|
1601
|
+
return (this.Settings ?? new Vertical2DChartSettings());
|
|
1602
|
+
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
|
|
1605
|
+
*
|
|
1606
|
+
* @param {Vertical2DChartSettings} settingsCasted Settings castati al tipo giusto
|
|
1607
|
+
*/
|
|
1608
|
+
fillSpecificSettings(settingsCasted) {
|
|
1609
|
+
settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
|
|
1610
|
+
settingsCasted.GroupPaddingPercentage = settingsCasted.GroupPaddingPercentage != null ? settingsCasted.GroupPaddingPercentage : this.GroupPaddingPercentage;
|
|
1611
|
+
settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
|
|
1612
|
+
settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
|
|
1613
|
+
settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
|
|
1614
|
+
settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
|
|
1615
|
+
}
|
|
1616
|
+
/**
|
|
1617
|
+
* Effettua il rendering di questo grafico in base ai Settings
|
|
1618
|
+
*
|
|
1619
|
+
* @param {Vertical2DChartSettings} settingsCasted Impostazioni di graficazione
|
|
1620
|
+
* @returns {Vertical2DChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
|
|
1621
|
+
*/
|
|
1622
|
+
graphicate(settingsCasted) {
|
|
1623
|
+
return new Vertical2DChartService(this.adapter).graphicate(this.Data, settingsCasted);
|
|
1624
|
+
}
|
|
1625
|
+
}
|
|
1626
|
+
EsVertical2DChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVertical2DChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1627
|
+
EsVertical2DChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVertical2DChartComponent, selector: "es-vertical-2d-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", GroupPaddingPercentage: "GroupPaddingPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1628
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVertical2DChartComponent, decorators: [{
|
|
1629
|
+
type: Component,
|
|
1630
|
+
args: [{ selector: 'es-vertical-2d-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
1631
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
1632
|
+
type: Inject,
|
|
1633
|
+
args: [PLATFORM_ID]
|
|
1634
|
+
}] }, { type: undefined, decorators: [{
|
|
1635
|
+
type: Inject,
|
|
1636
|
+
args: [ESC_LOGS]
|
|
1637
|
+
}] }, { type: undefined, decorators: [{
|
|
1638
|
+
type: Inject,
|
|
1639
|
+
args: [ESC_ANIMATIONS]
|
|
1640
|
+
}] }, { type: undefined, decorators: [{
|
|
1641
|
+
type: Inject,
|
|
1642
|
+
args: [ESC_THEME]
|
|
1643
|
+
}] }, { type: i4$1.LocalizationService }]; }, propDecorators: { Data: [{
|
|
1644
|
+
type: Input
|
|
1645
|
+
}], DataArray: [{
|
|
1646
|
+
type: Input
|
|
1647
|
+
}], ColumnWidthPercentage: [{
|
|
1648
|
+
type: Input
|
|
1649
|
+
}], GroupPaddingPercentage: [{
|
|
1650
|
+
type: Input
|
|
1651
|
+
}], LabelWidth: [{
|
|
1652
|
+
type: Input
|
|
1653
|
+
}], LabelVerticalOrientationCutoffWidth: [{
|
|
1654
|
+
type: Input
|
|
1655
|
+
}], LabelRightWhenCompressed: [{
|
|
1656
|
+
type: Input
|
|
1657
|
+
}], LabelTopWhenCompressed: [{
|
|
1658
|
+
type: Input
|
|
1659
|
+
}] } });
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* Classe il cui unico scopo è gestire il setup e rendering di un VerticalChart
|
|
1663
|
+
*/
|
|
1664
|
+
class VerticalChartService {
|
|
1701
1665
|
/** @ignore */
|
|
1702
1666
|
constructor(Adapter) {
|
|
1703
1667
|
this.Adapter = Adapter;
|
|
1704
1668
|
/** @ignore */
|
|
1705
|
-
this.DefaultGroupPaddingPercentage = 5;
|
|
1706
|
-
/** @ignore */
|
|
1707
1669
|
this.dangerZone = 50;
|
|
1708
1670
|
/** @ignore */
|
|
1709
1671
|
this.LabelWidth = 150;
|
|
@@ -1715,7 +1677,7 @@ class Vertical2DChartService {
|
|
|
1715
1677
|
this.DefaultColumnWidthPercentage = 85;
|
|
1716
1678
|
}
|
|
1717
1679
|
/**
|
|
1718
|
-
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un
|
|
1680
|
+
* Metodo che data una coppia Dati - Impostazioni li utilizza per creare e visualizzare un VerticalChart
|
|
1719
1681
|
*/
|
|
1720
1682
|
graphicate(data, settings) {
|
|
1721
1683
|
if (settings.Timeline) {
|
|
@@ -1726,6 +1688,9 @@ class Vertical2DChartService {
|
|
|
1726
1688
|
am4core.options.autoDispose = true;
|
|
1727
1689
|
this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
|
|
1728
1690
|
let ChartInstanceCasted = this.ChartInstance;
|
|
1691
|
+
let dataConverted = this.Adapter ? this.Adapter.adaptDataForVerticalChart(data) : data;
|
|
1692
|
+
ChartInstanceCasted.data = dataConverted.values;
|
|
1693
|
+
let noStrokes = dataConverted.values.some(t => !!t.c);
|
|
1729
1694
|
if (settings.Legend) {
|
|
1730
1695
|
ChartInstanceCasted.legend = new am4charts.Legend();
|
|
1731
1696
|
ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
|
|
@@ -1748,10 +1713,7 @@ class Vertical2DChartService {
|
|
|
1748
1713
|
categoryAxis.title.text = settings.XAxisTitle;
|
|
1749
1714
|
categoryAxis.title.fontWeight = "bold";
|
|
1750
1715
|
}
|
|
1751
|
-
|
|
1752
|
-
categoryAxis.dataFields.category = 'key';
|
|
1753
|
-
categoryAxis.renderer.cellStartLocation = am4core.percent(settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage).value;
|
|
1754
|
-
categoryAxis.renderer.cellEndLocation = am4core.percent(100 - (settings.GroupPaddingPercentage ?? this.DefaultGroupPaddingPercentage)).value;
|
|
1716
|
+
categoryAxis.dataFields.category = "k";
|
|
1755
1717
|
categoryAxis.renderer.grid.template.location = 0;
|
|
1756
1718
|
categoryAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 30;
|
|
1757
1719
|
let label = categoryAxis.renderer.labels.template;
|
|
@@ -1779,24 +1741,24 @@ class Vertical2DChartService {
|
|
|
1779
1741
|
}
|
|
1780
1742
|
});
|
|
1781
1743
|
}
|
|
1782
|
-
|
|
1783
|
-
let
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1744
|
+
// Create series
|
|
1745
|
+
let series = ChartInstanceCasted.series.push(new am4charts.ColumnSeries());
|
|
1746
|
+
series.dataFields.valueY = "v";
|
|
1747
|
+
series.dataFields.categoryX = "k";
|
|
1748
|
+
series.name = "";
|
|
1749
|
+
let columnTemplate = series.columns.template;
|
|
1750
|
+
columnTemplate.tooltipText = "{categoryX}: [bold]{valueY}[/] {t}";
|
|
1751
|
+
columnTemplate.fillOpacity = .8;
|
|
1752
|
+
columnTemplate.width = am4core.percent(settings.ColumnWidthPercentage ?? this.DefaultColumnWidthPercentage);
|
|
1753
|
+
if (noStrokes) {
|
|
1754
|
+
columnTemplate.strokeOpacity = 0;
|
|
1755
|
+
columnTemplate.strokeWidth = 0;
|
|
1756
|
+
columnTemplate.adapter.add("fill", (_, target) => am4core.color(target.dataItem.dataContext.c));
|
|
1757
|
+
}
|
|
1758
|
+
else {
|
|
1759
|
+
columnTemplate.strokeWidth = 2;
|
|
1760
|
+
columnTemplate.strokeOpacity = 1;
|
|
1792
1761
|
}
|
|
1793
|
-
ChartInstanceCasted.data = dataConverted;
|
|
1794
|
-
if (dataPreConverted.colorinfos)
|
|
1795
|
-
ChartInstanceCasted.colors.list = dataPreConverted.colorinfos.map(c => am4core.color(c.color));
|
|
1796
|
-
//Prendo la prima categoria e mi baso sulle proprietà per dfeinire le serie
|
|
1797
|
-
for (let prop in dataConverted[0])
|
|
1798
|
-
if (prop !== "key")
|
|
1799
|
-
this.createSeries(ChartInstanceCasted, settings, prop, prop);
|
|
1800
1762
|
return this;
|
|
1801
1763
|
}
|
|
1802
1764
|
/** @ignore */
|
|
@@ -1806,54 +1768,87 @@ class Vertical2DChartService {
|
|
|
1806
1768
|
refreshData(data) {
|
|
1807
1769
|
//TODO:IMPL
|
|
1808
1770
|
}
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
/**
|
|
1774
|
+
* Componente specifico per la graficazione di un grafico a Barre
|
|
1775
|
+
*/
|
|
1776
|
+
class EsVerticalChartComponent extends BaseChartComponent {
|
|
1777
|
+
/**
|
|
1778
|
+
* @ignore
|
|
1779
|
+
*/
|
|
1780
|
+
constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
|
|
1781
|
+
super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
|
|
1782
|
+
this.adapter = adapter;
|
|
1821
1783
|
}
|
|
1822
|
-
/**
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
let w = 1 - xAxis.renderer.cellStartLocation - (1 - xAxis.renderer.cellEndLocation);
|
|
1828
|
-
if (series.dataItems.length > 1) {
|
|
1829
|
-
let x0 = xAxis.getX(series.dataItems.getIndex(0), "categoryX");
|
|
1830
|
-
let x1 = xAxis.getX(series.dataItems.getIndex(1), "categoryX");
|
|
1831
|
-
let delta = ((x1 - x0) / ChartInstanceCasted.series.length) * w;
|
|
1832
|
-
if (am4core.isNumber(delta)) {
|
|
1833
|
-
let middle = ChartInstanceCasted.series.length / 2;
|
|
1834
|
-
let newIndex = 0;
|
|
1835
|
-
ChartInstanceCasted.series.each((series) => {
|
|
1836
|
-
if (!series.isHidden && !series.isHiding) {
|
|
1837
|
-
series.dummyData = newIndex;
|
|
1838
|
-
newIndex++;
|
|
1839
|
-
}
|
|
1840
|
-
else {
|
|
1841
|
-
series.dummyData = ChartInstanceCasted.series.indexOf(series);
|
|
1842
|
-
}
|
|
1843
|
-
});
|
|
1844
|
-
let visibleCount = newIndex;
|
|
1845
|
-
let newMiddle = visibleCount / 2;
|
|
1846
|
-
ChartInstanceCasted.series.each((series) => {
|
|
1847
|
-
let trueIndex = ChartInstanceCasted.series.indexOf(series);
|
|
1848
|
-
let newIndex = series.dummyData;
|
|
1849
|
-
let dx = (newIndex - trueIndex + middle - newMiddle) * delta;
|
|
1850
|
-
series.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
|
|
1851
|
-
series.bulletsContainer.animate({ property: "dx", to: dx }, series.interpolationDuration, series.interpolationEasing);
|
|
1852
|
-
});
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
|
|
1786
|
+
*/
|
|
1787
|
+
getSpecificPropertiesToCheck() {
|
|
1788
|
+
return ["Data", "DataArray"];
|
|
1855
1789
|
}
|
|
1856
|
-
|
|
1790
|
+
/**
|
|
1791
|
+
* Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
|
|
1792
|
+
*
|
|
1793
|
+
* @returns {VerticalChartSettings} Settings castati al tipo giusto
|
|
1794
|
+
*/
|
|
1795
|
+
getCastedSettings() {
|
|
1796
|
+
return (this.Settings ?? new VerticalChartSettings());
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
|
|
1800
|
+
*
|
|
1801
|
+
* @param {VerticalChartSettings} settingsCasted Settings castati al tipo giusto
|
|
1802
|
+
*/
|
|
1803
|
+
fillSpecificSettings(settingsCasted) {
|
|
1804
|
+
settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
|
|
1805
|
+
settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
|
|
1806
|
+
settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
|
|
1807
|
+
settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
|
|
1808
|
+
settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
|
|
1809
|
+
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Effettua il rendering di questo grafico in base ai Settings
|
|
1812
|
+
*
|
|
1813
|
+
* @param {VerticalChartSettings} settingsCasted Impostazioni di graficazione
|
|
1814
|
+
* @returns {VerticalChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
|
|
1815
|
+
*/
|
|
1816
|
+
graphicate(settingsCasted) {
|
|
1817
|
+
return new VerticalChartService(this.adapter).graphicate(this.Data, settingsCasted);
|
|
1818
|
+
}
|
|
1819
|
+
}
|
|
1820
|
+
EsVerticalChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
1821
|
+
EsVerticalChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVerticalChartComponent, selector: "es-vertical-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1822
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalChartComponent, decorators: [{
|
|
1823
|
+
type: Component,
|
|
1824
|
+
args: [{ selector: 'es-vertical-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
1825
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
1826
|
+
type: Inject,
|
|
1827
|
+
args: [PLATFORM_ID]
|
|
1828
|
+
}] }, { type: undefined, decorators: [{
|
|
1829
|
+
type: Inject,
|
|
1830
|
+
args: [ESC_LOGS]
|
|
1831
|
+
}] }, { type: undefined, decorators: [{
|
|
1832
|
+
type: Inject,
|
|
1833
|
+
args: [ESC_ANIMATIONS]
|
|
1834
|
+
}] }, { type: undefined, decorators: [{
|
|
1835
|
+
type: Inject,
|
|
1836
|
+
args: [ESC_THEME]
|
|
1837
|
+
}] }, { type: i4$1.LocalizationService }]; }, propDecorators: { Data: [{
|
|
1838
|
+
type: Input
|
|
1839
|
+
}], DataArray: [{
|
|
1840
|
+
type: Input
|
|
1841
|
+
}], ColumnWidthPercentage: [{
|
|
1842
|
+
type: Input
|
|
1843
|
+
}], LabelWidth: [{
|
|
1844
|
+
type: Input
|
|
1845
|
+
}], LabelVerticalOrientationCutoffWidth: [{
|
|
1846
|
+
type: Input
|
|
1847
|
+
}], LabelRightWhenCompressed: [{
|
|
1848
|
+
type: Input
|
|
1849
|
+
}], LabelTopWhenCompressed: [{
|
|
1850
|
+
type: Input
|
|
1851
|
+
}] } });
|
|
1857
1852
|
|
|
1858
1853
|
/**
|
|
1859
1854
|
* Classe il cui unico scopo è gestire il setup e rendering di un VerticalStackedChart
|
|
@@ -1981,139 +1976,84 @@ class VerticalStackedChartService {
|
|
|
1981
1976
|
}
|
|
1982
1977
|
|
|
1983
1978
|
/**
|
|
1984
|
-
*
|
|
1979
|
+
* Componente specifico per la graficazione di un grafico a Barre in modalità Stacked (una serie sopra l'altra)
|
|
1985
1980
|
*/
|
|
1986
|
-
class
|
|
1987
|
-
/** @ignore */
|
|
1988
|
-
constructor(Adapter) {
|
|
1989
|
-
this.Adapter = Adapter;
|
|
1990
|
-
//******************** Funzione di throttling per non spammare richieste in caso di animazioni attivate
|
|
1991
|
-
//TODO: spostarla in un metodo di utilità (esfaenza/extensions)
|
|
1992
|
-
/** @ignore */
|
|
1993
|
-
this.executionTimers = {};
|
|
1994
|
-
}
|
|
1981
|
+
class EsVerticalStackedChartComponent extends BaseChartComponent {
|
|
1995
1982
|
/**
|
|
1996
|
-
*
|
|
1983
|
+
* @ignore
|
|
1997
1984
|
*/
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
return null;
|
|
2002
|
-
}
|
|
2003
|
-
let dataConverted = this.Adapter ? this.Adapter.adaptDataForAreaChart(data) : data;
|
|
2004
|
-
let showTicks = settings.ShowTicks == null ? true : settings?.ShowTicks;
|
|
2005
|
-
let interval = dataConverted.interval;
|
|
2006
|
-
//Per evitare di dimenticarmeli e gestire comunque bene gli ngif ecc...
|
|
2007
|
-
am4core.options.autoDispose = true;
|
|
2008
|
-
this.ChartInstance = am4core.create(settings.Name, am4charts.XYChart);
|
|
2009
|
-
let ChartInstanceCasted = this.ChartInstance;
|
|
2010
|
-
if (settings.Legend) {
|
|
2011
|
-
ChartInstanceCasted.legend = new am4charts.Legend();
|
|
2012
|
-
ChartInstanceCasted.legend.position = settings?.LegendPosition ?? 'right';
|
|
2013
|
-
ChartInstanceCasted.legend.itemContainers.template.tooltipText = "{category}";
|
|
2014
|
-
if (settings.LegendPadding) {
|
|
2015
|
-
let template = this.ChartInstance.legend.itemContainers.template;
|
|
2016
|
-
template.paddingTop = settings.LegendPadding.top ?? 0;
|
|
2017
|
-
template.paddingBottom = settings.LegendPadding.bottom ?? 0;
|
|
2018
|
-
template.paddingLeft = settings.LegendPadding.left ?? 0;
|
|
2019
|
-
template.paddingRight = settings.LegendPadding.right ?? 0;
|
|
2020
|
-
}
|
|
2021
|
-
}
|
|
2022
|
-
let yAxis = ChartInstanceCasted.yAxes.push(new am4charts.ValueAxis());
|
|
2023
|
-
yAxis.tooltip.disabled = true;
|
|
2024
|
-
if (settings.YAxisTitle) {
|
|
2025
|
-
yAxis.title.text = settings.YAxisTitle;
|
|
2026
|
-
yAxis.title.fontWeight = "bold";
|
|
2027
|
-
}
|
|
2028
|
-
yAxis.min = 0;
|
|
2029
|
-
let dateAxis = ChartInstanceCasted.xAxes.push(new am4charts.DateAxis());
|
|
2030
|
-
dateAxis.renderer.minGridDistance = settings?.MinGridDistance ?? 50;
|
|
2031
|
-
dateAxis.startLocation = 0.5;
|
|
2032
|
-
dateAxis.endLocation = 0.5;
|
|
2033
|
-
if (settings.XAxisTitle) {
|
|
2034
|
-
dateAxis.title.text = settings.XAxisTitle;
|
|
2035
|
-
dateAxis.title.fontWeight = "bold";
|
|
2036
|
-
}
|
|
2037
|
-
if (showTicks) {
|
|
2038
|
-
dateAxis.renderer.ticks.template.disabled = false;
|
|
2039
|
-
dateAxis.renderer.ticks.template.strokeOpacity = 1;
|
|
2040
|
-
dateAxis.renderer.ticks.template.stroke = am4core.color("#495C43");
|
|
2041
|
-
dateAxis.renderer.ticks.template.strokeWidth = 2;
|
|
2042
|
-
dateAxis.renderer.ticks.template.length = 10;
|
|
2043
|
-
dateAxis.renderer.ticks.template.location = 0;
|
|
2044
|
-
}
|
|
2045
|
-
if (!!interval)
|
|
2046
|
-
dateAxis.baseInterval = { count: interval.count, timeUnit: interval.timeunit };
|
|
2047
|
-
// Unisco il dataset e tiro fuori i dati
|
|
2048
|
-
let chartData = [];
|
|
2049
|
-
let seriesToMakeCache = {};
|
|
2050
|
-
let seriesToMake = [];
|
|
2051
|
-
for (let i = 0; i < dataConverted.groups.length; i++) {
|
|
2052
|
-
let group = dataConverted.groups[i];
|
|
2053
|
-
let dataItem = { date: group.name };
|
|
2054
|
-
for (let ii = 0; ii < group.values.length; ii++) {
|
|
2055
|
-
let val = group.values[ii];
|
|
2056
|
-
dataItem[val.k] = val.v;
|
|
2057
|
-
if (!seriesToMakeCache[val.k]) {
|
|
2058
|
-
seriesToMakeCache[val.k] = true;
|
|
2059
|
-
seriesToMake.push(val.k);
|
|
2060
|
-
}
|
|
2061
|
-
}
|
|
2062
|
-
chartData.push(dataItem);
|
|
2063
|
-
}
|
|
2064
|
-
ChartInstanceCasted.data = chartData;
|
|
2065
|
-
//---------------------------------------------------------
|
|
2066
|
-
seriesToMake.forEach(s => { this.createSeries(ChartInstanceCasted, s); });
|
|
2067
|
-
ChartInstanceCasted.cursor = new am4charts.XYCursor();
|
|
2068
|
-
ChartInstanceCasted.cursor.xAxis = dateAxis;
|
|
2069
|
-
dateAxis.events.on("startchanged", t => this.emitSelectionChanged(t, settings));
|
|
2070
|
-
dateAxis.events.on("endchanged", t => this.emitSelectionChanged(t, settings));
|
|
2071
|
-
return this;
|
|
2072
|
-
}
|
|
2073
|
-
/** @ignore */
|
|
2074
|
-
setSelection(from, to) {
|
|
1985
|
+
constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
|
|
1986
|
+
super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
|
|
1987
|
+
this.adapter = adapter;
|
|
2075
1988
|
}
|
|
2076
|
-
/**
|
|
2077
|
-
|
|
2078
|
-
|
|
1989
|
+
/**
|
|
1990
|
+
* Ottiene le proprietà specifiche per questa tipologia di grafico per cui serve rigraficare
|
|
1991
|
+
*/
|
|
1992
|
+
getSpecificPropertiesToCheck() {
|
|
1993
|
+
return ["Data", "DataArray"];
|
|
2079
1994
|
}
|
|
2080
|
-
/**
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
var initial = axis.min == axis.minZoomed && axis.max == axis.maxZoomed;
|
|
2088
|
-
settings.OnSelectionChangedCallback({ from: start, to: end, initial: initial });
|
|
2089
|
-
}, 150);
|
|
2090
|
-
}
|
|
1995
|
+
/**
|
|
1996
|
+
* Ottiene i Settings (Ereditati dalla classe base, quindi del tipo generico **BaseSettings**) castati al tipo specifico per questo grafico
|
|
1997
|
+
*
|
|
1998
|
+
* @returns {VerticalStackedChartSettings} Settings castati al tipo giusto
|
|
1999
|
+
*/
|
|
2000
|
+
getCastedSettings() {
|
|
2001
|
+
return (this.Settings ?? new VerticalStackedChartSettings());
|
|
2091
2002
|
}
|
|
2092
|
-
/**
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
series.fillOpacity = 0.6;
|
|
2104
|
-
series.strokeWidth = 2;
|
|
2105
|
-
series.stacked = true;
|
|
2106
|
-
return series;
|
|
2003
|
+
/**
|
|
2004
|
+
* Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
|
|
2005
|
+
*
|
|
2006
|
+
* @param {VerticalStackedChartSettings} settingsCasted Settings castati al tipo giusto
|
|
2007
|
+
*/
|
|
2008
|
+
fillSpecificSettings(settingsCasted) {
|
|
2009
|
+
settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
|
|
2010
|
+
settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
|
|
2011
|
+
settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
|
|
2012
|
+
settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
|
|
2013
|
+
settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
|
|
2107
2014
|
}
|
|
2108
|
-
/**
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2015
|
+
/**
|
|
2016
|
+
* Effettua il rendering di questo grafico in base ai Settings
|
|
2017
|
+
*
|
|
2018
|
+
* @param {VerticalStackedChartSettings} settingsCasted Impostazioni di graficazione
|
|
2019
|
+
* @returns {VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
|
|
2020
|
+
*/
|
|
2021
|
+
graphicate(settingsCasted) {
|
|
2022
|
+
return new VerticalStackedChartService(this.adapter).graphicate(this.Data, settingsCasted);
|
|
2115
2023
|
}
|
|
2116
|
-
}
|
|
2024
|
+
}
|
|
2025
|
+
EsVerticalStackedChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalStackedChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2026
|
+
EsVerticalStackedChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVerticalStackedChartComponent, selector: "es-vertical-stacked-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2027
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalStackedChartComponent, decorators: [{
|
|
2028
|
+
type: Component,
|
|
2029
|
+
args: [{ selector: 'es-vertical-stacked-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
2030
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
2031
|
+
type: Inject,
|
|
2032
|
+
args: [PLATFORM_ID]
|
|
2033
|
+
}] }, { type: undefined, decorators: [{
|
|
2034
|
+
type: Inject,
|
|
2035
|
+
args: [ESC_LOGS]
|
|
2036
|
+
}] }, { type: undefined, decorators: [{
|
|
2037
|
+
type: Inject,
|
|
2038
|
+
args: [ESC_ANIMATIONS]
|
|
2039
|
+
}] }, { type: undefined, decorators: [{
|
|
2040
|
+
type: Inject,
|
|
2041
|
+
args: [ESC_THEME]
|
|
2042
|
+
}] }, { type: i4$1.LocalizationService }]; }, propDecorators: { Data: [{
|
|
2043
|
+
type: Input
|
|
2044
|
+
}], DataArray: [{
|
|
2045
|
+
type: Input
|
|
2046
|
+
}], ColumnWidthPercentage: [{
|
|
2047
|
+
type: Input
|
|
2048
|
+
}], LabelWidth: [{
|
|
2049
|
+
type: Input
|
|
2050
|
+
}], LabelVerticalOrientationCutoffWidth: [{
|
|
2051
|
+
type: Input
|
|
2052
|
+
}], LabelRightWhenCompressed: [{
|
|
2053
|
+
type: Input
|
|
2054
|
+
}], LabelTopWhenCompressed: [{
|
|
2055
|
+
type: Input
|
|
2056
|
+
}] } });
|
|
2117
2057
|
|
|
2118
2058
|
/**
|
|
2119
2059
|
* Componente specifico per la graficazione di un qualsiasi tipo di grafico.
|
|
@@ -2187,12 +2127,12 @@ class EsChartComponent extends BaseChartComponent {
|
|
|
2187
2127
|
}
|
|
2188
2128
|
}
|
|
2189
2129
|
}
|
|
2190
|
-
EsChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token:
|
|
2130
|
+
EsChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: i4.DateService }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4$1.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2191
2131
|
EsChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsChartComponent, selector: "es-chart", inputs: { Type: "Type", Data: "Data", DataArray: "DataArray" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2192
2132
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartComponent, decorators: [{
|
|
2193
2133
|
type: Component,
|
|
2194
2134
|
args: [{ selector: 'es-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
2195
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type:
|
|
2135
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: i4.DateService }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
2196
2136
|
type: Inject,
|
|
2197
2137
|
args: [PLATFORM_ID]
|
|
2198
2138
|
}] }, { type: undefined, decorators: [{
|
|
@@ -2204,7 +2144,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2204
2144
|
}] }, { type: undefined, decorators: [{
|
|
2205
2145
|
type: Inject,
|
|
2206
2146
|
args: [ESC_THEME]
|
|
2207
|
-
}] }, { type: i4.LocalizationService }]; }, propDecorators: { Type: [{
|
|
2147
|
+
}] }, { type: i4$1.LocalizationService }]; }, propDecorators: { Type: [{
|
|
2208
2148
|
type: Input
|
|
2209
2149
|
}], Data: [{
|
|
2210
2150
|
type: Input
|
|
@@ -2212,497 +2152,607 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2212
2152
|
type: Input
|
|
2213
2153
|
}] } });
|
|
2214
2154
|
|
|
2155
|
+
/** Componenti esportati dal modulo */
|
|
2156
|
+
const COMPONENTS = [
|
|
2157
|
+
EsChartComponent,
|
|
2158
|
+
EsLineChartComponent,
|
|
2159
|
+
EsPieChartComponent,
|
|
2160
|
+
EsVertical2DChartComponent,
|
|
2161
|
+
EsVerticalChartComponent,
|
|
2162
|
+
EsVerticalStackedChartComponent,
|
|
2163
|
+
PageChartSelector,
|
|
2164
|
+
EsAreaChartComponent
|
|
2165
|
+
];
|
|
2166
|
+
class EsChartsModule {
|
|
2167
|
+
static forRoot(config) {
|
|
2168
|
+
return {
|
|
2169
|
+
ngModule: EsChartsModule,
|
|
2170
|
+
providers: [
|
|
2171
|
+
{ provide: ESC_ANIMATIONS, useValue: config?.animations == null || config?.animations == undefined ? true : config?.animations },
|
|
2172
|
+
{ provide: ESC_THEME, useValue: config?.theme || 'spiritedaway' },
|
|
2173
|
+
{ provide: ESC_LOGS, useValue: config?.debugMode || false },
|
|
2174
|
+
{ provide: BaseAdapter, useClass: config?.adapter || BaseAdapter }
|
|
2175
|
+
]
|
|
2176
|
+
};
|
|
2177
|
+
}
|
|
2178
|
+
}
|
|
2179
|
+
EsChartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2180
|
+
EsChartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, declarations: [EsChartComponent,
|
|
2181
|
+
EsLineChartComponent,
|
|
2182
|
+
EsPieChartComponent,
|
|
2183
|
+
EsVertical2DChartComponent,
|
|
2184
|
+
EsVerticalChartComponent,
|
|
2185
|
+
EsVerticalStackedChartComponent,
|
|
2186
|
+
PageChartSelector,
|
|
2187
|
+
EsAreaChartComponent], imports: [CommonModule], exports: [EsChartComponent,
|
|
2188
|
+
EsLineChartComponent,
|
|
2189
|
+
EsPieChartComponent,
|
|
2190
|
+
EsVertical2DChartComponent,
|
|
2191
|
+
EsVerticalChartComponent,
|
|
2192
|
+
EsVerticalStackedChartComponent,
|
|
2193
|
+
PageChartSelector,
|
|
2194
|
+
EsAreaChartComponent] });
|
|
2195
|
+
EsChartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, imports: [CommonModule] });
|
|
2196
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, decorators: [{
|
|
2197
|
+
type: NgModule,
|
|
2198
|
+
args: [{
|
|
2199
|
+
imports: [CommonModule],
|
|
2200
|
+
declarations: [...COMPONENTS],
|
|
2201
|
+
exports: [...COMPONENTS]
|
|
2202
|
+
}]
|
|
2203
|
+
}] });
|
|
2204
|
+
|
|
2215
2205
|
/**
|
|
2216
|
-
*
|
|
2206
|
+
* Classe di supporto al caricamento dinamico dei vari pezzi di amcharts che mi servono per il grafico (temi, locali, ecc...)
|
|
2207
|
+
*
|
|
2208
|
+
* Essenzialmente ogni volta che viene creato un grafico, questo acquisisce il tema e il locale applicato IN QUEL MOMENTO,
|
|
2209
|
+
* questo significa che per creare due grafici con temi diversi bisogna fare:
|
|
2210
|
+
*
|
|
2211
|
+
* 1) Caricamento tema 1
|
|
2212
|
+
*
|
|
2213
|
+
* 2) Creazione grafico 1
|
|
2214
|
+
*
|
|
2215
|
+
* 3) Scaricamento tema 1
|
|
2216
|
+
*
|
|
2217
|
+
* 3) Caricamento tema 2
|
|
2218
|
+
*
|
|
2219
|
+
* 4) Creazione grafico 2
|
|
2220
|
+
*
|
|
2217
2221
|
*/
|
|
2218
|
-
class
|
|
2222
|
+
class ChartLoader {
|
|
2219
2223
|
/**
|
|
2220
2224
|
* @ignore
|
|
2221
2225
|
*/
|
|
2222
|
-
constructor(
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
/**
|
|
2241
|
-
* Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
|
|
2242
|
-
*
|
|
2243
|
-
* @param {AreaChartSettings} settingsCasted Settings castati al tipo giusto
|
|
2244
|
-
*/
|
|
2245
|
-
fillSpecificSettings(settingsCasted) {
|
|
2226
|
+
constructor(logs) {
|
|
2227
|
+
this.logs = logs;
|
|
2228
|
+
/**
|
|
2229
|
+
* Indica se attualmente ho le animazioni caricate in modo da non ricaricarle inutilmente
|
|
2230
|
+
*/
|
|
2231
|
+
this.AnimationsAreLoaded = false;
|
|
2232
|
+
/**
|
|
2233
|
+
* Indica l'ultimo tema caricato in modo da non ricaricarlo inutilmente qualora il prossimo grafico da creare richieda lo stesso tema
|
|
2234
|
+
*/
|
|
2235
|
+
this.LastLoadedTheme = "";
|
|
2236
|
+
/**
|
|
2237
|
+
* Cache dei temi (moduli caricati dinamicamente)
|
|
2238
|
+
*/
|
|
2239
|
+
this.themeCache = {};
|
|
2240
|
+
/**
|
|
2241
|
+
* Cache delle localizzazioni (moduli caricati dinamicamente)
|
|
2242
|
+
*/
|
|
2243
|
+
this.localizationCache = {};
|
|
2246
2244
|
}
|
|
2247
2245
|
/**
|
|
2248
|
-
*
|
|
2246
|
+
* Applica il tema con le animazioni all'istanza globale di amCharts
|
|
2249
2247
|
*
|
|
2250
|
-
* @param {
|
|
2251
|
-
* @returns {
|
|
2248
|
+
* @param {Object} chartsCore Istanza globale di amCharts
|
|
2249
|
+
* @returns {Promise} Promise che identifica la fine del caricamento
|
|
2252
2250
|
*/
|
|
2253
|
-
|
|
2254
|
-
|
|
2251
|
+
applyAnimations(chartsCore) {
|
|
2252
|
+
if (!this.AnimationsAreLoaded) {
|
|
2253
|
+
return this.importIfNeeded('themes', ChartThemes.animated).then(() => {
|
|
2254
|
+
this.log("CORE: Applying theme " + ChartThemes.animated);
|
|
2255
|
+
chartsCore.useTheme(this.themeCache[ChartThemes.animated]);
|
|
2256
|
+
this.AnimationsAreLoaded = true;
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
else {
|
|
2260
|
+
this.log("CORE: theme already applyed " + ChartThemes.animated);
|
|
2261
|
+
return new Promise((resolve) => { resolve(true); });
|
|
2262
|
+
}
|
|
2255
2263
|
}
|
|
2256
|
-
}
|
|
2257
|
-
EsAreaChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsAreaChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2258
|
-
EsAreaChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsAreaChartComponent, selector: "es-area-chart", inputs: { Data: "Data", DataArray: "DataArray" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2259
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsAreaChartComponent, decorators: [{
|
|
2260
|
-
type: Component,
|
|
2261
|
-
args: [{ selector: 'es-area-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
2262
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
2263
|
-
type: Inject,
|
|
2264
|
-
args: [PLATFORM_ID]
|
|
2265
|
-
}] }, { type: undefined, decorators: [{
|
|
2266
|
-
type: Inject,
|
|
2267
|
-
args: [ESC_LOGS]
|
|
2268
|
-
}] }, { type: undefined, decorators: [{
|
|
2269
|
-
type: Inject,
|
|
2270
|
-
args: [ESC_ANIMATIONS]
|
|
2271
|
-
}] }, { type: undefined, decorators: [{
|
|
2272
|
-
type: Inject,
|
|
2273
|
-
args: [ESC_THEME]
|
|
2274
|
-
}] }, { type: i4.LocalizationService }]; }, propDecorators: { Data: [{
|
|
2275
|
-
type: Input
|
|
2276
|
-
}], DataArray: [{
|
|
2277
|
-
type: Input
|
|
2278
|
-
}] } });
|
|
2279
|
-
|
|
2280
|
-
/**
|
|
2281
|
-
* Componente specifico per la graficazione di un grafico a Linea su un asse temporale
|
|
2282
|
-
*/
|
|
2283
|
-
class EsLineChartComponent extends BaseChartComponent {
|
|
2284
2264
|
/**
|
|
2285
|
-
*
|
|
2265
|
+
* De-applica il tema con le animazioni dall'istanza globale di amCharts
|
|
2266
|
+
*
|
|
2267
|
+
* @param {Object} chartsCore Istanza globale di amCharts
|
|
2268
|
+
* @returns {Promise} Promise che identifica la fine dello scarico
|
|
2286
2269
|
*/
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2270
|
+
unapplyAnimations(chartsCore) {
|
|
2271
|
+
if (this.AnimationsAreLoaded) {
|
|
2272
|
+
this.log("CORE: Animations in use, unapplying theme " + ChartThemes.animated);
|
|
2273
|
+
chartsCore.unuseTheme(this.themeCache[ChartThemes.animated]);
|
|
2274
|
+
this.AnimationsAreLoaded = false;
|
|
2275
|
+
}
|
|
2276
|
+
else
|
|
2277
|
+
this.log("CORE: Animations already unused, no need to unapply them");
|
|
2278
|
+
return new Promise((resolve) => { resolve(true); });
|
|
2291
2279
|
}
|
|
2292
2280
|
/**
|
|
2293
|
-
*
|
|
2281
|
+
* Applica il tema specificato all'istanza globale di amCharts
|
|
2282
|
+
*
|
|
2283
|
+
* @param {Object} chartsCore Istanza globale di amCharts
|
|
2284
|
+
* @param {'spiritedaway' | 'moonrisekingdom' | 'frozen' | 'dark' | 'kelly' | 'material' | 'dataviz' | 'none'} theme Tema da applicare
|
|
2285
|
+
* @returns {Promise} Promise che identifica la fine del caricamento
|
|
2294
2286
|
*/
|
|
2295
|
-
|
|
2296
|
-
|
|
2287
|
+
applyTheme(chartsCore, theme) {
|
|
2288
|
+
// Ultimo tema applicato è lo stesso che mi è stato richiesto di applicare --> NO-OP
|
|
2289
|
+
if (this.LastLoadedTheme == theme) {
|
|
2290
|
+
this.log("CORE: theme already applied " + theme);
|
|
2291
|
+
return new Promise((resolve) => { resolve(true); });
|
|
2292
|
+
}
|
|
2293
|
+
// Scarico il tema precedente a prescindere, ormai non mi serve più
|
|
2294
|
+
this.unapplyPreviousTheme(chartsCore);
|
|
2295
|
+
// Il tema è il none --> registro la cosa e basta, il tema precedente è stato rimosso subito qui sopra ^
|
|
2296
|
+
if (theme == ChartThemes.none) {
|
|
2297
|
+
this.LastLoadedTheme = ChartThemes.none;
|
|
2298
|
+
return new Promise((resolve) => { resolve(true); });
|
|
2299
|
+
}
|
|
2300
|
+
// Il tema è diverso dal precedente e non è il tema vuoto --> Importo il tema specificato se non presente in memoria e lo applico al grafico attuale
|
|
2301
|
+
return this.importIfNeeded('themes', theme).then(() => {
|
|
2302
|
+
this.log("CORE: Applying theme " + theme);
|
|
2303
|
+
chartsCore.useTheme(this.themeCache[theme]);
|
|
2304
|
+
this.LastLoadedTheme = theme;
|
|
2305
|
+
});
|
|
2297
2306
|
}
|
|
2298
2307
|
/**
|
|
2299
|
-
*
|
|
2308
|
+
* De-applica il tema precedente dall'istanza globale di amCharts
|
|
2300
2309
|
*
|
|
2301
|
-
* @
|
|
2310
|
+
* @param {Object} chartsCore Istanza globale di amCharts
|
|
2302
2311
|
*/
|
|
2303
|
-
|
|
2304
|
-
|
|
2312
|
+
unapplyPreviousTheme(chartsCore) {
|
|
2313
|
+
if (!this.LastLoadedTheme || this.LastLoadedTheme == ChartThemes.none)
|
|
2314
|
+
return;
|
|
2315
|
+
this.log("CORE: Unapplying previously used theme " + this.LastLoadedTheme);
|
|
2316
|
+
chartsCore.unuseTheme(this.themeCache[this.LastLoadedTheme]);
|
|
2305
2317
|
}
|
|
2306
2318
|
/**
|
|
2307
|
-
*
|
|
2319
|
+
* Applica il locale specificato all'istanza specifica del grafico
|
|
2308
2320
|
*
|
|
2309
|
-
* @param {
|
|
2321
|
+
* @param {amCharts.Chart} chart Istanza specifica del grafico a cui applicare il locale
|
|
2322
|
+
* @param {string} locale Locale da applicare
|
|
2323
|
+
* @returns {Promise} Promise che identifica la fine del caricamento
|
|
2310
2324
|
*/
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
settingsCasted.AllowGaps = settingsCasted.AllowGaps != null ? settingsCasted.AllowGaps : this.AllowGaps;
|
|
2317
|
-
settingsCasted.MergeDatasets = settingsCasted.MergeDatasets != null ? settingsCasted.MergeDatasets : this.MergeDatasets;
|
|
2318
|
-
settingsCasted.FinalInstants = settingsCasted.FinalInstants != null ? settingsCasted.FinalInstants : this.FinalInstants;
|
|
2319
|
-
settingsCasted.Min = settingsCasted.Min != null ? settingsCasted.Min : this.Min;
|
|
2320
|
-
settingsCasted.Max = settingsCasted.Max != null ? settingsCasted.Max : this.Max;
|
|
2321
|
-
settingsCasted.Fill = settingsCasted.Fill != null ? settingsCasted.Fill : this.Fill;
|
|
2322
|
-
settingsCasted.Stacked = settingsCasted.Stacked != null ? settingsCasted.Stacked : this.Stacked;
|
|
2325
|
+
applyLocale(chart, locale) {
|
|
2326
|
+
return this.importIfNeeded('lang', locale).then(() => {
|
|
2327
|
+
this.log("Chart " + chart.htmlContainer.id + ": applying locale " + locale);
|
|
2328
|
+
chart.language.locale = this.localizationCache[locale];
|
|
2329
|
+
});
|
|
2323
2330
|
}
|
|
2324
2331
|
/**
|
|
2325
|
-
*
|
|
2332
|
+
* Permette di importare, se serve un dato tema o localizzazione
|
|
2326
2333
|
*
|
|
2327
|
-
* @param {
|
|
2328
|
-
* @
|
|
2334
|
+
* @param {'lang' | 'themes'} what Oggetto da importare, se localizzazione o tema
|
|
2335
|
+
* @param {string} item Chiave dell'oggetto da importare
|
|
2336
|
+
*
|
|
2337
|
+
* @returns {Promise} Promise che identifica la fine del caricamento
|
|
2329
2338
|
*/
|
|
2330
|
-
|
|
2331
|
-
|
|
2339
|
+
importIfNeeded(what, item) {
|
|
2340
|
+
// Se sto cercando di caricare qualcosa di già caricato non faccio nulla
|
|
2341
|
+
if (!(what == 'themes' && !this.themeCache[item]) && !(what == 'lang' && !this.localizationCache[item])) {
|
|
2342
|
+
this.log("CORE: " + (what == 'lang' ? "Language " : "Theme ") + item + " already loaded");
|
|
2343
|
+
return new Promise((resolve) => { resolve(true); });
|
|
2344
|
+
}
|
|
2345
|
+
this.log("CORE: Loading " + (what == 'lang' ? "language " : "theme ") + item);
|
|
2346
|
+
/*
|
|
2347
|
+
* ****************************
|
|
2348
|
+
* ******** ATTENZIONE ********
|
|
2349
|
+
* ****************************
|
|
2350
|
+
*
|
|
2351
|
+
* Se stai vedendo questo codice di import e stai valutando di riscriverlo come:
|
|
2352
|
+
*
|
|
2353
|
+
* V V
|
|
2354
|
+
* import(`@amcharts/amcharts4/${what}/${item}`).then(module => {
|
|
2355
|
+
* if (what == 'themes') this.themeCache[item] = module.default;
|
|
2356
|
+
* else if (what == 'lang') this.localizationCache[item] = module.default;
|
|
2357
|
+
* });
|
|
2358
|
+
*
|
|
2359
|
+
* Sappi che è una pessima idea. Gli import sono valutati da webpack in compiletime per generare i chunk,
|
|
2360
|
+
* mettere la navigazione agli import con la concatenazione viene preso malissimo ed essenzialmente dice a webpack
|
|
2361
|
+
* di tirare su e bundlare l'intera node_modules. Divertente, no?
|
|
2362
|
+
*
|
|
2363
|
+
*/
|
|
2364
|
+
switch (what) {
|
|
2365
|
+
case 'themes':
|
|
2366
|
+
switch (item) {
|
|
2367
|
+
case ChartThemes.spiritedaway:
|
|
2368
|
+
return import('@amcharts/amcharts4/themes/spiritedaway').then(theme => this.themeCache[item] = theme.default);
|
|
2369
|
+
case ChartThemes.moonrisekingdom:
|
|
2370
|
+
return import('@amcharts/amcharts4/themes/moonrisekingdom').then(theme => this.themeCache[item] = theme.default);
|
|
2371
|
+
case ChartThemes.frozen:
|
|
2372
|
+
return import('@amcharts/amcharts4/themes/frozen').then(theme => this.themeCache[item] = theme.default);
|
|
2373
|
+
case ChartThemes.dark:
|
|
2374
|
+
return import('@amcharts/amcharts4/themes/dark').then(theme => this.themeCache[item] = theme.default);
|
|
2375
|
+
case ChartThemes.kelly:
|
|
2376
|
+
return import('@amcharts/amcharts4/themes/kelly').then(theme => this.themeCache[item] = theme.default);
|
|
2377
|
+
case ChartThemes.material:
|
|
2378
|
+
return import('@amcharts/amcharts4/themes/material').then(theme => this.themeCache[item] = theme.default);
|
|
2379
|
+
case ChartThemes.dataviz:
|
|
2380
|
+
return import('@amcharts/amcharts4/themes/dataviz').then(theme => this.themeCache[item] = theme.default);
|
|
2381
|
+
case ChartThemes.animated:
|
|
2382
|
+
return import('@amcharts/amcharts4/themes/animated').then(theme => this.themeCache[item] = theme.default);
|
|
2383
|
+
}
|
|
2384
|
+
break;
|
|
2385
|
+
case 'lang':
|
|
2386
|
+
switch (item) {
|
|
2387
|
+
case 'it-IT':
|
|
2388
|
+
return import('@amcharts/amcharts4/lang/it_IT').then(lang => this.localizationCache[item] = lang.default);
|
|
2389
|
+
case 'en-US':
|
|
2390
|
+
return import('@amcharts/amcharts4/lang/en_US').then(lang => this.localizationCache[item] = lang.default);
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
this.log("CORE: Loading Failed. " + (what == 'lang' ? "Language " : "Theme") + " not recognized: " + item);
|
|
2394
|
+
return new Promise((resolve) => { resolve(true); });
|
|
2395
|
+
}
|
|
2396
|
+
/**
|
|
2397
|
+
* @ignore
|
|
2398
|
+
*/
|
|
2399
|
+
log(text) {
|
|
2400
|
+
if (this.logs)
|
|
2401
|
+
console.log("@esfaenza/es-charts: " + text);
|
|
2332
2402
|
}
|
|
2333
2403
|
}
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
2337
|
-
type:
|
|
2338
|
-
args: [{
|
|
2339
|
-
}], ctorParameters: function () { return [{ type:
|
|
2340
|
-
type: Inject,
|
|
2341
|
-
args: [PLATFORM_ID]
|
|
2342
|
-
}] }, { type: undefined, decorators: [{
|
|
2404
|
+
ChartLoader.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader, deps: [{ token: ESC_LOGS }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2405
|
+
ChartLoader.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader, providedIn: EsChartsModule });
|
|
2406
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ChartLoader, decorators: [{
|
|
2407
|
+
type: Injectable,
|
|
2408
|
+
args: [{ providedIn: EsChartsModule }]
|
|
2409
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
2343
2410
|
type: Inject,
|
|
2344
2411
|
args: [ESC_LOGS]
|
|
2345
|
-
}] }
|
|
2346
|
-
type: Inject,
|
|
2347
|
-
args: [ESC_ANIMATIONS]
|
|
2348
|
-
}] }, { type: undefined, decorators: [{
|
|
2349
|
-
type: Inject,
|
|
2350
|
-
args: [ESC_THEME]
|
|
2351
|
-
}] }, { type: i4.LocalizationService }]; }, propDecorators: { Data: [{
|
|
2352
|
-
type: Input
|
|
2353
|
-
}], DataArray: [{
|
|
2354
|
-
type: Input
|
|
2355
|
-
}], Step: [{
|
|
2356
|
-
type: Input
|
|
2357
|
-
}], DataGroupBucketSize: [{
|
|
2358
|
-
type: Input
|
|
2359
|
-
}], DataGroupingThreshold: [{
|
|
2360
|
-
type: Input
|
|
2361
|
-
}], StrokeSize: [{
|
|
2362
|
-
type: Input
|
|
2363
|
-
}], AllowGaps: [{
|
|
2364
|
-
type: Input
|
|
2365
|
-
}], MergeDatasets: [{
|
|
2366
|
-
type: Input
|
|
2367
|
-
}], FinalInstants: [{
|
|
2368
|
-
type: Input
|
|
2369
|
-
}], Min: [{
|
|
2370
|
-
type: Input
|
|
2371
|
-
}], Max: [{
|
|
2372
|
-
type: Input
|
|
2373
|
-
}], Fill: [{
|
|
2374
|
-
type: Input
|
|
2375
|
-
}], Stacked: [{
|
|
2376
|
-
type: Input
|
|
2377
|
-
}] } });
|
|
2412
|
+
}] }]; } });
|
|
2378
2413
|
|
|
2379
2414
|
/**
|
|
2380
|
-
* Componente
|
|
2415
|
+
* Componente Grafico Base che gestisce tutte le cose comuni dei vari grafici istanziabili, come la presenza o menu di una legenda,
|
|
2416
|
+
* il tema utilizzato, il locale del singolo grafico, ecc ecc...
|
|
2381
2417
|
*/
|
|
2382
|
-
class
|
|
2383
|
-
/**
|
|
2384
|
-
* @ignore
|
|
2385
|
-
*/
|
|
2386
|
-
constructor(el, ChartLoader, ChartDispatcher, adapter, zone, platformId, ESC_LOGS, ESC_ANIMATIONS, ESC_THEME, lc) {
|
|
2387
|
-
super(el, platformId, zone, ChartLoader, ChartDispatcher, ESC_LOGS, ESC_ANIMATIONS, lc.Locale, ESC_THEME);
|
|
2388
|
-
this.adapter = adapter;
|
|
2389
|
-
}
|
|
2418
|
+
class BaseChartComponent {
|
|
2390
2419
|
/**
|
|
2391
|
-
*
|
|
2420
|
+
* Costruttore
|
|
2421
|
+
*
|
|
2422
|
+
* @param {ElementRef} el Contenitore all'interno del cui viene creato il grafico. Utilizzato per estrapolarne la **ContainerHeight**
|
|
2423
|
+
* @param {Object} platformId piattaforma Angular (browser, ecc...) per essere sicuri che amcharts venga attivato solo lato browser. Non utilizzando SSR nelle applicazioni che consumano questa libreria non è particolarmente significativo, ma non si sa mai
|
|
2424
|
+
* @param {NgZone} zone NgZone di default per permettere di inizializzare il grafico all'infuori di Angular per avere qualche prestazione in più
|
|
2425
|
+
* @param {ChartLoader} Charter Istanza del Loader che si occuperà di caricare in memoria tutto ciò che serve per il grafico attuale (temi, locale, animazioni, ecc...)
|
|
2426
|
+
* @param {ChartDispatcher} Dispatcher Istanza del Dispatcher che si occupa di differire il caricamento dei grafici 1 dopo l'altro in modo che caricamenti pseudo paralleli incasinino tutto
|
|
2427
|
+
* @param {boolean} logs Indica se effettuare log a console o meno, iniettato dalle classi specializzate dal token ESC_LOGS
|
|
2428
|
+
* @param {boolean} animations Indica se per questo grafico devono essere attive o meno le animazioni. Impostazione generica presa dal token ESC_ANIMATIONS
|
|
2429
|
+
* @param {string} locale Indica il locale specifico per questo grafico. Impostazione generica presa dal LocalizationService
|
|
2430
|
+
* @param {string} theme Indica il tema specifico per questo grafico. Impostazione generica presa dal token ESC_THEME
|
|
2392
2431
|
*/
|
|
2393
|
-
|
|
2394
|
-
|
|
2432
|
+
constructor(el, platformId, zone, Charter, Dispatcher, logs, animations, locale, theme) {
|
|
2433
|
+
this.el = el;
|
|
2434
|
+
this.platformId = platformId;
|
|
2435
|
+
this.zone = zone;
|
|
2436
|
+
this.Charter = Charter;
|
|
2437
|
+
this.Dispatcher = Dispatcher;
|
|
2438
|
+
this.logs = logs;
|
|
2439
|
+
this.animations = animations;
|
|
2440
|
+
this.locale = locale;
|
|
2441
|
+
this.theme = theme;
|
|
2442
|
+
/**
|
|
2443
|
+
* Nome del grafico, fondamentale assegnarlo per permettere alla libreria di schedularne la creazione
|
|
2444
|
+
*/
|
|
2445
|
+
this.name = "";
|
|
2446
|
+
/**
|
|
2447
|
+
* Dopo aver navigato a un nuovo grafico verranno attesi questi millisecondi prima di richiedere i dati attraverso la **DataRetrieve**.
|
|
2448
|
+
*
|
|
2449
|
+
* Questo per evitare che l'utente cliccando velocemente "avanti" generi tonnellate di richieste inutili
|
|
2450
|
+
*/
|
|
2451
|
+
this.BrowseDelayMs = 500;
|
|
2452
|
+
/**
|
|
2453
|
+
* Evento lanciato sulla selezione di un range di dati o dalla timeline o dal grafico. Valido per tutti i grafici che supportano serie basate sulle date
|
|
2454
|
+
*/
|
|
2455
|
+
this.onSelectionChanged = new EventEmitter();
|
|
2456
|
+
/**
|
|
2457
|
+
* Evento lanciato dal click di una serie dalla Legenda, a patto che l'Input **HideSeriesOnLabelClick** sia impostato a false
|
|
2458
|
+
*/
|
|
2459
|
+
this.onSeriesClicked = new EventEmitter();
|
|
2460
|
+
/**
|
|
2461
|
+
* Evento lanciato all'inizio del caricamento di una nuova pagina del grafico
|
|
2462
|
+
*/
|
|
2463
|
+
this.onLoadStart = new EventEmitter();
|
|
2464
|
+
/**
|
|
2465
|
+
* Evento lanciato al termine del caricamento di una nuova pagina del grafico
|
|
2466
|
+
*/
|
|
2467
|
+
this.onLoadEnd = new EventEmitter();
|
|
2468
|
+
/**
|
|
2469
|
+
* Evento lanciato al termine della creazione del grafico referenziando l'istanza nativa del grafico creato in modo da poter effettuare modifiche
|
|
2470
|
+
* post inizializzazione lato applicativo
|
|
2471
|
+
*/
|
|
2472
|
+
this.chartLoaded = new EventEmitter();
|
|
2473
|
+
/**
|
|
2474
|
+
* Serve a decidere se sarà presente l'interfaccia di paginazione
|
|
2475
|
+
*/
|
|
2476
|
+
this.isPaged = false;
|
|
2477
|
+
/**
|
|
2478
|
+
* @ignore
|
|
2479
|
+
*/
|
|
2480
|
+
this.initDone = false;
|
|
2395
2481
|
}
|
|
2396
2482
|
/**
|
|
2397
|
-
*
|
|
2483
|
+
* Metodo di inizializzazione post valorizzazione degli input, utilizzato per valorizzare correttamente le proprietà essenziali del grafico (Animazioni, Tema e Locale)
|
|
2398
2484
|
*
|
|
2399
|
-
*
|
|
2485
|
+
* Viene data priorità ai Settings (HTML), priorità secondaria agli Input diretti (Lato HTML), priorità ultima alle impostazioni globali,
|
|
2486
|
+
* impostate in fase di import del modulo assegnando valori ai token ESC_ANIMATIONS, ESC_THEME
|
|
2400
2487
|
*/
|
|
2401
|
-
|
|
2402
|
-
|
|
2488
|
+
ngOnInit() {
|
|
2489
|
+
// Qui servono solo le variabili da conoscere PRE-graficazione per il caricamento dei moduli lazy del grafico
|
|
2490
|
+
this.Animations = this.Settings?.Animations != null ? this.Settings?.Animations : (this.Animations != null ? this.Animations : this.animations);
|
|
2491
|
+
this.Theme = this.Settings?.Theme != null ? this.Settings?.Theme : (this.Theme != null ? this.Theme : this.theme);
|
|
2492
|
+
this.Locale = this.Settings?.Locale != null ? this.Settings?.Locale : (this.Locale != null ? this.Locale : this.locale);
|
|
2493
|
+
this.isPaged = (this.DataArray && this.DataArray.length > 0 && !this.Data) || (this.DataDtos && this.DataDtos.length > 0 && !!this.DataRetrieve);
|
|
2494
|
+
this.log("Chart " + this.name + ": ngOnInit");
|
|
2403
2495
|
}
|
|
2404
2496
|
/**
|
|
2405
|
-
*
|
|
2497
|
+
* Implementazione utilizzata per controllare eventuali proprietà chiave del grafico e rigraficare tutto qualora si rivelasse necessario
|
|
2406
2498
|
*
|
|
2407
|
-
* @param {
|
|
2499
|
+
* @param {SimpleChanges} changes Indicazione dei cambiamenti sulle proprietà del grafico. Vedere documentazione Angular in merito
|
|
2408
2500
|
*/
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
settingsCasted.LabelsWidth = settingsCasted.LabelsWidth != null ? settingsCasted.LabelsWidth : this.LabelsWidth;
|
|
2416
|
-
settingsCasted.LabelsVisible = settingsCasted.LabelsVisible != null ? settingsCasted.LabelsVisible : this.LabelsVisible;
|
|
2501
|
+
ngOnChanges(changes) {
|
|
2502
|
+
if (!this.initDone)
|
|
2503
|
+
return;
|
|
2504
|
+
this.log("Chart " + this.name + ": ngOnChanges");
|
|
2505
|
+
let propsToCheck = ["Timeline", "Legend", "Settings", "Animations", "Theme", "Locale", ...this.getSpecificPropertiesToCheck()];
|
|
2506
|
+
this.checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck);
|
|
2417
2507
|
}
|
|
2418
2508
|
/**
|
|
2419
|
-
*
|
|
2420
|
-
*
|
|
2421
|
-
* @param {PieChartSettings} settingsCasted Impostazioni di graficazione
|
|
2422
|
-
* @returns {PieChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
|
|
2509
|
+
* Nel post inizializzazione, a patto che mi trovi in ambiente "browser", proseguo al caricamento del grafico sull'HTML
|
|
2423
2510
|
*/
|
|
2424
|
-
|
|
2425
|
-
|
|
2511
|
+
ngAfterViewInit() {
|
|
2512
|
+
if (!this.name)
|
|
2513
|
+
throw "a Unique name is mandatory to create a chart";
|
|
2514
|
+
this.log("Chart " + this.name + ": ngAfterViewInit, graphicating chart outside Angular");
|
|
2515
|
+
if (!this.isPaged)
|
|
2516
|
+
this.dispatchLoadChart();
|
|
2426
2517
|
}
|
|
2427
|
-
}
|
|
2428
|
-
EsPieChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsPieChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2429
|
-
EsPieChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsPieChartComponent, selector: "es-pie-chart", inputs: { Data: "Data", DataArray: "DataArray", HideZeroes: "HideZeroes", Mode3D: "Mode3D", DonutRadiusPercentage: "DonutRadiusPercentage", LabelsWrap: "LabelsWrap", LabelsTruncate: "LabelsTruncate", LabelsWidth: "LabelsWidth", LabelsVisible: "LabelsVisible" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2430
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsPieChartComponent, decorators: [{
|
|
2431
|
-
type: Component,
|
|
2432
|
-
args: [{ selector: 'es-pie-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
2433
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
2434
|
-
type: Inject,
|
|
2435
|
-
args: [PLATFORM_ID]
|
|
2436
|
-
}] }, { type: undefined, decorators: [{
|
|
2437
|
-
type: Inject,
|
|
2438
|
-
args: [ESC_LOGS]
|
|
2439
|
-
}] }, { type: undefined, decorators: [{
|
|
2440
|
-
type: Inject,
|
|
2441
|
-
args: [ESC_ANIMATIONS]
|
|
2442
|
-
}] }, { type: undefined, decorators: [{
|
|
2443
|
-
type: Inject,
|
|
2444
|
-
args: [ESC_THEME]
|
|
2445
|
-
}] }, { type: i4.LocalizationService }]; }, propDecorators: { Data: [{
|
|
2446
|
-
type: Input
|
|
2447
|
-
}], DataArray: [{
|
|
2448
|
-
type: Input
|
|
2449
|
-
}], HideZeroes: [{
|
|
2450
|
-
type: Input
|
|
2451
|
-
}], Mode3D: [{
|
|
2452
|
-
type: Input
|
|
2453
|
-
}], DonutRadiusPercentage: [{
|
|
2454
|
-
type: Input
|
|
2455
|
-
}], LabelsWrap: [{
|
|
2456
|
-
type: Input
|
|
2457
|
-
}], LabelsTruncate: [{
|
|
2458
|
-
type: Input
|
|
2459
|
-
}], LabelsWidth: [{
|
|
2460
|
-
type: Input
|
|
2461
|
-
}], LabelsVisible: [{
|
|
2462
|
-
type: Input
|
|
2463
|
-
}] } });
|
|
2464
|
-
|
|
2465
|
-
/**
|
|
2466
|
-
* Componente specifico per la graficazione di un grafico a Barre con due dimensioni
|
|
2467
|
-
*/
|
|
2468
|
-
class EsVertical2DChartComponent extends BaseChartComponent {
|
|
2469
2518
|
/**
|
|
2470
|
-
*
|
|
2519
|
+
* All'onDestroy scarico il grafico per liberare memoria
|
|
2471
2520
|
*/
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2521
|
+
ngOnDestroy() {
|
|
2522
|
+
if (this.Chart) {
|
|
2523
|
+
this.log("Chart " + this.name + ": Unloading destroyed chart");
|
|
2524
|
+
this.browserOnly(() => { this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
|
|
2525
|
+
}
|
|
2526
|
+
else
|
|
2527
|
+
this.log("Chart " + this.name + ": Unloading uncreated chart component. It probably was a duplicated");
|
|
2475
2528
|
}
|
|
2476
2529
|
/**
|
|
2477
|
-
*
|
|
2530
|
+
* Registra il grafico attuale nel Dispatcher in modo che venga caricato appena possibile
|
|
2478
2531
|
*/
|
|
2479
|
-
|
|
2480
|
-
|
|
2532
|
+
dispatchLoadChart() {
|
|
2533
|
+
this.browserOnly(() => {
|
|
2534
|
+
this.Dispatcher.register(this.name, () => { return this.loadChart(); });
|
|
2535
|
+
});
|
|
2481
2536
|
}
|
|
2482
2537
|
/**
|
|
2483
|
-
*
|
|
2538
|
+
* Il caricamento del grafico funziona nel seguente modo:
|
|
2484
2539
|
*
|
|
2485
|
-
*
|
|
2486
|
-
*/
|
|
2487
|
-
getCastedSettings() {
|
|
2488
|
-
return (this.Settings ?? new Vertical2DChartSettings());
|
|
2489
|
-
}
|
|
2490
|
-
/**
|
|
2491
|
-
* Integra i Settings base con tutti gli Input specifici di questo grafico, dando priorità ai Settings se definiti
|
|
2540
|
+
* 1) Caricamento del tema e delle animazioni, qualora necessari
|
|
2492
2541
|
*
|
|
2493
|
-
*
|
|
2494
|
-
*/
|
|
2495
|
-
fillSpecificSettings(settingsCasted) {
|
|
2496
|
-
settingsCasted.ColumnWidthPercentage = settingsCasted.ColumnWidthPercentage != null ? settingsCasted.ColumnWidthPercentage : this.ColumnWidthPercentage;
|
|
2497
|
-
settingsCasted.GroupPaddingPercentage = settingsCasted.GroupPaddingPercentage != null ? settingsCasted.GroupPaddingPercentage : this.GroupPaddingPercentage;
|
|
2498
|
-
settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
|
|
2499
|
-
settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
|
|
2500
|
-
settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
|
|
2501
|
-
settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
|
|
2502
|
-
}
|
|
2503
|
-
/**
|
|
2504
|
-
* Effettua il rendering di questo grafico in base ai Settings
|
|
2542
|
+
* 2) Caricamento delle impostazioni specifiche e integrazione con le impostazioni generiche
|
|
2505
2543
|
*
|
|
2506
|
-
*
|
|
2507
|
-
*
|
|
2544
|
+
* 3) Graficazione
|
|
2545
|
+
*
|
|
2546
|
+
* 4) Caricamento del locale
|
|
2508
2547
|
*/
|
|
2509
|
-
|
|
2510
|
-
|
|
2548
|
+
loadChart() {
|
|
2549
|
+
this.log("Chart " + this.name + ": Start loading Modules if needed");
|
|
2550
|
+
return Promise.all([
|
|
2551
|
+
this.setupAmChartsThemes().then(() => {
|
|
2552
|
+
this.log("Chart " + this.name + ": Graphicating after modules load");
|
|
2553
|
+
var castedSettings = this.getCastedSettings();
|
|
2554
|
+
this.fillSettings(castedSettings);
|
|
2555
|
+
this.fillSpecificSettings(castedSettings);
|
|
2556
|
+
this.ChartService = this.graphicate(castedSettings);
|
|
2557
|
+
this.Chart = this.ChartService.ChartInstance;
|
|
2558
|
+
if (!this.Chart)
|
|
2559
|
+
this.log("Chart " + this.name + ": Could not create graph");
|
|
2560
|
+
// Unico punto reale in cui viene utilizzato il locale, tehe
|
|
2561
|
+
return this.Charter.applyLocale(this.Chart, this.Locale).then(() => { this.initDone = true; this.chartLoaded.emit(this); });
|
|
2562
|
+
})
|
|
2563
|
+
]);
|
|
2511
2564
|
}
|
|
2512
|
-
}
|
|
2513
|
-
EsVertical2DChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVertical2DChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2514
|
-
EsVertical2DChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVertical2DChartComponent, selector: "es-vertical-2d-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", GroupPaddingPercentage: "GroupPaddingPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2515
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVertical2DChartComponent, decorators: [{
|
|
2516
|
-
type: Component,
|
|
2517
|
-
args: [{ selector: 'es-vertical-2d-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
2518
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
2519
|
-
type: Inject,
|
|
2520
|
-
args: [PLATFORM_ID]
|
|
2521
|
-
}] }, { type: undefined, decorators: [{
|
|
2522
|
-
type: Inject,
|
|
2523
|
-
args: [ESC_LOGS]
|
|
2524
|
-
}] }, { type: undefined, decorators: [{
|
|
2525
|
-
type: Inject,
|
|
2526
|
-
args: [ESC_ANIMATIONS]
|
|
2527
|
-
}] }, { type: undefined, decorators: [{
|
|
2528
|
-
type: Inject,
|
|
2529
|
-
args: [ESC_THEME]
|
|
2530
|
-
}] }, { type: i4.LocalizationService }]; }, propDecorators: { Data: [{
|
|
2531
|
-
type: Input
|
|
2532
|
-
}], DataArray: [{
|
|
2533
|
-
type: Input
|
|
2534
|
-
}], ColumnWidthPercentage: [{
|
|
2535
|
-
type: Input
|
|
2536
|
-
}], GroupPaddingPercentage: [{
|
|
2537
|
-
type: Input
|
|
2538
|
-
}], LabelWidth: [{
|
|
2539
|
-
type: Input
|
|
2540
|
-
}], LabelVerticalOrientationCutoffWidth: [{
|
|
2541
|
-
type: Input
|
|
2542
|
-
}], LabelRightWhenCompressed: [{
|
|
2543
|
-
type: Input
|
|
2544
|
-
}], LabelTopWhenCompressed: [{
|
|
2545
|
-
type: Input
|
|
2546
|
-
}] } });
|
|
2547
|
-
|
|
2548
|
-
/**
|
|
2549
|
-
* Componente specifico per la graficazione di un grafico a Barre
|
|
2550
|
-
*/
|
|
2551
|
-
class EsVerticalChartComponent extends BaseChartComponent {
|
|
2552
2565
|
/**
|
|
2553
|
-
*
|
|
2566
|
+
* Riempimento delle impostazioni nella classe Settings. Si danno priorità ai valori già impostati nei Settings,
|
|
2567
|
+
* integrando eventualmente con le proprietà del grafico
|
|
2568
|
+
*
|
|
2569
|
+
* @param {BaseSettings} settings Impostazioni base ricevute dalla specializzazione del grafico
|
|
2554
2570
|
*/
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2571
|
+
fillSettings(settings) {
|
|
2572
|
+
// Merge degli Input con i Settings, dando priorità ai Settings
|
|
2573
|
+
settings.Theme = settings.Theme ? settings.Theme : this.Theme;
|
|
2574
|
+
settings.Locale = settings.Locale ? settings.Locale : this.Locale;
|
|
2575
|
+
settings.Animations = settings.Animations != null ? settings.Animations : this.Animations;
|
|
2576
|
+
settings.Legend = settings.Legend != null ? settings.Legend : this.Legend;
|
|
2577
|
+
settings.Name = settings.Name ? settings.Name : this.name;
|
|
2578
|
+
settings.Timeline = settings.Timeline != null ? settings.Timeline : this.Timeline;
|
|
2579
|
+
settings.AdaptLabelSizeAndOrientation = settings.AdaptLabelSizeAndOrientation != null ? settings.AdaptLabelSizeAndOrientation : this.AdaptLabelSizeAndOrientation;
|
|
2580
|
+
settings.XAxisTitle = settings.XAxisTitle ? settings.XAxisTitle : this.XTitle;
|
|
2581
|
+
settings.YAxisTitle = settings.YAxisTitle ? settings.YAxisTitle : this.YTitle;
|
|
2582
|
+
settings.LegendPosition = settings.LegendPosition ? settings.LegendPosition : this.LegendPosition;
|
|
2583
|
+
settings.HideSeriesOnLabelClick = settings.HideSeriesOnLabelClick != null ? settings.HideSeriesOnLabelClick : this.HideSeriesOnLabelClick;
|
|
2584
|
+
settings.MinGridDistance = settings.MinGridDistance != null ? settings.MinGridDistance : this.MinGridDistance;
|
|
2585
|
+
settings.LegendPadding = settings.LegendPadding ? settings.LegendPadding : this.LegendPadding ?? null;
|
|
2586
|
+
settings.ContainerHeight = this.el.nativeElement.parentElement.offsetHeight;
|
|
2587
|
+
settings.OnSeriesClickCallback = (series) => { this.onSeriesClicked.emit(series); };
|
|
2588
|
+
settings.OnSelectionChangedCallback = (event) => { this.onSelectionChanged.emit({ from: event.from, to: event.to, initial: event.initial }); };
|
|
2558
2589
|
}
|
|
2559
2590
|
/**
|
|
2560
|
-
*
|
|
2591
|
+
* Controlla i cambiamenti avvenuti alle proprietà chiave e rieffettua la graficazione qualora necessario
|
|
2592
|
+
*
|
|
2593
|
+
* @param {SimpleChanges} changes Indicazione della modifiche avvenute nei vari Input
|
|
2594
|
+
* @param {string[]} propsToCheck Lista degli Input da controllare per cui una modifica causa una rigraficazione
|
|
2561
2595
|
*/
|
|
2562
|
-
|
|
2563
|
-
|
|
2596
|
+
checkPropertiesAndRegraphicateAsNeeded(changes, propsToCheck) {
|
|
2597
|
+
let toReGraphicate = false;
|
|
2598
|
+
for (let i = 0; i < propsToCheck.length; i++)
|
|
2599
|
+
toReGraphicate = toReGraphicate || (changes[propsToCheck[i]] && changes[propsToCheck[i]].currentValue);
|
|
2600
|
+
if (toReGraphicate)
|
|
2601
|
+
this.reloadChart();
|
|
2564
2602
|
}
|
|
2565
2603
|
/**
|
|
2566
|
-
*
|
|
2604
|
+
* Funzione che effettua un cambio di pagina per i grafici paginati. Qualora **data** fosse nullo significa che è iniziato un caricamento
|
|
2605
|
+
* e anche lato applicativo il DataRetrieve dovrà considerare che l'assenza di valori non è altro che un'indicazione di inizio caricamento
|
|
2567
2606
|
*
|
|
2568
|
-
*
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2607
|
+
* Il caricamento di qualsiasi pagina genererà comunque una primo evento con **data** nullo in modo da indicare l'inizio caricamento e
|
|
2608
|
+
* in seconda istanza un altro evento in cui **data** sarà sempre valorizzato, o con il Dto da usare per recuperare i dati, o con i dati
|
|
2609
|
+
* veri e propri già presenti nel **DataArray**
|
|
2610
|
+
*
|
|
2611
|
+
* I callback **onLoadStart** e **onLoadEnd** vengono sempre chiamati
|
|
2612
|
+
*
|
|
2613
|
+
* @param {{ data: LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any, index: number }} nd Indice del caricamento dati, con eventualmente già i dati se disponibili
|
|
2614
|
+
*/
|
|
2615
|
+
changePage(nd) {
|
|
2616
|
+
if (!nd.data) {
|
|
2617
|
+
this.loadingChart = true;
|
|
2618
|
+
// Serve per informare l'applicativo in listening sull'indice attualmente in visualizzazione.
|
|
2619
|
+
// La mancanza di dati indica che non devono essere effettuate ricerche per ora
|
|
2620
|
+
if (this.DataRetrieve)
|
|
2621
|
+
this.DataRetrieve(null, nd.index);
|
|
2622
|
+
this.onLoadStart.emit();
|
|
2623
|
+
return;
|
|
2624
|
+
}
|
|
2625
|
+
if (this.DataRetrieve)
|
|
2626
|
+
this.DataRetrieve(nd.data, nd.index).then(t => { this.changePageDataReceived(t); });
|
|
2627
|
+
else
|
|
2628
|
+
this.changePageDataReceived(nd.data);
|
|
2572
2629
|
}
|
|
2573
2630
|
/**
|
|
2574
|
-
*
|
|
2631
|
+
* Al termine del caricamento dei dati di una pagina questo metodo viene chiamato per rigraficare la situazione con i nuovi dati
|
|
2575
2632
|
*
|
|
2576
|
-
* @param {
|
|
2633
|
+
* @param {LineChartData | PieChartData | Vertical2DChartData | VerticalChartData | any} data Dati del grafico
|
|
2577
2634
|
*/
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2635
|
+
changePageDataReceived(data) {
|
|
2636
|
+
this.loadingChart = false;
|
|
2637
|
+
this.onLoadEnd.emit();
|
|
2638
|
+
let firstBind = !this.Data;
|
|
2639
|
+
this.Data = data;
|
|
2640
|
+
if (!firstBind)
|
|
2641
|
+
this.reloadChart();
|
|
2642
|
+
else
|
|
2643
|
+
this.dispatchLoadChart();
|
|
2584
2644
|
}
|
|
2585
2645
|
/**
|
|
2586
|
-
*
|
|
2646
|
+
* Ricarica il grafico distruggendo il vecchio e ricreando il nuovo
|
|
2587
2647
|
*
|
|
2588
|
-
*
|
|
2589
|
-
*
|
|
2648
|
+
* Le chiamate a questo metodo possono essere trasformate in chiamate al metodo **graphicate** della Service, se solo quel metodo fosse abbastanza intelligente per capire
|
|
2649
|
+
* le differenze fra il grafico com'era prima e come deve diventare, in modo da non ricrearlo ma semplicemente modificare quello che già è disegnato
|
|
2590
2650
|
*/
|
|
2591
|
-
|
|
2592
|
-
|
|
2651
|
+
reloadChart() {
|
|
2652
|
+
this.browserOnly(() => { if (!this.Chart.isDisposed())
|
|
2653
|
+
this.Chart.dispose(); this.Dispatcher.deregisterGraph(this.name); });
|
|
2654
|
+
this.Dispatcher.register(this.name, () => { return this.loadChart(); });
|
|
2593
2655
|
}
|
|
2594
|
-
}
|
|
2595
|
-
EsVerticalChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalChartComponent, deps: [{ token: i0.ElementRef }, { token: ChartLoader }, { token: ChartDispatcher }, { token: BaseAdapter }, { token: i0.NgZone }, { token: PLATFORM_ID }, { token: ESC_LOGS }, { token: ESC_ANIMATIONS }, { token: ESC_THEME }, { token: i4.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2596
|
-
EsVerticalChartComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: EsVerticalChartComponent, selector: "es-vertical-chart", inputs: { Data: "Data", DataArray: "DataArray", ColumnWidthPercentage: "ColumnWidthPercentage", LabelWidth: "LabelWidth", LabelVerticalOrientationCutoffWidth: "LabelVerticalOrientationCutoffWidth", LabelRightWhenCompressed: "LabelRightWhenCompressed", LabelTopWhenCompressed: "LabelTopWhenCompressed" }, usesInheritance: true, ngImport: i0, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: PageChartSelector, selector: "chart-pager", inputs: ["Items", "Dtos", "BrowseDelayMs", "StartIndex"], outputs: ["onPageChange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
2597
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsVerticalChartComponent, decorators: [{
|
|
2598
|
-
type: Component,
|
|
2599
|
-
args: [{ selector: 'es-vertical-chart', changeDetection: ChangeDetectionStrategy.OnPush, template: "<chart-pager *ngIf=\"isPaged\" (onPageChange)=\"changePage($event)\" [Items]=\"DataArray\" [Dtos]=\"DataDtos\" [StartIndex]=\"DataDtoStartIndex\"\r\n [BrowseDelayMs]=\"BrowseDelayMs\">\r\n <ng-template #header_inner let-headerItem>\r\n <ng-container *ngTemplateOutlet=\"header_tr; context : {$implicit: headerItem}\"></ng-container>\r\n </ng-template>\r\n</chart-pager>\r\n\r\n<ng-container *ngIf=\"loadingChart && loading_template\">\r\n <div style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <ng-container *ngTemplateOutlet=\"loading_template\"></ng-container>\r\n </div>\r\n</ng-container>\r\n\r\n<ng-container *ngIf=\"loadingChart && !loading_template\">\r\n <div class=\"esc-loading-overlay\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\">\r\n <p class=\"label\">Loading....</p>\r\n </div>\r\n</ng-container>\r\n\r\n<div [class.hide-block]=\"loadingChart\" id=\"{{name}}\" style=\"width: 100%;\" [style.height]=\"isPaged ? 'calc(100% - 44px)' : '100%'\"></div>", styles: [".esc-loading-overlay{background:rgba(153,153,153,.6);text-transform:uppercase;font-size:30px;font-weight:700;color:#fff;text-align:center;font-family:monospace}.esc-loading-overlay .label{margin:0;padding-top:7%}.hide-block{display:none}\n"] }]
|
|
2600
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
2601
|
-
type: Inject,
|
|
2602
|
-
args: [PLATFORM_ID]
|
|
2603
|
-
}] }, { type: undefined, decorators: [{
|
|
2604
|
-
type: Inject,
|
|
2605
|
-
args: [ESC_LOGS]
|
|
2606
|
-
}] }, { type: undefined, decorators: [{
|
|
2607
|
-
type: Inject,
|
|
2608
|
-
args: [ESC_ANIMATIONS]
|
|
2609
|
-
}] }, { type: undefined, decorators: [{
|
|
2610
|
-
type: Inject,
|
|
2611
|
-
args: [ESC_THEME]
|
|
2612
|
-
}] }, { type: i4.LocalizationService }]; }, propDecorators: { Data: [{
|
|
2613
|
-
type: Input
|
|
2614
|
-
}], DataArray: [{
|
|
2615
|
-
type: Input
|
|
2616
|
-
}], ColumnWidthPercentage: [{
|
|
2617
|
-
type: Input
|
|
2618
|
-
}], LabelWidth: [{
|
|
2619
|
-
type: Input
|
|
2620
|
-
}], LabelVerticalOrientationCutoffWidth: [{
|
|
2621
|
-
type: Input
|
|
2622
|
-
}], LabelRightWhenCompressed: [{
|
|
2623
|
-
type: Input
|
|
2624
|
-
}], LabelTopWhenCompressed: [{
|
|
2625
|
-
type: Input
|
|
2626
|
-
}] } });
|
|
2627
|
-
|
|
2628
|
-
/**
|
|
2629
|
-
* Componente specifico per la graficazione di un grafico a Barre in modalità Stacked (una serie sopra l'altra)
|
|
2630
|
-
*/
|
|
2631
|
-
class EsVerticalStackedChartComponent extends BaseChartComponent {
|
|
2632
2656
|
/**
|
|
2633
|
-
*
|
|
2657
|
+
* Permette di aggiungere un blocco di dati in maniera "live" ad un grafico
|
|
2634
2658
|
*/
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
this.adapter = adapter;
|
|
2659
|
+
addData(chartData) {
|
|
2660
|
+
this.ChartService.refreshData(chartData);
|
|
2638
2661
|
}
|
|
2662
|
+
;
|
|
2639
2663
|
/**
|
|
2640
|
-
*
|
|
2664
|
+
* Funzione che si occupa di caricare i temi necessari per il grafico in oggetto. Prima applica il tema, poi, se serve, applica le animazioni
|
|
2641
2665
|
*/
|
|
2642
|
-
|
|
2643
|
-
return [
|
|
2666
|
+
setupAmChartsThemes() {
|
|
2667
|
+
return Promise.all([
|
|
2668
|
+
this.Charter.applyTheme(am4core, this.Theme).then(() => {
|
|
2669
|
+
return this.Animations ? this.Charter.applyAnimations(am4core) : this.Charter.unapplyAnimations(am4core);
|
|
2670
|
+
})
|
|
2671
|
+
]);
|
|
2644
2672
|
}
|
|
2645
2673
|
/**
|
|
2646
|
-
*
|
|
2647
|
-
*
|
|
2648
|
-
* @returns {VerticalStackedChartSettings} Settings castati al tipo giusto
|
|
2674
|
+
* @ignore
|
|
2649
2675
|
*/
|
|
2650
|
-
|
|
2651
|
-
|
|
2676
|
+
log(log) {
|
|
2677
|
+
if (this.logs)
|
|
2678
|
+
console.log("@esfaenza/es-charts: " + log);
|
|
2652
2679
|
}
|
|
2653
2680
|
/**
|
|
2654
|
-
*
|
|
2681
|
+
* Imposta lo zoom dal **from** al **to**
|
|
2655
2682
|
*
|
|
2656
|
-
* @param {
|
|
2683
|
+
* @param {Date} from Inizio dello zoom
|
|
2684
|
+
* @param {Date} to Fine dello zoom
|
|
2657
2685
|
*/
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
settingsCasted.LabelWidth = settingsCasted.LabelWidth != null ? settingsCasted.LabelWidth : this.LabelWidth;
|
|
2661
|
-
settingsCasted.LabelVerticalOrientationCutoffWidth = settingsCasted.LabelVerticalOrientationCutoffWidth != null ? settingsCasted.LabelVerticalOrientationCutoffWidth : this.LabelVerticalOrientationCutoffWidth;
|
|
2662
|
-
settingsCasted.LabelRightWhenCompressed = settingsCasted.LabelRightWhenCompressed != null ? settingsCasted.LabelRightWhenCompressed : this.LabelRightWhenCompressed;
|
|
2663
|
-
settingsCasted.LabelTopWhenCompressed = settingsCasted.LabelTopWhenCompressed != null ? settingsCasted.LabelTopWhenCompressed : this.LabelTopWhenCompressed;
|
|
2686
|
+
setSelection(from, to) {
|
|
2687
|
+
this.ChartService.setSelection(from, to);
|
|
2664
2688
|
}
|
|
2665
2689
|
/**
|
|
2666
|
-
*
|
|
2667
|
-
*
|
|
2668
|
-
* @param {VerticalStackedChartSettings} settingsCasted Impostazioni di graficazione
|
|
2669
|
-
* @returns {VerticalStackedChartService} La service utilizzata per il rendering nello stato subito successivo al rendering effettuato
|
|
2690
|
+
* @ignore
|
|
2670
2691
|
*/
|
|
2671
|
-
|
|
2672
|
-
|
|
2692
|
+
browserOnly(f) {
|
|
2693
|
+
if (isPlatformBrowser(this.platformId)) {
|
|
2694
|
+
this.zone.runOutsideAngular(() => {
|
|
2695
|
+
f();
|
|
2696
|
+
});
|
|
2697
|
+
}
|
|
2673
2698
|
}
|
|
2674
2699
|
}
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type:
|
|
2678
|
-
type:
|
|
2679
|
-
|
|
2680
|
-
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: ChartLoader }, { type: ChartDispatcher }, { type: BaseAdapter }, { type: i0.NgZone }, { type: Object, decorators: [{
|
|
2681
|
-
type: Inject,
|
|
2682
|
-
args: [PLATFORM_ID]
|
|
2683
|
-
}] }, { type: undefined, decorators: [{
|
|
2684
|
-
type: Inject,
|
|
2685
|
-
args: [ESC_LOGS]
|
|
2686
|
-
}] }, { type: undefined, decorators: [{
|
|
2687
|
-
type: Inject,
|
|
2688
|
-
args: [ESC_ANIMATIONS]
|
|
2689
|
-
}] }, { type: undefined, decorators: [{
|
|
2690
|
-
type: Inject,
|
|
2691
|
-
args: [ESC_THEME]
|
|
2692
|
-
}] }, { type: i4.LocalizationService }]; }, propDecorators: { Data: [{
|
|
2700
|
+
BaseChartComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseChartComponent, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
2701
|
+
BaseChartComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: BaseChartComponent, inputs: { XTitle: "XTitle", YTitle: "YTitle", Settings: "Settings", Legend: "Legend", LegendPosition: "LegendPosition", Timeline: "Timeline", name: "name", Animations: "Animations", Theme: "Theme", Locale: "Locale", HideSeriesOnLabelClick: "HideSeriesOnLabelClick", MinGridDistance: "MinGridDistance", AdaptLabelSizeAndOrientation: "AdaptLabelSizeAndOrientation", LegendPadding: "LegendPadding", DataDtos: "DataDtos", DataDtoStartIndex: "DataDtoStartIndex", DataRetrieve: "DataRetrieve", BrowseDelayMs: "BrowseDelayMs" }, outputs: { onSelectionChanged: "onSelectionChanged", onSeriesClicked: "onSeriesClicked", onLoadStart: "onLoadStart", onLoadEnd: "onLoadEnd", chartLoaded: "chartLoaded" }, queries: [{ propertyName: "header_tr", first: true, predicate: ["header"], descendants: true }, { propertyName: "loading_template", first: true, predicate: ["loading"], descendants: true }], usesOnChanges: true, ngImport: i0 });
|
|
2702
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: BaseChartComponent, decorators: [{
|
|
2703
|
+
type: Directive
|
|
2704
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: Object }, { type: i0.NgZone }, { type: ChartLoader }, { type: ChartDispatcher }, { type: undefined }, { type: undefined }, { type: undefined }, { type: undefined }]; }, propDecorators: { XTitle: [{
|
|
2693
2705
|
type: Input
|
|
2694
|
-
}],
|
|
2706
|
+
}], YTitle: [{
|
|
2695
2707
|
type: Input
|
|
2696
|
-
}],
|
|
2708
|
+
}], Settings: [{
|
|
2697
2709
|
type: Input
|
|
2698
|
-
}],
|
|
2710
|
+
}], Legend: [{
|
|
2699
2711
|
type: Input
|
|
2700
|
-
}],
|
|
2712
|
+
}], LegendPosition: [{
|
|
2701
2713
|
type: Input
|
|
2702
|
-
}],
|
|
2714
|
+
}], Timeline: [{
|
|
2703
2715
|
type: Input
|
|
2704
|
-
}],
|
|
2716
|
+
}], name: [{
|
|
2717
|
+
type: Input
|
|
2718
|
+
}], Animations: [{
|
|
2719
|
+
type: Input
|
|
2720
|
+
}], Theme: [{
|
|
2721
|
+
type: Input
|
|
2722
|
+
}], Locale: [{
|
|
2723
|
+
type: Input
|
|
2724
|
+
}], HideSeriesOnLabelClick: [{
|
|
2705
2725
|
type: Input
|
|
2726
|
+
}], MinGridDistance: [{
|
|
2727
|
+
type: Input
|
|
2728
|
+
}], AdaptLabelSizeAndOrientation: [{
|
|
2729
|
+
type: Input
|
|
2730
|
+
}], LegendPadding: [{
|
|
2731
|
+
type: Input
|
|
2732
|
+
}], DataDtos: [{
|
|
2733
|
+
type: Input
|
|
2734
|
+
}], DataDtoStartIndex: [{
|
|
2735
|
+
type: Input
|
|
2736
|
+
}], DataRetrieve: [{
|
|
2737
|
+
type: Input
|
|
2738
|
+
}], BrowseDelayMs: [{
|
|
2739
|
+
type: Input
|
|
2740
|
+
}], header_tr: [{
|
|
2741
|
+
type: ContentChild,
|
|
2742
|
+
args: ['header', { static: false }]
|
|
2743
|
+
}], loading_template: [{
|
|
2744
|
+
type: ContentChild,
|
|
2745
|
+
args: ['loading', { static: false }]
|
|
2746
|
+
}], onSelectionChanged: [{
|
|
2747
|
+
type: Output
|
|
2748
|
+
}], onSeriesClicked: [{
|
|
2749
|
+
type: Output
|
|
2750
|
+
}], onLoadStart: [{
|
|
2751
|
+
type: Output
|
|
2752
|
+
}], onLoadEnd: [{
|
|
2753
|
+
type: Output
|
|
2754
|
+
}], chartLoaded: [{
|
|
2755
|
+
type: Output
|
|
2706
2756
|
}] } });
|
|
2707
2757
|
|
|
2708
2758
|
/**
|
|
@@ -2725,56 +2775,6 @@ class PagedChartData {
|
|
|
2725
2775
|
}
|
|
2726
2776
|
}
|
|
2727
2777
|
|
|
2728
|
-
/** Componenti esportati dal modulo */
|
|
2729
|
-
const COMPONENTS = [
|
|
2730
|
-
EsChartComponent,
|
|
2731
|
-
EsLineChartComponent,
|
|
2732
|
-
EsPieChartComponent,
|
|
2733
|
-
EsVertical2DChartComponent,
|
|
2734
|
-
EsVerticalChartComponent,
|
|
2735
|
-
EsVerticalStackedChartComponent,
|
|
2736
|
-
PageChartSelector,
|
|
2737
|
-
EsAreaChartComponent
|
|
2738
|
-
];
|
|
2739
|
-
class EsChartsModule {
|
|
2740
|
-
static forRoot(config) {
|
|
2741
|
-
return {
|
|
2742
|
-
ngModule: EsChartsModule,
|
|
2743
|
-
providers: [
|
|
2744
|
-
{ provide: ESC_ANIMATIONS, useValue: config?.animations == null || config?.animations == undefined ? true : config?.animations },
|
|
2745
|
-
{ provide: ESC_THEME, useValue: config?.theme || 'spiritedaway' },
|
|
2746
|
-
{ provide: ESC_LOGS, useValue: config?.debugMode || false },
|
|
2747
|
-
{ provide: BaseAdapter, useClass: config?.adapter || BaseAdapter }
|
|
2748
|
-
]
|
|
2749
|
-
};
|
|
2750
|
-
}
|
|
2751
|
-
}
|
|
2752
|
-
EsChartsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2753
|
-
EsChartsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, declarations: [EsChartComponent,
|
|
2754
|
-
EsLineChartComponent,
|
|
2755
|
-
EsPieChartComponent,
|
|
2756
|
-
EsVertical2DChartComponent,
|
|
2757
|
-
EsVerticalChartComponent,
|
|
2758
|
-
EsVerticalStackedChartComponent,
|
|
2759
|
-
PageChartSelector,
|
|
2760
|
-
EsAreaChartComponent], imports: [CommonModule], exports: [EsChartComponent,
|
|
2761
|
-
EsLineChartComponent,
|
|
2762
|
-
EsPieChartComponent,
|
|
2763
|
-
EsVertical2DChartComponent,
|
|
2764
|
-
EsVerticalChartComponent,
|
|
2765
|
-
EsVerticalStackedChartComponent,
|
|
2766
|
-
PageChartSelector,
|
|
2767
|
-
EsAreaChartComponent] });
|
|
2768
|
-
EsChartsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, imports: [CommonModule] });
|
|
2769
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: EsChartsModule, decorators: [{
|
|
2770
|
-
type: NgModule,
|
|
2771
|
-
args: [{
|
|
2772
|
-
imports: [CommonModule],
|
|
2773
|
-
declarations: [...COMPONENTS],
|
|
2774
|
-
exports: [...COMPONENTS]
|
|
2775
|
-
}]
|
|
2776
|
-
}] });
|
|
2777
|
-
|
|
2778
2778
|
/*
|
|
2779
2779
|
* Public API Surface of es-charts
|
|
2780
2780
|
*/
|