Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scout-ui/src/minicharts/d3fns/date.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ module.exports = function(opts) {
return {
label: weekdayLabels[i],
value: d.length,
tooltip: weekdayLabels[i]
// tooltip: weekdayLabels[i]
};
})
.value();
Expand All @@ -74,7 +74,7 @@ module.exports = function(opts) {
return {
label: hourLabels[i] + ':00',
value: d.length,
tooltip: hourLabels[i] + ':00'
// tooltip: hourLabels[i] + ':00'
};
})
.value();
Expand Down
15 changes: 12 additions & 3 deletions scout-ui/src/minicharts/d3fns/few.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ module.exports = function(data, g, width, height, options) {
.attr('width', function(d) {
return x(d.value);
})
.attr('height', barHeight)
.on('mouseover', tip.show)
.on('mouseout', tip.hide);
.attr('height', barHeight);

bar.append('text')
.attr('y', barHeight / 2)
Expand All @@ -73,4 +71,15 @@ module.exports = function(data, g, width, height, options) {
})
.attr('fill', 'white');

bar.append('rect')
.attr('class', 'glass')
.attr('y', 0)
.attr('x', 0)
.attr('width', function(d) {
return x(d.value);
})
.attr('height', barHeight)
.on('mouseover', tip.show)
.on('mouseout', tip.hide);

};
2 changes: 1 addition & 1 deletion scout-ui/src/minicharts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = AmpersandView.extend({

// unique values get a div-based minichart
if ((this.model._id === 'String') &&
(_.uniq(this.model.values.toJSON()).length === this.model.count)) {
(this.model.unique === this.model.count)) {

this.viewOptions.renderMode = 'html';
this.viewOptions.className = 'minichart unique';
Expand Down
4 changes: 2 additions & 2 deletions scout-ui/src/minicharts/unique.jade
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ div(data-hook='viz-container')
//- = minValue

dt
//-a(href="#")
i.mms-icon-continuous(data-hook='refresh')
a
i.mms-icon-continuous(data-hook='refresh')
dd
ul.list-inline
each val in randomValues
Expand Down
53 changes: 28 additions & 25 deletions scout-ui/src/minicharts/unique.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,48 @@ var _ = require('lodash');
var debug = require('debug')('scout-ui:minicharts:unique');

module.exports = VizView.extend({
props: {
timer: {
type: 'number',
default: null
}
},
template: require('./unique.jade'),
derived: {
orderedValues: {
deps: ['model.values'],
cache: true,
fn: function() {
return this.model.values.toJSON().sort();
}
},
minValue: {
deps: ['orderedValues'],
cache: true,
fn: function() {
return this.orderedValues[0];
}
},
maxValue: {
deps: ['orderedValues'],
cache: true,
fn: function() {
return this.orderedValues[this.orderedValues.length - 1];
}
},
randomValues: {
deps: ['orderedValues'],
cache: false,
fn: function() {
return this.orderedValues.slice(1, 15);
return _(this.model.values.sample(15))
.map(function(x) {
return x.value;
})
.value();
}
}
},
events: {
'click .fa-refresh': 'refresh'
'mousedown [data-hook=refresh]': 'refresh',
'mouseup': 'stopTimer'
},
render: function() {
this.renderWithTemplate(this);
},
refresh: function() {
debug('refresh clicked');
refresh: function(event) {
if (!this.timer) {
this.timer = setInterval(this.refresh.bind(this), 600);
} else {
clearInterval(this.timer);
this.timer = setInterval(this.refresh.bind(this), 50);
}
if (event) {
event.preventDefault();
}
this.render();
},
stopTimer: function(event) {
clearInterval(this.timer);
this.timer = null;
}

});