Reputation: 1829
3 library for graph generation & i am facing problems while setting the X & Y axis for the intervals based upon values. I want to know whether NVD3's java script has inbuilt capabilities to adjust the X axis intervals based upon the number on records inside the data?
I am generating the graph & it possibly sets the y axis's first value to the lowest value of the sample data. If i need to start the y axis from 0 too then how should it be done?
sample data:
var data = [{
"key": "30 Day",
"values": [{
"x": 0,
"y": 18
}, {
"x": 1,
"y": 24
}, {
"x": 2,
"y": 23
}, {
"x": 3,
"y": 27
},{
"x": 4,
"y": 24
},{
"x": 5,
"y": 31
},{
"x": 6,
"y": 37
},{
"x": 7,
"y": 46
},{
"x": 8,
"y": 32
},{
"x": 9,
"y": 23
},{
"x": 10,
"y": 30
}]
}];
Upvotes: 0
Views: 639
Reputation: 71
Several NVD3 charts support xDomain/yDomain options. For example:
var chart = nv.models.lineChart();
chart.xDomain( [ 0, 10 ] ).yDomain( [ 0, 50 ] );
Upvotes: 1