-
Notifications
You must be signed in to change notification settings - Fork 17
/
guideline.js
39 lines (34 loc) · 1014 Bytes
/
guideline.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
import graph_core from './core.js'
import jui from "juijs-chart";
export default {
name: 'guideline',
mixins: [ graph_core ],
props: {
tooltipX: {
type: Boolean,
required: false,
default: false
},
tooltipY: {
type: Boolean,
required: false,
default: true
}
},
beforeMount: function(e) {
const time = jui.include('util.time');
const format = this.$parent.axisFormat;
let formatFunc = function(value) {
if(typeof(value) == 'object' && typeof(format) == 'string') {
return time.format(value, format);
} else if(typeof(value) == 'number') {
return Math.round(value);
}
return value;
}
let opts = { type: 'cross' };
if(this.tooltipX) opts.xFormat = formatFunc;
if(this.tooltipY) opts.yFormat = formatFunc;
this.$parent.widgets.push(opts);
}
}