togostanza 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2be783949cf427be67ec3a47efe59ed5f91f5b94
4
- data.tar.gz: 86cebe957aa1608b6baf2ae48d57e9ccf9aea223
3
+ metadata.gz: fc97dbc3b87d24a73ca0648a0e073e32e2bb2906
4
+ data.tar.gz: ba821a103ec7b2d44e7c089535eb7ac929a8c636
5
5
  SHA512:
6
- metadata.gz: 6b5d7eea816c3f1ecd30ab1f21e0eaf66a52b85edf141a33c1e51d71fdc14e894a00cb1a2a3bf40c5555cd21b3c7628e6d22a378c63aa22f6bf175490b7aeff9
7
- data.tar.gz: 5114732733d67d2166c9bdd49fb277f8acc83f23639393dfd07636141ab2375916438602df307a74e1a07b7ca1c22fc4de4ff0ea0c11f88c191db55a01a2639e
6
+ metadata.gz: 8cf4e437c60074dae984afd871a7e715ab1418ea25e78e28f047121352abcdb0b32713d683b26eef24c432af8358699075edebff85c18a9e8218391c90ca3bee
7
+ data.tar.gz: 743c1e1ebf7be8098faa23d1d020b415347406881e98268309a2ad7fc984a087f7784954d4d644a066c2b58a0de0b895195556e587737841c8ec43510af6e4dc
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Keita Urashima
1
+ Copyright (c) 2013 Database Center for Life Science (DBCLS)
2
2
 
3
3
  MIT License
