diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/pokeviewer/pokemon_helper.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/app/helpers/pokeviewer/pokemon_helper.rb b/app/helpers/pokeviewer/pokemon_helper.rb index de2d815..f29fc35 100644 --- a/app/helpers/pokeviewer/pokemon_helper.rb +++ b/app/helpers/pokeviewer/pokemon_helper.rb | |||
@@ -52,9 +52,18 @@ module Pokeviewer | |||
52 | [center_x + x_offset, center_y + y_offset] | 52 | [center_x + x_offset, center_y + y_offset] |
53 | end | 53 | end |
54 | 54 | ||
55 | svg.polygon points: outline.map { |point| point * "," } * " ", class: "pkcv-outline" | 55 | svg.polygon( |
56 | points: outline.map { |point| point * "," } * " ", | ||
57 | class: "pkcv-outline") | ||
56 | 58 | ||
57 | points = data.map do |c| | 59 | points = data.map do |c| |
60 | svg.line( | ||
61 | x1: center_x, | ||
62 | y1: center_y, | ||
63 | x2: center_x + radius * Math.cos(angle), | ||
64 | y2: center_y + radius * Math.sin(angle), | ||
65 | class: "pkcv-line") | ||
66 | |||
58 | datapoint = c[1] | 67 | datapoint = c[1] |
59 | datapoint = 0.01 if datapoint < 1 | 68 | datapoint = 0.01 if datapoint < 1 |
60 | datapoint /= 10.0 | 69 | datapoint /= 10.0 |
@@ -68,11 +77,13 @@ module Pokeviewer | |||
68 | [center_x + x_offset, center_y + y_offset] | 77 | [center_x + x_offset, center_y + y_offset] |
69 | end | 78 | end |
70 | 79 | ||
71 | svg.polygon points: points.map { |point| point * "," } * " ", class: "pkcv-data" | 80 | svg.polygon( |
81 | points: points.map { |point| point * "," } * " ", | ||
82 | class: "pkcv-data") | ||
72 | 83 | ||
73 | tag.svg(svg.to_s.html_safe, | 84 | tag.svg(svg.to_s.html_safe, |
74 | viewBox: "0 -30 410 430", | 85 | viewBox: "-80 -30 570 430", |
75 | width: 410, | 86 | width: 300, |
76 | class: "pokemon-condition") | 87 | class: "pokemon-condition") |
77 | end | 88 | end |
78 | 89 | ||