Revize 66c042f1
Přidáno uživatelem Štěpán Červenka před více než 3 roky(ů)
src/app/shared/graph-loading/multigraph.ts | ||
---|---|---|
7 | 7 |
isAnalytics: boolean; |
8 | 8 |
data: any []; |
9 | 9 |
interval: number; |
10 |
legend: {}; |
|
10 | 11 |
|
11 |
constructor(isAnalytics: boolean, data: any [], interval: number) { |
|
12 |
constructor(isAnalytics: boolean, data: any [], legend: {}, interval: number) {
|
|
12 | 13 |
this.isAnalytics = isAnalytics; |
13 | 14 |
this.data = data; |
14 | 15 |
this.interval = interval; |
16 |
this.legend = this.getLegend(legend); |
|
15 | 17 |
|
16 | 18 |
} |
17 | 19 |
|
... | ... | |
22 | 24 |
let config1 = require('/src/vega/config/config.json'); |
23 | 25 |
lodash.merge(rvalue, config1); |
24 | 26 |
let config2 = require('/src/vega/config/config-multiline.json'); |
27 |
let config3 = require('/src/vega/config/config-barline.json'); |
|
25 | 28 |
|
26 | 29 |
|
27 | 30 |
for(let key in config2.signals) { |
... | ... | |
29 | 32 |
rvalue.signals.push(obj); |
30 | 33 |
} |
31 | 34 |
|
32 |
return config1; |
|
35 |
for(let key in config3.signals) { |
|
36 |
let obj = config3.signals[key]; |
|
37 |
rvalue.signals.push(obj); |
|
38 |
} |
|
39 |
|
|
40 |
return rvalue; |
|
33 | 41 |
} |
34 | 42 |
|
35 | 43 |
getSpec(): {} { |
... | ... | |
37 | 45 |
const rvalue: any = {}; |
38 | 46 |
const base = require('/src/vega/base/default.json'); |
39 | 47 |
const body = require('/src/vega/body/multilinechart.json'); |
40 |
const tooltip = require('/src/vega/tooltip/multiline-tooltip.json'); |
|
48 |
const legend = require('/src/vega/miscs/legend.json'); |
|
49 |
const tooltip = require('/src/vega/miscs/multiline-tooltip.json'); |
|
41 | 50 |
|
42 |
lodash.merge(rvalue, base, body, tooltip); |
|
51 |
lodash.merge(rvalue, base, body, legend, tooltip);
|
|
43 | 52 |
|
44 |
rvalue.data[0].values = this.data; |
|
53 |
rvalue.data[1].values = this.data; |
|
54 |
rvalue.data[0].values = this.legend; |
|
45 | 55 |
rvalue.signals[0].value = this.interval; |
46 | 56 |
rvalue.marks[0].marks[0].marks[0].marks[2].encode.enter.tooltip.signal = this.getTooltipMessage(); |
47 | 57 |
|
... | ... | |
58 | 68 |
return message; |
59 | 69 |
} |
60 | 70 |
|
71 |
private getLegend(legend: any) { |
|
72 |
if(Array.isArray(legend)) { |
|
73 |
return legend[0]; |
|
74 |
} else { |
|
75 |
return legend; |
|
76 |
} |
|
77 |
} |
|
78 |
|
|
79 |
|
|
61 | 80 |
} |
Také k dispozici: Unified diff
Re #8775 - Agregovat grafy se stejným typem sensoru