purechart 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3da83a5728b80f59c13b285e45d578f1cc4d14d4b3583f6f9d06f01a28f07f83
4
- data.tar.gz: 56b3dc6cba9a146ea9dd0f0c0e28c6dc46569c24fe8a6de2ea63f3d7b76d7ca2
3
+ metadata.gz: 72182144697d37343ce85634ec4089b8e3f490b7856d7368644663b9782e4580
4
+ data.tar.gz: 6f58dbcbc9b04f3fdc5c563e1fc5a0421e6170c74a18b9ca6f859591fd7a6f44
5
5
  SHA512:
6
- metadata.gz: 4398210acb1fb3a7a65a3e219fb9517ff94a9ef143d381d60933e374353f26e58caa800abb3892a69ae34af87741f754d6369b4ae5af441beee0101ba0624e8f
7
- data.tar.gz: 501efff6e2aefca396f15c1d74878c5404d23b1d977c493b3667040e6e455020bbb0d52e292819293b71a3085f3d1898d8c11c38de49382ce9c47ab9ee935c03
6
+ metadata.gz: ca861faea0eeb11ebc21764fbdab5798015c72ec92f31e2e61bafa43464613f2eec9124cdd9dff60cf3752e2c77aa9c7276cfe722586cc4ad2aea61986c36c4a
7
+ data.tar.gz: 34b108389320aa960504e3f9399b2f54275a94664cd5b32a7e530d0e54a9e63e53402879f2b63ad15cd31db7a23c01bdf9613813f0e9f8ea44f1470de26e3097
@@ -1,4 +1,3 @@
1
- <!-- TODO - Use 'style' hash to apply styles -->
2
1
  <div class="chart-flex-container">
3
2
  <div class="chart" style="border-left: <%= style['axes']['style'] %>; border-bottom: <%= style['axes']['style'] %>">
4
3
  <div class="chart-elements">
@@ -8,7 +7,7 @@
8
7
  <div class="lollipop-end" style="background-color: <%= object[:color] %>;">
9
8
  <div class="tooltip">
10
9
  <p style="color: <%= object[:color] %>;"><%= object[:name] %></p>
11
- <p>$<%= object[:value] %></p>
10
+ <p><%= configuration[:symbol] ? configuration[:symbol] : ''%><%= object[:value] %></p>
12
11
  </div>
13
12
  </div>
14
13
  </div>
@@ -45,7 +44,7 @@
45
44
  <% end %>
46
45
  </div>
47
46
  <div style="margin-left: 96px">
48
- <h4 style="text-align: center; font-family: <%= style['labels']['font'] %>; font-weight: <%= style['labels']['weight'] %>; color: <%= style['labels']['color'] %>"><%= axes[:horizontal] %> ($)</h4>
47
+ <h4 class="purechart" style="text-align: center; font-family: <%= style['labels']['font'] %>; font-weight: <%= style['labels']['weight'] %>; color: <%= style['labels']['color'] %>"><%= configuration[:axes][:horizontal] %><%= configuration[:symbol] ? " (" + configuration[:symbol] + ")" : ''%></h4>
49
48
  </div>
50
49
  </div>
51
50
 
@@ -1,23 +1,10 @@
1
1
  <style>
2
- /* TODO - Remove all general styles except for the font import */
3
2
  @import url('https://fonts.googleapis.com/css2?family=Inter+Tight:wght@400;600&display=swap');
4
3
 
5
- body {
6
- padding: 32px;
7
- }
8
-
9
- h2,
10
- h4 {
4
+ h4.purechart {
11
5
  margin: 0;
12
- font-family: 'Inter Tight', sans-serif;
13
- }
14
-
15
- h2 {
16
- margin-bottom: 16px;
17
- }
18
-
19
- h4 {
20
6
  margin-top: 16px;
7
+ font-family: 'Inter Tight', sans-serif;
21
8
  }
22
9
 
23
10
  .chart {
@@ -52,6 +39,7 @@ h4 {
52
39
  position: relative;
53
40
 
54
41
  cursor: pointer;
42
+ z-index: 1;
55
43
  }
56
44
 
57
45
  .lollipop-end {
@@ -103,6 +91,7 @@ h4 {
103
91
  margin: 0px;
104
92
  font-family: 'Inter Tight';
105
93
  font-weight: 700;
94
+ color: black;
106
95
  }
107
96
 
108
97
  .gridlines {
@@ -112,7 +101,6 @@ h4 {
112
101
  left: 0;
113
102
  bottom: 0;
114
103
 
115
- z-index: -1;
116
104
  display: flex;
117
105
  }
118
106
 
@@ -1,6 +1,6 @@
1
1
  module PureChart
2
2
  module ChartHelpers
3
- def lollipop_chart(data, axes = { horizontal: "Value" }, path = "")
3
+ def lollipop_chart(data, configuration = { axes: { horizontal: "Value" } }, path = "")
4
4
  # Set default configuration file path
5
5
  default_config_path = File.join( File.dirname(__FILE__), 'styles/default.yml' )
6
6
 
@@ -10,9 +10,7 @@ module PureChart
10
10
  if path != ""
11
11
  # TODO - Implement better logic
12
12
  if File.file?("app/purechart/" + path + ".yml")
13
- puts "loading..."
14
13
  user_config_hash = YAML.load(File.read("app/purechart/" + path + ".yml"))
15
- puts user_config_hash
16
14
  elsif File.file?("app/purechart/" + path + ".yaml")
17
15
  user_config_hash = YAML.load(File.read("app/purechart/" + path + ".yaml"))
18
16
  elsif File.file?("app/purechart/" + path + ".json")
@@ -25,9 +23,6 @@ module PureChart
25
23
  # Merge user's configuration with default
26
24
  style_config = default_config_hash.merge(user_config_hash)
27
25
 
28
- puts "USER CONFIG - "
29
- puts user_config_hash
30
-
31
26
  # Format data for chart generation
32
27
  largest_value = (data.map { |object| object[:value] }).max()
33
28
 
@@ -43,7 +38,7 @@ module PureChart
43
38
  ActionController::Base.render partial: '/lollipop', locals: {
44
39
  data: data,
45
40
  gridlines: gridlines,
46
- axes: axes,
41
+ configuration: configuration,
47
42
  style: style_config
48
43
  }
49
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: purechart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - George Berdovskiy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-16 00:00:00.000000000 Z
11
+ date: 2023-03-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Pure HTML/CSS charts for Ruby on Rails.
14
14
  email: