Skip to content

Commit

Permalink
#29 better handling of timeline extremes
Browse files Browse the repository at this point in the history
  • Loading branch information
itayw committed Oct 29, 2015
1 parent f0140a6 commit 7e4ec33
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 58 deletions.
24 changes: 14 additions & 10 deletions build/release/joola.js

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions build/release/joola.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/release/joola.min.js.map

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions build/release/joola.shim.js

Large diffs are not rendered by default.

24 changes: 14 additions & 10 deletions build/temp/joola.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/temp/meta.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/lib/viz/DimensionPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ var DimensionPicker = module.exports = function (options, callback) {
});

list = _.sortBy(list, function (item) {
return item.ordinal || item.name || item.key;
if (item.ordinal)
return parseInt(item.ordinal, 10);
return item.name || item.key;
});

list.forEach(function (dimension) {
Expand Down
4 changes: 3 additions & 1 deletion src/lib/viz/MetricPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ var MetricPicker = module.exports = function (options, callback) {
var mlasttarget = null;

list = _.sortBy(list, function (item) {
return item.ordinal || item.name || item.key;
if (item.ordinal)
return parseInt(item.ordinal, 10);
return item.name || item.key;
});

list.forEach(function (metric) {
Expand Down
14 changes: 7 additions & 7 deletions src/lib/viz/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,19 @@ var Timeline = module.exports = function (options, callback) {
self.chart.addSeries(s);
});

self.chart.redraw();
extremes_0 = self.chart.yAxis[0].getExtremes();
extremes_0.min = 0;
if (extremes_0.dataMin < 0)
extremes_0.min = extremes_0.dataMin;

extremes_0.max = extremes_0.dataMax * 1.1;
if (extremes_0.dataMin === 0 && extremes_0.dataMax === 0) {
extremes_0.min = 0;
extremes_0.max = 1;
}

if (!self.last_extremes_0)
self.last_extremes_0 = extremes_0;
if (self.last_extremes_0.min !== extremes_0.min || self.last_extremes_0.max !== extremes_0.max)
self.chart.yAxis[0].setExtremes(extremes_0.min, extremes_0.max);
self.chart.yAxis[0].setExtremes(extremes_0.min, extremes_0.max, false, false);
self.last_extremes_0 = extremes_0;
if (self.chart.yAxis.length > 1) {
extremes_1 = self.chart.yAxis[1].getExtremes();
extremes_1.min = 0;
Expand All @@ -385,9 +385,9 @@ var Timeline = module.exports = function (options, callback) {
if (!self.last_extremes_1)
self.last_extremes_1 = extremes_1;
if (self.last_extremes_1.min !== extremes_1.min || self.last_extremes_1.max !== extremes_1.max)
self.chart.yAxis[1].setExtremes(extremes_1.min, extremes_1.max);
self.chart.yAxis[1].setExtremes(extremes_1.min, extremes_1.max, false, false);
}
//}
self.chart.redraw();
};

this.clearAllFiltered = function (skipdraw, callback) {
Expand Down

0 comments on commit 7e4ec33

Please sign in to comment.