From bdf91b4d76e31469ebddf904fdf1ba8a3fa86eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grand?= <francois.grand@inrae.fr> Date: Thu, 15 Sep 2022 11:48:49 +0200 Subject: [PATCH] fix: console error message "invalid scale configuration for scale" refs #554 --- .../dialog-edit-param-values.component.ts | 8 ++++---- .../jet-trajectory-chart.component.ts | 14 +++++++------- .../pab-profile-chart.component.ts | 8 ++++---- .../remous-results/remous-results.component.ts | 12 ++++++------ .../results-chart/results-chart.component.ts | 16 ++++++++-------- 5 files changed, 29 insertions(+), 29 deletions(-) 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 b1e971ec1..a5cc9fcec 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 @@ -108,20 +108,20 @@ export class DialogEditParamValuesComponent implements OnInit { duration: 0 }, scales: { - x: [{ + x: { type: "linear", position: "bottom", ticks: { precision: ResultsComponentDirective.CHARTS_AXIS_PRECISION } - }], - y: [{ + }, + y: { type: "linear", position: "left", ticks: { precision: ResultsComponentDirective.CHARTS_AXIS_PRECISION } - }] + } }, elements: { line: { diff --git a/src/app/components/jet-trajectory-chart/jet-trajectory-chart.component.ts b/src/app/components/jet-trajectory-chart/jet-trajectory-chart.component.ts index c5df1edb3..c11af834a 100644 --- a/src/app/components/jet-trajectory-chart/jet-trajectory-chart.component.ts +++ b/src/app/components/jet-trajectory-chart/jet-trajectory-chart.component.ts @@ -67,7 +67,7 @@ export class JetTrajectoryChartComponent extends ResultsComponentDirective imple super(); // do not move following block out of constructor or scale labels won't be rendered this.graph_options["scales"] = { - x: [{ + x: { type: "linear", position: "bottom", ticks: { @@ -77,8 +77,8 @@ export class JetTrajectoryChartComponent extends ResultsComponentDirective imple display: true, text: this.intlService.localizeText("INFO_LIB_ABSCISSE") } - }], - y: [{ + }, + y: { type: "linear", position: "left", ticks: { @@ -88,7 +88,7 @@ export class JetTrajectoryChartComponent extends ResultsComponentDirective imple display: true, text: this.intlService.localizeText("INFO_LIB_ALTITUDE") } - }] + } }; // enable zoom and pan (using "chartjs-plugin-zoom" package) const that = this; @@ -134,7 +134,7 @@ export class JetTrajectoryChartComponent extends ResultsComponentDirective imple @Input() public set results(r: Result) { - this.forceRebuild(); // used for forcing redefinition of x[0].min/max in generateScatterChart() + this.forceRebuild(); // used for forcing redefinition of x.min/max in generateScatterChart() this._results = r; } @@ -195,8 +195,8 @@ export class JetTrajectoryChartComponent extends ResultsComponentDirective imple } // adjust chart width - this.graph_options.scales.x[0].min = 0; - this.graph_options.scales.x[0].max = greatestAbscissa; + this.graph_options.scales.x.min = 0; + this.graph_options.scales.x.max = greatestAbscissa; // build Y data series for (const ys of ySeries) { diff --git a/src/app/components/pab-profile-chart/pab-profile-chart.component.ts b/src/app/components/pab-profile-chart/pab-profile-chart.component.ts index ca8aeebcd..b79afc76b 100644 --- a/src/app/components/pab-profile-chart/pab-profile-chart.component.ts +++ b/src/app/components/pab-profile-chart/pab-profile-chart.component.ts @@ -72,7 +72,7 @@ export class PabProfileChartComponent extends ResultsComponentDirective implemen super(); // do not move following block out of constructor or scale labels won't be rendered this.graph_options["scales"] = { - x: [{ + x: { type: "linear", position: "bottom", ticks: { @@ -82,8 +82,8 @@ export class PabProfileChartComponent extends ResultsComponentDirective implemen display: true, text: this.intlService.localizeText("INFO_LIB_DISTANCE_AMONT") } - }], - y: [{ + }, + y: { type: "linear", position: "left", ticks: { @@ -93,7 +93,7 @@ export class PabProfileChartComponent extends ResultsComponentDirective implemen display: true, text: this.intlService.localizeText("INFO_LIB_COTE") } - }] + } }; // enable zoom and pan (using "chartjs-plugin-zoom" package) const that = this; diff --git a/src/app/components/remous-results/remous-results.component.ts b/src/app/components/remous-results/remous-results.component.ts index ed8143ab3..77f8bd8d6 100644 --- a/src/app/components/remous-results/remous-results.component.ts +++ b/src/app/components/remous-results/remous-results.component.ts @@ -398,7 +398,7 @@ export class RemousResultsComponent extends ResultsComponentDirective implements duration: 0 }, scales: { - x: [{ + x: { gridLines: { display: true, color: "rgba(255,99,132,0.2)", @@ -414,14 +414,14 @@ export class RemousResultsComponent extends ResultsComponentDirective implements display: true, text: this.uitextAbscisse } - }], - y: [{ + }, + y: { // stacked: true, gridLines: { display: true, color: "rgba(255,99,132,0.2)" } - }] + } }, plugins: { legend: { @@ -448,7 +448,7 @@ export class RemousResultsComponent extends ResultsComponentDirective implements duration: 0 }, scales: { - x: [{ + x: { title: { display: true, text: this.uitextAbscisse @@ -459,7 +459,7 @@ export class RemousResultsComponent extends ResultsComponentDirective implements return fv(Number(value)); } }, - }] + } }, plugins: { legend: { diff --git a/src/app/components/results-chart/results-chart.component.ts b/src/app/components/results-chart/results-chart.component.ts index 743986e40..9821f98e9 100644 --- a/src/app/components/results-chart/results-chart.component.ts +++ b/src/app/components/results-chart/results-chart.component.ts @@ -252,7 +252,7 @@ export class ResultsChartComponent extends ResultsComponentDirective implements } this.graph_options["scales"] = { - x: [{ + x: { gridLines: { offsetGridLines: true }, @@ -266,13 +266,13 @@ export class ResultsChartComponent extends ResultsComponentDirective implements display: true, text: this.axisLabelWithoutSymbol(this.chartX) } - }], - y: [{ + }, + y: { title: { display: true, text: this.axisLabelWithoutSymbol(this.chartY) } - }] + } }; const that = this; @@ -349,7 +349,7 @@ export class ResultsChartComponent extends ResultsComponentDirective implements } this.graph_options["scales"] = { - x: [{ + x: { type: "linear", position: "bottom", ticks: { @@ -359,8 +359,8 @@ export class ResultsChartComponent extends ResultsComponentDirective implements display: true, text: this.axisLabelWithoutSymbol(this.chartX) } - }], - y: [{ + }, + y: { type: "linear", position: "left", ticks: { @@ -370,7 +370,7 @@ export class ResultsChartComponent extends ResultsComponentDirective implements display: true, text: this.axisLabelWithoutSymbol(this.chartY) } - }] + } }; if (isMultiple) { -- GitLab