Wijmo 5 - FlexSheet and FlexChart
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.grapecity.com/wijmo/5.latest/styles/wijmo.min.css">
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.input.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.filter.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.grid.sheet.min.js"></script>
<script src="https://cdn.grapecity.com/wijmo/5.latest/controls/wijmo.chart.min.js"></script>
<div class="container">
<h1>FlexSheet and FlexChart</h1>
<p>This is a <b>FlexSheet</b> control:</p>
<div id="theSheet"></div>
<p>And this is a <b>FlexChart</b> control showing the same data:</p>
<div id="theChart"></div>
</div>
CSS
.wj-flexsheet {
height: 300px;
margin: 12px;
}
.wj-flexchart {
height: 300px;
margin: 12px;
}
body {
margin-bottom: 24pt;
}
JavaScript
onload = function() {
// create some random data
var countries = 'US,Germany,UK,Japan,Italy,Greece'.split(','),
data = [];
for (var i = 0; i < countries.length; i++) {
data.push({
country: countries[i],
downloads: Math.round(Math.random() * 20000),
sales: Math.random() * 10000,
expenses: Math.random() * 5000
});
}
// create CollectionView on the data (so grid and chart stay in sync)
var view = new wijmo.collections.CollectionView(data);
// initialize the FlexSheet
var grid = new wijmo.grid.sheet.FlexSheet('#theSheet');
var sheet = new wijmo.grid.sheet.Sheet();
sheet.itemsSource = view;
grid.sheets.push(sheet);
grid.getColumn('downloads').format = 'n0';
grid.getColumn('sales').format = 'n2';
grid.getColumn('expenses').format = 'n2';
// initialize the chart
var chart = new wijmo.chart.FlexChart('#theChart', {
itemsSource: view,
bindingX: 'country',
series: [
{ binding: 'sales', name: 'Sales' },
{ binding: 'expenses', name: 'Expenses' },
{ binding: 'downloads', name: 'Downloads', chartType: wijmo.chart.ChartType.LineSymbols }
],
selectionMode: wijmo.chart.SelectionMode.Point
});
}