-
Notifications
You must be signed in to change notification settings - Fork 0
/
jgfMultiGraph.js
55 lines (47 loc) · 1.08 KB
/
jgfMultiGraph.js
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
const { Guard } = require('./guard');
/**
* Container for multiple Jgf graph objects in one object.
*/
class JgfMultiGraph {
/**
* Constructor
* @param {string} type Multi graph classification.
* @param {string} label A text display for the multi graph.
* @param {object|null} metadata Custom multi graph metadata.
*/
constructor(type, label, metadata = null) {
this.type = type;
this.label = label;
this._metadata = metadata;
this._graphs = [];
}
/**
* Adds a single graph.
* @param {JgfGraph} graph Graph to be added.
*/
addGraph(graph) {
this._graphs.push(graph);
}
/**
* Returns all graphs.
*/
get graphs() {
return this._graphs;
}
/**
* Sets the multi graph meta data.
*/
set metadata(metadata) {
Guard.assertValidMetadata(metadata);
this._metadata = metadata;
}
/**
* Returns the multi graph meta data.
*/
get metadata() {
return this._metadata;
}
}
module.exports = {
JgfMultiGraph,
};