-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharea.js
More file actions
61 lines (50 loc) · 1.53 KB
/
area.js
File metadata and controls
61 lines (50 loc) · 1.53 KB
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
56
57
58
59
60
61
"use strict";
// the stylesheet resolves to:
// app/plugins/snorkel-plugins-demo/static/styles/area.css
bootloader.add_stylesheet("snorkel-plugins-demo/static/styles/area");
var TimeView = require("app/client/views/time_view");
var helpers = require("app/client/views/helpers");
var AreaView = TimeView.extend({
baseview: helpers.VIEWS.TIME,
initialize: function() {
this.chart_type = 'area';
},
render: function() {
TimeView.prototype.render.apply(this);
this.$el.addClass("area_graph");
}
}, {
icon: "noun/line.svg"
});
function build_custom_controls() {
var custom_controls = $("<div class='clearfix'/>");
var custom_params = SF.controller().get_custom_params();
$C("selector", {
name: "fill_missing",
options: {
"zero" : "Treat as Zero",
"" : "Ignore"
},
selected: custom_params.fill_missing,
}, function(selector) {
$C("query_control_row", {
label: "Missing Data",
component: selector.toString()
}, function(cmp) {
custom_controls.append("<div />");
custom_controls.append(cmp.$el);
});
});
return custom_controls;
}
AreaView.prototype.build_custom_controls = build_custom_controls;
// this directory is relative to app/plugins/
SF.trigger("view:add", "snorkel-plugins-demo/area", {
custom_controls: build_custom_controls,
include: helpers.STD_INPUTS
.concat(helpers.inputs.TIME_BUCKET)
.concat(helpers.inputs.COMPARE)
.concat(helpers.inputs.SORT_BY),
icon: "noun/line.svg"
}, AreaView);
module.exports = AreaView;