Commit 306940db authored by Thonier Florian's avatar Thonier Florian
Browse files

js/numerical_axis.js : bug correction link to #2540

modifiy the min value to start the axe. Now start at the minimal value
change number_step
change label of axis to add minimal value
parent e82415d8
......@@ -184,11 +184,6 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
}else{
var nb_steps = this.NB_STEPS_IN_AXIS-1
undefined_min = min
// Recover the initial min value
if (has_undefined) {
min = (min*this.NB_STEPS_IN_AXIS + max)/(this.NB_STEPS_IN_AXIS + 1)
}
nb_step = this.computeSteps(max, nb_steps);
h = (max-min)/nb_steps
......@@ -198,10 +193,10 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
this.labels.push(this.label("line", (this.reverse) ? 0 : 1, "?"))
// Shift the start when there is an undefined value
var start_shift = (min - undefined_min)/(max-undefined_min)
for (var j = 0; j <= nb_steps; j++) {
for (var j = 0; j <= nb_steps-1; j++) {
pos = (h*j)*(1/delta);
text = this.getLabelText(h*j);
text = this.getLabelText(min + h*j);
if (this.reverse) pos = 1 - pos;
if (!display_label) text = "";
this.addLabel("line", text, pos, text);
......@@ -210,7 +205,7 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
}
NumericalAxis.prototype.computeSteps = function(min, max, nb_steps) {
var steps = nb_steps;
var steps = nb_steps+1;
if (Math.abs(max - min) < nb_steps) {
steps = Math.abs(max - min)
}
......
Markdown is supported
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