This repository was archived by the owner on Jul 30, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdata-service.js
More file actions
56 lines (56 loc) · 1.45 KB
/
data-service.js
File metadata and controls
56 lines (56 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"use strict";
/**
* Chart data service
*/
Object.defineProperty(exports, "__esModule", { value: true });
function GetDateTimeData(start, end, min, max) {
var series1 = [];
var point = {};
var value = 100;
var date;
for (var i = 0; start <= end; i++) {
date = start.getTime();
if (min || max) {
value = getRandomInt(min, max);
}
else {
if (Math.random() > .5) {
value += Math.random();
}
else {
value -= Math.random();
}
}
point = { x: new Date(date), y: value };
new Date(start.setDate(start.getDate() + 1));
series1.push(point);
}
return series1;
}
exports.GetDateTimeData = GetDateTimeData;
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
exports.getRandomInt = getRandomInt;
function GetNumericData(start, end, min, max) {
var series1 = [];
var point = {};
var value = 30;
for (var i = start; i <= end; i++) {
if (min || max) {
value = getRandomInt(min, max);
}
else {
if (Math.random() > .5) {
value += Math.random();
}
else {
value -= Math.random();
}
}
point = { x: i, y: Math.round(value) };
series1.push(point);
}
return series1;
}
exports.GetNumericData = GetNumericData;