plasticine 1.2.1 → 1.2.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e66d1f4b3fa8368311e58c898c0e09ade893daf8deb6df5ea147a14434bba66
|
4
|
+
data.tar.gz: b19a9dd56807f2437be8e0709711117eea5d9392c9b68409971e0d3305e960dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d88313573087a2649edffe92cd0b8292206472d049a99991bd6d1f6ea431fd2ee335af3112bf486cb7ed30162d1a078afa85c09c6348e3784fde03496db5c56
|
7
|
+
data.tar.gz: 60c751b37114dc5744e252c536e7cccccc1bc6509f5ad2286631cde1e51a58e3f94930ec139edd36f7513bd227dd7171e8fad8d7841d804676e6f0ce044993ab
|
@@ -114,9 +114,11 @@ class @PlasticineColumn
|
|
114
114
|
|
115
115
|
switch @xAxisFormat
|
116
116
|
when 'date' then @xAxis.tickFormat(d3.timeFormat('%b'))
|
117
|
+
when 'day' then @xAxis.tickFormat(d3.timeFormat('%e-%m'))
|
117
118
|
when 'quarter' then @xAxis.tickFormat (d) => PlasticineHelpers.toQuarter(d, @quarterStartMonth)
|
118
119
|
when 'year' then @xAxis.tickFormat (d) => PlasticineHelpers.toYear(d, @quarterStartMonth)
|
119
120
|
when 'money' then @xAxis.tickFormat (d) => PlasticineHelpers.toPrice(d)
|
121
|
+
when 'numeric' then @xAxis.tickFormat (d) => PlasticineHelpers.toNumeric(d)
|
120
122
|
|
121
123
|
|
122
124
|
setXScaleRange: () ->
|
@@ -124,7 +126,7 @@ class @PlasticineColumn
|
|
124
126
|
columnsLeftPadding = @holder.data('columns-left-padding')
|
125
127
|
columnsRightPadding = @holder.data('columns-right-padding')
|
126
128
|
width = @holderWidth()
|
127
|
-
|
129
|
+
|
128
130
|
@xScale = @xScale.rangeRound([columnsLeftPadding, width - columnsRightPadding]).padding(columnsMargin);
|
129
131
|
|
130
132
|
|
@@ -135,7 +137,9 @@ class @PlasticineColumn
|
|
135
137
|
|
136
138
|
switch @yAxisFormat
|
137
139
|
when 'date' then @yAxis.tickFormat(d3.timeFormat('%b'))
|
140
|
+
when 'day' then @yAxis.tickFormat(d3.timeFormat('%e %b'))
|
138
141
|
when 'money' then @yAxis.tickFormat (d) => PlasticineHelpers.toPrice(d)
|
142
|
+
when 'numeric' then @yAxis.tickFormat (d) => PlasticineHelpers.toNumeric(d)
|
139
143
|
|
140
144
|
|
141
145
|
showTooltip: (bar, data) ->
|
@@ -4,6 +4,7 @@
|
|
4
4
|
PlasticineHelpers.parseValue = (value, format) ->
|
5
5
|
switch format
|
6
6
|
when 'date' then new Date(value)
|
7
|
+
when 'day' then new Date(value)
|
7
8
|
else value
|
8
9
|
|
9
10
|
PlasticineHelpers.setLocale = () ->
|
@@ -22,6 +23,18 @@ PlasticineHelpers.setLocale = () ->
|
|
22
23
|
"shortMonths": ["Jan", "Fev", "Mar", "Avr", "Mai", "Jun", "Jul", "Aou", "Sep", "Oct", "Nov", "Dec"]
|
23
24
|
)
|
24
25
|
|
26
|
+
PlasticineHelpers.formatNumericString = (str) ->
|
27
|
+
str = String(str)
|
28
|
+
switch str.length
|
29
|
+
when 4 then [str.slice(0, 1), ' ', str.slice(1)].join('')
|
30
|
+
when 5 then [str.slice(0, 2), ' ', str.slice(2)].join('')
|
31
|
+
when 6 then [str.slice(0, 3), ' ', str.slice(3)].join('')
|
32
|
+
when 7 then [str.slice(0, 1), ' ', str.slice(1, 4), ' ', str.slice(4)].join('')
|
33
|
+
when 8 then [str.slice(0, 2), ' ', str.slice(2, 5), ' ', str.slice(4)].join('')
|
34
|
+
else str
|
35
|
+
|
36
|
+
|
37
|
+
PlasticineHelpers.toNumeric = (value) -> @formatNumericString(value)
|
25
38
|
|
26
39
|
PlasticineHelpers.toPrice = (amount) ->
|
27
40
|
if amount is 0
|
@@ -30,16 +43,10 @@ PlasticineHelpers.toPrice = (amount) ->
|
|
30
43
|
price = String(amount)[0..-3]
|
31
44
|
price = "0" if price is ""
|
32
45
|
|
33
|
-
price =
|
34
|
-
when 4 then [price.slice(0, 1), ' ', price.slice(1)].join('')
|
35
|
-
when 5 then [price.slice(0, 2), ' ', price.slice(2)].join('')
|
36
|
-
when 6 then [price.slice(0, 3), ' ', price.slice(3)].join('')
|
37
|
-
when 7 then [price.slice(0, 1), ' ', price.slice(1, 4), ' ', price.slice(4)].join('')
|
38
|
-
when 8 then [price.slice(0, 2), ' ', price.slice(2, 5), ' ', price.slice(4)].join('')
|
39
|
-
else price
|
46
|
+
price = @formatNumericString(value)
|
40
47
|
|
41
|
-
# Show decimals
|
42
|
-
#price += ',' + String(amount).slice(-2)
|
48
|
+
# TODO : Show decimals
|
49
|
+
# price += ',' + String(amount).slice(-2)
|
43
50
|
|
44
51
|
price += ' $'
|
45
52
|
|
@@ -128,9 +128,11 @@ class @PlasticineLine
|
|
128
128
|
|
129
129
|
switch @xAxisFormat
|
130
130
|
when 'date' then @xAxis.tickFormat(d3.timeFormat('%b'))
|
131
|
+
when 'day' then @xAxis.tickFormat(d3.timeFormat('%e %b'))
|
131
132
|
when 'quarter' then @xAxis.tickFormat (d) => PlasticineHelpers.toQuarter(d, @quarterStartMonth)
|
132
133
|
when 'year' then @xAxis.tickFormat (d) => PlasticineHelpers.toYear(d, @quarterStartMonth)
|
133
134
|
when 'money' then @xAxis.tickFormat (d) => PlasticineHelpers.toPrice(d)
|
135
|
+
when 'numeric' then @xAxis.tickFormat (d) => PlasticineHelpers.toNumeric(d)
|
134
136
|
|
135
137
|
|
136
138
|
setXScaleRange: () ->
|
@@ -149,4 +151,6 @@ class @PlasticineLine
|
|
149
151
|
|
150
152
|
switch @yAxisFormat
|
151
153
|
when 'date' then @yAxis.tickFormat(d3.timeFormat('%b'))
|
154
|
+
when 'day' then @yAxis.tickFormat(d3.timeFormat('%e %b'))
|
152
155
|
when 'money' then @yAxis.tickFormat (d) => PlasticineHelpers.toPrice(d)
|
156
|
+
when 'numeric' then @yAxis.tickFormat (d) => PlasticineHelpers.toNumeric(d)
|
data/plasticine.gemspec
CHANGED
@@ -3,7 +3,7 @@ Gem::Specification.new do |gem|
|
|
3
3
|
gem.description = "Data visualization toolkit for Rails App using D3.js"
|
4
4
|
gem.summary = "Data visualization toolkit for Rails App using D3.js"
|
5
5
|
gem.homepage = "https://github.com/alchimikweb/plasticine"
|
6
|
-
gem.version = "1.2.
|
6
|
+
gem.version = "1.2.2"
|
7
7
|
gem.licenses = ["MIT"]
|
8
8
|
|
9
9
|
gem.authors = ["Sebastien Rosa"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plasticine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sebastien Rosa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|