Commit 6629b457 authored by Mathieu Giraud's avatar Mathieu Giraud

js/{generic,numerical}_axis.js: define and use .ignore(clone) to adapt axes when .adapt is true

See #3503.

fix gen
parent 94cf6275
......@@ -42,6 +42,7 @@ function GenericAxis (reverse, can_undefined) {
this.reverse = false;
if(typeof reverse !== "undefined")
this.reverse = reverse
this.adapt = false
}
GenericAxis.prototype = {
......@@ -62,9 +63,14 @@ GenericAxis.prototype = {
this.populateLabels(labels, sort);
this.populateValueMapping();
return this;
},
ignore: function(clone) {
return this.adapt && clone.isFiltered
},
compareLabels: function(a, b) {
if (typeof a === 'undefined') return (typeof b === 'undefined') ? 0 : -1;
if (typeof b === 'undefined') return (typeof a === 'undefined') ? 0 : 1;
......@@ -86,6 +92,8 @@ GenericAxis.prototype = {
else {
for (var i=0; i < values.length; i++) {
var value = values[i];
if (this.ignore(value))
continue;
var convert = this.applyConverter(value);
var pos;
if (labels.indexOf(convert) != -1) {
......@@ -122,6 +130,8 @@ GenericAxis.prototype = {
// if (value.isVirtual())
// continue ; // ? pas toujours ?
if (this.ignore(value))
continue;
var convert = this.applyConverter(value);
if (typeof round !== 'undefined')
......@@ -207,6 +217,8 @@ GenericAxis.prototype = {
var has_undefined;
for (var i = 0; i < values.length; i++) {
var value = values[i];
if (this.ignore(value))
continue;
var key = this.applyConverter(value);
if (typeof key == 'undefined') {
has_undefined = true;
......
......@@ -81,6 +81,9 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
if (typeof labels == "undefined") {
for (var i in this.values){
if (this.ignore(this.values[i]))
continue;
if (! this.values[i].isVirtual()) {
var tmp = this.applyConverter(this.values[i]);
......
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