Skip to content

Commit

Permalink
Added the marginLeft and marginRight options to both dashboard Panel …
Browse files Browse the repository at this point in the history
…and Timeline
  • Loading branch information
Or Weinberger committed Oct 31, 2013
1 parent 1dc89e5 commit 47ddfdb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
6 changes: 4 additions & 2 deletions lib/joolaio.visualisation.dashboard.Panel.js
Expand Up @@ -34,7 +34,9 @@ joolaio.visualisation.dashboard.Panel = function (options) {
this.options = $.extend({
widgets: {
timeline: {
height: 235
height: 235,
marginLeft: 0,
marginRight: 0
},
metricbox: {
minichart: {
Expand Down Expand Up @@ -342,7 +344,7 @@ joolaio.visualisation.dashboard.Panel.prototype.drawWidgets = function (sender,
if (item.metrics[1] && item.metrics[1] != null && item.metrics[1] != '')
metricslist += ', ' + item.metrics[1];

_html = '<div class="joolaio dashboard timeline widget" data-widgetid="' + item.id + '" data-title="' + item.title + '" data-metrics="' + metricslist + '" data-period="' + item.period + '" data-limit="' + item.limit + '" data-height="' + _this.options.widgets.timeline.height + '"></div>';
_html = '<div class="joolaio dashboard timeline widget" data-widgetid="' + item.id + '" data-title="' + item.title + '" data-metrics="' + metricslist + '" data-period="' + item.period + '" data-limit="' + item.limit + '" data-height="' + _this.options.widgets.timeline.height + '" data-marginLeft="' + _this.options.widgets.timeline.marginLeft + '" data-marginRight="' + _this.options.widgets.timeline.marginRight + '"></div>';
if (item.column == 1) {
$(container).find('.column-left').append(_html);
}
Expand Down
17 changes: 14 additions & 3 deletions lib/joolaio.visualisation.dashboard.Timeline.js
Expand Up @@ -65,7 +65,9 @@ joolaio.visualisation.dashboard.Timeline.prototype.init = function (options, con

this._this = this;
this.options = $.extend({
height: 235
height: 235,
marginLeft: 0,
marginRight: 0
}, options);
this.containers = this.containers || [];
this.dimensions = [];
Expand Down Expand Up @@ -99,6 +101,13 @@ joolaio.visualisation.dashboard.Timeline.prototype.init = function (options, con
if (_itemcount)
_this.itemCount = _itemcount;

var _marginleft = $(item).attr('data-marginLeft');
if (_marginleft)
_this.options.marginLeft = _marginleft;

var _marginright = $(item).attr('data-marginRight');
if (_marginleft)
_this.options.marginRight = _marginright;

var _metrics = $(item).attr('data-metrics');
if (!_metrics)
Expand Down Expand Up @@ -146,6 +155,8 @@ joolaio.visualisation.dashboard.Timeline.prototype.init = function (options, con
})
});



var executionTime = new Date().getMilliseconds() - start;
joolaio.debug.log('INFO', 'joolaio.Visualisation.Dashboard.Timeline', 5, '...init (' + executionTime + 'ms)');
};
Expand Down Expand Up @@ -342,8 +353,8 @@ joolaio.visualisation.dashboard.Timeline.prototype.update = function (sender, me
chart: {
height: _this.options.height,
marginTop: 0,
marginLeft: -15, //0
marginRight: -20, //0
marginLeft: _this.options.marginLeft, //0
marginRight: _this.options.marginRight, //0
marginBottom: 50, //25
spacingLeft: 0,
spacingTop: 15,
Expand Down

0 comments on commit 47ddfdb

Please sign in to comment.