plot 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/plot/mark.rb +12 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67d6a3629080da18f0e3a73f6d8c49454c32698e54581c8b7bf8744c4773649c
4
- data.tar.gz: c4456dfbd322ae85cfe26e26e063122942922d9781eb4649a82351c8811b54d8
3
+ metadata.gz: 2a4c9cdff5e430e39848b1a600059bdc6bef528f2f7b8e0d845ff881106d5243
4
+ data.tar.gz: fa8897e7299c937e101d56be0b344003effc4982249ac1ce89ff41b20dcf7678
5
5
  SHA512:
6
- metadata.gz: 6afb6dd820edb324e75f3478610dcee2fb2798e909471c11b91dad7152ace8bd336b837fc646b7a5d1d6911c4d72d6ff223d91d5b82e61df1411da8a249a1d29
7
- data.tar.gz: 665f0c522e9e9c37ba2093972367ff5a5115df26efa34300ecaef5606170a281a857333dfb2010cea1a2d5426029815fc21b1d928bfeb28fef7b339e1b6b3d5d
6
+ metadata.gz: 9a99e59876e00212709b71de99dbf47f8cf4ea197576bbb8d7c8f2e3fad8660088c346462f163de0906039dc130bfff3304db0359d57c50fdecf4828a5773602
7
+ data.tar.gz: 80c74daa800b0a80b7235238c43e0a825943564c04522e89dcec6d80236baf64c2406df24f1247ca0d41d3a15fdcc4fa337759d8c3b3750718c2e73ceb64f21c
data/lib/plot/mark.rb CHANGED
@@ -82,7 +82,18 @@ class Plot::Mark
82
82
  end
83
83
  end
84
84
 
85
- "Plot['#{@type}'](JSON.parse('#{JSON.generate(data)}'), JSON.parse('#{JSON.generate(@options)}'))"
85
+ data.each do |d|
86
+ d.each do |k,v|
87
+ if v.class == Date then
88
+ d[k] = {
89
+ date: true,
90
+ string: v.to_s
91
+ }
92
+ end
93
+ end
94
+ end
95
+
96
+ "Plot['#{@type}'](JSON.parse(`#{JSON.generate(data)}`).map((obj) => { Object.keys(obj).forEach((k) => { if (obj[k].date) { obj[k] = new Date(Date.parse(obj[k].string)) } } ); return obj; }), JSON.parse('#{JSON.generate(@options)}'))"
86
97
  end
87
98
 
88
99
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reese Armstrong
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-10 00:00:00.000000000 Z
11
+ date: 2023-10-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An unofficial DSL for making charts with Observable Plot. You define
14
14
  plot definitions with the DSL that create full charts when data is added. This gem