-
Notifications
You must be signed in to change notification settings - Fork 17
/
methods-timerange.js
52 lines (46 loc) · 1.57 KB
/
methods-timerange.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
import JUI from "juijs-chart";
export default {
methods: {
convertToData: function(values) {
let util = JUI.include('util.base');
let data = [];
for(let i = 0; i < values.length; i++) {
let val = values[i];
if(util.typeCheck('array', val)) {
data.push({
'0': val[0],
'1': val[1]
});
}
}
return data;
},
initGraphAxes: function() {
let xAxis = {
type : 'date',
domain : this.labels,
interval : this.axisInterval,
format : this.axisFormat,
line : this.axisXStyle == "none" ? false : this.axisXStyle,
hide : this.axisXStyle == "hidden",
orient : this.axisXPosition,
key : '0',
textRotate: -this.textRotateX
}
let yAxis = {
type : 'range',
domain : [ this.axisMin, this.axisMax ],
step : this.axisStep,
line : this.axisYStyle == "none" ? false : this.axisYStyle,
hide : this.axisYStyle == "hidden",
orient : this.axisYPosition,
textRotate: -this.textRotateY
}
return {
x : (this.axisReverse) ? yAxis : xAxis,
y : (this.axisReverse) ? xAxis : yAxis,
data : this.convertToData(this.values)
}
}
}
}