Commit 2cadfcac authored by Mathias Chouet's avatar Mathias Chouet :spaghetti:
Browse files

Graphiques: amélioration des infobulles pour les paramètres multivariés

Showing with 57 additions and 4 deletions
+57 -4
......@@ -195,10 +195,26 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont
}
}]
};
const that = this;
this.graph_options["tooltips"] = {
displayColors: false,
callbacks: {
label: function(tooltipItem, data) {
return Number(tooltipItem.yLabel).toFixed(nDigits);
title: (tooltipItems, data) => {
return this.chartY + " = " + Number(tooltipItems[0].yLabel).toFixed(nDigits);
},
label: (tooltipItem, data) => {
const lines: string[] = [];
for (const v of that._results.getVariatingParametersSymbols()) {
const series = that._results.getValuesSeries(v);
const line = v + " = " + series[tooltipItem.index].toFixed(nDigits);
if (v === this.chartX) {
lines.unshift("");
lines.unshift(line);
} else {
lines.push(line);
}
}
return lines;
}
}
};
......@@ -252,10 +268,26 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont
}
}]
};
const that = this;
this.graph_options["tooltips"] = {
displayColors: false,
callbacks: {
label: function(tooltipItem, data) {
return "(" + Number(tooltipItem.xLabel).toFixed(nDigits) + ", " + Number(tooltipItem.yLabel).toFixed(nDigits) + ")";
title: (tooltipItems, data) => {
return this.chartY + " = " + Number(tooltipItems[0].yLabel).toFixed(nDigits);
},
label: (tooltipItem, data) => {
const lines: string[] = [];
for (const v of that._results.getVariatingParametersSymbols()) {
const series = that._results.getValuesSeries(v);
const line = v + " = " + series[tooltipItem.index].toFixed(nDigits);
if (v === this.chartX) {
lines.unshift("");
lines.unshift(line);
} else {
lines.push(line);
}
}
return lines;
}
}
};
......
......@@ -33,4 +33,10 @@ export interface PlottableData {
* @param symbol parameter / result symbol (ex: "Q")
*/
getValuesSeries(symbol: string): any[];
/**
* Returns the list of variating parameters
* (used by tooltip functions)
*/
getVariatingParametersSymbols(): string[];
}
......@@ -45,6 +45,11 @@ export class PlottablePabResults implements PlottableData {
return this.pabResults.columns;
}
// just to implement interface
public getVariatingParametersSymbols(): string[] {
return [];
}
/**
* Returns the series of values for the required symbol
* @param symbol parameter / result symbol (ex: "Q")
......
......@@ -176,6 +176,16 @@ export class VarResults extends CalculatedParamResults implements PlottableData
return res;
}
/**
* Returns the list of variating parameters
* (used by tooltip functions)
*/
public getVariatingParametersSymbols(): string[] {
return this._variatedParams.map((vp) => {
return vp.symbol;
});
}
public update(displaySymbol: boolean) {
if (this._variableParamHeaders.length === 0) {
this._variableParamHeaders = this._variatedParams.map((v) => {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment