3 var graphviz = require('graphviz');
4 var fs = require('fs');
6 var persistenceService = require('gitter-web-persistence');
9 var g = graphviz.digraph('G');
11 var ONE_TO_ONE_EDGE_COLOR = '#0000ff';
13 var d1 = new Date('13 Nov 2014');
14 var d2 = new Date('20 Nov 2014');
16 persistenceService.ChatMessage.aggregate([
19 $and: [{ sent: { $gt: d1 } }, { sent: { $lt: d2 } }]
25 userId: '$fromUserId',
35 .then(function(chats) {
36 chats.forEach(function(c) {
37 g.addNode('' + c._id.userId, { shape: 'point' });
38 g.addNode('' + c._id.room, { shape: 'point' });
39 g.addEdge('' + c._id.userId, '' + c._id.room, {
40 color: ONE_TO_ONE_EDGE_COLOR,
46 fs.writeFileSync('chats2.dot', g.to_dot());
47 // g.output( "png", "test01.png" );
50 .catch(function(err) {