FusionTime - day binning
Created using FusionCharts Suite XT - www.fusioncharts.com
HTML
<script src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<script src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<!-- Simple implementation of the Bar 2D chart -->
<div id="chart-container">FusionCharts will render here</div>
JavaScript
Date.prototype.yyyymmdd = function() {
var mm = this.getMonth() + 1; // getMonth() is zero-based
var dd = this.getDate();
return [this.getFullYear(),
(mm > 9 ? '' : '0') + mm,
(dd > 9 ? '' : '0') + dd
].join('/');
};
var data = [],
chart;
var n = new Date(2020, 11, 1);
for (let index = 0; index < 100; index++) {
let d = new Date(n);
data.push([d.yyyymmdd(), Math.floor((Math.random() * 10000) + 1)]);
n.setDate(n.getDate() + 1);
}
var schema = [{
"name": "Time",
"type": "date",
format: "%Y/%m/%d"
}, {
"name": "Value",
"type": "number"
}];
var fusionTable = new FusionCharts.DataStore().createDataTable(data, schema);
chart = new FusionCharts({
type: 'timeseries',
renderAt: 'chart-container',
width: "90%",
height: 600,
dataSource: {
data: fusionTable,
chart: {
exportEnabled: 1,
},
yAxis: [{
plot: [{
value: 'Value',
connectNullData: true,
type: 'line',
}],
format: {
defaultFormat: 0,
}
}],
xAxis: {
binning: {
year: [],
month: [],
day: [1],
hour: [],
minute: [],
second: [],
millisecond: []
}
}
}
}).render();