Skip to content

Instantly share code, notes, and snippets.

@YorkAARGH
Created April 4, 2018 20:31
Show Gist options
  • Save YorkAARGH/0e009eeba8c1fd28105b17a661ed9a46 to your computer and use it in GitHub Desktop.
Save YorkAARGH/0e009eeba8c1fd28105b17a661ed9a46 to your computer and use it in GitHub Desktop.
Highcharts-Example
const Chart = require('./Chart');
module.exports = class extends Chart {
constructor(stats, dashStats) {
super();
const now = new Date();
this.options.title.text = 'Usage Stats';
this.options.plotOptions.series.pointStart = now.setHours(now.getHours() - 1);
this.options.plotOptions.series.pointInterval = 60 * 1000;
this.options.series[1] = {};
this.options.series[1].type = 'line';
this.options.series[1].color = '#3498DB';
this.options.series[1].data = stats;
this.options.series[1].name = 'Commands Per Minute';
this.options.series[0] = {};
this.options.series[0].type = 'line';
this.options.series[0].color = '#CCCC00';
this.options.series[0].data = dashStats;
this.options.series[0].name = 'Dashboard Page Requests Per Minute';
}
async generateChart() {
await super.generateChart(`c:\\inetpub\\wwwroot\\img\\stats.png`);
return `https://runeinfo.xyz/img/stats.png?time=${Date.now()}`;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment