about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--app/assets/stylesheets/pokeviewer/pokemon.css.scss6
-rw-r--r--app/helpers/pokeviewer/pokemon_helper.rb19
2 files changed, 21 insertions, 4 deletions
diff --git a/app/assets/stylesheets/pokeviewer/pokemon.css.scss b/app/assets/stylesheets/pokeviewer/pokemon.css.scss index c9560d4..2a75730 100644 --- a/app/assets/stylesheets/pokeviewer/pokemon.css.scss +++ b/app/assets/stylesheets/pokeviewer/pokemon.css.scss
@@ -333,8 +333,14 @@ body {
333 fill-opacity: 0.3; 333 fill-opacity: 0.3;
334 } 334 }
335 335
336 .pkcv-line {
337 stroke: gray;
338 stroke-width: 2;
339 }
340
336 .pkcv-data { 341 .pkcv-data {
337 fill: #4ee100; 342 fill: #4ee100;
343 fill-opacity: 0.9;
338 } 344 }
339 345
340 .pkcv-label, .pkcv-label-outline { 346 .pkcv-label, .pkcv-label-outline {
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