Skip to content

Commit

Permalink
#155 fixed issue with incorrect day breakdown
Browse files Browse the repository at this point in the history
  • Loading branch information
itayw committed Dec 15, 2014
1 parent efd0c52 commit ac2d139
Show file tree
Hide file tree
Showing 11 changed files with 3,729 additions and 1,544 deletions.
Empty file added build/release/.joola.js
Empty file.
2,587 changes: 1,834 additions & 753 deletions build/release/joola.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

18 changes: 9 additions & 9 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.

2,587 changes: 1,834 additions & 753 deletions build/temp/joola.js

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions src/lib/viz/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,15 @@ var Canvas = module.exports = function (options, callback) {
}
_query[0].type = 'base';
_query[0].hash = '';
_query[0].dimensions.forEach(function (d) {
_query[0].hash += d.key || d;
});
_query[0].metrics.forEach(function (m) {
_query[0].hash += m.key || m;
});
if (_query[0].dimensions && Array.isArray(_query[0].dimensions)) {
_query[0].dimensions.forEach(function (d) {
_query[0].hash += d.key || d;
});
}
if (_query[0].metrics && Array.isArray(_query[0].metrics))
_query[0].metrics.forEach(function (m) {
_query[0].hash += m.key || m;
});
_query[0].hash = joola.common.hash(_query[0].hash);
if (self.options.datepicker && self.options.datepicker.container) {
_query[0].timeframe = {};
Expand Down
19 changes: 12 additions & 7 deletions src/lib/viz/Metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ var Metric = module.exports = function (options, callback) {

this.template = function () {
var $html = $('<div class="jio metricbox value"></div>' +
'<div class="jio metricbox caption"></div>');
'<div class="jio metricbox caption"></div>');
return $html;
};

this.draw = function (options, callback) {
if (!Array.isArray(this.options.query))
this.options.query = [this.options.query];
self.stop();
this.options.query.dimensions = [];
this.options.query.metrics = this.options.query.metrics.splice(0, 1);
this.options.query[0].dimensions = [];
this.options.query[0].metrics = this.options.query[0].metrics.splice(0, 1);
return this._super.fetch(this.options.query, function (err, message) {
if (Array.isArray(message))
message = message[0];
Expand Down Expand Up @@ -143,9 +144,13 @@ var Metric = module.exports = function (options, callback) {
//subscribe to default events
self.options.canvas.on('datechange', function (dates) {
//let's change our query and fetch again
self.options.query.timeframe = {};
self.options.query.timeframe.start = new Date(dates.base_fromdate);
self.options.query.timeframe.end = new Date(dates.base_todate);
if (!Array.isArray(self.options.query))
self.options.query = [self.options.query];
//let's change our query and fetch again
self.options.query[0].timeframe = {};
self.options.query[0].timeframe.start = new Date(dates.base_fromdate);
self.options.query[0].timeframe.end = new Date(dates.base_todate);


self.destroy();
self.draw(self.options);
Expand Down
17 changes: 16 additions & 1 deletion src/lib/viz/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,22 @@ var Table = module.exports = function (options, callback) {
return callback(err);

joola.viz.onscreen.push(self);


if (self.options.canvas) {
self.options.canvas.addVisualization(self);
self.options.canvas.on('datechange', function (dates) {
if (!Array.isArray(self.options.query))
self.options.query = [self.options.query];
//let's change our query and fetch again
self.options.query[0].timeframe = {};
self.options.query[0].timeframe.start = new Date(dates.base_fromdate);
self.options.query[0].timeframe.end = new Date(dates.base_todate);

self.destroy();
self.draw(self.options);
});
}

joola.events.emit('table.init.finish', self);
if (typeof callback === 'function')
return callback(null, self);
Expand Down
21 changes: 11 additions & 10 deletions src/lib/viz/Timeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ var Timeline = module.exports = function (options, callback) {

this.template = function () {
var $html = $('<div class="jio timeline caption"></div>' +
'<div class="jio timeline chartwrapper">' +
' <div class="jio timeline controls">' +
' <div class="jio timeline primary-metric-picker"></div>' +
' <div class="jio timeline secondary-metric-picker"></div>' +
' </div>' +
'<div class="jio timeline thechart" style="width:100%;margin:0 auto"></div> </div > ');
'<div class="jio timeline chartwrapper">' +
' <div class="jio timeline controls">' +
' <div class="jio timeline primary-metric-picker"></div>' +
' <div class="jio timeline secondary-metric-picker"></div>' +
' </div>' +
'<div class="jio timeline thechart" style="width:100%;margin:0 auto"></div> </div > ');
return $html;
};

Expand Down Expand Up @@ -363,10 +363,12 @@ var Timeline = module.exports = function (options, callback) {
if (self.options.canvas) {
self.options.canvas.addVisualization(self);
self.options.canvas.on('datechange', function (dates) {
if (!Array.isArray(self.options.query))
self.options.query = [self.options.query];
//let's change our query and fetch again
self.options.query.timeframe = {};
self.options.query.timeframe.start = new Date(dates.base_fromdate);
self.options.query.timeframe.end = new Date(dates.base_todate);
self.options.query[0].timeframe = {};
self.options.query[0].timeframe.start = new Date(dates.base_fromdate);
self.options.query[0].timeframe.end = new Date(dates.base_todate);

self.destroy();
self.draw(self.options);
Expand All @@ -386,7 +388,6 @@ var Timeline = module.exports = function (options, callback) {
query.reason = 'added_plot';
query.abc = 'abc';
query.filter = filter;
console.log(query);
self.destroy();
self.draw(self.options);
});
Expand Down
5 changes: 2 additions & 3 deletions src/lib/viz/_proto.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ proto.fetch = function (context, query, callback) {
return callback(null, message);
});

console.log(args);
joola.query.fetch.apply(this, args);
};

Expand Down Expand Up @@ -212,7 +211,7 @@ proto.makeChartTimelineSeries = function (message) {
});
if (timestampDimension) {
//validate and fill the date range;
interval = interval === 'ddate' ? 'day' : interval;
interval = interval === 'ddate' ? 'day' : (interval || 'day');
if (!query.timeframe) {
query.timeframe = {};
query.timeframe.start = result.documents[result.documents.length - 1].values.timestamp;
Expand Down Expand Up @@ -274,7 +273,7 @@ proto.makeChartTimelineSeries = function (message) {
name: metric_name,
data: [],
yAxis: _yaxis,
color: joola.colors[seriesIndex ]
color: joola.colors[seriesIndex]
};
documents.forEach(function (document, docIndex) {
var x = document.fvalues[dimensions[0].key];
Expand Down

0 comments on commit ac2d139

Please sign in to comment.