Commit 7cca6727 authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-c/2703-bug_floatAxis' into 'dev'

numericalAxis.js : bug correction for FloatAxis label and value positions

Closes #2703

See merge request !120
parents 331df64f 0c88a87b
Pipeline #10957 canceled with stages
in 3 minutes and 54 seconds
......@@ -95,18 +95,9 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
if(this.can_undefined)
this.value_mapping["?"] = [];
for(var idx in this.clones) {
var clone = clones[idx];
if(!clone.isVirtual()) {
var value = this.applyConverter(clone);
if (typeof value == "undefined" || typeof this.value_mapping[value] == "undefined" ) {
if (this.can_undefined)
this.value_mapping["?"].push(clone);
}else{
this.value_mapping[value].push(clone);
}
}
}
// insert all the values into the valuemapping object
this.insert_values()
if (typeof min == "undefined"){
min = 0;
......@@ -151,6 +142,24 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
return {'pos': pos};
}
/**
* This function allow to insert all the values getted into the value_mapping object.
*/
NumericalAxis.prototype.insert_values = function() {
for(var idx in this.clones) {
var clone = this.clones[idx];
if(!clone.isVirtual()) {
var value = this.applyConverter(clone);
if (typeof value == "undefined" || typeof this.value_mapping[value] == "undefined") {
if (this.can_undefined)
this.value_mapping["?"].push(clone);
}else{
this.value_mapping[value].push(clone);
}
}
}
}
/**
* reset and build labels <br>
......@@ -270,5 +279,28 @@ function FloatAxis (model, reverse, can_undefined) {
FloatAxis.prototype = Object.create(NumericalAxis.prototype);
FloatAxis.prototype.getLabelText = function(value) {
return (value).toFixed(2)
return parseFloat(value).toFixed(2)
}
FloatAxis.prototype.insert_values = function() {
for(var idx in this.clones) {
var clone = this.clones[idx];
if(!clone.isVirtual()) {
var value = this.applyConverter(clone)//.toFixed(2);
if (typeof value == "undefined" || value == undefined || value == "undefined") {
if (this.can_undefined)
this.value_mapping["?"].push(clone);
}else{
this.value_mapping[value] = this.value_mapping[value] || []
this.value_mapping[value].push(clone);
}
}
}
var temp = {}
var sorted_keys = Object.keys(this.value_mapping).sort()
for (var key_pos in sorted_keys){
key = sorted_keys[key_pos]
temp[key] = this.value_mapping[key]
}
this.value_mapping = temp
}
\ No newline at end of file
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