Commit dd9f9b2a authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-c/3503-adapt-x-axis-bar' into 'dev'

Feature c/3503 adapt x axis bar

See merge request !301
parents e8dfbb49 1c43b8a5
Pipeline #42449 passed with stages
in 5 minutes and 41 seconds
......@@ -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]);
......
......@@ -1690,8 +1690,8 @@ ScatterPlot.prototype = {
this.mode = mode;
this.compute_size();
this.axisX = this.updateAxis(this.splitX, false);
this.axisY = this.updateAxis(this.splitY, true);
this.axisX = this.updateAxis(this.splitX, false, (this.mode == this.MODE_BAR));
this.axisY = this.updateAxis(this.splitY, true, false);
if (this.mode == this.MODE_BAR){
this.updateBar();
......@@ -1719,7 +1719,7 @@ ScatterPlot.prototype = {
* @param {Axis} axis
* @param {string} splitMethod
* */
updateAxis: function(splitMethod, is_Y) {
updateAxis: function(splitMethod, is_Y, adaptAxis) {
if (typeof is_Y === "undefined") is_Y = false;
var axis;
var aa = this.available_axis[splitMethod]
......@@ -1730,6 +1730,8 @@ ScatterPlot.prototype = {
axis = aa.axis;
axis.reverse = is_Y;
axis.adapt = adaptAxis
if (is_Y)
axis.MAX_NB_STEPS_IN_AXIS = 6
axis.init(this.m.clones, aa.fct, aa.labels, aa.sort, aa.min, aa.max, aa.log, aa.display_label);
......
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