Created
August 25, 2017 23:30
-
-
Save SuddenDevelopment/8e535eb658bd2b0a9152db5a01e960a6 to your computer and use it in GitHub Desktop.
nvd3 focus zoom brush values callback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add data to the array like this | |
$scope.chartData=[{x:0,y:0}]; | |
$scope.chartOptions = { | |
"chart": { | |
"type": 'linePlusBarChart', | |
//...the other options... | |
"callback": function(chart){ | |
chart.dispatch.on( 'brush', function (objBrush) { | |
// objBrush.extent these are array index values! | |
var intBegin=$scope.chartData[0].values[Math.round(objBrush.extent[0])].x; | |
var intEnd=$scope.chartData[0].values[Math.round(objBrush.extent[1])].x; | |
console.log(intBegin,intEnd); | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment