Revize c4f90f7b
Přidáno uživatelem Štěpán Červenka před více než 3 roky(ů)
src/app/shared/graph-loading/graphloader.ts | ||
---|---|---|
10 | 10 |
export class GraphLoader { |
11 | 11 |
|
12 | 12 |
|
13 |
static getGraphType(sensors, data, legend, isAnalytics): Graph { |
|
13 |
static getGraphType(sensors, data, interval, legend, isAnalytics): Graph {
|
|
14 | 14 |
if (sensors == null) { |
15 |
return new EmptyGraph("Selected no sensors.");
|
|
15 |
return new EmptyGraph("No sensors selected.");
|
|
16 | 16 |
|
17 | 17 |
} else if (Array.isArray(sensors)) { |
18 | 18 |
if (sensors.length == 0) { |
19 |
return new EmptyGraph("Selected no sensors.");
|
|
19 |
return new EmptyGraph("No sensors selected.");
|
|
20 | 20 |
} else if (sensors.length == 1) { |
21 |
return new SingleGraph(sensors[0], isAnalytics, data, legend,10000);
|
|
21 |
return new SingleGraph(sensors[0], isAnalytics, data, legend,interval);
|
|
22 | 22 |
} else { |
23 |
return new MultiGraph(isAnalytics, data, legend,10000);
|
|
23 |
return new MultiGraph(isAnalytics, data, legend,interval);
|
|
24 | 24 |
} |
25 | 25 |
|
26 | 26 |
} else { |
27 |
return new SingleGraph(sensors, isAnalytics, data, legend, 10000);
|
|
27 |
return new SingleGraph(sensors, isAnalytics, data, legend, interval);
|
|
28 | 28 |
} |
29 | 29 |
} |
30 | 30 |
|
31 | 31 |
|
32 |
static getGraph(sensors, data, legendInfo, element, isAnalytics) {
|
|
33 |
let graph = this.getGraphType(sensors,data, legendInfo, isAnalytics); |
|
32 |
static getGraphWithInterval(sensors, data, interval, legendInfo, element, isAnalytics) {
|
|
33 |
let graph = this.getGraphType(sensors,data, interval, legendInfo, isAnalytics);
|
|
34 | 34 |
let config = graph.getConfig(); |
35 | 35 |
let spec = graph.getSpec(); |
36 | 36 |
|
37 | 37 |
|
38 | 38 |
this.showGraph(spec, config, element); |
39 |
} |
|
39 | 40 |
|
41 |
static getGraph(sensors, data, legendInfo, element, isAnalytics) { |
|
42 |
this.getGraphWithInterval(sensors, data, 1800000, legendInfo, element, isAnalytics); |
|
40 | 43 |
} |
41 | 44 |
|
42 | 45 |
|
... | ... | |
45 | 48 |
const vegaTooltip = require('vega-tooltip'); |
46 | 49 |
const handler = new vegaTooltip.Handler(); |
47 | 50 |
|
48 |
const loc = vega.locale({ |
|
49 |
decimal: ',', |
|
50 |
thousands: '\u00a0', |
|
51 |
grouping: [3], |
|
52 |
currency: ['', '\u00a0Kč'] |
|
53 |
},{ |
|
54 |
dateTime: '%A,%e.%B %Y, %X', |
|
55 |
date: '%-d.%-m.%Y', |
|
56 |
time: '%H:%M:%S', |
|
57 |
periods: ['AM', 'PM'], |
|
58 |
days: ['neděle', 'pondělí', 'úterý', 'středa', 'čvrtek', 'pátek', 'sobota'], |
|
59 |
shortDays: ['ne.', 'po.', 'út.', 'st.', 'čt.', 'pá.', 'so.'], |
|
60 |
months: ['leden', 'únor', 'březen', 'duben', 'květen', 'červen', 'červenec', 'srpen', 'září', 'říjen', 'listopad', 'prosinec'], |
|
61 |
shortMonths: ['led', 'úno', 'břez', 'dub', 'kvě', 'čer', 'červ', 'srp', 'zář', 'říj', 'list', 'pros'] |
|
62 |
}); |
|
63 | 51 |
|
64 | 52 |
const view = new vega.View(vega.parse(spec, config)) |
65 | 53 |
.tooltip(handler.call) |
66 | 54 |
.initialize(element) |
67 | 55 |
.hover() |
68 |
.locale(loc) |
|
69 | 56 |
.runAsync(); |
70 | 57 |
} |
71 | 58 |
|
Také k dispozici: Unified diff
Re #8914 - Opravit zobrazení grafů pro endpoint analytics