omf_web 0.9.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +31 -0
- data/bin/omf_web_server.rb +157 -0
- data/doc/screenshot2.png +0 -0
- data/doc/widget_detail.png +0 -0
- data/example/demo/data_sources/downloads.rb +2 -1
- data/example/simple/README.md +12 -13
- data/example/simple/create_waveform.rb +29 -0
- data/example/simple/introduction.md +17 -0
- data/example/simple/sample.sq3 +0 -0
- data/example/simple/sample.sql +1008 -0
- data/example/simple/simple.yaml +62 -0
- data/example/simple/simple_dynamic.yaml +66 -0
- data/lib/irods4r/file.rb +15 -14
- data/lib/irods4r/icommands.rb +18 -18
- data/lib/irods4r.rb +9 -9
- data/lib/omf-web/config.ru +41 -16
- data/lib/omf-web/content/git_repository.rb +32 -31
- data/lib/omf-web/content/irods_repository.rb +34 -33
- data/lib/omf-web/content/repository.rb +48 -44
- data/lib/omf-web/data_source_proxy.rb +33 -22
- data/lib/omf-web/rack/session_authenticator.rb +48 -12
- data/lib/omf-web/rack/tab_mapper.rb +30 -36
- data/lib/omf-web/rack/websocket_handler.rb +26 -25
- data/lib/omf-web/session_store.rb +16 -13
- data/lib/omf-web/theme/abstract_page.rb +26 -22
- data/lib/omf-web/theme/bright/page.rb +84 -34
- data/lib/omf-web/theme/bright/stacked_renderer.rb +20 -19
- data/lib/omf-web/theme.rb +14 -9
- data/lib/omf-web/thin/runner.rb +38 -36
- data/lib/omf-web/thin/server.rb +255 -0
- data/lib/omf-web/version.rb +1 -1
- data/lib/omf-web/widget/data_widget.rb +6 -6
- data/lib/omf-web/widget/text/maruku/helpers.rb +33 -30
- data/lib/omf-web/widget/text/maruku/input/parse_block.rb +117 -117
- data/lib/omf-web/widget/text/maruku/output/to_html.rb +155 -154
- data/lib/omf-web/widget/text/maruku.rb +17 -16
- data/omf_web.gemspec +6 -2
- data/sample.sq3 +0 -0
- data/share/htdocs/graph/js/gauge.js +524 -0
- data/share/htdocs/vendor/VERSION_MAP.yaml +3 -3
- data/share/htdocs/vendor/backbone-1.0.0/backbone.js +1571 -0
- data/share/htdocs/vendor/d3-3.0/LICENSE.brewer.txt +38 -0
- data/share/htdocs/vendor/d3-3.0/colorbrewer.js +1 -0
- data/share/htdocs/vendor/d3-3.0/d3.js +8810 -0
- data/share/htdocs/vendor/d3-3.0/d3.min.js +5 -0
- data/share/htdocs/vendor/geo_json/Readme.txt +71 -0
- data/share/htdocs/vendor/geo_json/regions.json +41 -0
- data/share/htdocs/vendor/geo_json/switzerland.json +24 -0
- data/share/htdocs/vendor/geo_json/world.json +497 -0
- data/share/htdocs/vendor/nv_d3/js/nv.d3.js +8801 -4447
- data/share/htdocs/vendor/spin/jquery.spin.js +46 -0
- data/share/htdocs/vendor/spin/spin.js +349 -0
- data/share/htdocs/vendor/spin/spin.min.js +1 -0
- data/share/htdocs/vendor/underscore-1.4.4/underscore.js +1227 -0
- metadata +63 -48
- data/example/simple/data_sources/gimi31.sq3 +0 -0
- data/example/simple/data_sources/ping_source.rb +0 -56
- data/example/simple/simple_viz_server.rb +0 -39
- data/example/simple/widgets/charts_tab.yaml +0 -38
- data/share/.DS_Store +0 -0
- data/share/htdocs/.DS_Store +0 -0
- data/share/htdocs/vendor/backbone-0.5.3/backbone.js +0 -1158
- data/share/htdocs/vendor/underscore-1.2.1/underscore.js +0 -958
@@ -14,11 +14,11 @@ require 'yaml'
|
|
14
14
|
MaRuKu::Globals[:html_math_engine] = 'ritex'
|
15
15
|
|
16
16
|
module OMF::Web::Widget::Text
|
17
|
-
|
17
|
+
|
18
18
|
module Maruku
|
19
|
-
|
19
|
+
|
20
20
|
# # Fetch text and parse it
|
21
|
-
# #
|
21
|
+
# #
|
22
22
|
# def self.load_content(source)
|
23
23
|
# unless File.readable?(source)
|
24
24
|
# raise "Cannot read text file '#{source}'"
|
@@ -26,26 +26,27 @@ module OMF::Web::Widget::Text
|
|
26
26
|
# content = File.open(source).read
|
27
27
|
# ::Maruku.new(content)
|
28
28
|
# end
|
29
|
-
|
29
|
+
|
30
30
|
# Fetch text and parse it
|
31
|
-
#
|
31
|
+
#
|
32
32
|
def self.format_content(content_proxy)
|
33
33
|
unless content_proxy.is_a? OMF::Web::ContentProxy
|
34
34
|
raise "Expected content proxy, but got '#{content_proxy.class}'"
|
35
35
|
end
|
36
36
|
content = content_proxy.content
|
37
|
+
puts ">>>> CREATING NEW MARUKU"
|
37
38
|
::Maruku.new(content)
|
38
39
|
end
|
39
|
-
|
40
|
-
|
40
|
+
|
41
|
+
|
41
42
|
class WidgetElement
|
42
43
|
attr_reader :widget
|
43
|
-
|
44
|
+
|
44
45
|
def initialize(wdescr)
|
45
46
|
@wdescr = wdescr
|
46
47
|
@widget = OMF::Web::Widget.create_widget(wdescr)
|
47
48
|
end
|
48
|
-
|
49
|
+
|
49
50
|
def to_html
|
50
51
|
content = @widget.content
|
51
52
|
h = content.to_html
|
@@ -54,20 +55,20 @@ module OMF::Web::Widget::Text
|
|
54
55
|
end
|
55
56
|
::REXML::Document.new("<div class='embedded'>#{h}</div>").root
|
56
57
|
end
|
57
|
-
|
58
|
+
|
58
59
|
def node_type
|
59
60
|
:widget
|
60
61
|
end
|
61
62
|
end
|
62
|
-
|
63
|
+
|
63
64
|
OpenMatch = /^\s*\{\{\{\s*(.*)$/
|
64
65
|
CloseMatch = /(.*)\}\}\}/
|
65
|
-
|
66
|
+
|
66
67
|
MaRuKu::In::Markdown::register_block_extension(
|
67
68
|
:regexp => OpenMatch,
|
68
69
|
:handler => lambda { |doc, src, context|
|
69
70
|
lines = []
|
70
|
-
|
71
|
+
|
71
72
|
line = src.shift_line
|
72
73
|
line =~ OpenMatch
|
73
74
|
line = $1
|
@@ -88,18 +89,18 @@ module OMF::Web::Widget::Text
|
|
88
89
|
true
|
89
90
|
}
|
90
91
|
)
|
91
|
-
|
92
|
+
|
92
93
|
end # module Maruku
|
93
94
|
|
94
95
|
end # OMF::Web::Widget::Text
|
95
96
|
|
96
97
|
# module MaRuKu::Out::HTML
|
97
|
-
#
|
98
|
+
#
|
98
99
|
# def to_html_viz
|
99
100
|
# span = Element.new 'javascript'
|
100
101
|
# span.attributes['class'] = 'maruku_section_number'
|
101
102
|
# span << Text.new('Foooo')
|
102
103
|
# add_ws span
|
103
104
|
# end
|
104
|
-
#
|
105
|
+
#
|
105
106
|
# end
|
data/omf_web.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
# specify any dependencies here; for example:
|
22
22
|
# s.add_development_dependency "minitest", "~> 2.11.3"
|
23
|
-
s.add_runtime_dependency "omf_oml", "~> 0
|
23
|
+
s.add_runtime_dependency "omf_oml", "~> 1.0"
|
24
24
|
s.add_runtime_dependency "erector", "~> 0.8.3"
|
25
25
|
s.add_runtime_dependency "activesupport", "~> 3.0.0" # required by erector:table
|
26
26
|
s.add_runtime_dependency "rack", "~> 1.3.5"
|
@@ -32,6 +32,10 @@ Gem::Specification.new do |s|
|
|
32
32
|
s.add_runtime_dependency "json", "~> 1.7.3"
|
33
33
|
s.add_runtime_dependency "grit", "~> 2.5.0"
|
34
34
|
s.add_runtime_dependency "sqlite3", "~> 1.3.6"
|
35
|
-
s.add_runtime_dependency "postgres-pr", "~> 0.6.3"
|
35
|
+
s.add_runtime_dependency "postgres-pr", "~> 0.6.3"
|
36
36
|
s.add_runtime_dependency "websocket-rack", "~> 0.4.0"
|
37
|
+
s.add_runtime_dependency "rack-accept", "~> 0.4.5"
|
38
|
+
|
39
|
+
s.add_runtime_dependency "ruby-openid", "~> 2.2.3"
|
40
|
+
|
37
41
|
end
|
data/sample.sq3
ADDED
File without changes
|
@@ -0,0 +1,524 @@
|
|
1
|
+
/**
|
2
|
+
* Code borrowed from http://tomerdoron.blogspot.com/2011/12/google-style-gauges-using-d3js.html
|
3
|
+
* Gist: https://gist.github.com/1499279
|
4
|
+
*/
|
5
|
+
|
6
|
+
L.provide('OML.gauge', ["graph/js/abstract_chart", "#OML.abstract_chart"], function () {
|
7
|
+
|
8
|
+
OML.gauge = OML.abstract_chart.extend({
|
9
|
+
//this.opts = opts;
|
10
|
+
|
11
|
+
decl_properties: [
|
12
|
+
['value', 'key', {property: 'value'}],
|
13
|
+
['id', 'key'],
|
14
|
+
// ['y_axis', 'key', {property: 'y'}],
|
15
|
+
['radius', 'int', 10],
|
16
|
+
['stroke_width', 'int', 2],
|
17
|
+
['stroke_color', 'color', 'black'],
|
18
|
+
['fill_color', 'color', 'orange']
|
19
|
+
],
|
20
|
+
|
21
|
+
defaults: function() {
|
22
|
+
return this.deep_defaults({
|
23
|
+
diameter: 0.9,
|
24
|
+
margin: {
|
25
|
+
left: 20,
|
26
|
+
top: 20,
|
27
|
+
right: 20,
|
28
|
+
bottom: 20
|
29
|
+
},
|
30
|
+
}, OML.gauge.__super__.defaults.call(this));
|
31
|
+
},
|
32
|
+
|
33
|
+
configure_base_layer: function(vis) {
|
34
|
+
this.gauges_ctxt = {}; // keep context for each gauge
|
35
|
+
|
36
|
+
var base = this.base_layer = vis.append("svg:g")
|
37
|
+
.attr("class", "gauges")
|
38
|
+
;
|
39
|
+
|
40
|
+
this.legend_layer = base.append("svg:g");
|
41
|
+
this.gauges = []; // where we keep the gauge instances
|
42
|
+
|
43
|
+
},
|
44
|
+
|
45
|
+
redraw: function(data) {
|
46
|
+
var self = this;
|
47
|
+
var o = this.opts;
|
48
|
+
var ca = this.widget_area;
|
49
|
+
|
50
|
+
var m = this.mapping;
|
51
|
+
var value_f = m.value;
|
52
|
+
var id_f = m.id;
|
53
|
+
|
54
|
+
var fd = _.filter(data, function(d) {return value_f(d) >= 0});
|
55
|
+
var sd = _.groupBy(fd, id_f);
|
56
|
+
var d = _.map(sd, function(v, k) {return _.last(v)});
|
57
|
+
data = d;
|
58
|
+
var data_len = self.gauges.length;
|
59
|
+
|
60
|
+
var remove = function(array, from, to) {
|
61
|
+
var rest = array.slice((to || from) + 1 || array.length);
|
62
|
+
array.length = from < 0 ? array.length + from : from;
|
63
|
+
return array.push.apply(array, rest);
|
64
|
+
};
|
65
|
+
|
66
|
+
var gauges = this.base_layer
|
67
|
+
.selectAll(".gauge")
|
68
|
+
.data(data, function(d) {
|
69
|
+
return id_f(d);
|
70
|
+
})
|
71
|
+
;
|
72
|
+
gauges.enter()
|
73
|
+
.append("svg:g")
|
74
|
+
.attr("class", "gauge")
|
75
|
+
.each(function(d, i) {
|
76
|
+
var opts = {
|
77
|
+
min: 0, max: 15000,
|
78
|
+
majorTicks: 5, minorTicks: 5
|
79
|
+
};
|
80
|
+
var g = self.create_gauge(this, ca, opts)();
|
81
|
+
var i = self.gauges.length;
|
82
|
+
self.gauges.push({el: this, gauge: g});
|
83
|
+
g.update(value_f(d), i, i + 1);
|
84
|
+
})
|
85
|
+
;
|
86
|
+
// update
|
87
|
+
gauges.each(function(d, i) {
|
88
|
+
var i; var n = self.gauges.length;
|
89
|
+
for (i = 0; i < n; i++) {
|
90
|
+
var g = self.gauges[i];
|
91
|
+
if (g.el == this) {
|
92
|
+
g.gauge.update(value_f(d), i, n);
|
93
|
+
break;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
});
|
97
|
+
gauges.exit()
|
98
|
+
.transition().duration(300).style("opacity", 0)
|
99
|
+
.each("end", function(d) {
|
100
|
+
console.log(d);
|
101
|
+
var i; var n = self.gauges.length;
|
102
|
+
for (i = 0; i < n; i++) {
|
103
|
+
var g = self.gauges[i];
|
104
|
+
if (g.el == this) {
|
105
|
+
remove(self.gauges, i);
|
106
|
+
break;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
})
|
110
|
+
.remove();
|
111
|
+
},
|
112
|
+
|
113
|
+
create_gauge: function(base_el, widget_area, opts) {
|
114
|
+
var selection = d3.select(base_el);
|
115
|
+
var range;
|
116
|
+
var raduis, cx, cy, size;
|
117
|
+
var body_layer, pointer_layer;
|
118
|
+
|
119
|
+
function g() {
|
120
|
+
return g;
|
121
|
+
}
|
122
|
+
|
123
|
+
g.update = function(value, gauge_idx, gauge_cnt) {
|
124
|
+
range = opts.max - opts.min;
|
125
|
+
var ca = widget_area;
|
126
|
+
var h = ca.h / gauge_cnt;
|
127
|
+
var y_off = ca.oh - ca.h - ca.y;
|
128
|
+
y_off += h * gauge_idx;
|
129
|
+
var w = ca.w;
|
130
|
+
var x_off = ca.x;
|
131
|
+
|
132
|
+
cx = ca.w / 2
|
133
|
+
cy = h / 2;
|
134
|
+
size = (h > w ? w : h);
|
135
|
+
scale = 1.0 / 2;
|
136
|
+
raduis = scale * size;
|
137
|
+
|
138
|
+
var t = "translate(" + x_off + ", " + y_off + ")";
|
139
|
+
selection.attr("transform", t);
|
140
|
+
|
141
|
+
var gb = selection.selectAll(".gauge_body")
|
142
|
+
.data([[opts.max, opts.min, size]], function(d) { return d });
|
143
|
+
gb.enter()
|
144
|
+
.append("svg:g")
|
145
|
+
.attr("class", "gauge_body")
|
146
|
+
.each(function(d) {draw_body(this)})
|
147
|
+
;
|
148
|
+
gb.exit().remove();
|
149
|
+
|
150
|
+
var gp = selection.selectAll(".gauge_pointer")
|
151
|
+
.data([[value, opts.max, opts.min, size]], function(d) { return d });
|
152
|
+
gp.enter()
|
153
|
+
.append("svg:g")
|
154
|
+
.attr("class", "gauge_pointer")
|
155
|
+
.each(function(d) {draw_pointer(value, this)})
|
156
|
+
;
|
157
|
+
gp.each(function(d) {draw_pointer(value, this)})
|
158
|
+
gp.exit().remove();
|
159
|
+
|
160
|
+
return g;
|
161
|
+
|
162
|
+
}
|
163
|
+
|
164
|
+
function draw_body(body_el) {
|
165
|
+
body_layer = d3.select(body_el);
|
166
|
+
|
167
|
+
body_layer.append("svg:circle")
|
168
|
+
.attr("cx", cx)
|
169
|
+
.attr("cy", cy)
|
170
|
+
.attr("r", raduis)
|
171
|
+
.style("fill", "#ccc")
|
172
|
+
.style("stroke", "#000")
|
173
|
+
.style("stroke-width", "0.5px");
|
174
|
+
|
175
|
+
body_layer.append("svg:circle")
|
176
|
+
.attr("cx", cx)
|
177
|
+
.attr("cy", cy)
|
178
|
+
.attr("r", 0.9 * raduis)
|
179
|
+
.style("fill", "#fff")
|
180
|
+
.style("stroke", "#e0e0e0")
|
181
|
+
.style("stroke-width", "2px");
|
182
|
+
|
183
|
+
|
184
|
+
draw_scale();
|
185
|
+
|
186
|
+
}
|
187
|
+
|
188
|
+
function draw_scale() {
|
189
|
+
var fontSize = Math.round(size / 16);
|
190
|
+
var majorDelta = range / (opts.majorTicks - 1);
|
191
|
+
for (var major = opts.min; major <= opts.max; major += majorDelta) {
|
192
|
+
var minorDelta = majorDelta / opts.minorTicks;
|
193
|
+
for (var minor = major + minorDelta; minor < Math.min(major + majorDelta, opts.max); minor += minorDelta) {
|
194
|
+
var point1 = valueToPoint(minor, 0.75);
|
195
|
+
var point2 = valueToPoint(minor, 0.85);
|
196
|
+
body_layer.append("svg:line")
|
197
|
+
.attr("x1", point1.x)
|
198
|
+
.attr("y1", point1.y)
|
199
|
+
.attr("x2", point2.x)
|
200
|
+
.attr("y2", point2.y)
|
201
|
+
.style("stroke", "#666")
|
202
|
+
.style("stroke-width", "1px");
|
203
|
+
}
|
204
|
+
|
205
|
+
var point1 = valueToPoint(major, 0.7);
|
206
|
+
var point2 = valueToPoint(major, 0.85);
|
207
|
+
body_layer.append("svg:line")
|
208
|
+
.attr("x1", point1.x)
|
209
|
+
.attr("y1", point1.y)
|
210
|
+
.attr("x2", point2.x)
|
211
|
+
.attr("y2", point2.y)
|
212
|
+
.style("stroke", "#333")
|
213
|
+
.style("stroke-width", "2px");
|
214
|
+
|
215
|
+
if (major == opts.min || major == opts.max) {
|
216
|
+
var point = valueToPoint(major, 0.63);
|
217
|
+
body_layer.append("svg:text")
|
218
|
+
.attr("x", point.x)
|
219
|
+
.attr("y", point.y)
|
220
|
+
.attr("dy", fontSize / 3)
|
221
|
+
.attr("text-anchor", major == opts.min ? "start" : "end")
|
222
|
+
.text(d3.format('.3s')(major))
|
223
|
+
.style("font-size", fontSize + "px")
|
224
|
+
.style("fill", "#333")
|
225
|
+
.style("stroke-width", "0px");
|
226
|
+
}
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
function draw_pointer(value, pointer_el) {
|
231
|
+
pointer_layer = d3.select(pointer_el);
|
232
|
+
|
233
|
+
var delta = range / 13;
|
234
|
+
|
235
|
+
var head = valueToPoint(value, 0.85);
|
236
|
+
var head1 = valueToPoint(value - delta, 0.12);
|
237
|
+
var head2 = valueToPoint(value + delta, 0.12);
|
238
|
+
|
239
|
+
var tailValue = value - (range * (1/(270/360)) / 2);
|
240
|
+
var tail = valueToPoint(tailValue, 0.28);
|
241
|
+
var tail1 = valueToPoint(tailValue - delta, 0.12);
|
242
|
+
var tail2 = valueToPoint(tailValue + delta, 0.12);
|
243
|
+
|
244
|
+
var data = [head, head1, tail2, tail, tail1, head2, head];
|
245
|
+
|
246
|
+
var line = d3.svg.line()
|
247
|
+
.x(function(d) { return d.x })
|
248
|
+
.y(function(d) { return d.y })
|
249
|
+
.interpolate("basis");
|
250
|
+
|
251
|
+
//var pointerContainer = body.select(".pointerContainer");
|
252
|
+
var pointer = pointer_layer.selectAll("path").data([data])
|
253
|
+
|
254
|
+
pointer.enter()
|
255
|
+
.append("svg:path")
|
256
|
+
.attr("d", line)
|
257
|
+
.style("fill", "#dc3912")
|
258
|
+
.style("stroke", "#c63310")
|
259
|
+
.style("fill-opacity", 0.7)
|
260
|
+
|
261
|
+
pointer.transition()
|
262
|
+
.attr("d", line)
|
263
|
+
//.ease("linear")
|
264
|
+
//.duration(5000);
|
265
|
+
|
266
|
+
// pointer_layer = selection.append("svg:g").attr("class", "pointerContainer");
|
267
|
+
// draw_pointer(0);
|
268
|
+
// middle knob
|
269
|
+
pointer_layer.append("svg:circle")
|
270
|
+
.attr("cx", cx)
|
271
|
+
.attr("cy", cy)
|
272
|
+
.attr("r", 0.12 * raduis)
|
273
|
+
.style("fill", "#4684EE")
|
274
|
+
.style("stroke", "#666")
|
275
|
+
.style("opacity", 1);
|
276
|
+
|
277
|
+
|
278
|
+
// Value as text
|
279
|
+
var fontSize = Math.round(size / 10);
|
280
|
+
var text = d3.format('.2e')(Math.round(value));
|
281
|
+
pointer_layer.selectAll("text")
|
282
|
+
.data([value])
|
283
|
+
.text(text)
|
284
|
+
.enter()
|
285
|
+
.append("svg:text")
|
286
|
+
.attr("x", cx)
|
287
|
+
.attr("y", size - cy / 5 - fontSize)
|
288
|
+
.attr("dy", fontSize / 2)
|
289
|
+
.attr("text-anchor", "middle")
|
290
|
+
.text(text)
|
291
|
+
.style("font-size", fontSize + "px")
|
292
|
+
.style("fill", "#000")
|
293
|
+
.style("stroke-width", "0px");
|
294
|
+
}
|
295
|
+
|
296
|
+
function valueToDegrees(value) {
|
297
|
+
return value / range * 270 - 45;
|
298
|
+
}
|
299
|
+
|
300
|
+
function valueToRadians(value) {
|
301
|
+
return valueToDegrees(value) * Math.PI / 180;
|
302
|
+
}
|
303
|
+
|
304
|
+
function valueToPoint(value, factor) {
|
305
|
+
var point = {
|
306
|
+
x: cx - raduis * factor * Math.cos(valueToRadians(value)),
|
307
|
+
y: cy - raduis * factor * Math.sin(valueToRadians(value))
|
308
|
+
}
|
309
|
+
return point;
|
310
|
+
}
|
311
|
+
|
312
|
+
|
313
|
+
return g;
|
314
|
+
},
|
315
|
+
|
316
|
+
|
317
|
+
|
318
|
+
})
|
319
|
+
})
|
320
|
+
|
321
|
+
// for (var index in ctxt.greenZones)
|
322
|
+
// {
|
323
|
+
// this.drawBand(ctxt.greenZones[index].from, ctxt.greenZones[index].to, self.config.greenColor);
|
324
|
+
// }
|
325
|
+
//
|
326
|
+
// for (var index in ctxt.yellowZones)
|
327
|
+
// {
|
328
|
+
// this.drawBand(ctxt.yellowZones[index].from, ctxt.yellowZones[index].to, self.config.yellowColor);
|
329
|
+
// }
|
330
|
+
//
|
331
|
+
// for (var index in ctxt.redZones)
|
332
|
+
// {
|
333
|
+
// this.drawBand(ctxt.redZones[index].from, ctxt.redZones[index].to, self.config.redColor);
|
334
|
+
// }
|
335
|
+
//
|
336
|
+
// if (undefined != ctxt.label)
|
337
|
+
// {
|
338
|
+
// var fontSize = Math.round(ctxt.size / 9);
|
339
|
+
// this.body.append("svg:text")
|
340
|
+
// .attr("x", ctxt.cx)
|
341
|
+
// .attr("y", ctxt.cy / 2 + fontSize / 2)
|
342
|
+
// .attr("dy", fontSize / 2)
|
343
|
+
// .attr("text-anchor", "middle")
|
344
|
+
// .text(ctxt.label)
|
345
|
+
// .style("font-size", fontSize + "px")
|
346
|
+
// .style("fill", "#333")
|
347
|
+
// .style("stroke-width", "0px");
|
348
|
+
// }
|
349
|
+
//
|
350
|
+
//
|
351
|
+
// var pointerContainer = this.body.append("svg:g").attr("class", "pointerContainer");
|
352
|
+
// this.drawPointer(0);
|
353
|
+
// pointerContainer.append("svg:circle")
|
354
|
+
// .attr("cx", ctxt.cx)
|
355
|
+
// .attr("cy", ctxt.cy)
|
356
|
+
// .attr("r", 0.12 * ctxt.raduis)
|
357
|
+
// .style("fill", "#4684EE")
|
358
|
+
// .style("stroke", "#666")
|
359
|
+
// .style("opacity", 1);
|
360
|
+
//
|
361
|
+
// *********
|
362
|
+
//
|
363
|
+
// function Gauge(placeholderName, configuration)
|
364
|
+
// {
|
365
|
+
// this.placeholderName = placeholderName;
|
366
|
+
//
|
367
|
+
// var self = this; // some internal d3 functions do not "like" the "this" keyword, hence setting a local variable
|
368
|
+
//
|
369
|
+
// ctxture = function(configuration)
|
370
|
+
// {
|
371
|
+
// ctxt = configuration;
|
372
|
+
//
|
373
|
+
// ctxt.size = ctxt.size * 0.9;
|
374
|
+
//
|
375
|
+
// ctxt.raduis = ctxt.size * 0.97 / 2;
|
376
|
+
// ctxt.cx = ctxt.size / 2;
|
377
|
+
// ctxt.cy = ctxt.size / 2;
|
378
|
+
//
|
379
|
+
// ctxt.min = configuration.min || 0;
|
380
|
+
// ctxt.max = configuration.max || 100;
|
381
|
+
// ctxt.range = ctxt.max - ctxt.min;
|
382
|
+
//
|
383
|
+
// ctxt.majorTicks = configuration.majorTicks || 5;
|
384
|
+
// ctxt.minorTicks = configuration.minorTicks || 2;
|
385
|
+
//
|
386
|
+
// ctxt.greenColor = configuration.greenColor || "#109618";
|
387
|
+
// ctxt.yellowColor = configuration.yellowColor || "#FF9900";
|
388
|
+
// ctxt.redColor = configuration.redColor || "#DC3912";
|
389
|
+
// }
|
390
|
+
//
|
391
|
+
// this.render = function()
|
392
|
+
// {
|
393
|
+
// this.body = d3.select("#" + this.placeholderName)
|
394
|
+
// .append("svg:svg")
|
395
|
+
// .attr("class", "gauge")
|
396
|
+
// .attr("width", ctxt.size)
|
397
|
+
// .attr("height", ctxt.size);
|
398
|
+
//
|
399
|
+
// this.body.append("svg:circle")
|
400
|
+
// .attr("cx", ctxt.cx)
|
401
|
+
// .attr("cy", ctxt.cy)
|
402
|
+
// .attr("r", ctxt.raduis)
|
403
|
+
// .style("fill", "#ccc")
|
404
|
+
// .style("stroke", "#000")
|
405
|
+
// .style("stroke-width", "0.5px");
|
406
|
+
//
|
407
|
+
// this.body.append("svg:circle")
|
408
|
+
// .attr("cx", ctxt.cx)
|
409
|
+
// .attr("cy", ctxt.cy)
|
410
|
+
// .attr("r", 0.9 * ctxt.raduis)
|
411
|
+
// .style("fill", "#fff")
|
412
|
+
// .style("stroke", "#e0e0e0")
|
413
|
+
// .style("stroke-width", "2px");
|
414
|
+
//
|
415
|
+
// for (var index in ctxt.greenZones)
|
416
|
+
// {
|
417
|
+
// this.drawBand(ctxt.greenZones[index].from, ctxt.greenZones[index].to, self.config.greenColor);
|
418
|
+
// }
|
419
|
+
//
|
420
|
+
// for (var index in ctxt.yellowZones)
|
421
|
+
// {
|
422
|
+
// this.drawBand(ctxt.yellowZones[index].from, ctxt.yellowZones[index].to, self.config.yellowColor);
|
423
|
+
// }
|
424
|
+
//
|
425
|
+
// for (var index in ctxt.redZones)
|
426
|
+
// {
|
427
|
+
// this.drawBand(ctxt.redZones[index].from, ctxt.redZones[index].to, self.config.redColor);
|
428
|
+
// }
|
429
|
+
//
|
430
|
+
// if (undefined != ctxt.label)
|
431
|
+
// {
|
432
|
+
// var fontSize = Math.round(ctxt.size / 9);
|
433
|
+
// this.body.append("svg:text")
|
434
|
+
// .attr("x", ctxt.cx)
|
435
|
+
// .attr("y", ctxt.cy / 2 + fontSize / 2)
|
436
|
+
// .attr("dy", fontSize / 2)
|
437
|
+
// .attr("text-anchor", "middle")
|
438
|
+
// .text(ctxt.label)
|
439
|
+
// .style("font-size", fontSize + "px")
|
440
|
+
// .style("fill", "#333")
|
441
|
+
// .style("stroke-width", "0px");
|
442
|
+
// }
|
443
|
+
//
|
444
|
+
// var fontSize = Math.round(ctxt.size / 16);
|
445
|
+
// var majorDelta = ctxt.range / (ctxt.majorTicks - 1);
|
446
|
+
// for (var major = ctxt.min; major <= ctxt.max; major += majorDelta)
|
447
|
+
// {
|
448
|
+
// var minorDelta = majorDelta / ctxt.minorTicks;
|
449
|
+
// for (var minor = major + minorDelta; minor < Math.min(major + majorDelta, ctxt.max); minor += minorDelta)
|
450
|
+
// {
|
451
|
+
// var point1 = this.valueToPoint(minor, 0.75);
|
452
|
+
// var point2 = this.valueToPoint(minor, 0.85);
|
453
|
+
//
|
454
|
+
// this.body.append("svg:line")
|
455
|
+
// .attr("x1", point1.x)
|
456
|
+
// .attr("y1", point1.y)
|
457
|
+
// .attr("x2", point2.x)
|
458
|
+
// .attr("y2", point2.y)
|
459
|
+
// .style("stroke", "#666")
|
460
|
+
// .style("stroke-width", "1px");
|
461
|
+
// }
|
462
|
+
//
|
463
|
+
// var point1 = this.valueToPoint(major, 0.7);
|
464
|
+
// var point2 = this.valueToPoint(major, 0.85);
|
465
|
+
//
|
466
|
+
// this.body.append("svg:line")
|
467
|
+
// .attr("x1", point1.x)
|
468
|
+
// .attr("y1", point1.y)
|
469
|
+
// .attr("x2", point2.x)
|
470
|
+
// .attr("y2", point2.y)
|
471
|
+
// .style("stroke", "#333")
|
472
|
+
// .style("stroke-width", "2px");
|
473
|
+
//
|
474
|
+
// if (major == ctxt.min || major == ctxt.max)
|
475
|
+
// {
|
476
|
+
// var point = this.valueToPoint(major, 0.63);
|
477
|
+
//
|
478
|
+
// this.body.append("svg:text")
|
479
|
+
// .attr("x", point.x)
|
480
|
+
// .attr("y", point.y)
|
481
|
+
// .attr("dy", fontSize / 3)
|
482
|
+
// .attr("text-anchor", major == ctxt.min ? "start" : "end")
|
483
|
+
// .text(major)
|
484
|
+
// .style("font-size", fontSize + "px")
|
485
|
+
// .style("fill", "#333")
|
486
|
+
// .style("stroke-width", "0px");
|
487
|
+
// }
|
488
|
+
// }
|
489
|
+
//
|
490
|
+
// var pointerContainer = this.body.append("svg:g").attr("class", "pointerContainer");
|
491
|
+
// this.drawPointer(0);
|
492
|
+
// pointerContainer.append("svg:circle")
|
493
|
+
// .attr("cx", ctxt.cx)
|
494
|
+
// .attr("cy", ctxt.cy)
|
495
|
+
// .attr("r", 0.12 * ctxt.raduis)
|
496
|
+
// .style("fill", "#4684EE")
|
497
|
+
// .style("stroke", "#666")
|
498
|
+
// .style("opacity", 1);
|
499
|
+
// }
|
500
|
+
//
|
501
|
+
// this.redraw = function(value)
|
502
|
+
// {
|
503
|
+
// this.drawPointer(value);
|
504
|
+
// }
|
505
|
+
//
|
506
|
+
// this.drawBand = function(start, end, color)
|
507
|
+
// {
|
508
|
+
// if (0 >= end - start) return;
|
509
|
+
//
|
510
|
+
// this.body.append("svg:path")
|
511
|
+
// .style("fill", color)
|
512
|
+
// .attr("d", d3.svg.arc()
|
513
|
+
// .startAngle(this.valueToRadians(start))
|
514
|
+
// .endAngle(this.valueToRadians(end))
|
515
|
+
// .innerRadius(0.65 * ctxt.raduis)
|
516
|
+
// .outerRadius(0.85 * ctxt.raduis))
|
517
|
+
// .attr("transform", function() { return "translate(" + self.config.cx + ", " + self.config.cy + ") rotate(270)" });
|
518
|
+
// }
|
519
|
+
//
|
520
|
+
//
|
521
|
+
//
|
522
|
+
// // initialization
|
523
|
+
// ctxture(configuration);
|
524
|
+
// }
|
@@ -1,7 +1,7 @@
|
|
1
|
-
backbone: backbone-0.
|
1
|
+
backbone: backbone-1.0.0
|
2
2
|
bootstrap: bootstrap-2.3.1
|
3
3
|
codemirror: CodeMirror-2.32
|
4
|
-
d3: d3-
|
4
|
+
d3: d3-3.0
|
5
5
|
jquery: jquery-1.7.2
|
6
6
|
jquery-ui: jquery-ui-1.8.23
|
7
7
|
mustache: mustache-0.7.0
|
@@ -9,4 +9,4 @@ raphael: raphael-2.1.0
|
|
9
9
|
silk_icons: silk_icons_v013
|
10
10
|
slickgrid: slickgrid-200512
|
11
11
|
stacktrace: stacktrace-0.3
|
12
|
-
underscore: underscore-1.
|
12
|
+
underscore: underscore-1.4.4
|