Reputation: 14590
Look at this demo: http://jsfiddle.net/2313ffbf/
data is generated by:
// generate some random data, quite different range
function generateChartData() {
var chartData = [];
// current date
var firstDate = new Date();
// now set 500 minutes back
firstDate.setMinutes(firstDate.getDate() - 1000);
// and generate data items
var visits = 30; // <--- change this to 500
for (var i = 0; i < visits; i++) {
var newDate = new Date(firstDate);
// each time we add one minute
newDate.setMinutes(newDate.getMinutes() + i);
// some random number
visits += Math.round((Math.random()<0.5?1:-1)*Math.random()*10);
// add data item to the array
chartData.push({
date: newDate,
visits: visits
});
}
return chartData;
}
And if you run it you can see the line graph isn't at the margins but centered.
If you change var visits = 30;
to something like 500, then the line touch the margins.
How can I get that with few data too?
Upvotes: 0
Views: 51
Reputation: 2322
Try being more specific in your chart configuration. So instead of mm
(minutes) write fff
(miliseconds):
var chart = AmCharts.makeChart("chartdiv", {
...
"categoryAxis": {
"minPeriod": "fff",
"parseDates": true
},
...
});
Find out more here.
Upvotes: 1