Skip to content

Commit 5b09b53

Browse files
committed
Improve graph speed a little
1 parent e508ba6 commit 5b09b53

4 files changed

Lines changed: 43 additions & 11 deletions

File tree

OpenFlow/src/public/Controllers.ts

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,17 @@ module openflow {
233233
options: any = {
234234
legend: { display: true }
235235
};
236-
baseColors: string[] = ['#F7464A', '#97BBCD', '#FDB45C', '#46BFBD', '#949FB1', '#4D5360'];
236+
// baseColors: string[] = ['#F7464A', '#97BBCD', '#FDB45C', '#46BFBD', '#949FB1', '#4D5360'];
237+
// baseColors: string[] = ['#803690', '#00ADF9', '#DCDCDC', '#46BFBD', '#FDB45C', '#949FB1', '#4D5360'];
238+
baseColors: [
239+
'#97BBCD', // blue
240+
'#DCDCDC', // light grey
241+
'#F7464A', // red
242+
'#46BFBD', // green
243+
'#FDB45C', // yellow
244+
'#949FB1', // grey
245+
'#4D5360' // dark grey
246+
];
237247
colors: string[] = this.baseColors;
238248
type: string = 'bar';
239249
heading: string = "";
@@ -243,7 +253,6 @@ module openflow {
243253
ids: any[] = [];
244254
charttype: string = "bar";
245255
click: any = null;
246-
247256
}
248257
export declare function emit(k, v);
249258
export class ReportsCtrl extends entitiesCtrl<openflow.Base> {
@@ -301,6 +310,7 @@ module openflow {
301310
this.userdata.data.ReportsCtrl.run(this.userdata.data.ReportsCtrl.points);
302311
}
303312
async processData(): Promise<void> {
313+
console.log('processData');
304314
this.userdata.data.ReportsCtrl.run = this.processData.bind(this);
305315
this.userdata.data.ReportsCtrl.points = null;
306316
this.loading = true;
@@ -331,10 +341,19 @@ module openflow {
331341
if (data.length > 0) onlinerobots = data[0]._rpaheartbeat;
332342

333343
chart = new chartset();
334-
chart.heading = "Robots seen the last " + this.timeframedesc;
344+
chart.heading = "Online and offline robots, seen the last " + this.timeframedesc;
335345
chart.labels = ['online', 'offline'];
336346
chart.data = [onlinerobots, (totalrobots - onlinerobots)];
337-
chart.charttype = "doughnut";
347+
chart.charttype = "pie";
348+
chart.colors = [
349+
// '#98FB98', // very light green
350+
// '#F08080', // very light red
351+
// '#228B22', // green
352+
// '#B22222', // red
353+
'#006400', // green
354+
'#8B0000', // red
355+
];
356+
338357
// chart.click = this.robotsclick.bind(this);
339358
chart.click = this.robotsclick.bind(this);
340359
this.charts.push(chart);
@@ -376,6 +395,7 @@ module openflow {
376395
if (!this.$scope.$$phase) { this.$scope.$apply(); }
377396
}
378397
async robotsclick(points, evt): Promise<void> {
398+
console.log('robotsclick');
379399
this.userdata.data.ReportsCtrl.run = this.robotsclick.bind(this);
380400
this.userdata.data.ReportsCtrl.points = points;
381401
if (points.length > 0) {
@@ -397,9 +417,11 @@ module openflow {
397417
}
398418
this.charts = [];
399419
agg = [
400-
{ $match: { _type: 'user' } },
401-
rpaheartbeat,
402-
{
420+
{ $match: { _type: 'user' } }
421+
, { $sort: { "_rpaheartbeat": -1 } }
422+
, { "$limit": 20 }
423+
, rpaheartbeat
424+
, {
403425
$lookup: {
404426
from: "audit",
405427
localField: "_id",
@@ -414,7 +436,9 @@ module openflow {
414436
"count": { "$size": "$audit" }
415437
}
416438
}
417-
, { "$limit": 20 }
439+
, { $sort: { "count": -1 } }
440+
// , { $sort: { "_rpaheartbeat": -1 } }
441+
// , { "$limit": 20 }
418442
];
419443

420444
var data = await this.api.Aggregate("users", agg);
@@ -504,6 +528,7 @@ module openflow {
504528

505529
}
506530
async robotclick(points, evt): Promise<void> {
531+
console.log('robotclick');
507532
if (points.length > 0) {
508533
} else { return; }
509534
var userid = this.charts[0].ids[points[0]._index];
@@ -545,6 +570,7 @@ module openflow {
545570

546571
}
547572
async workflowclick(points, evt): Promise<void> {
573+
console.log('workflowclick');
548574
if (points.length > 0) {
549575
} else { return; }
550576

OpenFlow/src/public/Reports.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ <h1>OpenRPA</h1>
1212

1313
<div ng-repeat="chart in ctrl.charts">
1414
<div>{{chart.heading}}</div>
15-
<div style="width: 500px">
15+
<!-- style="width: 500px" -->
16+
<div style="max-width: 600px;">
1617
<canvas id="bar" class="chart-base" chart-type="chart.charttype" chart-data="chart.data"
17-
chart-labels="chart.labels" chart-series="chart.series" chart-click="chart.click">
18+
chart-labels="chart.labels" chart-series="chart.series" chart-click="chart.click"
19+
chart-colors="chart.colors">
1820
</canvas>
1921
</div><br>
2022
</div>

OpenFlow/src/public/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
*/
44
module openflow {
55
"use strict";
6+
// .config(function (ChartJsProvider) {
7+
// ChartJsProvider.setOptions({ responsive: true });
8+
// ChartJsProvider.setOptions('Line', { responsive: true });
9+
// })
610
var webApp: any = angular.module("webApp", ['ngRoute', 'chart.js', 'ngLocalize', 'ngLocalize.Config'])
711
.controller("MenuCtrl", MenuCtrl)
812
.controller("Providers", ProvidersCtrl)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.534
1+
0.0.535

0 commit comments

Comments
 (0)