I am trying to show a graph by making use of nvd plugin. It is showing proper data but though I am sending integer data, it showing float data in x axis with 2 decimal places and when I mouse over then it is showing float with one decimal place. My code is like:
nv.addGraph(function() {
var chart = nv.models.discreteBarChart()
.x(function(d) { return d.label })
.y(function(d) { return d.value })
.staggerLabels(true)
.tooltips(false)
.showValues(true)
d3.select('#chart svg')
.datum(exampleData())
.transition().duration(500)
.call(chart);
nv.utils.windowResize(chart.update);
return chart;
});
function exampleData() {
return [
{
key: "Cumulative Return",
values: [
{
"label" : "CDS / Options" ,
"value" : 29
} ,
{
"label" : "Cash" ,
"value" : 0
} ,
{
"label" : "Corporate Bonds" ,
"value" : 32
} ,
{
"label" : "Equity" ,
"value" : 196
} ,
{
"label" : "Index Futures" ,
"value" : 0
} ,
{
"label" : "Options" ,
"value" : 98
} ,
{
"label" : "Preferred" ,
"value" : 13
} ,
{
"label" : "Not Available" ,
"value" : 5
}
]
}
];
}
How to solve this issue? Thanks in advance.