diff options
Diffstat (limited to 'plugins/CoreVisualizations/javascripts/jqplotBarGraph.js')
-rw-r--r-- | plugins/CoreVisualizations/javascripts/jqplotBarGraph.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/CoreVisualizations/javascripts/jqplotBarGraph.js b/plugins/CoreVisualizations/javascripts/jqplotBarGraph.js index cd21308f73..24af4c2e9d 100644 --- a/plugins/CoreVisualizations/javascripts/jqplotBarGraph.js +++ b/plugins/CoreVisualizations/javascripts/jqplotBarGraph.js @@ -22,6 +22,9 @@ _setJqplotParameters: function (params) { JqplotGraphDataTable.prototype._setJqplotParameters.call(this, params); + var barMargin = this.data[0].length > 10 ? 2 : 10; + var minBarWidth = 10; + this.jqplotParams.seriesDefaults = { renderer: $.jqplot.BarRenderer, rendererOptions: { @@ -29,7 +32,7 @@ shadowDepth: 2, shadowAlpha: .2, fillToZero: true, - barMargin: this.data[0].length > 10 ? 2 : 10 + barMargin: barMargin } }; @@ -48,6 +51,18 @@ this.jqplotParams.canvasLegend = { show: true }; + + var comparisonService = piwikHelper.getAngularDependency('piwikComparisonsService'); + if (comparisonService.isComparing()) { + var seriesCount = this.jqplotParams.series.length; + var dataCount = this.data[0].length; + + var totalBars = seriesCount * dataCount; + var totalMinWidth = (minBarWidth + barMargin) * totalBars + 50; + + this.$element.find('.piwik-graph').css('min-width', totalMinWidth + 'px'); + this.$element.css('overflow-x', 'scroll'); + } }, _bindEvents: function () { |