Using DataViewsJS, you can generate grid columns automatically by retrieving the data from JSON files. Use the following steps to create a basic grid layout.
<!DOCTYPE html>
<html>
<head>
<title>DataViews test page</title>
</head>
</html>
<script src="[Your Script Path]/gc.dataviews.common.min.js" type="text/javascript"></script>
<script src="[Your Script Path]/gc.dataviews.core.min.js" type="text/javascript"></script>
<script src="[Your Script Path]/gc.dataviews.grid.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="[Your Stylesheet Path]/gc.dataviews.core.min.css" type="text/css" />
<script src="[Your Script Path]/license.js" type="text/javascript"></script>
var countries = ['US,Germany,UK,Japan,Italy,Greece'];
var data = [];
for (var i = 0; i < 100; i++) {
data.push({
id: i,
country: countries[i % countries.length],
date: new Date(2015, i % 12, i % 28),
amount: Math.floor(Math.random() * 10000),
active: i % 4 === 0,
});
}
var dataView = new GC.DataViews.DataView('#grid1', data, new GC.DataViews.GridLayout());
<body>
<div id="grid1" style="height:100%"></div>
</body>
Note: The license.js file should contain the following license string. Replace the text in quotes with your actual license key string.
GC.DataViews.LicenseKey = 'your license key';
Submit and view feedback for