I am using angular nvd3 chart and want to retrieve the x-axis min and max value so that when I click a custom next button the new x-axis value will be loaded and chart will show the next range of values...
I am stuck here as I can't find a way to get the min max value of the current x-axis
Here is my code...
angular.module('sbAdminApp', ['nvd3'])
.controller('DemoCtrl', ['$rootScope', '$scope', '$timeout', function
($rootScope, $scope, $timeout){
$rootScope.curlabel = "year";
$scope.curformat = "mon"
$scope.options = {
chart: {
type: 'discreteBarChart',
height: 450,
staggerLabels: false,
x: function(d){return d.label;},
y: function(d){return d.value;},
showValues: true,
valueFormat: function(d){ return d3.format(',.4f')(d); },
dispatch: {
tooltipShow: function(e){ console.log('! tooltip SHOW !')},
tooltipHide: function(e){console.log('! tooltip HIDE !')},
beforeUpdate: function(e){ console.log('! before UPDATE !')}
},
discretebar: {
dispatch: {
//chartClick: function(e) {console.log("! chart Click !")},
elementClick: function(d) {
//console.log(d);
var labelValue = d.data.label;
$scope.newchart($rootScope.curlabel, labelValue);
}
}
},
zoom: {
enabled: true,
scaleExtent: [1, 10],
useFixedDomain: false,
useNiceScale: false,
horizontalOff: false,
verticalOff: true,
unzoomEventType: 'dblclick.zoom'
}
}
};
$scope.data = [
{
key: "Cumulative Return",
values: [
{
"label" : 2010 ,
"value" : -29.765957771107
} ,
{
"label" : 2011 ,
"value" : 0
} ,
{
"label" : 2012 ,
"value" : 32.807804682612
} ,
{
"label" : 2013 ,
"value" : 196.45946739256
} ,
{
"label" : 2014 ,
"value" : 0.19434030906893
} ,
{
"label" : 2015,
"value" : -98.079782601442
} ,
{
"label" : 2016 ,
"value" : -13.925743130903
} ,
{
"label" : 2017 ,
"value" : -5.1387322875705
},
{
"label" : 2018 ,
"value" : -5.1387322875705
},
{
"label" : 2019 ,
"value" : -5.1387322875705
}
]
}
];
Thanks in Advance
$scope.data.values
– Weedoze