|
|
|
@ -29,7 +29,9 @@ nv.models.bullet = function() {
|
|
|
|
|
selection.each(function(d, i) {
|
|
|
|
|
var availableWidth = width - margin.left - margin.right,
|
|
|
|
|
availableHeight = height - margin.top - margin.bottom,
|
|
|
|
|
container = d3.select(this);
|
|
|
|
|
container = d3.select(this),
|
|
|
|
|
mainGroup = this.parentNode.parentNode.getAttribute('transform')
|
|
|
|
|
heightFromTop = parseInt(mainGroup.replace(/.*,(\d+)\)/,"$1")) //TODO: There should be a smarter way to get this value
|
|
|
|
|
|
|
|
|
|
var rangez = ranges.call(this, d, i).slice().sort(d3.descending),
|
|
|
|
|
markerz = markers.call(this, d, i).slice().sort(d3.descending),
|
|
|
|
@ -41,8 +43,9 @@ nv.models.bullet = function() {
|
|
|
|
|
// Setup Scales
|
|
|
|
|
|
|
|
|
|
// Compute the new x-scale.
|
|
|
|
|
var MaxX = Math.max(rangez[0] ? rangez[0]:0 , markerz[0] ? markerz[0] : 0 , measurez[0] ? measurez[0] : 0)
|
|
|
|
|
var x1 = d3.scale.linear()
|
|
|
|
|
.domain([0, Math.max(rangez[0], markerz[0], measurez[0])]) // TODO: need to allow forceX and forceY, and xDomain, yDomain
|
|
|
|
|
.domain([0, MaxX]).nice() // TODO: need to allow forceX and forceY, and xDomain, yDomain
|
|
|
|
|
.range(reverse ? [availableWidth, 0] : [0, availableWidth]);
|
|
|
|
|
|
|
|
|
|
// Retrieve the old x-scale, if this is an update.
|
|
|
|
@ -87,7 +90,7 @@ nv.models.bullet = function() {
|
|
|
|
|
dispatch.elementMouseover({
|
|
|
|
|
value: d,
|
|
|
|
|
label: (i <= 0) ? 'Maximum' : (i > 1) ? 'Minimum' : 'Mean', //TODO: make these labels a variable
|
|
|
|
|
pos: [x1(d), availableHeight/2]
|
|
|
|
|
pos: [x1(d), heightFromTop]
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.on('mouseout', function(d,i) {
|
|
|
|
@ -117,7 +120,7 @@ nv.models.bullet = function() {
|
|
|
|
|
dispatch.elementMouseover({
|
|
|
|
|
value: d,
|
|
|
|
|
label: 'Current', //TODO: make these labels a variable
|
|
|
|
|
pos: [x1(d), availableHeight/2]
|
|
|
|
|
pos: [x1(d), heightFromTop]
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.on('mouseout', function(d) {
|
|
|
|
@ -148,7 +151,7 @@ nv.models.bullet = function() {
|
|
|
|
|
dispatch.elementMouseover({
|
|
|
|
|
value: d,
|
|
|
|
|
label: 'Previous',
|
|
|
|
|
pos: [x1(d), availableHeight/2]
|
|
|
|
|
pos: [x1(d), heightFromTop]
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
.on('mouseout', function(d,i) {
|
|
|
|
|