[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
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user