Skip to content

Commit bfb22f0

Browse files
author
Shengjie Xu
authored
[issue #254] [WIP] Adjust Timeline Width (#259)
* set the initial width of the timeline proportional to the window size * detect the resizing event; TODO: make the timeline width responsize to resizing event * remove logging code * code refactoring
1 parent 0831f7b commit bfb22f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

neo/public/javascripts/timeseries/controllers.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ angular.module('cloudberry.timeseries', ['cloudberry.common'])
3939
}
4040
}
4141
);
42+
4243
})
4344
.directive('timeSeries', function (Asterix) {
4445
var margin = {
@@ -47,7 +48,8 @@ angular.module('cloudberry.timeseries', ['cloudberry.common'])
4748
bottom: 30,
4849
left: 40
4950
};
50-
var width = 962 - margin.left - margin.right;
51+
// set the initial width of the timeline equal to the initial width of the browser window
52+
var width = $(window).width() * 0.8 - margin.left - margin.right;
5153
var height = 150 - margin.top - margin.bottom;
5254
return {
5355
restrict: "E",
@@ -110,6 +112,7 @@ angular.module('cloudberry.timeseries', ['cloudberry.common'])
110112
var startDate = (minDate.getFullYear()+"-"+(minDate.getMonth()+1));
111113
var endDate = (maxDate.getFullYear()+"-"+(maxDate.getMonth()+1));
112114

115+
113116
timeSeries
114117
.width(width)
115118
.height(height)

0 commit comments

Comments
 (0)