diff --git a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts index 070a5422d044e1faec4ec6a677a3b5dd16118a76..a660ee797b2f7044a78f3b4fd83151ebe3065707 100644 --- a/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts +++ b/src/app/components/dialog-edit-param-values/dialog-edit-param-values.component.ts @@ -1,11 +1,15 @@ import { MatDialogRef, MAT_DIALOG_DATA } from "@angular/material"; import { Inject, Component, OnInit } from "@angular/core"; import { FormBuilder, FormGroup, Validators } from "@angular/forms"; + import { I18nService } from "../../services/internationalisation/internationalisation.service"; import { NgParameter } from "../../formulaire/ngparam"; -import { ParamValueMode, ExtensionStrategy } from "jalhyd"; import { sprintf } from "sprintf-js"; import { ApplicationSetupService } from "../../services/app-setup/app-setup.service"; +import { ResultsComponent } from "../fixedvar-results/results.component"; + +import { ParamValueMode, ExtensionStrategy } from "jalhyd"; + import { fv } from "../../util"; @Component({ @@ -107,14 +111,14 @@ export class DialogEditParamValuesComponent implements OnInit { type: "linear", position: "bottom", ticks: { - precision: nDigits + precision: ResultsComponent.CHARTS_AXIS_PRECISION } }], yAxes: [{ type: "linear", position: "left", ticks: { - precision: nDigits + precision: ResultsComponent.CHARTS_AXIS_PRECISION } }] }, diff --git a/src/app/components/fixedvar-results/results.component.ts b/src/app/components/fixedvar-results/results.component.ts index db20c2ec5988ebcf106d8f07640c71df0d9f39ef..9c05df43576eade445c25450c0a448327ee95013 100644 --- a/src/app/components/fixedvar-results/results.component.ts +++ b/src/app/components/fixedvar-results/results.component.ts @@ -10,6 +10,9 @@ import { fv } from "../../util"; */ export class ResultsComponent { + /** max number of decimals for auto-adjusting charts axis graduations */ + public static CHARTS_AXIS_PRECISION = 10; + /** tracks the fullscreen state */ public get isFullscreen() { // return (document["fullscreenElement"] !== null); diff --git a/src/app/components/pab-profile-graph/pab-profile-graph.component.ts b/src/app/components/pab-profile-graph/pab-profile-graph.component.ts index 92a5b9979bec0f0c8fa8a40464a4b3bf4d758e7f..3ea15a0756fdbb6e8d048f47f9febc879155d37d 100644 --- a/src/app/components/pab-profile-graph/pab-profile-graph.component.ts +++ b/src/app/components/pab-profile-graph/pab-profile-graph.component.ts @@ -73,7 +73,7 @@ export class PabProfileGraphComponent extends ResultsComponent { type: "linear", position: "bottom", ticks: { - precision: nDigits + precision: ResultsComponent.CHARTS_AXIS_PRECISION }, scaleLabel: { display: true, @@ -84,7 +84,7 @@ export class PabProfileGraphComponent extends ResultsComponent { type: "linear", position: "left", ticks: { - precision: nDigits + precision: ResultsComponent.CHARTS_AXIS_PRECISION }, scaleLabel: { display: true, diff --git a/src/app/components/pab-results/pab-results-table.component.ts b/src/app/components/pab-results/pab-results-table.component.ts index d17b83a5636ccafb088337747807af5246b0bf71..13ca9f097b24782febb35bd5aa50a4804fb24c79 100644 --- a/src/app/components/pab-results/pab-results-table.component.ts +++ b/src/app/components/pab-results/pab-results-table.component.ts @@ -5,7 +5,6 @@ import { CloisonAval, Result } from "jalhyd"; import * as XLSX from "xlsx"; import { PabResults } from "../../results/pab-results"; -import { ApplicationSetupService } from "../../services/app-setup/app-setup.service"; import { I18nService } from "../../services/internationalisation/internationalisation.service"; import { ResultsComponent } from "../fixedvar-results/results.component"; import { fv } from "../../util"; @@ -32,7 +31,6 @@ export class PabResultsTableComponent extends ResultsComponent { table: ElementRef; constructor( - protected appSetupService: ApplicationSetupService, protected intlService: I18nService ) { super(); @@ -65,7 +63,6 @@ export class PabResultsTableComponent extends ResultsComponent { && ! this._pabResults.hasOnlyErrors() ) { const pr = this._pabResults; - const nDigits = this.appSetupService.displayDigits; // when a parameter is variating, index of the variating parameter // values to build the data from const vi = pr.variableIndex; diff --git a/src/app/components/pab-results/pab-variable-results-selector.component.ts b/src/app/components/pab-results/pab-variable-results-selector.component.ts index 799cc5267b40913a2664acc29da9ac8022994211..007aa25c3554343958e72e9b3b260efabd9430db 100644 --- a/src/app/components/pab-results/pab-variable-results-selector.component.ts +++ b/src/app/components/pab-results/pab-variable-results-selector.component.ts @@ -2,7 +2,6 @@ import { Component, Output, EventEmitter } from "@angular/core"; import { PabResults } from "../../results/pab-results"; import { I18nService } from "../../services/internationalisation/internationalisation.service"; -import { ApplicationSetupService } from "../../services/app-setup/app-setup.service"; import { fv } from "../../util"; @Component({ @@ -30,7 +29,6 @@ export class PabVariableResultsSelectorComponent { constructor( protected intlService: I18nService, - protected appSetupService: ApplicationSetupService ) { this._selectedValue = 0; } @@ -41,7 +39,6 @@ export class PabVariableResultsSelectorComponent { if (this._pabResults) { // pre-extract variable parameters values this.varValues = []; - const nDigits = this.appSetupService.displayDigits; // find longest list this.size = 0; for (let i = 0; i < this._pabResults.variatedParameters.length; i++) { diff --git a/src/app/components/remous-results/remous-results.component.ts b/src/app/components/remous-results/remous-results.component.ts index df56788875814aafe20f7ccc896aad21a1486968..d349db0e52f8802cd0b1fad7fe6accc0542aebd6 100644 --- a/src/app/components/remous-results/remous-results.component.ts +++ b/src/app/components/remous-results/remous-results.component.ts @@ -604,7 +604,7 @@ export class RemousResultsComponent extends ResultsComponent implements DoCheck offsetGridLines: true }, ticks: { - precision: nDigits, + precision: ResultsComponent.CHARTS_AXIS_PRECISION, callback: function(value, index, values) { return fv(Number(value)); } @@ -644,7 +644,7 @@ export class RemousResultsComponent extends ResultsComponent implements DoCheck labelString: this.uitextAbscisse }, ticks: { - precision: nDigits, + precision: ResultsComponent.CHARTS_AXIS_PRECISION, callback: function(value, index, values) { return fv(Number(value)); } diff --git a/src/app/components/results-graph/results-graph.component.ts b/src/app/components/results-graph/results-graph.component.ts index 96c35127a7a1889a4ac86819e89415b392fcf371..43933e81efde1faf6c3b0f99861345cb247eae4d 100644 --- a/src/app/components/results-graph/results-graph.component.ts +++ b/src/app/components/results-graph/results-graph.component.ts @@ -239,7 +239,7 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont offsetGridLines: true }, ticks: { - precision: nDigits, + precision: ResultsComponent.CHARTS_AXIS_PRECISION, callback: function(value, index, values) { return fv(Number(value)); } @@ -322,7 +322,7 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont type: "linear", position: "bottom", ticks: { - precision: nDigits + precision: ResultsComponent.CHARTS_AXIS_PRECISION }, scaleLabel: { display: true, @@ -333,7 +333,7 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont type: "linear", position: "left", ticks: { - precision: nDigits + precision: ResultsComponent.CHARTS_AXIS_PRECISION }, scaleLabel: { display: true, @@ -401,7 +401,6 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont const ret: IYSeries[] = []; const palette = ResultsComponent.distinctColors; const xSeries = this._results.getValuesSeries(this.chartX); - const nDigits = this.appSetup.displayDigits; let symbols: string[]; // whole family of variables => multiple series (should only happen with VarResults) diff --git a/src/app/formulaire/ngparam.ts b/src/app/formulaire/ngparam.ts index a58d5ff421548b9d938772ee4db2bfd508194cb1..136bbcaeb78d23ebba54cf14d879542fef6fcb61 100644 --- a/src/app/formulaire/ngparam.ts +++ b/src/app/formulaire/ngparam.ts @@ -42,7 +42,6 @@ export class NgParameter extends InputField implements Observer { public static preview(p: ParamDefinition, compact: boolean = false): string { let valuePreview: string; const i18n = ServiceFactory.instance.i18nService; - const nDigits = ServiceFactory.instance.applicationSetupService.displayDigits; switch (p.valueMode) { case ParamValueMode.SINGLE: @@ -101,7 +100,6 @@ export class NgParameter extends InputField implements Observer { public static linkedValuePreview(ref: LinkedValue): string { let valuePreview: string; const i18n = ServiceFactory.instance.i18nService; - const nDigits = ServiceFactory.instance.applicationSetupService.displayDigits; if (ref.isParameter()) { const targetParam = (ref.element as ParamDefinition); @@ -201,7 +199,6 @@ export class NgParameter extends InputField implements Observer { // undefined si on clique en dehors du select après l'avoir ouvert (cad sans avoir fait de sélection) // et au même niveau, cad à côté du bouton et non à côté du menu déroulant if (m !== undefined && this._paramDef.valueMode !== m) { - const nDigits = ServiceFactory.instance.applicationSetupService.displayDigits; this.unlinkParameter(); this._paramDef.valueMode = m; this.notifyObservers({ diff --git a/src/app/results/plottable-pab-results.ts b/src/app/results/plottable-pab-results.ts index f697ecac0e648037d23239ef4e912bf3f084afcc..8f340a954dad3fedf05ab85958ffaf3256bcedba 100644 --- a/src/app/results/plottable-pab-results.ts +++ b/src/app/results/plottable-pab-results.ts @@ -3,6 +3,8 @@ import { PabResults } from "./pab-results"; import { GraphType } from "./graph-type"; import { ServiceFactory } from "../services/service-factory"; +import { ParamDefinition } from "jalhyd"; + export class PlottablePabResults implements PlottableData { public graphType: GraphType = GraphType.Scatter; diff --git a/src/app/results/var-results.ts b/src/app/results/var-results.ts index a3823065caa4db96c3939c878bbf3f37387fa36d..d2a451ee77e6b25f2bd350a6474c99b8f6684608 100644 --- a/src/app/results/var-results.ts +++ b/src/app/results/var-results.ts @@ -1,7 +1,8 @@ +import { ResultElement, ParamFamily, ParamDefinition } from "jalhyd"; + import { CalculatorResults } from "./calculator-results"; import { CalculatedParamResults } from "./param-calc-results"; import { NgParameter } from "../formulaire/ngparam"; -import { ResultElement, ParamFamily } from "jalhyd"; import { ServiceFactory } from "../services/service-factory"; import { PlottableData } from "./plottable-data"; import { GraphType } from "./graph-type"; diff --git a/src/app/services/internationalisation/internationalisation.service.ts b/src/app/services/internationalisation/internationalisation.service.ts index 063fd0a3aa609a858f1dd1f40ac074924f551d38..fbf1226a5d0d234a8d96f47a4aa3dcad14e91fa7 100644 --- a/src/app/services/internationalisation/internationalisation.service.ts +++ b/src/app/services/internationalisation/internationalisation.service.ts @@ -197,7 +197,6 @@ export class I18nService extends Observable implements Observer { if (match > -1) { return this.localizeText(`INFO_${label.substring(match).toUpperCase()}_${value}`); } - const nDigits = this.applicationSetupService.displayDigits; return fv(value); }