Skip to content
Snippets Groups Projects
Commit 68b12779 authored by Nicolas Martinelli's avatar Nicolas Martinelli
Browse files

[FIX] web: left margin of graph

The left margin of the graph doesn't take into account the width of the
maximum Y-axis value. In case the values are high (> 10^7), they are
cropped.

The fix is to adapt the left margin as a function of the size of the
maximum value.

opw-676538
parent cab2dce0
No related branches found
No related tags found
No related merge requests found
......@@ -162,7 +162,9 @@ return Widget.extend({
svg.transition().duration(0);
var chart = nv.models.multiBarChart();
var maxVal = _.max(values, function(v) {return v.y})
chart.options({
margin: {left: 12 * String(maxVal && maxVal.y || 0).length},
delay: 250,
transition: 10,
showLegend: _.size(data) <= MAX_LEGEND_LENGTH,
......@@ -292,8 +294,9 @@ return Widget.extend({
svg.transition().duration(0);
var chart = nv.models.lineChart();
var maxVal = _.max(values, function(v) {return v.y})
chart.options({
margin: {left: 50, right: 50},
margin: {left: 12 * String(maxVal && maxVal.y || 0).length, right: 50},
useInteractiveGuideline: true,
showLegend: _.size(data) <= MAX_LEGEND_LENGTH,
showXAxis: true,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment