-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cedar.js
69 lines (61 loc) · 2.14 KB
/
Cedar.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
define([
'dojo/_base/declare',
'dijit/_WidgetBase',
'dijit/_TemplatedMixin',
'dijit/_WidgetsInTemplateMixin',
'gis/dijit/_FloatingWidgetMixin',
'dojo/query',
'dojo/topic',
'dojo/text!./Cedar/templates/Cedar.html',
'./Cedar/cedar',
'dijit/layout/ContentPane',
'dijit/registry'
], function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _FloatingWidgetMixin, query, topic, Template, Cedar, ContentPane, registry) {
var mapurl;
var cedarChart;
var pane;
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _FloatingWidgetMixin], {
widgetsInTemplate: true,
templateString: Template,
postCreate: function () {
this.inherited(arguments);
},
onCreateCedar: function()
{
mapurl = document.getElementById('mapSvrUrl').value;
if (!pane)
{
var tabsid = query(".attributesTabContainer")[0].id;
var tabs = registry.byId(tabsid);
pane = new ContentPane({ title: "Cedar Chart", content: '<div id="cedarchart"></div>' });
tabs.addChild(pane);
tabs.selectChild(pane);
}
//open the bottom pane
topic.publish('viewer/togglePane', {
pane: 'bottom',
show: 'block'
});
cedarChart = new Cedar({
"type":"scatter",
"dataset":{
"url": mapurl,
"query":{},
"mappings":{
"x": {"field":"Number_of","label":"Student Enrollment (2008)"},
"y": {"field":"F_of_teach","label":"Fraction of Teachers"},
"color":{"field":"Type","label":"Facility Type"}
}
}
});
cedarChart.tooltip = {
"title": "{Name}",
"content": "{Number_of} students"
}
cedarChart.show({
elementId: "#cedarchart",
autolabels: true
});
}
});
});