Commit f13c020b authored by Mathieu Giraud's avatar Mathieu Giraud

js/{generic,numerical}_axis.js, js/scatterPlot.js: rename and set...

js/{generic,numerical}_axis.js, js/scatterPlot.js: rename and set MAX_NB_STEPS_IN_AXIS to 8, but stay at 6 for Y

As the mechanism is more generic that what was used by bb410296, we can now have
a higher maximal number of steps, at least for X.
The actual numbers of steps will be often smaller, adapted to a nice distribution of label values.

Closes #2699.

One day, these values will be fixed dynamically to be responsive. See #2450.
parent 6fbf98f1
......@@ -34,7 +34,7 @@ function GenericAxis (reverse, can_undefined) {
this.values = []
this.value_mapping = {};
this.can_undefined = true;
this.NB_STEPS_IN_AXIS = 6; // Number (max) of labels per numerical axis
this.MAX_NB_STEPS_IN_AXIS = 8; // Number (max) of labels per numerical axis
this.NB_STEPS_BAR = 18; // Number (max) of labels per numerical axis in histograms
if(typeof can_undefined !== "undefined")
this.can_undefined = can_undefined;
......
......@@ -60,7 +60,7 @@ NumericalAxis.prototype = Object.create(GenericAxis.prototype);
display_label = typeof display_label !== 'undefined' ? display_label : true;
var self = this;
this.nb_steps = this.NB_STEPS_IN_AXIS
this.nb_steps = this.MAX_NB_STEPS_IN_AXIS
this.nb_steps_special = this.can_undefined ? 1 : 0
this.nb_steps_normal = this.nb_steps - this.nb_steps_special
......
......@@ -570,6 +570,7 @@ ScatterPlot.prototype = {
//sort each bar (axisY)
this.axisY = new PercentAxis(this.m, true);
this.axisY.MAX_NB_STEPS_IN_AXIS = 5;
this.axisY.init(this.m.clones, this.available_axis[this.splitY].fct);
this.sortBarTab(this.axisY.converter);
......@@ -1723,8 +1724,8 @@ ScatterPlot.prototype = {
* @param {Axis} axis
* @param {string} splitMethod
* */
updateAxis: function(splitMethod, reverse) {
if (typeof reverse === "undefined") reverse = false;
updateAxis: function(splitMethod, is_Y) {
if (typeof is_Y === "undefined") is_Y = false;
var axis;
var aa = this.available_axis[splitMethod]
if (aa == undefined) {
......@@ -1733,7 +1734,9 @@ ScatterPlot.prototype = {
}
axis = aa.axis;
axis.reverse = reverse;
axis.reverse = is_Y;
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);
return axis;
......
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