allowing the bullet chart to hide the previous data point if the value is null

This commit is contained in:
Ricardo 2012-12-13 16:28:43 -05:00
parent 38ba70f4dc
commit cdb68dafca
3 changed files with 43 additions and 35 deletions

View File

@ -1193,22 +1193,26 @@ nv.models.bullet = function() {
})
var h3 = availableHeight / 6;
g.selectAll('path.nv-markerTriangle')
.attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
.attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
.on('mouseover', function() {
dispatch.elementMouseover({
value: markerz[0],
label: 'Previous',
pos: [x1(markerz[0]), availableHeight/2]
if (markerz[0]) {
g.selectAll('path.nv-markerTriangle')
.attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
.attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
.on('mouseover', function() {
dispatch.elementMouseover({
value: markerz[0],
label: 'Previous',
pos: [x1(markerz[0]), availableHeight/2]
})
})
})
.on('mouseout', function() {
dispatch.elementMouseout({
value: markerz[0],
label: 'Previous'
})
});
.on('mouseout', function() {
dispatch.elementMouseout({
value: markerz[0],
label: 'Previous'
})
});
} else {
g.selectAll('path.nv-markerTriangle').remove();
}
wrap.selectAll('.nv-range')

10
nv.d3.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -153,22 +153,26 @@ nv.models.bullet = function() {
})
var h3 = availableHeight / 6;
g.selectAll('path.nv-markerTriangle')
.attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
.attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
.on('mouseover', function() {
dispatch.elementMouseover({
value: markerz[0],
label: 'Previous',
pos: [x1(markerz[0]), availableHeight/2]
if (markerz[0]) {
g.selectAll('path.nv-markerTriangle')
.attr('transform', function(d) { return 'translate(' + x1(markerz[0]) + ',' + (availableHeight / 2) + ')' })
.attr('d', 'M0,' + h3 + 'L' + h3 + ',' + (-h3) + ' ' + (-h3) + ',' + (-h3) + 'Z')
.on('mouseover', function() {
dispatch.elementMouseover({
value: markerz[0],
label: 'Previous',
pos: [x1(markerz[0]), availableHeight/2]
})
})
})
.on('mouseout', function() {
dispatch.elementMouseout({
value: markerz[0],
label: 'Previous'
})
});
.on('mouseout', function() {
dispatch.elementMouseout({
value: markerz[0],
label: 'Previous'
})
});
} else {
g.selectAll('path.nv-markerTriangle').remove();
}
wrap.selectAll('.nv-range')