Commit bb410296 authored by Mathieu Giraud's avatar Mathieu Giraud

js/axis.js, js/scatterPlot: 6 labels on axis with nice_ceil() and nice_floor()

The labels on the grid (and the bar) view are now easier to read.
Moreover 6 = 5+1, and division by 5 is often nice.

Note that this wastes a limited amount of space.
parent fed1cf80
......@@ -36,7 +36,7 @@ function Axis (model, reverse) {
this.reverse = reverse;
}
const NB_STEPS_IN_AXIS = 10; // Number (max) of labels per numerical axis
const NB_STEPS_IN_AXIS = 6; // Number (max) of labels per numerical axis
const NB_STEPS_BAR = 30; // Number (max) of labels per numerical axis in histograms
Axis.prototype = {
......@@ -188,6 +188,10 @@ Axis.prototype = {
min = 0;
max = 1;
}
else {
min = nice_floor(min)
max = nice_ceil(max)
}
if (has_undefined && ! use_log) {
min = min - (max - min)/NB_STEPS_IN_AXIS
......
......@@ -841,7 +841,7 @@ ScatterPlot.prototype = {
* compute the position of each rectangles / labels and start the display
* */
computeBarTab : function () {
var bar_max = this.computeBarMax();
var bar_max = nice_ceil(this.computeBarMax());
var tab_length = Object.keys(this.barTab).length;
var width = Math.min(0.08, 0.8 / tab_length);
......
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