Built with blockbuilder.org
xxxxxxxxxx
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="crossfilter.js"></script>
<script src="dc.js"></script>
<style>
body { margin:0;position:fixed;top:0;right:0;bottom:0;left:0; }
svg { width: 100%; height: 100%; }
</style>
</head>
<body>
<div id="dc-table-graph">
</div>
<script>
var test = [{
"N": "2",
"Profit": 1
}, {
"N": "107",
"Profit": 1
}, {
"N": "201",
"Profit": 1
}, {
"N": "54",
"Profit": 1
}];
function makeGraphs(trades) {
trades.forEach(function(d) {
d['N'] = +d['N']
});
var t = crossfilter(trades);
var NDimension = t.dimension(function (d) {
return d['N'];
});
var tradeTable = dc.dataTable("#dc-table-graph");
tradeTable.width(960).height(800)
.dimension(NDimension)
.group(function(d) { return "trades" })
.size(110)
.columns([
function(d) { return d.N; },
function(d) { return d['Profit']; },
function(d) { return typeof d.N; },
function(d) { return typeof (-d.N); }
])
.sortBy(function(d){ return -d.N; })
.order(d3.descending);
dc.renderAll();
}
makeGraphs(test);
</script>
</body>
https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js