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 7018d0e95bac4c60ba58e0f54b76555b0cf98d46..07f3f8553032d99bb86f508f6d9f7c70c1ad78b2 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 @@ -53,31 +53,59 @@ export class PabProfileGraphComponent extends ResultsComponent { private intlService: I18nService ) { super(); + const nDigits = this.appSetupService.displayDigits; + // do not move following block out of constructor or scale labels won't be rendered + this.graph_options["scales"] = { + xAxes: [{ + type: "linear", + position: "bottom", + ticks: { + precision: nDigits + }, + scaleLabel: { + display: true, + labelString: this.intlService.localizeText("INFO_LIB_DISTANCE_AMONT") + } + }], + yAxes: [{ + type: "linear", + position: "left", + ticks: { + precision: nDigits + }, + scaleLabel: { + display: true, + labelString: this.intlService.localizeText("INFO_LIB_COTE") + } + }] + }; } public set results(r: PabResults) { this._results = r; // pre-extract variable parameters values - this.varValues = []; - const nDigits = this.appSetupService.displayDigits; - // find longest list - this.size = 0; - for (let i = 0; i < this._results.variatedParameters.length; i++) { - const vs = this._results.variatedParameters[i].valuesIterator.count(); - if (vs > this.size) { - this.size = vs; + if (this._results) { + this.varValues = []; + const nDigits = this.appSetupService.displayDigits; + // find longest list + this.size = 0; + for (let i = 0; i < this._results.variatedParameters.length; i++) { + const vs = this._results.variatedParameters[i].valuesIterator.count(); + if (vs > this.size) { + this.size = vs; + } } - } - // get extended values lists for each variable parameter - for (const v of this._results.variatedParameters) { - const vv = []; - const iter = v.getExtendedValuesIterator(this.size); - while (iter.hasNext) { - const nv = iter.next(); - vv.push(nv.value.toFixed(nDigits)); + // get extended values lists for each variable parameter + for (const v of this._results.variatedParameters) { + const vv = []; + const iter = v.getExtendedValuesIterator(this.size); + while (iter.hasNext) { + const nv = iter.next(); + vv.push(nv.value.toFixed(nDigits)); + } + this.varValues.push(vv); } - this.varValues.push(vv); } } @@ -90,39 +118,12 @@ export class PabProfileGraphComponent extends ResultsComponent { * génère les données d'un graphe de type "scatter" */ private generateScatterGraph() { - const nDigits = this.appSetupService.displayDigits; const ySeries = this.getYSeries(); + this.graph_data = { datasets: [] }; - this.graph_options["scales"] = { - xAxes: [{ - type: "linear", - position: "bottom", - ticks: { - precision: nDigits - }, - scaleLabel: { - display: true, - labelString: "la super abscisse" - // labelString: this.axisLabelWithoutSymbol(this.chartX) - } - }], - yAxes: [{ - type: "linear", - position: "left", - ticks: { - precision: nDigits - }, - scaleLabel: { - display: true, - labelString: "la super ordonnée" - /// labelString: this.axisLabelWithoutSymbol(this.chartY) - } - }] - }; - // build Y data series for (const ys of ySeries) { // push series config diff --git a/src/locale/messages.en.json b/src/locale/messages.en.json index 7c51c408a11e5ec584485120945e64c34c8e9fae..b350b695e1739eab6431b5368cbbd1e3334f65fc 100644 --- a/src/locale/messages.en.json +++ b/src/locale/messages.en.json @@ -126,11 +126,13 @@ "INFO_LIB_BT": "Half opening of the triangle", "INFO_LIB_CD": "Discharge coefficient", "INFO_LIB_CLOISON": "Cross wall #", + "INFO_LIB_COTE": "Elevation (m)", "INFO_LIB_COTE_VANNE_LEVANTE": "Lift gate elevation", "INFO_LIB_CV": "Cv: Velocity coefficient", "INFO_LIB_CVQT": "CV.QT: Corrected discharge", "INFO_LIB_DH": "Fall", "INFO_LIB_DHR": "DHR : Residual fall", + "INFO_LIB_DISTANCE_AMONT": "Distance from upstream (m)", "INFO_LIB_EC": "EC: Kinetic energy", "INFO_LIB_ENUM_MACRORUGOFLOWTYPE": "Flow type", "INFO_LIB_FLU": "Subcritical water line", diff --git a/src/locale/messages.fr.json b/src/locale/messages.fr.json index 3332e729bd9041badc522d3ddf026a2a94a05f3f..55e62e3f6be484c6dd525ba5965315659bc77557 100644 --- a/src/locale/messages.fr.json +++ b/src/locale/messages.fr.json @@ -126,11 +126,13 @@ "INFO_LIB_BT": "Demi-ouverture du triangle", "INFO_LIB_CD": "Coefficient de débit", "INFO_LIB_CLOISON": "Cloison n°", + "INFO_LIB_COTE": "Cote (m)", "INFO_LIB_COTE_VANNE_LEVANTE": "Cote vanne levante", "INFO_LIB_CV": "Cv: Coefficient de vitesse d'approche", "INFO_LIB_CVQT": "CV.QT: Débit corrigé", "INFO_LIB_DH": "Chute", "INFO_LIB_DHR": "DHR: Chute résiduelle", + "INFO_LIB_DISTANCE_AMONT": "Distance depuis l'amont (m)", "INFO_LIB_EC": "EC: Énergie cinétique", "INFO_LIB_ENUM_MACRORUGOFLOWTYPE": "Type d'écoulement", "INFO_LIB_FLU": "Ligne d'eau fluviale",