Skip to content
Snippets Groups Projects
Commit 4cbfda52 authored by mathias.chouet's avatar mathias.chouet
Browse files

Fix #118 - simple plot (dots) chart type

parent 26dc40ee
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@ export class ResultsComponent {
*/
public static get distinctColors(): string[] {
return [
"#4363d8", // blue
"#003A80", // Irstea "marine", replacing the suggested "#4363d8" (blue)
"#f58231", // orange
"#3cb44b", // green
"#e6194B", // red
......
......@@ -11,7 +11,7 @@ import { GraphType } from "../../results/graph-type";
]
})
export class GraphTypeSelectComponent implements IObservable {
private _entries: GraphType[] = [GraphType.Histogram, GraphType.Scatter];
private _entries: GraphType[] = [ GraphType.Histogram, GraphType.Dots, GraphType.Scatter ];
private _entriesLabels: string[] = [];
private _selected: GraphType;
......@@ -25,6 +25,7 @@ export class GraphTypeSelectComponent implements IObservable {
this._observable = new Observable();
this._entriesLabels = [
this.intlService.localizeText("INFO_PARAMFIELD_GRAPH_TYPE_HISTOGRAM"),
this.intlService.localizeText("INFO_PARAMFIELD_GRAPH_TYPE_DOTS"),
"XY"
];
}
......
......@@ -176,6 +176,11 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont
this.generateBarGraph();
break;
case GraphType.Dots:
this.graph_type = "line";
this.generateLineGraph();
break;
default:
this.graph_type = "scatter";
this.generateScatterGraph();
......@@ -265,7 +270,7 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont
const lines: string[] = [];
const nbLines = that._results.getVariatingParametersSymbols().length;
for (const v of that._results.getVariatingParametersSymbols()) {
const series = that._results.getValuesSeries[0](v);
const series = that._results.getValuesSeries(v);
const line = v + " = " + fv(series[tooltipItem.index]);
if (v === this.chartX) {
if (nbLines > 1) {
......@@ -285,11 +290,25 @@ export class ResultsGraphComponent extends ResultsComponent implements AfterCont
labels: labs,
datasets: [{
label: "",
data: dat
data: dat,
backgroundColor: "rgba(0, 58, 128, 0.5)", // ResultsComponent.distinctColors[0] with transparency
showLine: "true"
}]
};
}
/**
* génère les données d'un graphe de type "line"
*/
private generateLineGraph() {
// same as bar graph (histogram)
this.generateBarGraph();
// override style
this.graph_data.datasets[0].backgroundColor = "rgba(0,0,0,0)"; // fill color under the line : transparent
this.graph_data.datasets[0].borderColor = ResultsComponent.distinctColors[0];
this.graph_data.datasets[0].showLine = false;
}
/**
* génère les données d'un graphe de type "scatter"
*/
......
......@@ -8,9 +8,9 @@ export enum GraphType {
Histogram,
/**
* points indépendants reliés par une courbe
* points indépendants
*/
HistoLine,
Dots,
/**
* graphe XY classique
......
......@@ -336,6 +336,7 @@
"INFO_PARAMFIELD_GRAPH_SELECT_X_AXIS": "Variable for X axis",
"INFO_PARAMFIELD_GRAPH_SELECT_Y_AXIS": "Variable for Y axis",
"INFO_PARAMFIELD_GRAPH_TYPE_HISTOGRAM": "Histogram",
"INFO_PARAMFIELD_GRAPH_TYPE_DOTS": "Plot",
"INFO_PARAMFIELD_GRAPH_TYPE": "Graph type",
"INFO_PARAMFIELD_IN_CALCULATION_INITIAL_VALUE": "initial value",
"INFO_PARAMFIELD_IN_CALCULATION": "In calculation",
......
......@@ -335,6 +335,7 @@
"INFO_PARAMFIELD_GRAPH_SELECT_X_AXIS": "Variable en abscisse",
"INFO_PARAMFIELD_GRAPH_SELECT_Y_AXIS": "Variable en ordonnée",
"INFO_PARAMFIELD_GRAPH_TYPE_HISTOGRAM": "Histogramme",
"INFO_PARAMFIELD_GRAPH_TYPE_DOTS": "Points",
"INFO_PARAMFIELD_GRAPH_TYPE": "Type de graphe",
"INFO_PARAMFIELD_IN_CALCULATION_INITIAL_VALUE": "valeur initiale",
"INFO_PARAMFIELD_IN_CALCULATION": "En calcul",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment