$scope.options = {
chart: {
type: 'historicalBarChart',
height: 450,
margin : {
top: 30,
right: 30,
bottom: 65,
left: 80
},
x: function(d){return d[0];},
y: function(d){return d[1]/10;},
showValues: true,
valueFormat: function(d){
return d3.format(',.1f')(d);
},
duration: 100,
xAxis: {
axisLabel: 'X Axis',
axisLabelDistance: 10,
tickFormat: function(d) {
return d3.time.format('%Y-%m-%d')(new Date(d))
},
rotateLabels: 30,
showMaxMin: false
},
yAxis: {
axisLabel: 'Y Axis',
axisLabelDistance: -10,
tickFormat: function(d){
return d3.format(',.1f')(d);
}
},
tooltip: {
keyFormatter: function(d) {
return d3.time.format('%Y-%m-%d')(new Date(d));
}
},
zoom: {
enabled: true,
scaleExtent: [1, 10],
useFixedDomain: false,
useNiceScale: false,
horizontalOff: false,
verticalOff: true,
unzoomEventType: 'dblclick.zoom'
}
}
};
$scope.data = [
{
"key" : "Quantity" ,
"bar": true,
"values" : [ [ null , null] , [ null ,null] , [ null , null] , [ null,null] , [ null,null] ]
}];
console.log($scope.data);
$http.get('/getTotalInvoiceBydate').success(function (response) {
console.log(response);
for(var i=0; i<response.length; i++)
{
$scope.data[0].values[i][0]=Date.parse(response[i].invoice_date);
$scope.data[0].values[i][1]=response[i].invoice_total;
}
// console.log($scope.data[0].values[0][0]);
});
});