4
4
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  body {
4
4
  background-color: #fff;
5
- font-family: "Helvetica Neue","Arial",san-serif;
5
+ font-family: "Arial",san-serif;
6
6
  height: 160px;
7
7
  font-size: 12px;
8
8
  line-height: 140%;
@@ -20,18 +20,96 @@ h1 {
20
20
  position: absolute;
21
21
  width: 100%;
22
22
  margin: 0;
23
- padding: 0 10px 6px;
24
- bottom: 0;
23
+ padding: 0 4px 6px;
24
+ top: 6px;
25
25
  left: 0;
26
26
  box-sizing: border-box;
27
- font-size: 14px;
27
+ font-size: 12px;
28
28
  line-height: 14px;
29
- font-weight: normal;
30
- color: #45b8cc;
29
+ font-weight: bold;
30
+ /*color: #45b8cc;*/
31
+ color: #000;
31
32
  text-align: center;
32
33
  text-shadow: -1px -1px 0px #fff, -1px 0px 0px #fff, -1px 1px 0px #fff, 0px -1px 0px #fff, 0px 1px 0px #fff, 1px -1px 0px #fff, 1px 0px 0px #fff, 1px 1px 0px #fff;
33
34
  z-index: 1;
34
35
  }
36
+ #main-view {
37
+ position: relative;
38
+ width: 100%;
39
+ height: 160px;
40
+ }
41
+
42
+
43
+ /* color scheme
44
+ -------------------------- */
45
+ .gene { color: #8db93c; }
46
+ .nc-rna { color: #45b8cc; }
47
+ .t-rna { color: #ed6592; }
48
+ .r-rna { color: #e59033; }
49
+
50
+ /* misc.
51
+ -------------------------- */
52
+ .hidden {
53
+ display: none;
54
+ }
55
+ .n-slash-a {
56
+ color: #bfbeba;
57
+ letter-spacing: .25em;
58
+ }
59
+
60
+
61
+ /* svg
62
+ -------------------------- */
63
+ .font-size-large {
64
+ font-size: 36px;
65
+ }
66
+ .font-size-middle {
67
+ font-size: 20px;
68
+ }
69
+ .font-size-small {
70
+ font-size: 12px;
71
+ }
72
+ .fill-base-color,
73
+ .unit {
74
+ fill: #249eb3;
75
+ }
76
+ .fill-black {
77
+ fill: #333030;
78
+ }
79
+ .fill-gray {
80
+ fill: #bfbeba;
81
+ }
82
+ .fill-light-gray {
83
+ fill: #e5e5e4;
84
+ }
85
+ .stroke-base-color {
86
+ stroke: #249eb3;
87
+ }
88
+ .stroke-black {
89
+ stroke: #333030;
90
+ }
91
+ .stroke-gray {
92
+ stroke: #bfbeba;
93
+ }
94
+ .stroke-light-gray {
95
+ stroke: #e5e5e4;
96
+ }
97
+ .bold {
98
+ font-weight: bold;
99
+ }
100
+ .text-anchor-start {
101
+ text-anchor: start;
102
+ }
103
+ .text-anchor-middle {
104
+ text-anchor: middle;
105
+ }
106
+ .text-anchor-end {
107
+ text-anchor: end;
108
+ }
109
+ .dash {
110
+ stroke-dasharray: 2 2;
111
+ }
112
+
35
113
 
36
114
 
37
115
  /* extension
@@ -56,7 +134,7 @@ h1 {
56
134
  opacity: 1;
57
135
  }
58
136
  #extension p {
59
- margin: 0 10px;
137
+ margin: 0 10px;
60
138
  }
61
139
  #extension a {
62
140
  color: #fff;
@@ -78,7 +156,7 @@ h1 {
78
156
  -------------------------- */
79
157
  .single-text-view {
80
158
  margin: 0;
81
- line-height: 150px;
159
+ line-height: 164px;
82
160
  text-align: center;
83
161
  font-weight: bold;
84
162
  font-size: 16px;
@@ -95,6 +173,7 @@ h1 {
95
173
  font-size: 50%;
96
174
  font-weight: normal;
97
175
  margin-right: -5px;
176
+ color: #249eb3;
98
177
  }
99
178
  p.text-size-small {
100
179
  font-size: 32px;
@@ -110,18 +189,80 @@ p.text-size-large {
110
189
  padding: 0 12px;
111
190
  line-height: 16px;
112
191
  font-weight: bold;
113
- position: relative;
192
+ position: absolute;
193
+ bottom: 6px;
114
194
  }
115
195
 
116
196
 
117
197
  /* image
118
198
  -------------------------- */
119
- img.single-image {
120
- width: 300%;
199
+ img.single-image-view {
200
+ width: 100%;
121
201
  height: auto;
122
202
  position: absolute;
123
203
  top: 50%;
124
204
  -webkit-transform: translateY(-50%);
205
+ -moz-transform: translateY(-50%);
206
+ transform: translateY(-50%);
207
+ }
208
+
209
+
210
+ /* growth temperature
211
+ -------------------------- */
212
+ .thermophile {
213
+ fill: #ff8b00;
214
+ }
215
+ .mesophile {
216
+ fill: #e7ed4d;
217
+ }
218
+ .psychrophile {
219
+ fill: #66c0ed;
220
+ }
221
+
222
+
223
+ /* figure
224
+ -------------------------- */
225
+ figure {
226
+ position: relative;
227
+ width: 100%;
228
+ height: 100%;
229
+ text-align: center;
230
+ margin: 0;
231
+ }
232
+ figure.habitat img {
233
+ width: 90px;
234
+ height: 90px;
235
+ margin-top: 35px;
236
+ }
237
+ figure figcaption {
238
+ font-size: 12px;
239
+ font-weight: bold;
240
+ color: #249eb3;
241
+ position: absolute;
242
+ bottom: 6px;
243
+ width: 100%;
244
+ }
245
+
246
+
247
+
248
+ /* key value table
249
+ -------------------------- */
250
+ .key-value-table {
251
+ width: 100%;
252
+ line-height: 27px;
253
+ vertical-align: bottom;
254
+ }
255
+ .key-value-table th {
256
+ text-align: left;
257
+ padding-left: 16px;
258
+ font-size: 12px;
259
+ }
260
+
261
+ .key-value-table td {
262
+ text-align: right;
263
+ padding-right: 16px;
264
+ font-size: 20px;
265
+ font-weight: bold;
125
266
  }
126
267
 
127
268
 
data/assets/nanostanza.js CHANGED
@@ -1,8 +1,20 @@
1
1
  $(function(){
2
2
 
3
- $w = $(window);
4
- $html = $("html");
5
- $body = $("body");
3
+ var $w = $(window),
4
+ $html = $("html"),
5
+ $body = $("body"),
6
+ screenWidth = $body.width(),
7
+ screenHeight = $body.height(),
8
+ MIDDLE_FONT_SIZE = 20,
9
+ TICK_FONT_SIZE = 8,
10
+ BASE_WIDTH = 12,
11
+ BASE_COLOR = "#249eb3",
12
+ GRAYISH_BASE_COLOR = "#d5e0dc",
13
+ BLACK_COLOR = "#333030",
14
+ GRAY_COLOR = "#bfbeba",
15
+ LIGHT_GRAY_COLOR = "#e5e5e4",
16
+ PH_COLORS = [ "#bf1e2e", "#f13e37", "#fcb040", "#8cc63e", "#24a9e2", "#283890", "#93268f" ],
17
+ SVG_START = "<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' id='svg-root' width = '" + screenWidth + "' height='" + screenHeight + "'>";
6
18
 
7
19
  { // font size
8
20
  $(".text-size-adjust").each(function(){
@@ -10,7 +22,7 @@ $(function(){
10
22
  $this.wrapInner("<span style='white-space: nowrap;'>");
11
23
  var $inner = $("span", $this);
12
24
  var w1 = $inner.width();
13
- var w2 = $body.width() - 40;
25
+ var w2 = screenWidth - 40;
14
26
  //window.console.log(w1+" / "+w2);
15
27
  if (w1 > w2) {
16
28
  var fontSize = parseInt($this.css("font-size"));
@@ -21,13 +33,6 @@ $(function(){
21
33
  }
22
34
  })
23
35
  }
24
- {
25
- $(".multiline-text-view").each(function(){
26
- var $this = $(this);
27
- var height = $this.height();
28
- $this.css("top", (($body.height() - 16 - height) * .5) + "px");
29
- });
30
- }
31
36
  { // extension
32
37
  try {
33
38
  if (NANO_STANZA && NANO_STANZA.EXTENSION && NANO_STANZA.EXTENSION.length) {
@@ -44,11 +49,166 @@ $(function(){
44
49
  var exHeight = $extension.height();
45
50
  var padding = (exHeight - height) * .5;
46
51
  $extension.css("padding-top", padding + "px");
47
- window.console.log("height: "+height);
48
52
  }
49
53
  } catch(e) {
50
54
  //window.console.log(e);
51
55
  }
52
56
  }
57
+ { // growth temperature
58
+ if ($body.has(".growth-temperature").length > 0) {
59
+ var html = SVG_START;
60
+ html += "\
61
+ <line x1='0' y1='68.5' x2='" + screenWidth + "' y2='68.5' class='stroke-light-gray dash' />\
62
+ <line x1='0' y1='114.5' x2='" + screenWidth + "' y2='114.5' class='stroke-light-gray dash' />\
63
+ <text x='24' y='72' class='font-size-small fill-black text-anchor-middle' >45°</text>\
64
+ <text x='24' y='118' class='font-size-small fill-black text-anchor-middle' >20°</text>\
65
+ <circle cx='43' cy='31' r='6' class='thermophile' />\
66
+ <rect x='37' y='31' width='12' height='38' class='thermophile' />\
67
+ <rect x='37' y='69' width='12' height='46' class='mesophile' />\
68
+ <rect x='37' y='115' width='12' height='25' class='psychrophile' />\
69
+ <circle cx='43' cy='138' r='14' class='psychrophile' />\
70
+ <text x='" + (screenWidth - 25) + "' y='56' class='font-size-middle fill-black bold text-anchor-end' >" + $(".datum[data-temperature='thermophile']").text() + "</text>\
71
+ <text x='" + (screenWidth - 25) + "' y='99' class='font-size-middle fill-black bold text-anchor-end' >" + $(".datum[data-temperature='mesophile']").text() + "</text>\
72
+ <text x='" + (screenWidth - 25) + "' y='142' class='font-size-middle fill-black bold text-anchor-end' >" + $(".datum[data-temperature='psychrophile']").text() + "</text>";
73
+ // close
74
+ html += "</svg>";
75
+ $("#main-view").append(html);
76
+ }
77
+ }
78
+ { // pie chart
79
+ if ($body.has(".pie-chart").length > 0) {
80
+ var data = [],
81
+ html = SVG_START,
82
+ sum = 0, currentRadian = -Math.PI * .5,
83
+ centerX = screenWidth * .5,
84
+ centerY = screenHeight * .5 + 7,
85
+ $chart = $(".pie-chart"),
86
+ RADIUS = 50;
87
+ $(".datum").each(function(){
88
+ var $datum = $(this);
89
+ data.push({
90
+ value: parseFloat($datum.text()),
91
+ name: $datum.data("name")
92
+ });
93
+ sum += data[data.length - 1].value;
94
+ });
95
+ // chart
96
+ html += "<g fill='none' stroke-width='" + BASE_WIDTH + "'>"
97
+ for (var i = 0; i < data.length; i++) {
98
+ var ratio = data[i].value / sum,
99
+ radian = Math.PI * 2 * ratio,
100
+ color = BASE_COLOR,
101
+ largeArcFlag = ratio > .5;
102
+ // color
103
+ if ($chart.hasClass("gc-content")) {
104
+ if (data[i].name == "at") color = GRAYISH_BASE_COLOR;
105
+ }
106
+ // arc
107
+ html += "<path d='M " + (Math.cos(currentRadian) * RADIUS + centerX) + "," + (Math.sin(currentRadian) * RADIUS + centerY) + " A " + RADIUS + "," + RADIUS + " 0 " + (largeArcFlag ? 1 : 0) + ",1 " + (Math.cos(currentRadian + radian) * RADIUS + centerX) + "," + (Math.sin(currentRadian + radian) * RADIUS + centerY) + "' stroke='" + color + "' />";
108
+ currentRadian += radian;
109
+ }
110
+ html += "</g>";
111
+ // text
112
+ html += "<text x='" + centerX + "' y='" + (centerY + 13) + "' dx='5' class='fill-black text-anchor-middle' ><tspan class='font-size-large bold'>" + $(".datum[data-name='gc']").text() + "</tspan><tspan class='unit'>" + $chart.data("unit") + "</tspan></text>";
113
+ // close
114
+ html += "</svg>";
115
+ $("#main-view").append(html);
116
+ }
117
+ }
118
+ { // bar chart
119
+ if ($body.has(".bar-chart").length > 0) {
120
+ var data = [],
121
+ html = SVG_START,
122
+ maxValue = 0, maxValueString = "", sum = 0,
123
+ colWidth, barWidth, marginLeft, strokeColor,
124
+ $chart = $(".bar-chart"),
125
+ xGraduationsPar = parseFloat($chart.data("xGraduationsPar"));
126
+ BASE_Y = 114,
127
+ MARGIN_X = 16,
128
+ MAX_HEIGHT = 88,
129
+ BAR_MIN_SPACE = 1,
130
+ FONT_SIZE_SMALL = 12,
131
+ TICKS = {
132
+ "0": [],
133
+ "1": [.5, 1],
134
+ "2": [1, 2],
135
+ "3": [1, 2, 3],
136
+ "4": [2, 4],
137
+ "5": [2, 4],
138
+ "6": [3, 6],
139
+ "7": [3, 6],
140
+ "8": [4, 8],
141
+ "9": [4, 8]
142
+ };
143
+ $(".datum").each(function(){
144
+ var $datum = $(this),
145
+ value = parseFloat($datum.text());
146
+ data.push({
147
+ value: value,
148
+ x: $datum.data("x")
149
+ });
150
+ sum += data[data.length - 1].value;
151
+ maxValue = maxValue < value ? value : maxValue;
152
+ });
153
+ maxValueString = Math.ceil(maxValue) + "";
154
+ marginLeft = TICK_FONT_SIZE * maxValueString.length + TICK_FONT_SIZE;
155
+ // background: x
156
+ html += "<line x1='0' y1='" + (BASE_Y + .5) + "' x2='" + screenWidth + "' y2='" + (BASE_Y + .5) + "' class='stroke-gray' />";
157
+ colWidth = (screenWidth - MARGIN_X * 2 - marginLeft) / data.length;
158
+ barWidth = (colWidth - BAR_MIN_SPACE) < BASE_WIDTH ? colWidth - BAR_MIN_SPACE : BASE_WIDTH;
159
+ for (var i = 0; i <= data.length; i++) {
160
+ var x = (MARGIN_X + marginLeft + colWidth * i), xGraduation;
161
+ if (i < data.length) {
162
+ xGraduation = data[i].x;
163
+ } else {
164
+ xGraduation = data[i - 1].x + (data[i - 1].x - data[i - 2].x);
165
+ }
166
+ if ((i % xGraduationsPar) == 0) {
167
+ html += "\
168
+ <line x1='" + x + "' y1='0' x2='" + x + "' y2='" + screenHeight + "' class='stroke-light-gray dash' />\
169
+ <text x='" + x + "' y='" + (BASE_Y + 14) + "' class='font-size-small fill-black text-anchor-middle' >" + xGraduation + "</text>";
170
+ }
171
+ }
172
+ // background: y
173
+ var ticks = TICKS[maxValueString.charAt(0)];
174
+ for (var i = 0; i < ticks.length; i++) {
175
+ var tick = ticks[i];
176
+ var y = BASE_Y - MAX_HEIGHT * (tick / parseInt(maxValueString.charAt(0)));
177
+ var tick2 = Math.pow(10, maxValueString.length) * tick * .1;
178
+ html += "\
179
+ <line x1='0' y1='" + y + "' x2='" + screenWidth + "' y2='" + y + "' class='stroke-gray dash' />\
180
+ <text x='" + (MARGIN_X + marginLeft - TICK_FONT_SIZE + 4) + "' y='" + (y + FONT_SIZE_SMALL * .5 - 2) + "' class='font-size-small fill-black text-anchor-end' >" + tick2 + "</text>";
181
+ }
182
+ // data
183
+ strokeColor = BASE_COLOR;
184
+ for (var i = 0; i < data.length; i++) {
185
+ switch ($chart.data("xAxisUnit")) {
186
+ case "pH":
187
+ strokeColor = PH_COLORS[i];
188
+ break;
189
+ }
190
+ var x = (MARGIN_X + marginLeft + colWidth * i) + colWidth * .5;
191
+ var barHeight = maxValue == 0 ? 0 : MAX_HEIGHT * (data[i].value / maxValue);
192
+ html += "\
193
+ <line x1='" + x + "' y1='" + BASE_Y + "' x2='" + x + "' y2='" + (BASE_Y - barHeight) + "' stroke='" + strokeColor + "' stroke-width='" + barWidth + "' />";
194
+ }
195
+ // sum
196
+ html += "<text x='" + (screenWidth * .5) + "' y='" + (BASE_Y + 36) + "' class='font-size-middle fill-black bold text-anchor-middle' >" + sum + "</text>"
197
+ // close
198
+ html += "</svg>";
199
+ $("#main-view").append(html);
200
+ }
201
+ }
53
202
 
203
+ { // vertical-centering
204
+ if ($body.has(".vertical-centering").length > 0) {
205
+ $(".vertical-centering").each(function(){
206
+ $this = $(this);
207
+ $this.css({
208
+ position: "relative",
209
+ top: (screenHeight - $this.outerHeight()) * .5 + 8
210
+ })
211
+ })
212
+ }
213
+ }
54
214
  });
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="レイヤー_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
5
+ y="0px" width="160px" height="160px" viewBox="0 0 160 160" enable-background="new 0 0 160 160" xml:space="preserve">
6
+ <text transform="matrix(1 0 0 1 19.1445 92)" fill="#BFBEBA" font-family="'HelveticaNeue-Bold'" font-size="32">No data</text>
7
+ </svg>
@@ -1,3 +1,3 @@
1
1
  module TogoStanza
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togostanza
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keita Urashima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-05 00:00:00.000000000 Z
11
+ date: 2014-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -253,6 +253,7 @@ files:
253
253
  - assets/csssprite.png
254
254
  - assets/nanostanza.css
255
255
  - assets/nanostanza.js
256
+ - assets/no_data.svg
256
257
  - assets/stanza.css
257
258
  - assets/stanza.js
258
259
  - bin/togostanza
@@ -323,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
323
324
  version: '0'
324
325
  requirements: []
325
326
  rubyforge_project:
326
- rubygems_version: 2.2.0
327
+ rubygems_version: 2.2.2
327
328
  signing_key:
328
329
  specification_version: 4
329
330
  summary: Development tools of TogoStanza
@@ -346,3 +347,4 @@ test_files:
346
347
  - spec/lib/togostanza/stanza/base_spec.rb
347
348
  - spec/lib/togostanza/stanza/grouping_spec.rb
348
349
  - spec/spec_helper.rb
350
+ has_rdoc: