Skip to content

Commit

Permalink
#29 cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
itayw committed Feb 4, 2014
1 parent 5714c34 commit 0fb4b2b
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 61 deletions.
68 changes: 36 additions & 32 deletions bin/joola.io.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions lib/common/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ else {
break;
}

if (!joolaio.options.debug.enabled)
return;

if (typeof message === 'object')
message = '[' + new Date().format('hh:nn:ss.fff') + '] ' + JSON.stringify(message);
else
Expand Down
20 changes: 12 additions & 8 deletions lib/viz/Geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,18 @@ var Geo = module.exports = function (options, callback) {
//else
// throw err;
}
var options = {
keepAspectRatio: true,
backgroundColor: {
fill: 'transparent'
},
datalessRegionColor: 'white'

};

var series = self._super.makeGeoSeries(message.dimensions, message.metrics, message.documents);
if (!self.drawn) {
var options = {
keepAspectRatio: true
};


self.drawn = true;
self.chart = new google.visualization.GeoChart(document.getElementById(self.options.$container.attr('id')));
Expand All @@ -63,11 +70,8 @@ var Geo = module.exports = function (options, callback) {
}
else if (self.options.query.realtime) {
//we're dealing with realtime
var options = {
keepAspectRatio: true
};

self.chart.draw(series, options);

self.chart.draw(series,options);
}
});
};
Expand Down
32 changes: 14 additions & 18 deletions lib/viz/MiniTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ var MiniTable = module.exports = function (options, callback) {
}

var series = self._super.makeTableChartSeries(message.dimensions, message.metrics, message.documents);

if (!self.drawn) {
self.drawn = true;

Expand Down Expand Up @@ -116,11 +115,11 @@ var MiniTable = module.exports = function (options, callback) {
});
$html.append($tbody);
self.options.$container.append($html);
sorttable.makeSortable($html.get(0));

var sortth = self.options.$container.find('th')[message.dimensions.length];
sorttable.innerSortFunction.apply(sortth, []);
sorttable.innerSortFunction.apply(sortth, []);
self.tablesort = new Tablesort($html.get(0), {
descending: true,
current: $html.find('th')[1]
});

if (typeof callback === 'function')
return callback(null);
Expand Down Expand Up @@ -194,21 +193,18 @@ var MiniTable = module.exports = function (options, callback) {
if (existingkeys.indexOf(_key) == -1)
$tr.remove();
}
}

var sortth = self.options.$container.find('th.sorttable_sorted').get(0);
if (!sortth)
sortth = self.options.$container.find('th.sorttable_sorted_reverse').get(0);
if (!sortth)
sortth = self.options.$container.find('th')[1];
if (series[0].data.length > 0) {
self.tablesort.refresh();

if ($(sortth).hasClass('sorttable_sorted')) {
$(sortth).removeClass('sorttable_sorted');
sorttable.innerSortFunction.apply(sortth, []);
}
else if ($(sortth).hasClass('sorttable_sorted_reverse')) {
$(sortth).removeClass('sorttable_sorted_reverse');
sorttable.innerSortFunction.apply(sortth, []);
sorttable.innerSortFunction.apply(sortth, []);
var limit = 5;
var trs = self.options.$container.find('tbody tr');
for (var i = 0; i < trs.length; i++) {
var elem = trs[i];
var $elem = $(elem);
if (i + 1 > limit)
$elem.remove();
}
}
});
Expand Down
8 changes: 5 additions & 3 deletions lib/viz/Pie.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ var Pie = module.exports = function (options, callback) {
spacingRight: 0,
borderWidth: 0,
plotBorderWidth: 0,
type: 'pie'
type: 'pie',
backgroundColor: 'transparent'
},
series: series,

legend: {enabled: false},
legend: {enabled: true},
credits: {enabled: false},
exporting: {enabled: true},
plotOptions: {
Expand All @@ -84,7 +85,8 @@ var Pie = module.exports = function (options, callback) {
color: '#000000',
connectorColor: '#000000',
format: '<b>{point.name}</b>: {point.percentage:.1f} %'
}
},
showInLegend: true
}
}
}, self.options.chart);
Expand Down

0 comments on commit 0fb4b2b

Please sign in to comment.